MCP server for your site
Fern automatically generates and hosts a production-ready Model Context Protocol (MCP) server for every documentation site with Ask Fern enabled. The server connects AI clients like Claude Code, Cursor, and Windsurf to your documentation as an external data source, so your readers can get instant answers about your product directly within their development environment.
This is the server your readers connect to, and it serves your content. To point your own agent at Fern’s product documentation while you build your site, or at your organization’s Fern data, use Fern’s MCP server.
Your MCP server is available at your-documentation-site.com/_mcp/server. For example, the MCP server for this site is at https://buildwithfern.com/learn/_mcp/server.
How it works
The server exposes a single tool that answers questions about your documentation site using the same Retrieval Augmented Generation (RAG) pipeline as Ask Fern. Queries are semantic rather than keyword-based — the tool searches indexed content and synthesizes an answer, not a list of raw results.
Each message sent through the MCP server runs Ask Fern under the hood and consumes 2 AI credits, the same as an Ask Fern query.
Connect to your MCP server
For Claude Code and Cursor, page action buttons let users connect in one click:
- Connect to Claude Code copies a
claude mcp addcommand to the clipboard to register the server. - Connect to Cursor opens Cursor with the server URL pre-filled for one-click install.
Both buttons are enabled by default on sites with Ask Fern.
All other clients (including Claude Desktop, Windsurf, and VS Code) connect using the server URL directly. Add your-documentation-site.com/_mcp/server to your MCP configuration. For CLI clients, that looks like:
Authenticated sites
On sites with authentication enabled, MCP clients must include a FERN_TOKEN header containing a valid JWT. Without it, the server only returns publicly visible content (if any).
Get a token
Exchange your credentials for a JWT. The endpoint depends on how your site authenticates users.
API key (JWT / OAuth)
Password protection
Exchange a Fern API key for a JWT via the get-jwt endpoint:
Configure your MCP client
Register the server manually, as the page action buttons can’t carry credentials. Then, add the JWT as a FERN_TOKEN header. In Claude Code:
For Cursor, VS Code, and other clients, add FERN_TOKEN: <jwt> to the headers field in your MCP server configuration if the client supports custom headers.
JWTs expire. Re-run the token exchange when the token lapses. There is no automatic refresh mechanism in the MCP transport.
Disable the MCP server
To turn the server off entirely, set mcp to false in your page-actions configuration:
This is especially useful on authenticated sites because unauthenticated agents can discover the MCP endpoint but can’t read its content. Disabling the server returns 404 from the endpoint, hides the connection buttons, and stops agents from discovering it through llms.txt or agent prompts.
Other ways agents can access your docs
Agents can also fetch documentation directly over HTTP. Fern serves clean Markdown via per-page URLs and llms.txt — including on authenticated sites.