Your OpenAPI spec is already an MCP server.
Point API Bear at the spec you already have, and every endpoint becomes a tool your AI assistant can call. No server to write, no tool definitions to maintain. It runs on your machine and talks straight to your API.
npx -y apibear --spec ./openapi.jsonOne package, two ways in
Run it, or build on it. Same install.
The CLI and the parser library ship together as apibear, so they can never drift apart.
npx apibear
The one most people want. Give it a spec (a file or a URL), add your API key, and your assistant gets a tool for every endpoint. Nothing to code, nothing to host.
import "apibear"
Building your own MCP host or agent platform? Import the exact parser the CLI runs: a typed, dependency-free engine that turns OpenAPI 3.0/3.1 into MCP tool definitions.
- What you test is what you ship. The tools
--list-toolsprints are the tools your code gets fromparseOpenApiToTools. - One version to pin. Pin
apibearonce and you get the same parser whether you run it or import it. - One changelog, one repo. A fix lands in the CLI and the library in the same release.
How it works
Three steps. Zero code.
No tool definitions to hand-write, no server to deploy, nothing in the middle.
Point it at your spec
A local file or an https:// URL, JSON or YAML, OpenAPI 3.0 or 3.1. If the spec doesn't say where the API lives, add --base-url.
Hand it your key
Pass your token with --header, once or as many times as you need. API Bear adds the headers to every request and sends them only to your API.
Just ask
Ask for “the last five failed invoices” and your assistant picks the right endpoint, fills in the parameters and reads the result. If the API says no, the error comes back in plain view so the model can fix its request and try again.
Setup
Paste it into your client
Pick your client, swap in your spec and token, and restart. That's the whole install.
{
"mcpServers": {
"petstore": {
"command": "npx",
"args": [
"-y", "apibear",
"--spec", "https://petstore3.swagger.io/api/v3/openapi.json",
"--header", "Authorization: Bearer YOUR_TOKEN"
]
}
}
}{
"mcpServers": {
"petstore": {
"command": "npx",
"args": [
"-y", "apibear",
"--spec", "./openapi.json",
"--header", "Authorization: Bearer YOUR_TOKEN"
]
}
}
}claude mcp add petstore -- npx -y apibear \
--spec https://petstore3.swagger.io/api/v3/openapi.json \
--header "Authorization: Bearer YOUR_TOKEN"{
"mcp": {
"petstore": {
"type": "local",
"command": [
"npx",
"-y", "apibear",
"--spec", "./openapi.json",
"--header", "Authorization: Bearer YOUR_TOKEN"
],
"enabled": true
}
}
}{
"mcpServers": {
"petstore": {
"command": "npx",
"args": [
"-y", "apibear",
"--spec", "./openapi.json",
"--header", "Authorization: Bearer YOUR_TOKEN"
]
}
}
}{
"servers": {
"petstore": {
"command": "npx",
"args": [
"-y", "apibear",
"--spec", "./openapi.json",
"--header", "Authorization: Bearer YOUR_TOKEN"
]
}
}
}{
"mcpServers": {
"petstore": {
"command": "npx",
"args": [
"-y", "apibear",
"--spec", "./openapi.json",
"--header", "Authorization: Bearer YOUR_TOKEN"
]
}
}
}See your tools before your assistant does
Add --list-tools to preview exactly which tools your spec produces, right in your terminal.
$ npx -y apibear --spec ./petstore.json --list-tools
listPets List all pets
createPet Create a pet
showPetById Info for a specific petWhy API Bear
Small, sturdy, and on your side
API Bear does one job and sweats the details that make it work well with a model.
Runs on your machine
Requests go straight from your computer to your API. No proxy, no account, no telemetry.
Fits in the context window
Big spec, small task? --only exposes just the endpoints you name, so the model isn't wading through 400 tools to find 3.
Errors the model can read
When your API returns a 4xx or 5xx, the response body goes back to the model as a tool error, not a crash, so it can adjust and retry.
Never garbles the conversation
Logs go to stderr and the protocol stays on stdout; the two never mix. A chatty spec can't break your client.
Open source, one package
MIT-licensed. One apibear package ships the CLI and a dependency-free parser that runs the same in Node, browsers and Cloudflare Workers.
Honest about its limits
No Swagger 2.0, no file uploads, and tokens live in your client config in plain text. It's all written down: Known limitations.
FAQ
Frequently asked questions
The questions we hear most. Still stuck? See Troubleshooting.
Is it free?
Yes. The apibear package (the CLI and the parser library) is MIT-licensed open source and free to use, forever. The upcoming API Bear Gateway is an optional paid service for teams.
Why is the CLI and the library one package?
So they can't drift. The apibear command runs the same parser you get from import { parseOpenApiToTools } from "apibear", at the same version. Preview your tools with npx apibear --list-tools, then build on them in code knowing the names and schemas will match. The library entry still imports none of the CLI's dependencies, so browser and edge bundles stay small.
Will it work with my API?
If you have an OpenAPI 3.0 or 3.1 document in JSON or YAML, almost certainly. Swagger 2.0 isn't supported, but swagger2openapi converts it in one command. File-upload endpoints and deepObject query parameters aren't supported yet. See Known limitations.
Where do my API keys go?
Into your MCP client's config file (e.g. claude_desktop_config.json), on your machine, in plain text. API Bear only ever sends them to the API in your spec. Treat that file like a .env: don't commit it. If plaintext config won't fly with your security team, that's what the Gateway is for.
Does anything go through your servers?
No. There are no API Bear servers in the loop. When your assistant calls a tool, the request goes directly from your machine to your API.
What if my spec has no servers block, or only relative URLs?
Add --base-url https://api.yourdomain.com and API Bear uses it as the root for every request.
Can I expose only some endpoints?
Yes, and for large APIs you should. --only listInvoices,getInvoice limits the tools to the operationIds you name, which keeps the model focused and saves context.
Why a bear?
Look at the logo's ears. They're the prongs of a plug. Now you can't unsee it.
Bringing your team along?
The API Bear Gateway keeps API keys in an encrypted vault instead of on every laptop, and gives each teammate short-lived access. The CLI stays free and open source.