|
| 1 | +--- |
| 2 | +title: MCP server |
| 3 | +description: Connect AI clients like Claude Code and Cursor to your documentation site's MCP server for instant answers. |
| 4 | +--- |
| 5 | + |
| 6 | +[Model Context Protocol (MCP)](https://modelcontextprotocol.io) is an open standard by Anthropic that enables AI applications to connect with external data sources and tools. |
| 7 | + |
| 8 | +Fern automatically generates and hosts a production-ready MCP server for every documentation site with [Ask Fern](/learn/docs/ai-features/ask-fern/overview) enabled. Developers using AI clients like Claude Code, Cursor, and Windsurf can get instant answers about your product directly within their development environment. |
| 9 | + |
| 10 | +Your MCP server is available at `your-documentation-site.com/_mcp/server`. |
| 11 | + |
| 12 | +## Connect from your docs site |
| 13 | + |
| 14 | +Page action buttons on every page let users connect to the MCP server in one click. **Claude Code** and **Cursor** connections are enabled by default on sites with Ask Fern enabled. |
| 15 | + |
| 16 | +<AccordionGroup> |
| 17 | +<Accordion title="Connect to Claude Code"> |
| 18 | + |
| 19 | +Under **Page actions** on any page on your site, click **Connect to Claude Code**. This copies a `claude mcp add` command to your clipboard. Paste it into your terminal to register the MCP server with Claude Code. |
| 20 | + |
| 21 | +</Accordion> |
| 22 | +<Accordion title="Connect to Cursor"> |
| 23 | + |
| 24 | +Under **Page actions** on any page on your site, click **Connect to Cursor**. Cursor opens with the server URL automatically populated — click **Install** to connect. |
| 25 | + |
| 26 | +<video |
| 27 | + src="cursor-mcp.mp4" |
| 28 | + autoPlay |
| 29 | + loop |
| 30 | + controls |
| 31 | + playsInline |
| 32 | + muted |
| 33 | +> |
| 34 | +</video> |
| 35 | +</Accordion> |
| 36 | +<Accordion title="Connect to other agents (Claude Desktop, Windsurf, etc.)"> |
| 37 | + |
| 38 | +Visit `your-documentation-site.com/_mcp/server` in a browser to see the server information, then add this URL to your AI client's MCP server configuration. |
| 39 | + |
| 40 | +</Accordion> |
| 41 | +</AccordionGroup> |
| 42 | + |
| 43 | +To hide or customize these buttons, see [Page actions configuration](/learn/docs/configuration/site-level-settings#page-actions-configuration). |
| 44 | + |
| 45 | +## Direct API access for AI agents |
| 46 | + |
| 47 | +AI agents can access your documentation directly via HTTP. Fern serves content as clean Markdown for token efficiency. |
| 48 | + |
| 49 | +For authenticated sites, agents obtain a JWT via [`/api/fern-docs/get-jwt`](/learn/docs/fern-api-reference/get-jwt) with a Fern API key to access protected documentation content and search functionality. |
| 50 | + |
| 51 | +```bash Access protected content |
| 52 | +curl https://docs.example.com/platform/overview \ |
| 53 | + -H 'Accept: text/plain' \ |
| 54 | + -H 'x-fern-host: docs.example.com' \ |
| 55 | + -H 'FERN_TOKEN: your-jwt-here' |
| 56 | +``` |
0 commit comments