docusaurus-plugin-mcp
Exposes Docusaurus documentation and OpenAPI specs as an MCP server, enabling AI agents to search docs and inspect API endpoints.
README
docusaurus-plugin-mcp
Expose your Docusaurus docs and OpenAPI specs as an MCP server, so AI agents like Claude, Cursor, and VS Code can search your docs and inspect API endpoints from the editor.
Most docs-MCP tools index prose only. This one treats your OpenAPI specs as a first-class source: it resolves $refs and serves full request and response schemas, so an agent gets the real shape of an endpoint instead of guessing field names.
How it works
The plugin runs at build time. It reads your docs and OpenAPI files and writes a single snapshot (build/<outputDir>/snapshot.json) alongside your site. A small, host-agnostic handler then serves MCP over HTTP from that snapshot.
Docusaurus sites usually deploy as static files, which can't serve a live endpoint. So serving is split out: a CLI for local dev, and a tiny serverless function for production. The plugin's only job is producing the snapshot.
Install
npm install docusaurus-plugin-mcp
Configure
// docusaurus.config.js
export default {
plugins: [
[
'docusaurus-plugin-mcp',
{
server: { name: 'my-docs', version: '1.0.0' },
// OpenAPI specs to index, paths relative to the site dir. Optional.
openapi: [
{ name: 'api', spec: 'openapi/api.json' },
{ name: 'admin', spec: 'openapi/admin.yaml' },
],
},
],
],
};
Run docusaurus build and you'll get build/mcp/snapshot.json.
Options
| Option | Default | Description |
|---|---|---|
server.name / server.version |
site title / 0.0.0 |
Identity reported to MCP clients. |
instructions |
— | One-line steer shown to the model on connect. |
docsDir |
docs |
Docs source dir, relative to the site. |
routeBasePath |
/ |
Route base path your docs are served under. Used to build real page URLs. |
openapi |
[] |
{ name, spec }[]. spec is a JSON or YAML path relative to the site. |
exclude |
[] |
Substrings; any source-relative doc path containing one is skipped. |
outputDir |
mcp |
Snapshot location, relative to the build outDir. |
endpoint |
/mcp |
Default endpoint path for the CLI server. |
Tools
| Tool | Description |
|---|---|
search_docs |
Full-text search the docs. Returns URL, title, category, snippet. |
read_doc |
Full markdown of a page by URL. |
list_doc_categories |
Categories with page counts. |
list_apis |
The indexed OpenAPI specs with versions and counts. |
search_api |
Search operations and webhook events by path, name, summary, or tag. |
get_endpoint |
Full detail of one operation: params, request body, responses, $refs resolved. |
The three *_api tools only appear when you configure openapi. Everything is read-only.
Serve it
Local dev
After a build, serve the snapshot:
npx docusaurus-plugin-mcp serve # reads build/mcp/snapshot.json on :3100
Or build and serve in one step, without a full Docusaurus build:
npx docusaurus-plugin-mcp serve --site . --openapi api=openapi/api.json
Then point a client at http://localhost:3100/mcp, or inspect it:
npx @modelcontextprotocol/inspector # connect via Streamable HTTP
Production
Static hosting can't serve a live endpoint, so add one serverless function that imports the snapshot. The handler is a standard Node (req, res). Vercel example:
// api/mcp.ts
import { createNodeHandler } from 'docusaurus-plugin-mcp/server';
import snapshot from '../build/mcp/snapshot.json' assert { type: 'json' };
export default createNodeHandler(snapshot, { name: 'my-docs', version: '1.0.0' });
It's stateless: a fresh server is created per request, so it scales horizontally with no session store. The same handler works in any Node serverless runtime or an Express route. See examples/vercel.
Connect a client
# Claude Code
claude mcp add --transport http my-docs https://docs.example.com/mcp
// Cursor / VS Code: .cursor/mcp.json or .vscode/mcp.json
{ "mcpServers": { "my-docs": { "url": "https://docs.example.com/mcp" } } }
Programmatic use
import { buildSnapshot, resolveOptions } from 'docusaurus-plugin-mcp';
import { createMcpServer, createNodeHandler, loadSnapshot } from 'docusaurus-plugin-mcp/server';
buildSnapshot({ siteDir, baseUrl, options })— build a snapshot in memory.createMcpServer(snapshot, opts)— a configuredMcpServerfrom the SDK.createNodeHandler(snapshot, opts)— a stateless Node request handler.loadSnapshot(file)— read a snapshot from disk.
Limitations
- Doc URLs are derived from
routeBasePathplus the file path orslugfrontmatter. That covers the common cases; exotic routing or path aliases may not match exactly. - Refreshing happens at build. Rebuild to pick up doc changes. The CLI's build-on-the-fly mode is for dev.
- Runtime targets Node. Web-standard/edge runtimes aren't supported yet.
License
MIT
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。