Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion fern/products/docs/pages/ai/mcp-server.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,16 @@ Exchange your credentials for a JWT. The endpoint depends on how your site authe

Extract the `fern_token` value from the `Set-Cookie` header in the response.
</Tab>
<Tab title="SSO">
Log in to your docs site in a browser, then request the whoami endpoint from the same browser. It reads the session cookie set at login and returns the token:

```
https://docs.example.com/api/fern-docs/whoami
→ { "fern_token": "eyJ...", "user_info": { ... } }
```

The session cookie is `httpOnly`, so the token isn't readable from client-side JavaScript.
</Tab>
</Tabs>
</Step>

Expand All @@ -78,7 +88,7 @@ claude mcp add --transport http \
fern_mcp_docs.example.com https://docs.example.com/_mcp/server
```

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.
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. Clients that only send bearer tokens can pass the JWT as `Authorization: Bearer <jwt>` instead.
</Step>
</Steps>

Expand Down
7 changes: 7 additions & 0 deletions fern/products/docs/pages/changelog/2026-08-07.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## Authenticate the MCP server with a bearer token

<ChangelogTags>mcp, authentication</ChangelogTags>

The MCP server on authenticated sites now accepts the docs JWT as `Authorization: Bearer <jwt>`, in addition to the `FERN_TOKEN` header, so MCP clients that only send bearer tokens can read authenticated content. On SSO sites, retrieve the token from `/api/fern-docs/whoami` after logging in to your docs site in a browser.

<Button intent="none" outlined rightIcon="arrow-right" href="/learn/docs/ai/mcp-server#authenticated-sites">Read the docs</Button>
Loading