MCP
Expose your docs to AI agents as MCP tools.
fumadocs-core/mcp registers tools on a MCP server, for AI agents to read and search your docs.
The MCP Server guide sets up a route with these tools for you.
Usage
npm install fumadocs-core @modelcontextprotocol/server zodRegister the tools with your source, its docsLlms renderer, and a search server:
import { McpServer } from '@modelcontextprotocol/server';
import { registerSearchTool, registerSourceTools } from 'fumadocs-core/mcp';
import { createFromSource } from 'fumadocs-core/search/server';
import { source, docsLlms } from '@/lib/source';
export const mcp = new McpServer({ name: 'docs', version: '1.0.0' });
// `list_pages` & `get_page`
registerSourceTools(mcp, source, docsLlms);
// `search`
registerSearchTool(mcp, createFromSource(source));For runtime content sources, pass the getter of your source:
registerSourceTools(mcp, getSource, docsLlms);Then connect the server to a transport, like the streamable HTTP transport.
Tools
| Tool | Input | Output |
|---|---|---|
list_pages | None | llms.index(), the index of pages |
get_page | url of a page | llms.page(page), or an error when no page matches |
search | query, locale? | the search results, as JSON |
How is this guide?
Last updated on
