From 22850891272ff8203391e17ed073d53f378c9c84 Mon Sep 17 00:00:00 2001
From: "fern-api[bot]" <115122769+fern-api[bot]@users.noreply.github.com>
Date: Tue, 23 Jun 2026 16:40:09 +0000
Subject: [PATCH 1/4] Add authenticated MCP access documentation
---
fern/products/docs/pages/ai/mcp-server.mdx | 45 ++++++++++++++++++++++
1 file changed, 45 insertions(+)
diff --git a/fern/products/docs/pages/ai/mcp-server.mdx b/fern/products/docs/pages/ai/mcp-server.mdx
index bdc2493f29..d9a3101b93 100644
--- a/fern/products/docs/pages/ai/mcp-server.mdx
+++ b/fern/products/docs/pages/ai/mcp-server.mdx
@@ -28,6 +28,51 @@ Both buttons are enabled by default on sites with Ask Fern. For other clients (C
+## Authenticated sites
+
+On sites with [authentication](/learn/docs/authentication/overview) 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 a [Fern API key](/learn/cli-api/cli-reference/commands#fern-token) for a JWT via the [get-jwt endpoint](/learn/docs/fern-api-reference/get-jwt):
+
+ ```bash
+ curl https://docs.example.com/api/fern-docs/get-jwt \
+ -H "FERN_API_KEY: $FERN_TOKEN"
+ # → { "fern_token": "eyJ...", "roles": [] }
+ ```
+
+
+ Exchange the site password for a JWT:
+
+ ```bash
+ curl -s -D - https://docs.example.com/api/fern-docs/auth/password \
+ -H "Content-Type: application/json" \
+ -d '{"password": "your-site-password"}'
+ ```
+
+ Extract the `fern_token` value from the `Set-Cookie` header in the response.
+
+
+
+### Configure your MCP client
+
+Pass the JWT as the `FERN_TOKEN` header when registering the server. For example, in Claude Code:
+
+```bash
+claude mcp add --transport http \
+ --header "FERN_TOKEN: " \
+ fern-docs https://docs.example.com/_mcp/server
+```
+
+For Cursor, VS Code, and other clients, add `FERN_TOKEN: ` 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.
+
+
## 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`](/learn/docs/ai-features/markdown) — including on authenticated sites.
From 0b37777eed421a615e4a4d2cf354899f2541a42d Mon Sep 17 00:00:00 2001
From: Devin Logan
Date: Mon, 29 Jun 2026 19:54:21 -0400
Subject: [PATCH 2/4] better structure
---
fern/products/docs/pages/ai/mcp-server.mdx | 25 ++++++++++++++++------
1 file changed, 19 insertions(+), 6 deletions(-)
diff --git a/fern/products/docs/pages/ai/mcp-server.mdx b/fern/products/docs/pages/ai/mcp-server.mdx
index d9a3101b93..b3cbc140f9 100644
--- a/fern/products/docs/pages/ai/mcp-server.mdx
+++ b/fern/products/docs/pages/ai/mcp-server.mdx
@@ -7,14 +7,14 @@ Fern automatically generates and hosts a production-ready [Model Context Protoco
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](https://buildwithfern.com/learn/_mcp/server).
-## Connect from your docs site
+## Connect to your MCP server
-[Page action](/learn/docs/configuration/site-level-settings#page-actions-configuration) buttons let users connect to your MCP server in one click:
+For Claude Code and Cursor, [page action](/learn/docs/configuration/site-level-settings#page-actions-configuration) buttons let users connect in one click:
- **Connect to Claude Code** copies a `claude mcp add` command 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. For other clients (Claude Desktop, Windsurf, etc.), users can add `your-documentation-site.com/_mcp/server` to their MCP configuration.
+Both buttons are enabled by default on sites with Ask Fern.
-All other clients (including Claude Desktop, Windsurf, and VS Code) connects using the server URL directly. Add `your-documentation-site.com/_mcp/server` to your MCP configuration. For CLI clients, that looks like:
+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:
```bash
claude mcp add --transport http \