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 Desktop, Cursor, Windsurf, and others — can search your docs and fetch page content using your own documentation URL.
Stateless Spec 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, cookie, or handshake to configure or maintain.
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.
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
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 and token to your client's MCP server configuration. The
value of type is always http, and the token is always sent in the
Authorization header.
Claude Desktop
{
"mcpServers": {
"owndocs": {
"transport": {
"type": "http",
"url": "https://docs.example.com/api/mcp",
"headers": {
"Authorization": "Bearer your-long-random-token"
}
}
}
}
}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-tokenTool reference
search_docs
Searches every documentation page for the given query and returns the best matches.
querystringbodyrequiredFree-text search query. Non-empty string.
limitnumberbodyDefault: 5Maximum number of results to return. Clamped between 1 and 20.
resultsarrayrequiredArray of matching pages, each with title, url, and snippet.
fetch_page
Fetches the raw MDX content of a single documentation page.
urlstringbodyrequiredPage path starting with / or relative. Path traversal is rejected.
contentstringrequiredThe raw MDX content of the page, wrapped with the resolved url.
Verify 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.