From 626fee0e3c6f04d3d4a0b62d937592cbb17f0188 Mon Sep 17 00:00:00 2001
From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Date: Sat, 8 Aug 2026 17:08:10 +0000
Subject: [PATCH 1/2] docs: document `fern mcp install`
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
---
.../cli-api-reference/pages/commands.mdx | 39 +++++++++++++++++++
fern/products/docs/pages/ai/mcp-server.mdx | 2 +
2 files changed, 41 insertions(+)
diff --git a/fern/products/cli-api-reference/pages/commands.mdx b/fern/products/cli-api-reference/pages/commands.mdx
index be13bd1b3..8cac55458 100644
--- a/fern/products/cli-api-reference/pages/commands.mdx
+++ b/fern/products/cli-api-reference/pages/commands.mdx
@@ -14,6 +14,7 @@ hideOnThisPage: true
| [`fern downgrade`](#fern-downgrade) | Move the Fern CLI version in `fern.config.json` back to an older version |
| [`fern login`](#fern-login) | Login to Fern CLI via GitHub, Google, Postman, or enterprise SSO |
| [`fern logout`](#fern-logout) | Log out of the Fern CLI |
+| [`fern mcp install`](#fern-mcp-install) | Connect Claude Code, Cursor, or Codex to Fern's MCP server |
| [`fern export`](#fern-export) | Export an OpenAPI spec for your API |
| [`fern api update`](#fern-api-update) | Manually update your OpenAPI spec |
| [`fern api enrich`](#fern-api-enrich) | Merge `x-fern-examples` from an overrides file into native OpenAPI examples |
@@ -857,6 +858,44 @@ hideOnThisPage: true
+
+
+ Use `fern mcp install` to connect a coding agent to Fern's MCP server, which exposes tools for searching your published documentation and reading your site configuration, analytics, and reader feedback. The command writes the token from [`fern login`](#fern-login) into the agent's config, so the agent doesn't go through a second OAuth flow:
+
+
+ ```bash
+ fern mcp install [--client claude|cursor|codex] [--org ]
+ ```
+
+
+ Without flags, the command configures every supported agent installed on the machine, adding a `fern` server entry that holds the server URL and an `Authorization` header. Other entries and surrounding content in each file are preserved.
+
+ | Client | Config file |
+ |--------|-------------|
+ | Claude Code | `~/.claude.json` |
+ | Cursor | `~/.cursor/mcp.json` |
+ | Codex | `~/.codex/config.toml` |
+
+ A [`fern token`](#fern-token) API key is rejected, because the MCP server authenticates a user rather than an organization. The token written into the agent config doesn't refresh: when the server starts returning 401s, run `fern login && fern mcp install` again.
+
+ ### client
+
+ Use `--client` to configure specific agents instead of every one detected. Repeat the flag to name more than one.
+
+ ```bash
+ fern mcp install --client claude --client cursor
+ ```
+
+ ### org
+
+ Use `--org` to override the organization from [`fern.config.json`](/learn/sdks/overview/project-structure#fernconfigjson). The organization scopes the server URL to `https://fai.buildwithfern.com/organizations//mcp`. Outside a Fern project, the command falls back to the unscoped `https://fai.buildwithfern.com/mcp`, which resolves the organization from your login and fails if that login covers several.
+
+ ```bash
+ fern mcp install --org my-org
+ ```
+
+
+
diff --git a/fern/products/docs/pages/ai/mcp-server.mdx b/fern/products/docs/pages/ai/mcp-server.mdx
index 2e6373129..8631af618 100644
--- a/fern/products/docs/pages/ai/mcp-server.mdx
+++ b/fern/products/docs/pages/ai/mcp-server.mdx
@@ -102,3 +102,5 @@ This is especially useful on [authenticated sites](/learn/docs/authentication/ov
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.
+Fern hosts a separate MCP server for your Fern organization, which searches your published pages and reads your site configuration, analytics, and reader feedback. Run [`fern mcp install`](/learn/cli-api-reference/cli-reference/commands#fern-mcp-install) to connect Claude Code, Cursor, or Codex to it.
+
From cdfb97de0292cc5140e8926c414602822d1ebf60 Mon Sep 17 00:00:00 2001
From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Date: Sat, 8 Aug 2026 17:09:19 +0000
Subject: [PATCH 2/2] docs: tighten fern mcp install section
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
---
fern/products/cli-api-reference/pages/commands.mdx | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/fern/products/cli-api-reference/pages/commands.mdx b/fern/products/cli-api-reference/pages/commands.mdx
index 8cac55458..267d62c49 100644
--- a/fern/products/cli-api-reference/pages/commands.mdx
+++ b/fern/products/cli-api-reference/pages/commands.mdx
@@ -868,6 +868,16 @@ hideOnThisPage: true
```
+ From a machine with no Fern CLI yet:
+
+
+ ```bash
+ npm i -g fern-api
+ fern login
+ fern mcp install
+ ```
+
+
Without flags, the command configures every supported agent installed on the machine, adding a `fern` server entry that holds the server URL and an `Authorization` header. Other entries and surrounding content in each file are preserved.
| Client | Config file |
@@ -876,7 +886,7 @@ hideOnThisPage: true
| Cursor | `~/.cursor/mcp.json` |
| Codex | `~/.codex/config.toml` |
- A [`fern token`](#fern-token) API key is rejected, because the MCP server authenticates a user rather than an organization. The token written into the agent config doesn't refresh: when the server starts returning 401s, run `fern login && fern mcp install` again.
+ The MCP server authenticates a user rather than an organization, so a `FERN_TOKEN` registry token is rejected: log in with [`fern login`](#fern-login) instead. The token written into the agent config doesn't refresh, so when the server starts returning 401s, run `fern login && fern mcp install` again.
### client
@@ -888,7 +898,7 @@ hideOnThisPage: true
### org
- Use `--org` to override the organization from [`fern.config.json`](/learn/sdks/overview/project-structure#fernconfigjson). The organization scopes the server URL to `https://fai.buildwithfern.com/organizations//mcp`. Outside a Fern project, the command falls back to the unscoped `https://fai.buildwithfern.com/mcp`, which resolves the organization from your login and fails if that login covers several.
+ Use `--org` to override the organization ID from `fern.config.json`. The organization scopes the server URL to `https://fai.buildwithfern.com/organizations//mcp`. Outside a Fern project, the command falls back to the unscoped `https://fai.buildwithfern.com/mcp`.
```bash
fern mcp install --org my-org