All articles
November 2, 2026

OpenAPI to MCP Server: Let Your AI Agent Set It Up with DocStar

openapi-to-mcp-server-cover.png

You have an OpenAPI spec, and your users want to use your API from Claude, ChatGPT or Cursor. With DocStar you don't click through a setup wizard to get there. You hand the job to the AI coding agent you already use: it imports your spec into DocStar, checks it against your code, picks the right tools and writes the guidance for assistants. You review and publish. The result is a hosted MCP server, an interactive API reference and a CLI, all from one collection, with no server code to write or host.

This guide shows the agent-first way to go from OpenAPI to MCP server with DocStar, what the agent does at each step, and the few decisions that stay with you.

New to MCP? Read What Is an MCP Server? first.

#

What you get from one OpenAPI spec in DocStar

From one published DocStar collection Who uses it
A hosted MCP server that searches your docs and calls your API, at https://mcp.docstar.io/connector/<your-slug> Claude, ChatGPT, Cursor, VS Code and other MCP clients
An interactive API reference with a TRY button Developers reading your docs
CLI commands for every published endpoint Developers and coding agents in a terminal
A Markdown copy of every page and an llms.txt Any AI tool reading your docs

All of it reads the same published docs, so a fix made once shows up everywhere.

#

Step 1: Connect your coding agent to DocStar

DocStar has its own MCP server for doing documentation work. Add it to Claude Code, Cursor, Codex or any assistant that supports remote MCP servers:

https://mcp.docstar.io/mcp

If DocStar is listed in your assistant's connector directory, connect it from there instead. The first time the agent needs your workspace, you sign in to DocStar in your browser. There is no API key to copy, and the agent only sees the workspaces and collections your account can access. Details are in Connect Your AI Assistant.

#

Step 2: Give it one prompt

Open the agent in the repository that holds your API and your spec, and paste a prompt like this:

Use the DocStar MCP to turn my API into an MCP server. First read https://docstar.io/mcp/quickstart.md and follow it step by step. Import openapi.yaml into a new DocStar API collection, then check every endpoint against my latest code and fix anything the spec gets wrong or leaves out. Give each endpoint a clear description and a full JSON body example.

Change the file name to match yours. That is the only typing you need to do.

[Screenshot: Claude Code running the DocStar MCP with the import plan shown for approval]

#

Step 3: Let the agent do the setup

Here is what the agent does through the DocStar MCP, and what you see along the way.

#

It imports your spec

DocStar imports OpenAPI 3.x and Swagger 2.0, in JSON or YAML, as well as Postman collections. The agent sends the spec straight to DocStar's import API, which accepts it as a JSON body, so nothing has to be uploaded by hand. DocStar creates a new API collection with your endpoints and folders. The collection slug is permanent and becomes part of your MCP URL and CLI commands, so the agent asks you to confirm it. Your product name is a good choice.

#

It fixes what the spec gets wrong

Specs drift. Fields get added in code and never make it into the YAML, descriptions say "The ID", and examples go stale. Because the agent can read your routes, it compares each endpoint with the code and updates the docs: verb-first names such as Create Invoice, a description that says when to use the endpoint, a full JSON body example with every accepted field, and sample success and error responses. These are exactly the details an AI assistant relies on to pick the right endpoint and fill in the right fields.

#

It sets up the MCP server

Every DocStar collection already has an MCP server. The agent tunes it for your product:

  • Endpoint tools. It picks up to 20 of your most important endpoints and gives each a named tool, such as create_invoice, so assistants choose them reliably. It can set safety hints (read-only, destructive, idempotent) so assistants know when to ask before running a tool. Everything else stays reachable through the server's general API tool.

  • The skill. It writes the short guide assistants read before using your API: what the API is for, the usual order of calls, rules and limits, and which calls to confirm first.

  • Instructions. It adds short rules sent on every connection, such as "Ask for the account ID before creating an order", kept under 2,000 characters.

All of this is described in Build an MCP Server for Your App.

#

It asks before anything goes live

The DocStar MCP shows you what it will create, change or publish and waits for your OK. Every change starts as a draft, so nothing reaches your live docs or your MCP server until you approve it.

#

Step 4: Review and publish

Skim the drafts in the DocStar editor. This is where a human adds the judgment an agent can't: which internal or test-only endpoints should stay private, and whether the names read the way your users talk. Unpublished endpoints never appear in the MCP server or the CLI.

