Skip to content

Commit 3cc50c4

Browse files
committed
docs
1 parent 3f734cf commit 3cc50c4

File tree

4 files changed

+233
-3
lines changed

4 files changed

+233
-3
lines changed

fern/apis/mcp-tools/generators.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
api:
2+
specs:
3+
- openapi: openapi.json

fern/apis/mcp-tools/openapi.json

Lines changed: 209 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,209 @@
1+
{
2+
"openapi": "3.1.0",
3+
"info": {
4+
"title": "Fern Docs MCP API",
5+
"version": "1.0.0",
6+
"description": "API endpoints for MCP agents to authenticate and search Fern documentation sites."
7+
},
8+
"servers": [
9+
{
10+
"url": "https://docs.example.com",
11+
"description": "Your documentation domain"
12+
}
13+
],
14+
"components": {
15+
"securitySchemes": {
16+
"FernApiKey": {
17+
"type": "apiKey",
18+
"in": "header",
19+
"name": "FERN_API_KEY",
20+
"description": "Fern API key, from `fern generate token`."
21+
},
22+
"FernToken": {
23+
"type": "apiKey",
24+
"in": "header",
25+
"name": "FERN_TOKEN",
26+
"description": "JWT token for this user."
27+
}
28+
}
29+
},
30+
"paths": {
31+
"/api/fern-docs/get-jwt": {
32+
"get": {
33+
"summary": "JWT from Fern API key",
34+
"description": "Get a JWT to access protected documentation endpoints, optionally scoped to specific roles.",
35+
"operationId": "getJwt",
36+
"security": [
37+
{
38+
"FernApiKey": []
39+
}
40+
],
41+
"parameters": [
42+
{
43+
"name": "ROLES",
44+
"in": "header",
45+
"required": false,
46+
"schema": {
47+
"type": "string"
48+
},
49+
"description": "Comma-separated list of roles (e.g., \"botanist,seedling\"). Sets roles for returned JWT if provided, otherwise, roles are empty."
50+
},
51+
{
52+
"name": "x-fern-host",
53+
"in": "header",
54+
"required": false,
55+
"schema": {
56+
"type": "string"
57+
},
58+
"description": "Domain (required on preview URLs)"
59+
}
60+
],
61+
"responses": {
62+
"200": {
63+
"description": "Successfully generated JWT",
64+
"content": {
65+
"application/json": {
66+
"schema": {
67+
"type": "object",
68+
"properties": {
69+
"fern_token": {
70+
"type": "string",
71+
"description": "JWT token for authenticating subsequent requests"
72+
},
73+
"roles": {
74+
"type": "array",
75+
"items": {
76+
"type": "string"
77+
},
78+
"description": "Roles included in the JWT"
79+
}
80+
},
81+
"required": ["fern_token", "roles"]
82+
}
83+
}
84+
}
85+
},
86+
"400": {
87+
"description": "Bad request (local preview, self-hosted, or SSO environment)",
88+
"content": {
89+
"application/json": {
90+
"schema": {
91+
"type": "object",
92+
"properties": {
93+
"error": {
94+
"type": "string"
95+
}
96+
}
97+
}
98+
}
99+
}
100+
},
101+
"401": {
102+
"description": "Unauthorized (missing or invalid API key)",
103+
"content": {
104+
"application/json": {
105+
"schema": {
106+
"type": "object",
107+
"properties": {
108+
"error": {
109+
"type": "string"
110+
}
111+
}
112+
}
113+
}
114+
}
115+
},
116+
"403": {
117+
"description": "Forbidden (API key does not belong to this domain's Fern organization)",
118+
"content": {
119+
"application/json": {
120+
"schema": {
121+
"type": "object",
122+
"properties": {
123+
"error": {
124+
"type": "string"
125+
}
126+
}
127+
}
128+
}
129+
}
130+
}
131+
}
132+
}
133+
},
134+
"/api/fern-docs/search/v2/key": {
135+
"get": {
136+
"summary": "Algolia search credentials",
137+
"description": "Get Algolia search credentials for querying documentation.",
138+
"operationId": "getSearchKey",
139+
"security": [
140+
{
141+
"FernApiKey": []
142+
},
143+
{
144+
"FernToken": []
145+
}
146+
],
147+
"parameters": [
148+
{
149+
"name": "ROLES",
150+
"in": "header",
151+
"required": false,
152+
"schema": {
153+
"type": "string"
154+
},
155+
"description": "Comma-separated list of roles (only with FERN_API_KEY). Sets roles for returned search key if provided, otherwise, roles are empty."
156+
},
157+
{
158+
"name": "x-fern-host",
159+
"in": "header",
160+
"required": false,
161+
"schema": {
162+
"type": "string"
163+
},
164+
"description": "Documentation domain (required on preview URLs)"
165+
}
166+
],
167+
"responses": {
168+
"200": {
169+
"description": "Successfully retrieved search credentials",
170+
"content": {
171+
"application/json": {
172+
"schema": {
173+
"type": "object",
174+
"properties": {
175+
"appId": {
176+
"type": "string",
177+
"description": "Algolia application ID"
178+
},
179+
"apiKey": {
180+
"type": "string",
181+
"description": "Short-lived Algolia search API key"
182+
},
183+
"roles": {
184+
"type": "array",
185+
"items": {
186+
"type": "string"
187+
},
188+
"description": "Roles included in the search key (only with FERN_API_KEY auth)"
189+
}
190+
},
191+
"required": ["appId", "apiKey"]
192+
}
193+
}
194+
}
195+
},
196+
"400": {
197+
"description": "Bad request (local preview or unsupported preview URL)"
198+
},
199+
"401": {
200+
"description": "Unauthorized (invalid Fern API key)"
201+
},
202+
"403": {
203+
"description": "Forbidden (API key does not belong to this domain's Fern organization)"
204+
}
205+
}
206+
}
207+
}
208+
}
209+
}

