# Framework MCP Servers (Live Docs for AI Agents) > Stop agents hallucinating APIs by feeding them the framework's current types. Frontend architecture guidance from fearchitect, written by Abas Turabli and last reviewed 2026-06-24. Source: https://fearchitect.com/topics/framework-mcp-servers Use it as reference for the task at hand. Before changing code, check this guidance against the codebase: where the code already makes a different, deliberate choice, flag the conflict instead of rewriting it. Library APIs move faster than this guide, so confirm exact signatures in the official docs linked at the end. ## Summary An LLM's training data has a cutoff date, so an agent working in your codebase may cite APIs that have since changed. A framework MCP server bridges that gap: it exposes current docs, codemods, and diagnostic data as MCP resources and tools so the agent reads the truth instead of guessing. ## Framework MCP server The Model Context Protocol (MCP) is an open JSON-RPC 2.0 standard for connecting AI agents to external data and tools. A framework MCP server applies that standard to a specific framework or toolchain: its job is to surface accurate, current information so agents stop hallucinating stale APIs. An agent connects via stdio (same-machine process) or Streamable HTTP (remote), then calls `resources/list` and `tools/list` to discover what the server offers. The three primitive types are **resources** (read-only data — current docs, config), **tools** (callable actions — codemods, type-checks), and **prompts** (reusable templates). Every call returns live state, not training-time snapshots. ## Diagram ```mermaid graph LR Agent["AI agent / MCP host"] -->|"resources/read
tools/call"| MCP["Framework MCP server"] MCP -->|reads| Docs["Live docs / changelog"] MCP -->|runs| CLI["Framework CLI / compiler"] MCP -->|reads| Src["Project source files"] ``` The agent calls the MCP server at runtime; the server reads live docs and toolchain output — not stale training data. ## What a good framework MCP server exposes - Current API reference as resources — agent reads the page, not its training-time snapshot. - Version-aware docs: the server knows which version is installed and filters content accordingly. - Codemods as tools: agent calls a tool to migrate code rather than guessing the new syntax. - Compiler / type-checker output as a resource or tool result — gives the agent real error messages. - Project config introspection: reads tsconfig.json, framework config, and reports resolved settings. ## Minimal framework MCP server (TypeScript SDK) The official `@modelcontextprotocol/sdk` (v1.x, stable) provides `McpServer` and transport classes. This server exposes one resource (the installed framework version) and one tool (run a type-check). **Framework info MCP server with a resource and a tool** ```ts // framework-mcp-server.ts import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"; import { execSync } from "node:child_process"; import { readFileSync } from "node:fs"; import { z } from "zod"; const server = new McpServer({ name: "framework-info", version: "0.1.0" }); // Resource: installed framework version from package.json server.registerResource( "framework-version", "framework://version", { title: "Installed framework version", mimeType: "text/plain" }, async () => { const pkg = JSON.parse(readFileSync("package.json", "utf8")); const version = pkg.dependencies?.next ?? pkg.devDependencies?.next ?? "unknown"; return { contents: [{ uri: "framework://version", text: version }] }; }, ); // Tool: run tsc --noEmit and return errors to the agent server.registerTool( "typecheck", { description: "Run tsc --noEmit and return compiler output.", inputSchema: z.object({}), }, async () => { try { execSync("npx tsc --noEmit", { encoding: "utf8" }); return { content: [{ type: "text", text: "No type errors." }] }; } catch (err: unknown) { const output = (err as { stdout?: string }).stdout ?? String(err); return { content: [{ type: "text", text: output }] }; } }, ); const transport = new StdioServerTransport(); await server.connect(transport); ``` The resource gives the agent the installed Next.js version at call time. The tool runs tsc and returns real compiler output — the agent gets accurate errors, not hallucinated ones. ## Decision: Build your own vs. wait for a vendor server Vendor-published framework MCP servers will appear over time, but you can ship a project-specific server today in under 100 lines. Scope it to your actual problem: if agents keep misusing your internal design-system API, expose that API's types as a resource. Don't boil the ocean — one accurate resource beats ten aspirational ones. ## Key terms - **MCP**: Model Context Protocol — an open JSON-RPC 2.0 standard for connecting AI agents to external data and tools. - **resource**: An MCP primitive exposing read-only data (docs, config, file contents) that an agent can pull on demand. - **tool**: An MCP primitive exposing a callable function (codemod, compiler run, API call) the agent can invoke. - **stdio transport**: MCP transport that uses stdin/stdout to communicate with a co-located server process — zero network overhead. - **knowledge cutoff**: The date after which an LLM has no training data; APIs released after this date are unknown to the model. ## Related topics - [AI Chat UIs & MCP Tools](https://fearchitect.com/topics/mcp-tool-uis.md): Render tool calls, stream results, and gate risky actions behind human consent. - [AI-Assisted Dev Workflow](https://fearchitect.com/topics/ai-assisted-dev-workflow.md): Using AI coding agents well without handing them ownership. - [Design-to-Code with MCP](https://fearchitect.com/topics/design-to-code-mcp.md): Feed real design tokens to an AI agent via MCP. ## Further reading - [MCP Introduction — modelcontextprotocol.io](https://modelcontextprotocol.io/introduction) - [MCP Architecture overview (primitives, transports, lifecycle)](https://modelcontextprotocol.io/docs/learn/architecture) - [Build an MCP server — official quickstart](https://modelcontextprotocol.io/docs/develop/build-server) - [MCP TypeScript SDK — GitHub](https://github.com/modelcontextprotocol/typescript-sdk)