Skip to content
fearchitect
AI-Assisted Frontend Engineering

Framework MCP Servers (Live Docs for AI Agents)

Stop agents from hallucinating APIs by feeding them the framework's current types and conventions.

By Abas TurabliReviewed

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.

Jump to the interview angle

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.

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 toolts
// 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.

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.

Interview angle

Interviewers probe whether you understand why agents hallucinate and how to fix it structurally. The soundbite: "An LLM's knowledge is frozen at training time; an MCP server is how you inject the current truth at inference time." Contrast resources (read-only context the agent can pull) with tools (actions the agent can invoke) — and explain why a codemod tool beats asking the agent to rewrite syntax from memory.

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.

Further reading

Search fearchitect

Jump to a topic, mode, or action.