When you're happy, tell the agent to publish, or publish from DocStar yourself. The agent then hands you the MCP URL and ready-made setup snippets. In Claude Code, for example:

claude mcp add --transport http acme https://mcp.docstar.io/connector/acme

For copy-ready setup steps you can give your own users, see How to Connect Your API to ChatGPT, Claude and Cursor.

#

Step 5: Add sign-in (the one step that needs your OAuth app)

If your API needs each user's own token, open the collection's MCP tab and fill in Sign-in for API calls: Authorization URL, Token URL, Client ID and secret, and a Token validation URL. Then add the redirect URIs shown in the tab to your OAuth app. The client secret is stored only on the MCP server and is never shown again.

From then on, the first time an assistant calls your API the user signs in with their own account, and every call runs with their own permissions. Key-based APIs get a key tool instead, so users enter their key once rather than pasting it into prompts. For private APIs, turn on Require sign-in when connecting. More in Securing Your DocStar MCP Server.

#

Your CLI is already there

The same published collection powers the DocStar CLI, so developers and coding agents can call your API from a terminal with no SDK to generate:

npm install -g docstar-cli
docstar-cli acme orders create-order --help

The CLI reads your published docs every time a command runs. If you set up OAuth for the MCP server, users can run docstar-cli login acme with the same OAuth app once you add https://api.docstar.io/p/cli-auth/callback as a redirect URI. See the DocStar CLI guide.

#

Keeping the MCP server current, with the same agent

Your API will change. Don't re-import the spec for every release, because each import creates a new collection. Ask the agent instead:

Read the routes changed in this branch and update the matching endpoints in our DocStar API collection as drafts.

It updates the existing endpoints, you review and publish, and connected assistants see the change on their next call. Nothing to redeploy. Teams that want this fully automated can also use webhooks and the DocStar API; see Make Your Docs Part of Your Stack.

#

Prefer to click? The same flow in the DocStar app

Everything the agent does is also available in the app. Click the collection name at the top of the left sidebar, choose Import collection, drop in your spec and click Import (Import Content). Then review endpoints, publish, and open Settings > MCP to copy the URL, choose tools, edit the skill and add sign-in. Only have a Postman collection? See How to Turn a Postman Collection into an MCP Server.

#

How this differs from other OpenAPI-to-MCP tools

As of November 2026, other tools can map a spec to MCP. Scalar has a free browser preview of the tools a spec would produce, with hosting in its dashboard, and open-source generators produce server code you host yourself. With DocStar, your own agent does the setup from your spec and your code, and the MCP server, API reference, CLI and AI-readable Markdown all come from one published collection.

#

Why teams choose DocStar

  • Agent-first setup. One prompt in Claude Code, Cursor or Codex imports the spec, fixes the docs and configures the MCP server.

  • Safe by design. The agent asks before changing anything, and every change starts as a draft.

  • Hosted for you. No server to deploy, scale or patch.

  • Per-user sign-in. OAuth or API keys, so every call runs with the user's own permissions.

  • One source, every surface. Docs, MCP server, CLI and llms.txt stay in sync because they read the same published pages.

#

FAQ

#

Do I have to set this up by hand in DocStar?

No. Connect your coding agent to the DocStar MCP and give it one prompt. It imports the spec, writes descriptions, picks tools and writes the skill, then asks you to approve. The only setting you add yourself is your OAuth app's details, if your API uses sign-in.

#

Why should the agent check my code if I already have a spec?

Specs often lag behind the code. Assistants pick endpoints and fill in fields from your docs, so missing fields or vague descriptions lead to wrong calls. The agent fixes those gaps before anything goes live.

#

Which OpenAPI versions does DocStar import?

OpenAPI 3.x and Swagger 2.0, in JSON or YAML. DocStar also imports Postman collections and DocStar exports.

#

Can assistants change data through my API?

Only through endpoints you publish. With sign-in, every call runs with the user's own permissions, and safety hints tell assistants when to ask before running a tool.

#

What happens when my API changes?

Ask your agent to update the matching endpoints, review the drafts and publish. Connected assistants and the CLI pick up the change straight away.

#

Get started free

Connect your coding agent, paste one prompt, and get an MCP server, API reference and CLI from your OpenAPI spec. Get started free with DocStar.

 

OpenAPI to MCP serverOpenAPI to MCPMCP serverSwagger to MCPDocStar MCPAI coding agent