Reference

Docs for AI tools (MCP)

@matrajs/mcp is this documentation as a Model Context Protocol server. Connect it and an AI assistant answers questions about Matra from these pages rather than from memory — which matters for a framework whose API is inferred from an array and has no ProseMirror underneath, because memory will confidently describe something else.

npx -y @matrajs/mcp            # stdio · what a desktop client spawns
npx -y @matrajs/mcp --http     # http://localhost:3333/mcp

Step 1 · Connect it

Claude Code

claude mcp add matra -- npx -y @matrajs/mcp

Claude Desktop · in claude_desktop_config.json

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

Cursor · the same object under "mcpServers" in .cursor/mcp.json.

Codex · in ~/.codex/config.toml

[mcp_servers.matra]
command = "npx"
args = ["-y", "@matrajs/mcp"]

Anything that speaks HTTP · run npx -y @matrajs/mcp --http 3333 and point the client at http://localhost:3333/mcp.

Step 2 · Ask

Ask the assistant how to add search and replace, or what ctx.mark() is for. It calls search_docs, reads the page it needs with read_doc, and quotes it. Nothing is fetched at runtime · every page ships inside the package.

What it serves

ToolDoes
list_docsEvery page, with its slug and a one-line description.
read_doc { slug }One page, as Markdown.
search_docs { query, limit? }Ranked pages with a snippet each.

Every page is also a resource at matra://docs/<slug>. The pages are the repository's Markdown — the README, the engine notes, benchmarks, security, the changelog — and every page of this site, converted to Markdown when the package is built.

From code

import { createServer } from '@matrajs/mcp'

const server = createServer(docs)
server.handle({ jsonrpc: '2.0', id: 1, method: 'tools/list' })

createServer is the protocol without a transport: one message in, one reply out. Put it behind whatever transport you already run.

The server is read-only and speaks only about Matra. It declares three tools, all marked read-only and idempotent, and no prompts. It never sends a message the client did not ask for, which is why the HTTP mode needs no event stream.

Edit this page on GitHub