-
Notifications
You must be signed in to change notification settings - Fork 7
docs: clarify ai api access instructions, integrate mcp and markdown pages #5210
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| --- | ||
| title: Markdown access | ||
| description: Access your documentation as Markdown — through per-page URLs, `llms.txt`, and `llms-full.txt` — for AI agents and tooling. | ||
| --- | ||
|
|
||
|
|
||
| Fern serves clean Markdown for any documentation page — including API Reference pages — so agents can consume your content efficiently. Agents fetch the source by appending `.md` or `.mdx` to a page URL, or by sending an `Accept: text/markdown` header via [content negotiation](https://developer.mozilla.org/en-US/docs/Web/HTTP/Content_negotiation). Combined with [`llms.txt`](/learn/docs/ai-features/llms-txt), this reduces token consumption by 90%+ compared to HTML. | ||
|
|
||
| <Frame caption="For example, `https://buildwithfern.com/learn/docs/ai-features/markdown.md` displays the Markdown source for this page."> | ||
| <img src="./markdown.png" | ||
| alt="Example showing a page's underlying Markdown" | ||
| className="rounded-lg border border-gray-200 dark:border-gray-700" | ||
| /> | ||
| </Frame> | ||
|
|
||
| The same Markdown is used everywhere — single pages, `llms.txt`, and `llms-full.txt` — and respects the same `<llms-only>` and `<llms-ignore>` content controls. | ||
|
|
||
| A [default per-page directive](/learn/docs/ai-features/agent-directives) is automatically prepended to every page's Markdown output when served to AI agents, pointing them to your `.md` URLs, `llms.txt`, and `llms-full.txt`. You can [override or disable this directive](/learn/docs/configuration/site-level-settings#agents-configuration) in `docs.yml`. The directive is only visible to agents — human-facing documentation is unaffected. | ||
|
|
||
| ## Accessing protected docs | ||
|
|
||
| On sites with [authentication](/learn/docs/authentication/overview) enabled, agents must include a JWT on every Markdown request — whether for an individual page, `llms.txt`, or `llms-full.txt`. Exchange your [Fern token](/learn/cli-api/cli-reference/commands#fern-token) for a [JWT](/learn/docs/fern-api-reference/get-jwt): | ||
|
|
||
| ```bash Get a JWT | ||
| curl https://docs.example.com/api/fern-docs/get-jwt \ | ||
| -H "FERN_API_KEY: $FERN_TOKEN" | ||
| # → { "fern_token": "eyJ...", "roles": [] } | ||
| ``` | ||
|
|
||
| Send the returned JWT as the `FERN_TOKEN` header on subsequent requests: | ||
|
|
||
| ```bash Fetch protected content | ||
| curl https://docs.example.com/platform/overview \ | ||
| -H 'Accept: text/markdown' \ | ||
| -H "FERN_TOKEN: $JWT" | ||
| ``` | ||
|
|
||
| JWTs are valid for 30 days — cache and refresh as needed. | ||
|
|
||
| ## Markdown for troubleshooting | ||
|
|
||
| Viewing the Markdown directly is also useful for troubleshooting layout problems. A **View as Markdown** button is enabled by default on every page and can be configured through the [page actions configuration](/learn/docs/configuration/site-level-settings#page-actions-configuration). |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 0 additions & 20 deletions
20
fern/products/docs/pages/developer-tools/view-markdown.mdx
This file was deleted.
Oops, something went wrong.
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 [vale] reported by reviewdog 🐶
[Microsoft.Wordiness] Consider using 'also' instead of 'In addition'.