# MCPO — MCP-to-OpenAPI Proxy Server > MCPO proxies an MCP tool as an OpenAPI HTTP server (with /docs), so non-MCP clients can call tools via HTTP, with uvx/pip/Docker run modes. ## Install Merge the JSON below into your `.mcp.json`: ## Quick Use 1. Run with uvx (README recommended): ```bash uvx mcpo --port 8000 --api-key "top-secret" -- your_mcp_server_command ``` 2. Test in browser: - Open `http://localhost:8000/docs` 3. Example (from README): ```bash uvx mcpo --port 8000 --api-key "top-secret" -- uvx mcp-server-time --local-timezone=America/New_York ``` ## Intro MCPO proxies an MCP tool as an OpenAPI HTTP server (with /docs), so non-MCP clients can call tools via HTTP, with uvx/pip/Docker run modes. - **Best for:** teams who want to expose MCP tooling as an HTTP/OpenAPI surface (with auth) to integrate with existing API clients - **Works with:** uvx or pip install, Docker run, OpenAPI schema + /docs UI, optional SSE or streamable-http MCP backends - **Setup time:** 10–15 minutes ## Practical Notes - README quick usage shows `--port 8000` and an `--api-key` gate; docs UI is at `/docs`. - README documents subpath hosting via `--root-path` and multi-tool configs via a Claude Desktop-style `config.json` (with optional hot reload). ## How to Use MCPO Without Over-Exposing Tools The moment you publish an OpenAPI surface, you should think like an API owner: - Put MCPO behind auth (`--api-key`) and rotate keys. - Prefer running it inside your private network; if public, add rate limits at a reverse proxy. - Keep your MCP server command minimal and pinned to known versions. ## A Useful Pattern: “Adapter Layer” If your internal tools are MCP-based but your consumers are not, MCPO becomes a clean adapter: - MCP tool stays local/agent-friendly. - OpenAPI surface is stable for integrations and monitoring. ### FAQ **Q: Is uv required?** A: No. README shows uvx as recommended, but also documents pip install and Docker run. **Q: Can it proxy non-stdio MCP servers?** A: Yes—README includes `--server-type` options like `sse` and `streamable-http`. **Q: How do I serve multiple tools?** A: Use a config file in Claude Desktop format; README shows `mcpo --config ...` and `--hot-reload`. ## Source & Thanks > Source: https://github.com/open-webui/mcpo > License: MIT > GitHub stars: 4,185 · forks: 459 --- ## 快速使用 1. 用 uvx 启动(README 推荐): ```bash uvx mcpo --port 8000 --api-key "top-secret" -- your_mcp_server_command ``` 2. 浏览器验证: - 打开 `http://localhost:8000/docs` 3. README 示例: ```bash uvx mcpo --port 8000 --api-key "top-secret" -- uvx mcp-server-time --local-timezone=America/New_York ``` ## 简介 MCPO 能把 MCP 工具“代理成”带 OpenAPI schema 的 HTTP 服务(含 docs UI),让不支持 MCP 的客户端也能调用工具;支持 uvx/pip/Docker 启动,并可对接 SSE / streamable-http 传输。 - **适合谁:** 想把 MCP 工具暴露成可鉴权的 HTTP/OpenAPI 接口,方便接入现有 API 客户端的团队 - **可搭配:** uvx 或 pip 安装、Docker 运行、OpenAPI schema + /docs UI、可对接 SSE 或 streamable-http 类型 MCP 后端 - **准备时间:** 10–15 分钟 ## 实战建议 - README Quick Usage 示例使用 `--port 8000` 与 `--api-key`;docs UI 在 `/docs`。 - README 说明 `--root-path` 子路径部署,以及用 Claude Desktop 风格 `config.json` 管理多工具(可选 hot reload)。 ## 不要把工具面“裸奔”到公网 一旦变成 OpenAPI 服务,你就需要按 API 的思路治理: - 用 `--api-key` 做鉴权,并定期轮换。 - 尽量在内网跑;必须对公网时,在反向代理上做限流与访问控制。 - MCP server 命令尽量固定版本,避免“升级即变更接口行为”。 ## 一个好用的模式:适配层 当内部是 MCP 工具,而外部消费者不是 MCP 客户端时,MCPO 作为适配层很合适: - 工具仍然保持 MCP 形态,便于 Agent 使用。 - 对外用 OpenAPI,方便集成、监控与治理。 ### FAQ **一定要 uv 吗?** 答:不一定。README 推荐 uvx,但也提供 pip 安装与 Docker 运行方式。 **能代理非 stdio 的 MCP 吗?** 答:可以。README 提供 `--server-type`,包括 `sse` 与 `streamable-http`。 **如何同时服务多个工具?** 答:用 Claude Desktop 格式的 config 文件;README 给出 `mcpo --config ...` 与 `--hot-reload`。 ## 来源与感谢 > Source: https://github.com/open-webui/mcpo > License: MIT > GitHub stars: 4,185 · forks: 459 --- Source: https://tokrepo.com/en/workflows/mcpo-mcp-to-openapi-proxy-server Author: MCP Hub