fern/products/docs/docs.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,13 @@ navigation:
128128
contents:
129129
- link: Ask Fern
130130
href: /learn/ask-fern/getting-started/what-is-ask-fern
131-
- page: MCP server for your site
132-
path: ./pages/ai/mcp-server.mdx
131+
- section: MCP server for your site
132+
contents:
133+
- page: Overview
134+
path: ./pages/ai/mcp-server.mdx
135+
- api: API Reference
136+
paginated: false
137+
api-name: mcp-tools
133138
slug: mcp-server
134139
- page: Fern Scribe (coming soon)
135140
path: ./pages/ai/scribe.mdx

fern/products/docs/pages/ai/mcp-server.mdx

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,17 @@ Developers can access your MCP server by visiting `your-documentation-site.com/m
1717

1818
<Tip>
1919
**Looking for Fern's own MCP server?** If you want to connect your AI client to Fern's MCP server for help with Ask Fern, Docs, and SDKs, see the [fern-mcp-server repository](https://github.com/fern-api/fern-mcp-server).
20-
</Tip>
20+
</Tip>
21+
22+
## Additional AI Tooling
23+
24+
LLMs can access your documentation programmatically, even for authenticated sites. When content is fetched this way, it's served as clean markdown without HTML markup, making it token efficient for LLMs to process.
25+
26+
```bash
27+
curl -X GET https://docs.example.com/platform/overview \
28+
-H 'Accept: text/plain' \
29+
-H 'x-fern-host: docs.example.com' \
30+
-H "FERN_TOKEN:${JWT}"
31+
```
32+
33+
For sites with authentication, LLMs can obtain a JWT by calling the [`/api/fern-docs/get-jwt`](/learn/docs/ai-features/mcp-server/api-reference/get-jwt) endpoint with a Fern API key. This JWT can then be used to access protected documentation content and search functionality.

0 commit comments

Comments
 (0)