@v4/docs-mcp

The house-documentation MCP server: search and read over the docs app, the Claude rules and CLAUDE.md from any Claude session.

2026-11-07

Overview

@v4/docs-mcp is the house-documentation MCP server. Register it once and every Claude / IDE session in the repo can search and read the committed documentation — instead of rediscovering the conventions file by file. How it compares with the docs app's own chat, and when to use which, is in Docs assistants. It is a tiny stdio Model Context Protocol server (@modelcontextprotocol/sdk + zod) with no build step: the entry point is src/server.mjs, run directly by Node.

What it indexes

The corpus is committed documentation only, resolved from the repo root, so it always reads this repo's own docs. Three roots are walked (src/docs-index.mjs), including files with a .md, .html or .txt extension:

  • apps/docs/content — the docs app content (this site).
  • .claude/rules — the frontend, testing, Storybook and model conventions.
  • CLAUDE.md — the repo's top-level instructions.

Reads are guarded: read_doc resolves a path only inside those roots and rejects anything containing .., so the tool cannot be walked out of the corpus.

Registration in .mcp.json

The server is registered at the repo root so it is picked up automatically:

{
  "mcpServers": {
    "v4-docs": {
      "command": "node",
      "args": ["packages/docs-mcp/src/server.mjs"]
    }
  }
}

The package and its registration came with the template. The server still names itself v4-docs (src/server.mjs) and .mcp.json registers it as v4-docs, so this repo and the Publishing Hub template collide on one MCP server name when both are open in the same session. Renaming it to euro-league-docs in both files is an outstanding fix. The package also exposes a v4-docs-mcp bin.

Tools

The server registers three tools (src/server.mjs):

Tool Arguments Returns
search_docs query (string ≥ 2) Ranked corpus paths with snippets — term-frequency scored, top 8
read_doc path (string) The file's text, by repo-relative path (paths come from search/list)
list_docs — Every file in the corpus, one repo-relative path per line

search_docs strips markup and scores by counting term occurrences across the corpus, returning { path, score, snippet } for the highest-scoring files with a ±120/240-character snippet around the first match — naive term-frequency, but effective over a corpus this size. There are no MCP resources; the corpus is reached entirely through these three tools.

Testing

src/docs-index.test.ts covers the index (vitest run). The package carries no runtime framework beyond the MCP SDK and zod, and no generated output — it is a leaf tool the whole repo shares.