From d10b69193615ef2107fa9084e97e35074afc4a51 Mon Sep 17 00:00:00 2001 From: David Rojas Date: Tue, 24 Nov 2026 13:15:13 -0600 Subject: [PATCH] docs(mcp): use the Petstore 3.1 spec URL in the MCP quickstart (FERN-104) The CLI now resolves a relative servers entry against the spec URL (fern-api/fern#18907), so the quickstart can run fern init on the original spec URL with no api.baseUrl override. Co-Authored-By: Claude --- fern/products/mcp-generator/quickstart.mdx | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/fern/products/mcp-generator/quickstart.mdx b/fern/products/mcp-generator/quickstart.mdx index d300c5df8..a08fe792f 100644 --- a/fern/products/mcp-generator/quickstart.mdx +++ b/fern/products/mcp-generator/quickstart.mdx @@ -16,14 +16,14 @@ Generate a hosted MCP server from an OpenAPI specification with Fern. Follow the ## Prerequisites -- The [Fern CLI](https://www.npmjs.com/package/fern-api), version 5.191.0 or later. +- The [Fern CLI](https://www.npmjs.com/package/fern-api), version 5.x.0 or later. - A Fern account, and access to the [Fern dashboard](https://dashboard.buildwithfern.com/). Deploying requires `fern login` on your machine, or a `FERN_TOKEN` environment variable in CI. - An OpenAPI spec. This guide uses the Swagger Petstore sample. - A network that allows `*.fernmcp.dev`. If your company blocks it, ask your IT team to add `*.fernmcp.dev` to the allowlist. Agents on that network can't reach the server until they do. ```bash npm install -g fern-api -fern --version # 5.191.0 or later +fern --version # 5.x.0 or later fern login ``` @@ -37,14 +37,10 @@ Replace `` in the commands that follow with your organization name. ```bash mkdir petstore-mcp && cd petstore-mcp -curl -o petstore.json https://petstore3.swagger.io/api/v3/openapi.json - -fern init --openapi ./petstore.json --org +fern init --openapi https://petstore31.swagger.io/api/v31/openapi.json --org ``` -This creates a `fern/` folder that contains your spec and a file named `sdk-config.yml`. - -The Petstore spec lists its server as the relative path `/api/v3`, and an MCP server needs the full address of the API it calls. The next step sets that address in `sdk-config.yml`. +This creates a `fern/` folder with a file named `sdk-config.yml` that points at the spec URL. @@ -54,13 +50,11 @@ Edit `fern/sdk-config.yml` so the file reads: ```yaml title="fern/sdk-config.yml" schemaVersion: sdk-config/v1 sdkName: api -api: - baseUrl: https://petstore3.swagger.io/api/v3 source: specs: - id: api type: openapi - path: ./openapi.json + url: https://petstore31.swagger.io/api/v31/openapi.json targets: - language: mcp output: @@ -68,7 +62,7 @@ targets: slug: petstore ``` -`api.baseUrl` is the address the server's tools call, and it takes precedence over the `servers` entry in your spec. If your spec's `servers` entry is already a full address, you can leave `api` out. `slug` names the server and becomes the last part of its URL. It takes 1 to 30 lowercase letters, numbers, and single hyphens, and can't start or end with a hyphen. +The server's tools call the address in the spec's `servers` entry. The Petstore spec lists it as the relative path `/api/v31`, and the CLI resolves a relative path against the spec URL, so the tools call `https://petstore31.swagger.io/api/v31`. For a local spec file with a relative `servers` entry, set the full address in `api.baseUrl`, which takes precedence over `servers`. `slug` names the server and becomes the last part of its URL. It takes 1 to 30 lowercase letters, numbers, and single hyphens, and can't start or end with a hyphen. @@ -123,7 +117,7 @@ targets: delivery: zip ``` -A local server needs the full address of your API too, from `api.baseUrl` or the `servers` entry in your spec. A `zip` build accepts a relative path, but every tool call on the local server then fails with `Invalid URL`. +A local server needs the full address of your API too, from `api.baseUrl` or the `servers` entry in your spec. `fern generate` then downloads `fern/generated/mcp.zip` and deploys nothing. Unzip it and start the server with Node.js: @@ -143,7 +137,7 @@ The zip also holds the generated TypeScript project in `project/`. Its `README.m | You see | Cause and fix | |---------|---------------| -| `[metadata.baseUrl] Invalid url`, or `Invalid URL` from every tool on a local server | The `servers` entry in your spec is a relative path such as `/api/v1`. Set `api.baseUrl` in `sdk-config.yml` to the full address, for example `https://api.example.com/v1`, or use the full address in `servers`. | +| `has a relative servers URL`, `[metadata.baseUrl] Invalid url`, or `Invalid URL` from every tool on a local server | The `servers` entry in a local spec file is a relative path such as `/api/v1`, or the CLI is older than 5.x.0. Set `api.baseUrl` in `sdk-config.yml` to the full address, for example `https://api.example.com/v1`, or use the full address in `servers`. | | `Deploying to Fern's hosted MCP platform requires authentication` | The CLI has no Fern credentials. Run `fern login`, or set `FERN_TOKEN` in CI. | | `Tool name "..." is ... characters` or `contains unsupported characters` | MCP tool names take 1 to 64 letters, digits, `_`, or `-`. [Set `x-fern-mcp-name`](/learn/mcp-generator/get-started/configure#name-and-describe-tools) on the operation, in your spec or an [overlay](/learn/api-definitions/openapi/overlays). The error message includes an overlay entry to copy. | | `MCP tool filter entries matched no tools` | An entry in `tools` or `toolsets` names no operation. The message lists the available tool names. |