AI ile kullanım

Kod yazan agent'lar prop'ları tahmin etmek yerine gerçek dokümanı okuyabildiğinde daha iyi Merid kodu yazar. Merid bunun için üç şey sunar; üçü de build sırasında bu dokümanlardan üretilir:

  • MCP server, @meridui/mcp: component'ler, prop'lar, token'lar, desenler ve kurulum hakkındaki soruları editörün içinden yanıtlar.
  • llms.txt ve her sayfanın Markdown sürümü: web'i okuyan araçlar için.
  • Resmî kural dosyası: agent'a Merid kodunun nasıl yazılacağını söyler; hangi import'lar, hangi token'lar, neyin yapılmayacağı.

Hızlı kurulum

Projende şunu çalıştır. @meridui/react'i kurar, stil dosyasını import eder ve kural dosyasıyla Claude Code, Cursor ve VS Code için MCP config'ini ekleyip eklemeyeceğini sorar. Her dosya değişikliği önce diff olarak gösterilir.

npx @meridui/cli init

Seçenekler için CLI sayfasına bak ya da aşağıdaki adımlarla elle kur.

MCP server

Server stdio üzerinden, npx -y @meridui/mcp ile yerelde çalışır. Salt okunurdur ve internet olmadan çalışır: dokümanlar pakete derlenmiştir, ağ isteği yapmaz ve dosya yazmaz.

AraçDöndürdüğü
list_componentsKategoriye göre gruplanmış tüm component'ler. Filtrelemek için category ver.
get_componentImport satırı, örnek kod, props tabloları, klavye etkileşimi ve erişilebilirlik notları. section ile yalnızca props, examples ya da accessibility döner.
search_docsTüm doküman sayfalarından sıralanmış bölümler ve linkleri.
get_tokens--mrd-* token'ları, açık ve koyu değerleriyle. category (color, space, radius, shadow, typography, motion, …) ya da theme ile filtrelenir.
get_design_contractTasarım sözleşmesi (adlandırma, renk, köşe yuvarlaklığı, gölge ve hareket kuralları) ve kural dosyası.
get_patternBir sayfa deseninin rehberi ve tam kaynak kodu: app-shell, settings, auth, data-table, forms, confirmations, empty-and-loading.
get_setupnext, vite ya da react-router için kurulum adımları.

Claude Code

Mevcut proje için ekle (.mcp.json yazar; commit'lersen tüm ekip kullanır):

claude mcp add --scope project --transport stdio merid -- npx -y @meridui/mcp

Ya da .mcp.json dosyasını kendin yaz:

{
  "mcpServers": {
    "merid": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "@meridui/mcp"]
    }
  }
}

Cursor

Projede .cursor/mcp.json oluştur (tüm projeler için ~/.cursor/mcp.json):

{
  "mcpServers": {
    "merid": {
      "command": "npx",
      "args": ["-y", "@meridui/mcp"]
    }
  }
}

VS Code

.vscode/mcp.json oluştur. VS Code mcpServers yerine servers anahtarını kullanır:

{
  "servers": {
    "merid": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "@meridui/mcp"]
    }
  }
}

Windsurf

Cascade'de MCP ayarlarını aç, mcp_config.json dosyasını düzenle ve şunu ekle:

{
  "mcpServers": {
    "merid": {
      "command": "npx",
      "args": ["-y", "@meridui/mcp"]
    }
  }
}

Diğer araçlar

stdio server destekleyen her MCP client'ı çalışır: komut npx, argümanlar -y @meridui/mcp. Node.js 20 veya üstü gerekir.

Dene

Agent'ına dokümana ihtiyaç duyan bir şey sor, örneğin:

  • "Merid ile bir ayarlar sayfası yap. settings desenini kullan."
  • "Merid'in Dialog.Content component'i hangi prop'ları alıyor?"
  • "Merid token'larıyla bir dark mode düğmesi ekle."

llms.txt

MCP yerine URL okuyan araçlar (sohbet asistanları, v0 ve benzerleri) için site, dokümanları llms.txt kuralına uygun düz metin olarak yayınlar:

URLİçerik
/llms.txtHer sayfanın tek satırlık özeti ve Markdown linkiyle İngilizce dizin.
/llms-full.txtKural dosyası, tasarım sözleşmesi ve tüm İngilizce doküman sayfaları tek dosyada.
/tr/llms.txtTürkçe dokümanların dizini.
/docs/…/<sayfa>.mdHerhangi bir sayfanın Markdown hali: URL'nin sonuna .md ekle, örneğin /tr/docs/components/button.md.

Modele kütüphanenin tamamını tek seferde vermek için https://meridui.dev/llms-full.txt adresini sohbete yapıştır.

Kural dosyası

Kural dosyası agent'a Merid kodunun nasıl görünmesi gerektiğini söyler: @meridui/react'ten import et, yalnızca --mrd-* token'larıyla stil ver (ham hex, keyfi boşluk ve inline stil yok), yeni component yazmadan önce var olanları birleştir ve erişilebilirlik kurallarına uy. CLI ve MCP server'ın kullandığı dosyanın aynısıdır. Agent'lar İngilizce talimatlarla en tutarlı sonucu verdiği için dosya İngilizcedir.

AGENTS.md
# Merid UI rules

This project uses Merid (`@meridui/react`) for its UI. Follow these rules when you write or change interface code. Docs: https://meridui.dev/docs · full text for LLMs: https://meridui.dev/llms-full.txt

