MCP Server Integration
OwnDocs ships a built-in Model Context Protocol (MCP) server that exposes your documentation to AI tools. Any MCP-compatible client — Claude Code, Claude Desktop, Cursor, Windsurf, and others — can search your docs and fetch page content using your own documentation URL.
Stateless Spec 2024-11-05 → 2026-07-28 Bearer authThe server is a single stateless HTTP endpoint. Every request is independent and
carries its own protocol metadata — there is no session or cookie to configure
or maintain. Standard MCP clients connect with the usual initialize handshake;
the OwnDocs protocol headers are optional.
What you can do
The server exposes two tools. Pick the one that fits the task.
search_docs
Free-text search across every documentation page. Returns matching pages with a title, URL, and snippet.
fetch_page
Fetch the raw MDX content of a single page by its URL path, so an AI tool can read the full source.
For the exact argument types, defaults, and environment variables, see the MCP Server feature page.
Prerequisites
- A deployed OwnDocs site on a URL your client can reach over HTTPS.
- Access to the environment variables on your hosting platform, so you can set
MCP_ENABLEDandMCP_BEARER_TOKEN. - An MCP client that supports remote HTTP servers, such as Claude Code, Claude Desktop, Cursor, or Windsurf.
Setup
Follow these three steps to connect a client. The same steps work on any domain and hosting provider — you only change your own URL and token.
-
Enable the server
The endpoint is opt-in so private documentation stays protected.
- Public mode (
ACCESS_MODE=public): always available. Set a token only if you want to require one. - Private mode (default): set both environment variables.
BashBashMCP_ENABLED=true MCP_BEARER_TOKEN=your-long-random-token - Public mode (
-
Generate a token
Skip this step if you're running public mode and don't need to require a token. Otherwise, run the following and store the output as a secret in your hosting platform.
BashBashopenssl rand -hex 32Treat this token as a secret. Anyone with it can read every page reachable through the server, so rotate it whenever a client loses access.
-
Find your endpoint URL
Your MCP endpoint is your documentation origin plus
/api/mcp.Plain TextPlain Texthttps://docs.example.com/api/mcp
Connect your client
Add your endpoint URL to your client's MCP server configuration, along with the
bearer token from Setup if you generated one. Private mode always
needs the token. In public mode, include it only if you set one — otherwise drop
the headers block from any example below and connect with the URL alone.
Claude Code
The terminal CLI and the Desktop app's Code tab share the same
configuration: .mcp.json at your project root, or ~/.claude.json for a setup
that follows you across projects.
{
"mcpServers": {
"owndocs": {
"type": "http",
"url": "https://docs.example.com/api/mcp",
"headers": {
"Authorization": "Bearer your-long-random-token"
}
}
}
}Or skip the JSON and let the CLI write it for you:
claude mcp add --transport http owndocs https://docs.example.com/api/mcp \
--header "Authorization: Bearer your-long-random-token"The Desktop app's Chat tab has its own configuration — see below.
Claude Desktop (Chat tab)
Bridge the Chat tab to your endpoint with
mcp-remote, which proxies a remote
HTTP server over stdio:
{
"mcpServers": {
"owndocs": {
"command": "npx",
"args": [
"mcp-remote",
"https://docs.example.com/api/mcp",
"--header",
"Authorization:Bearer your-long-random-token"
]
}
}
}Edit the file at
~/Library/Application Support/Claude/claude_desktop_config.json on macOS or
%APPDATA%\Claude\claude_desktop_config.json on Windows, then restart Claude
Desktop.
Cursor
In Cursor's MCP settings, add a remote HTTP server with these fields:
- Type —
HTTP - URL —
https://docs.example.com/api/mcp - Authorization header —
Bearer your-long-random-token
Windsurf
{
"mcpServers": {
"owndocs": {
"url": "https://docs.example.com/api/mcp",
"headers": {
"Authorization": "Bearer your-long-random-token"
}
}
}
}Generic client
Any MCP-compatible client uses the same two values:
Endpoint: https://docs.example.com/api/mcp
Authorization header: Bearer your-long-random-tokenVerify the connection
Once connected, ask the client to list tools. It should show search_docs and
fetch_page. Then ask it to search your documentation — if it returns matching
pages, the integration is working.
Troubleshooting
The server is not enabled. In private mode, set both MCP_ENABLED=true and
MCP_BEARER_TOKEN.
The token is missing or wrong. Confirm the Authorization: Bearer <token>
header is set on every request.
Confirm the client points at the full endpoint URL
(https://your-domain.com/api/mcp) and not just the domain.
The stateless MCP server uses POST only. There is no GET discovery endpoint, no session cookie, and no SSE upgrade to configure.