Versioned Docs for Coding Agents: How We Built FrontMCP's Docs MCP Server

  • frontmcp
  • mcp
  • docs
  • cloudflare-workers
  • mcp-registry

Dated article; use the maintained reference for current instructions. How checks work.

An agent helping with a FrontMCP project can find a perfectly good example that the project is too old to run. A search for a method name might lead to today’s documentation, even though the lockfile on the developer’s machine points to an earlier release.

We built a docs MCP server to give an agent the same starting point a maintainer would use: find the installed version, read the relevant section for that version and look up what changed before suggesting an upgrade. The server itself runs FrontMCP on a Cloudflare Worker.

What it replaced

FrontMCP's docs used to live on a hosted docs platform, and its MCP server was the one every new FrontMCP Nx workspace wrote into .mcp.json. It worked, but it couldn't answer the questions an agent upgrading a project actually asks:

  • It searched everything. Every answer mixed four products and every archived minor release.
  • It didn't know the project's release. An agent on 1.9.4 got answers written for whichever release ranked first.
  • It couldn't look up an API by name. An agent had to search for createFetchHandler the same way it searched for "rate limits".
  • It couldn't say what changed between two releases. That is the question an upgrade starts with.

When the docs moved to frontmcp.dev, we wrote our own server rather than move the old one along with them.

One snapshot per release, from git

The documentation is already in git. When we move the site to a new FrontMCP release, we tag the outgoing docs. That gives us the pages, navigation and release notes that belonged together at the time.

During the build, we extract each tagged snapshot and convert its MDX pages to Markdown using the site’s own converter. A release gets its own folder of pages and indexes that the Worker can serve. The table gives the size of the original 1.10.5 snapshot.

WhatFor 1.10.5
Pages, as Markdown178 pages, 6.7 MB
Sections, with their anchors3,662
API entries (decorators, options, error codes, CLI flags)4,737
Version notes ("New in", "Changed in")709
Pages with runnable examples143
Full-text search index3.3 MB, 0.87 MB gzipped

At launch, agents could choose among eleven releases, from 1.9.2 through 1.10.5. The server reads these folders as static assets. An agent can ask get_versions which releases are available.

Finding the right release

Say an agent is searching for rate-limit settings. First it can give resolve_version the project’s lockfile. A manifest may only tell it which range the project accepts, while the lockfile can tell it which release is installed. If several workspaces use different versions, the agent needs to identify the one it’s editing.

The result includes a versioned endpoint, such as https://mcp.frontmcp.dev/1.9.4. The agent can search there and open the matching section. If the exact release has no snapshot, the resolver identifies the closest documented release and explains the gap.

The Worker reads the version from the URL before passing the request to FrontMCP. Every tool handling that request can then read the same snapshot.

export default {
  async fetch(request, env, ctx) {
    const url = new URL(request.url);
    const pinnedVersion = url.pathname.match(/^\/(\d+(?:\.\d+){1,2})\/?$/)?.[1];
    if (pinnedVersion) url.pathname = "/";
    return (await handler)(new Request(url, request), ctx, { ...env, DOCS_VERSION: pinnedVersion });
  },
} satisfies ExportedHandler<DocsWorkerEnv>;

Every content tool also takes an optional version, so one connection can read two releases during an upgrade. Every answer names the release it comes from.

Tools for what agents do with a shell

Watching agents use our old virtual filesystem told us what they actually wanted. Some knew the name of a method. Others knew the problem and needed the right page. Someone planning an upgrade wanted the difference between two versions. We gave each of those requests a direct way in.

ToolWhat it does
search_docsFull-text search by section, returning the page, the heading, path#anchor and a snippet
get_pageA page or one section as Markdown. It also takes links to the old docs and maps them through the same redirect table the old host uses
list_pagesThe docs as the sidebar has them
lookup_apiAn API by name: @Tool, createFetchHandler, an option like throttle.ipFilter, an error code like TOOL_NOT_FOUND, or a CLI flag
get_exampleA page's runnable example: its files, its tests, and how to run them in a project
whats_changedBetween two releases: the release notes, every "Changed in" note with its page, and the pages that changed
resolve_version, get_versionsWhich release to read, and which ones are served
get_skillFrontMCP's latest skills catalog (not a historical snapshot)