## Imports

- Import components from the package root only: `import { Button, Dialog, Field, Input } from "@meridui/react";`. Never deep-import from `@meridui/react/dist/...` or copy component source into the project.
- Import the stylesheet once, at the app entry (root layout, `main.tsx`): `import "@meridui/react/styles.css";`. Do not import it per component.
- Compound components use dot parts (`Dialog.Root`, `Dialog.Content`, `Select.Item`). In React Server Component files use the flat exports (`DialogRoot`, `DialogContent`, …).
- For router links use `asChild`: `<Button asChild><Link href="/x">…</Link></Button>`.

## Compose before you create

1. Check whether a Merid component already does the job (Button, IconButton, Link, Field, Input, Textarea, Select, NativeSelect, Checkbox, Radio, Switch, SegmentedControl, Card, Stack, Grid, Container, Section, Heading, Text, Table, Badge, Avatar, Tabs, Accordion, Alert, `ToastProvider` + `useToast`, Progress, Spinner, Skeleton, EmptyState, Dialog, AlertDialog, Drawer, Popover, Tooltip, DropdownMenu, Breadcrumb, Pagination, Stepper, SidebarNav, Separator, Kbd, Code, VisuallyHidden).
2. If not, compose existing components (for example a settings row is `Section` + `Field` + `Switch`; a toolbar is `Stack direction="row"` + `Button`/`IconButton`).
3. Only then write a new component, and style it with Merid tokens as below. Do not wrap Merid components just to rename them or restyle them with overrides.
4. Look up props before using them (docs page or the `get_component` MCP tool). Do not invent props, variants or sizes.

## Styling: tokens only

- Colours come only from semantic `--mrd-*` tokens: `--mrd-ink`, `--mrd-body`, `--mrd-muted` for text; `--mrd-bg`, `--mrd-surface`, `--mrd-tray`, `--mrd-subtle` for surfaces; `--mrd-line` for borders; `--mrd-accent*` for interactive and selected states; `--mrd-danger*`, `--mrd-warning-*`, `--mrd-success*` for status.
- No raw hex, `rgb()`, `hsl()` or named colours in components or CSS. No primitive palette tokens (`--mrd-blue-500`) either; they do not follow themes or accent presets.
- Spacing comes from the scale (`--mrd-space-1` … `--mrd-space-28`, or the `gap`/`padding` props of `Stack`, `Grid`, `Card`, `Section`). No arbitrary pixel values such as `margin: 13px` or Tailwind arbitrary values like `p-[13px]`.
- Radius from `--mrd-radius-*`, shadows from `--mrd-shadow-*`, type from `--mrd-text-*` / `--mrd-leading-*` / `--mrd-weight-*`, motion from `--mrd-duration*` / `--mrd-ease`.
- No inline `style={{ … }}` for colour, spacing, radius or typography. Use component props, a CSS class that reads tokens, or `data-*` attributes. (Setting a single CSS variable inline, such as `style={{ "--mrd-button-height": "32px" }}`, is the one allowed exception.)
- Borders are 1px `--mrd-line`. Never 2px, never dark borders. Separate regions by surface (`--mrd-tray`) before adding a border.
- One `variant="primary"` button per view. No gradients. Font weight 700 is never used.
- Theme, accent and density are attributes, not classes: `data-theme="dark"`, `data-accent="violet"`, `data-density="compact"` on `<html>` or any subtree.
- Write your own CSS outside Merid's layers (or in a later layer). Never use `!important` to beat Merid; its rules live in `@layer merid.*` and lose to unlayered CSS.

## Accessibility

- Every form control has a visible label: wrap it in `Field label="…"` (which wires `id`, `aria-describedby`, invalid and required) or use `Label`.
- Icon-only actions use `IconButton` with a `label`. Never a bare `<button>` with only an icon.
- Use `Button` for actions and `Link` for navigation. Do not put `onClick` on a `div` or `span`.
- Every `Dialog` and `AlertDialog` has a `Dialog.Title` (use `VisuallyHidden` if it must not show). Destructive confirmations use `AlertDialog`, not `Dialog`.
- Do not remove focus outlines. Do not set `tabIndex` greater than 0. Let Merid manage focus in overlays.
- Show errors with `Field`'s `error` prop, in text, not with colour alone.
- Keep headings in order (`Heading level`), and give images meaningful `alt` (empty `alt=""` for decoration).
- Respect `prefers-reduced-motion`; do not add animations that ignore it.

## When unsure

Ask the Merid MCP server (`npx -y @meridui/mcp`): `list_components`, `get_component`, `get_tokens`, `get_pattern`, `get_design_contract`, `search_docs`. Or read https://meridui.dev/llms.txt.

Nereye koyulur:

AraçDosya
Codex, Cursor, Copilot, Jules ve AGENTS.md okuyan diğer agent'larProje kökünde AGENTS.md
Cursor proje kurallarıdescription ve globs frontmatter'ı ile .cursor/rules/merid.mdc
Claude CodeProje kökünde CLAUDE.md

npx @meridui/cli init --rules üçünü de yazar. AGENTS.md ve CLAUDE.md dosyalarında <!-- merid:start --> ile <!-- merid:end --> arasına bir bölüm ekler; kendi notlarına dokunmaz, tekrar çalıştırdığında yalnızca o bölümü günceller.