openapi-mcp-builder
Enables users to convert any OpenAPI or Swagger spec URL into a hosted MCP server on the Agentic Tools Platform, with tools for analyzing, trimming, and managing OpenAPI specifications.
README
openapi-mcp-builder
An MCP server that turns any OpenAPI (or Swagger) spec URL into a hosted MCP server on the Agentic Tools Platform, and hands the caller back the ready-to-use MCP gateway URL.
Under the hood it drives the platform's experimental /v1/openapi-servers/*
endpoints:
| Tool | Endpoint / behavior |
|---|---|
analyze_openapi_spec_url |
Local: GET spec URL, summarize operations by tag |
pick_openapi_endpoints |
Local: list all operations + MCP App UI (inline picker in supporting clients) |
search_openapi_operations |
Local: keyword search over paths/tags/opIds |
validate_openapi_tool_filter |
Local: unknown keys, regex check for paths |
export_trimmed_openapi_spec |
Shrink (operation keys, tags, path, prefix, related) |
reupload_openapi_spec_text |
Reupload spec body without a public URL |
build_tool_filter_for_tags |
Build {"include_tags":[...]} for tool_filter |
create_mcp_from_openapi_url |
POST /v1/openapi-servers + SAS PUT + poll |
list_openapi_mcp_servers |
GET /v1/openapi-servers |
get_openapi_mcp_server |
GET /v1/openapi-servers/{id} |
update_openapi_mcp_server |
PATCH /v1/openapi-servers/{id} |
delete_openapi_mcp_server |
DELETE /v1/openapi-servers/{id} |
refresh_openapi_mcp_server |
POST /v1/openapi-servers/{id}/refresh |
list_openapi_mcp_server_tools |
GET /v1/openapi-servers/{id}/tools |
reupload_openapi_spec_from_url |
PATCH ?reupload=true + SAS PUT + poll |
How the spec-URL workflow works
user -> MCP client (e.g. Agent Studio)
| tool call: create_mcp_from_openapi_url(spec_url, name, ...)
v
openapi-mcp-builder
1. GET spec_url # validate JSON / YAML
2. POST /v1/openapi-servers # metadata only -> spec_upload_url
3. PUT <spec_upload_url> # Azure Blob SAS, x-ms-blob-type: BlockBlob
4. GET /v1/openapi-servers/{id} (poll) # until parse_status terminal
5. return { gateway_url, tool_count, parse_status, ... }
The gateway_url in the final response is the MCP URL the agent connects to.
Large specs (operation limits)
The executor enforces a maximum number of OpenAPI operations per server (e.g. 50). A
tool_filter alone may not help if the platform still counts all operations in the
uploaded file before the filter is applied. In that case you must use a physically
smaller spec (fewer path operations in the document):
- Run
export_trimmed_openapi_specon thespec_urlwithinclude_operation_keys(exactGET /pathlist),include_tags, and/orpath_substrings(literal substrings in the path, e.g.dailyLogfor ProjectSight). This returns a trimmed OpenAPI JSON string andtrimmed_operation_count. - Call
reupload_openapi_spec_textwith that JSON asspec_texton the existing server (no Gist or extra hosting required).
For filters that the platform does apply to the live parse, use tool_filter
(include_tags, include_paths as regex such as .*[Dd]ailyLog.* — not glob
patterns like *daily*, which are invalid regex). Use analyze_openapi_spec_url
per-tag counts and set PLATFORM_MAX_OPENAPI_OPERATIONS / MAX_TRIMMED_SPEC_EXPORT_BYTES
in .env for hints and export size.
Optional: set CREATE_PREFLIGHT_ENFORCE=true so create_mcp_from_openapi_url
stops before register when the downloaded spec is over the operation cap and you
did not pass tool_filter or acknowledge_openapi_operation_limit=true
(see .env.example).
For agent authors (Studio / Cursor)
- Always run
analyze_openapi_spec_urlfirst. Ifexceeds_platform_limitis true, do not callcreate_mcp_from_openapi_urluntil you have a plan. tool_filtercontrols which operations become MCP tools; it may not reduce the operation count the executor sees in the uploaded file. To pass a hard cap, useexport_trimmed_openapi_spec(smaller document) +reupload_openapi_spec_text.- Use
search_openapi_operationsto map a user phrase (e.g. “daily log”) to real paths and tags, or callpick_openapi_endpointswith the samespec_urlwhen the client supports MCP Apps (inline UI; see MCP App picker). Alternatively use the standalone endpoint picker (build and serve at/endpoint-picker/; see that README) to copyinclude_operation_keysforexport_trimmed_openapi_spec.include_pathsintool_filtermust be regex, not globs; runvalidate_openapi_tool_filterwithstrict=truewhen you need to fail on unknown keys or glob-like path patterns. analyze_openapi_spec_urlreportsexternal_ref_*when the document uses non-#/$refs (file or URL). Bundle to a single file when possible. Invalid field names (e.g.path_pattern) are a common failure mode — see docs/PLATFORM.md for open questions to confirm with the platform team.
MCP App (inline endpoint picker)
The tool pick_openapi_endpoints is registered with FastMCP AppConfig pointing at a
ui:// HTML resource. MCP clients that implement the MCP Apps / UI extension
(for example recent VS Code or Claude builds) can render the picker inside the chat,
receive the operation list from the tool result, and proxy export_trimmed_openapi_spec
when the user runs export from the UI.
-
Build the bundle (writes into
src/openapi_mcp_builder/static/endpoint_picker_mcp.html):cd apps/endpoint-picker-mcp npm install npm run buildFrom the repo root you can also run
npm run build:endpoint-picker-mcp(see rootpackage.json). -
Agent Studio must explicitly support MCP Apps and negotiate
io.modelcontextprotocol/ui; if it does not,pick_openapi_endpointsstill returns the same JSON as a normal tool (no iframe). -
Manual check: connect this server in an MCP Apps–capable client, invoke
pick_openapi_endpointswith a publicspec_url, confirm the table appears, select operations, and run export from the UI.
Authentication (OAuth provider OBO)
When deployed inside Agent Studio, every tool call carries the
signed-in user's on-behalf-of TID token as Authorization: Bearer <token>.
openapi-mcp-builder extracts that header and forwards it to the Agentic AI
Platform, so every action (create, list, patch, delete) runs as the end user —
no static service credentials required.
Three modes are supported, evaluated per request:
- OBO passthrough — use the caller's
Authorizationheader (production). - Static token —
TOOLS_API_ACCESS_TOKENenv var (local dev / stdio). - Client credentials —
TOOLS_API_CLIENT_ID+TOOLS_API_CLIENT_SECRETmint a token againstTOOLS_API_TOKEN_URL(service-to-service).
The generated OpenAPI MCP server itself defaults to auth_config.provider = "passthrough", so the upstream REST API receives the same end-user token at
tool-invocation time unless you override it.
Install
python -m venv .venv
# Windows PowerShell
.venv\Scripts\Activate.ps1
# macOS / Linux
source .venv/bin/activate
pip install -e ".[dev]"
cp .env.example .env # then edit
Requires Python 3.10+.
Run
Stdio (Claude Desktop, local MCP clients)
MCP_TRANSPORT=stdio openapi-mcp-builder
# or
MCP_TRANSPORT=stdio python -m openapi_mcp_builder
Example Claude Desktop / Cursor MCP config:
{
"mcpServers": {
"openapi-mcp-builder": {
"command": "openapi-mcp-builder",
"env": {
"MCP_TRANSPORT": "stdio",
"TOOLS_API_ENV": "dev",
"TOOLS_API_ACCESS_TOKEN": "eyJhbGciOi..."
}
}
}
}
HTTP (Agent Studio, remote MCP hosts) — default
openapi-mcp-builder # listens on 0.0.0.0:8754 with MCP_TRANSPORT=http
Agent Studio should be configured to send Authorization: Bearer <OBO-token>
on every MCP request. Leave TOOLS_API_ACCESS_TOKEN empty so the server
requires the OBO header.
Environment selector
TOOLS_API_ENV picks the Tools API base URL:
TOOLS_API_ENV |
Base URL |
|---|---|
dev (default) |
https://tools.dev.Build Flows-ai.com |
stage |
https://tools.stage.Build Flows-ai.com |
prod |
https://tools.ai.Build Flows.com |
Set TOOLS_API_TOOLS_API_BASE_URL to override explicitly.
Example call
// tool: create_mcp_from_openapi_url
{
"spec_url": "https://api.redocly.com/registry/bundle/hcss-64o/identity/v1/openapi.yaml?branch=main",
"name": "hcss-identity",
"description": "HCSS Identity API (get bearer tokens)",
"tags": ["hcss", "identity"],
"auth_provider": "passthrough"
}
Response:
{
"ok": true,
"id": "srv_01HQZ...",
"name": "hcss-identity",
"parse_status": "success",
"tool_count": 3,
"gateway_url": "https://tools.dev.Build Flows-ai.com/openapi/hcss-identity",
"mcp_server_url": "https://tools.dev.Build Flows-ai.com/openapi/hcss-identity",
"path": "/openapi/hcss-identity",
"spec_bytes": 48321,
"spec_content_type": "application/yaml",
"waited_seconds": 4.12
}
Point your agent at mcp_server_url and you're done.
Project layout
openapi-mcp/
├── pyproject.toml
├── README.md
├── .env.example
├── src/openapi_mcp_builder/
│ ├── __init__.py
│ ├── __main__.py # CLI entrypoint / transport selection
│ ├── server.py # FastMCP tools
│ ├── workflow.py # download -> register -> upload -> poll
│ ├── client.py # Async HTTP client for the Tools API
│ ├── auth.py # OBO passthrough + fallbacks
│ ├── config.py # Pydantic Settings
│ ├── models.py # Request / response schemas
│ ├── operation_key.py # Canonical operation_key for trim
│ ├── spec_external_refs.py
│ ├── spec_inspect.py # Per-tag / path operation summaries (tool_filter)
│ ├── spec_ref_prune.py # Prune components to $ref-closure after trim
│ ├── spec_trim.py # Shrink paths in a spec for reupload
│ ├── static_resources.py # MCP App HTML loader (ui:// endpoint picker)
│ ├── static/ # bundled endpoint_picker_mcp.html (built by Vite)
│ └── tool_filter_validate.py
├── docs/
│ └── PLATFORM.md # Open questions for the platform (op cap vs filter)
├── apps/
│ ├── endpoint-picker/ # static UI: paste spec → include_operation_keys JSON
│ └── endpoint-picker-mcp/ # Vite MCP App bundle for inline picker (npm run build)
└── tests/
├── conftest.py
├── test_auth.py
├── test_spec_inspect.py
├── test_spec_external_refs.py
├── test_spec_ref_prune.py
├── test_spec_trim.py
├── test_tool_filter_validate.py
├── test_endpoint_picker.py # pick_openapi_endpoints + MCP HTML smoke
└── test_workflow.py # respx-mocked end-to-end flow
Tests
pytest
License
MIT
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。