There's one prompt too, upgrade_frontmcp, which runs whats_changed and asks the agent for an upgrade plan against the user's code.

These tools share a single Fetch handler. Here is the registration that connects them to the versioned docs.

import { app, FrontMcpInstance } from "@frontmcp/sdk";

const handler = FrontMcpInstance.createFetchHandler({
  info: { name: "frontmcp-docs", version: serverJson.version },
  instructions: INSTRUCTIONS,
  apps: [
    app({
      id: "docs",
      name: "FrontMCP docs",
      tools: [...docsTools, ...versionTools, ...referenceTools],
      prompts: [upgradePrompt],
    }),
  ],
  registry: { name: serverJson.name, description: serverJson.description, publicKey: REGISTRY_PUBLIC_KEY },
  tasks: { enabled: false },
});

What we learned

You can't redirect an MCP endpoint

We could redirect ordinary links when the docs moved. Redirecting a client’s MCP POST was less reliable, so we kept the original frontmcp.dev/mcp address working and served it directly through the Worker. Clients can change their configuration to the dedicated docs host on their own schedule.

Index what agents search for, not everything

Our first search index weighed 5.5 MB per release. Agents already had a dedicated lookup for API names, so we tried indexing just headings and prose. Removing code blocks, link URLs and unnecessary stored fields roughly halved the index. The same test queries still found their answers.

Send each page once

One response contained the whole page twice. Returning a string with a string output schema caused FrontMCP to include both a text representation and structured content. Returning the completed text result let the server send each Markdown page once.

Measure the cold start before choosing a plan

In our Node measurements, building the server took 27 ms and loading a search index took 130 ms. Once loaded, a search took 7 ms. Looking only at the warm number would have hidden the work needed to answer the first request. We chose the paid Workers plan and built the handler once per isolate.

Rate limit at the edge

A busy Worker can have several isolates, each with its own local counter. We added Cloudflare’s rate limit by client address in front of FrontMCP’s own throttle. A client that exceeds the 120-requests-per-minute limit receives a 429 response that tells it when to retry.

Treat the tools as an API

An agent prompt may depend on a tool name just as application code depends on a method name. We keep a snapshot of the public tool list and exercise the deployed server with both an older client and a stateless one, including a request pinned to a release.

In the MCP Registry

The server has its own host, which lets it serve its own /.well-known documents. FrontMCP's registry option, in the code above, serves the Registry's proof that the server owns the dev.frontmcp.mcp namespace, plus a server card and an AI catalog. Publishing is two CLI commands:

npx frontmcp registry keygen
npx frontmcp registry publish --file server.json --key-file ~/.frontmcp/keys/mcp-registry.key

keygen writes the private key outside the repository and prints the public key that goes into the registry option. publish signs the listing with the private key.

Connecting your agent

With Claude Code:

claude mcp add --transport http frontmcp-docs https://mcp.frontmcp.dev

Clients that keep their servers in a JSON file take the URL:

{ "mcpServers": { "frontmcp-docs": { "url": "https://mcp.frontmcp.dev" } } }

It needs no key and no sign-in, only reads, and speaks MCP from 2024-11-05 to 2026-07-28. Docs for Your Agent has the pins, every tool, and what its errors mean.

Field notes: three corrections after release

A lockfile with two SDK releases exposed a flaw. Reordering the entries could change which docs the agent received. The resolver now asks for a workspace or an installed version when the answer is ambiguous. Reversing the entries is part of the regression test.

Two other fixes came from following a search result all the way to the page. An older deployment article was outranking maintained instructions, and a section link that worked in HTML disappeared when converted to Markdown. We adjusted source selection and preserved the original heading identity through conversion.

What's next

Full-text search works well when the question and the docs use similar words. The searches we most want to understand are the ones that send an agent to the wrong release or the wrong section. If that happens, include the agent’s question and the version it was using when you report the result.

Report a docs issue. Site usage and privacy.