MCP 工具本身要先能跑起来,命令写在 -- 之后,否则代理无内容可暴露;SSE 和 streamable-http 服务需显式加 --server-type 并给 URL,不能当普通命令传;OAuth 回调默认占用 3030 端口,且不要在配置里手写 scope 或端点,交给自动发现。
mcpo
open-webuiMIT更新放缓把 MCP 服务转成标准 OpenAPI 接口的轻量代理,让只支持 OpenAPI 的客户端也能直接调用 MCP 工具,省去协议适配的改造工作。
A simple, secure MCP-to-OpenAPI proxy server
uvx mcpo --port 8000 --api-key "top-secret" -- your_mcp_server_command
pip install mcpo && mcpo --port 8000 --api-key "top-secret" -- your_mcp_server_commandREADME 未说明硬件要求,仅要求 Python 3.8+,uv 可选但推荐;也可直接用 Docker 镜像运行。
把任意 MCP 工具秒变成 OpenAPI HTTP 服务,让只认 OpenAPI 的 LLM 应用直接调用
把 MCP 服务转成标准 OpenAPI 接口的轻量代理,让只支持 OpenAPI 的客户端也能直接调用 MCP 工具,省去协议适配的改造工作。
核心能力
- 把 MCP 命令代理成标准 RESTful OpenAPI 接口
- 自动为每个工具生成可交互的 OpenAPI 文档页
- 支持 stdio、SSE、streamable-http 三种 MCP 服务类型
- 用配置文件一次挂载多个 MCP 工具,支持热重载
- 支持 OAuth 2.1 动态客户端注册与令牌持久化
容易踩的坑
- v0.0.20最新正式版2026-02-27 · 2026-02-27 17:58 UTC
[0.0.20] - 2026-02-27%0A%0A### Added%0A%0A* 🔁 MCP Connection Manager with Auto-Reconnect: Introduced MCPConnectionManager to manage the full lifecycle of MCP client sessions and transports. Connections that drop due to a ClosedResourceError are now automatically re-established and retried transparently, eliminating manual restarts for intermittent server disconnects.%0A* 🔄 Automatic Retry on Closed Sessions: Tool calls that encounter a ClosedResourceError will now automatically reconnect to the MCP server and retry the call, providing resilient end-to-end execution without user intervention.%0A%0A### Changed%0A%0A* 🧩 Normalized disabledTools Configuration Key: The disabled tools setting now accepts both camelCase (disabledTools) and snake_case (disabled_tools) in the config file for backwards compatibility and consistency with other configuration keys.%0A* 🧹 Simplified Tool Handler Architecture: Refactored get_tool_handler to remove the session parameter and nested factory functions in favor of a cleaner design that resolves the session from the request app state at call time, enabling reconnect-aware tool execution.%0A* 🛡️ Guarded Lifespan Startup During Hot Reload: The reload handler now checks for the presence of an async context manager before awaiting sub-app lifespan startup, preventing errors when lifespan context is unavailable.%0A%0A### Fixed%0A%0A* 🪛 Fixed Erroneous Validation Raise in disabledTools: Removed a misplaced raise statement in validate_server_config that would always throw an error after validating disabled_tools, even when the configuration was correct.%0A* 🧯 Graceful Handling of asyncio.CancelledError: Added explicit CancelledError handling during server creation and lifespan startup to properly roll back routes and log errors instead of crashing silently.
- v0.0.192025-10-14 · 2025-10-14 21:19 UTC
查看更新说明
[0.0.19] - 2025-10-14
Fixed
- 🔁 Reverted Client Header Forwarding: Reverted changes introduced in 0.0.18.
- v0.0.182025-10-14 · 2025-10-14 20:29 UTC
查看更新说明
[0.0.18] - 2025-10-14
Added
- 🧩 OAuth Support for Streamable HTTP Servers: Introduced full OAuth 2.0 support with dynamic client registration for 'streamable_http' MCP servers. This enables secure, standards-compliant authentication flows for both user and service clients.
- 🔧 Configurable Disabled Tools: Added 'disabled_tools' option in server configuration, allowing selective disabling of specific tools without modifying code. Useful for managing staged rollouts or limited-access environments.
- 🧠 Adjustable Log Level at Runtime: Logging verbosity can now be adjusted dynamically, giving operators finer control over monitoring and debugging noise without requiring restarts.
- 🔁 Client Header Forwarding: Added automatic forwarding of client HTTP headers to MCP backends—enabling trace propagation, correlation IDs, and richer observability in distributed environments.
- 🛤️ Support for Custom Path Prefixes: Servers can now run under a custom path prefix, allowing flexible deployment within multi-service gateways or reverse proxy environments.
- 📄 Root Path Documentation: Added documentation describing behavior and configuration for root path handling in multi-app or nested setups.
Changed
- 🧰 Refactored Connection Timeout Defaults: Connection timeout is now set to 'None' by default to prevent premature disconnects during long-running or streaming tasks.
- 🧹 Removed Deprecated Python Version Tagging: Dropped explicit Python version tagging; the project now officially supports Python 3.11 and above without manual tagging overhead.
Fixed
- 🪛 Improved Hot Reload Lifespan Tracking: Fixed an issue where sub-applications created during hot reloads were not properly initialized or cleaned up—ensuring stable lifecycle management during dynamic reconfiguration.
- 🔗 Symlink Handling in Config Watcher: Resolved a bug where configuration symlinks were not updating correctly on modification; watcher now tracks and reloads the proper file path automatically.
- v0.0.172025-07-31 · 2025-07-31 23:01 UTC
查看更新说明
[0.0.17] - 2025-07-22
Added
- 🔄 Hot Reload Support for Configuration Files: Added
--hot-reloadflag to watch your config file for changes and dynamically reload MCP servers without restarting the application—enabling seamless development workflows and runtime configuration updates. - 🤫 HTTP Request Filtering for Cleaner Logs: Added configurable log filtering to reduce noise from frequent HTTP requests, making debugging and monitoring much clearer in production environments.
Changed
- ⬆️ Updated MCP Package to v1.12.1: Upgraded MCP dependency to resolve compatibility issues with Pydantic and improve overall stability and performance.
- 🔧 Normalized Streamable HTTP Configuration: Streamlined configuration syntax for streamable-http servers to align with MCP standards while maintaining backward compatibility.
What's Changed
- enh: Allow for startup if some MCPs unavailable, graceful shutdown and better subtask handling by @taylorwilsdon in https://github.com/open-webui/mcpo/pull/194
- fix: propagate schema_defs to enable using schemas within native collections by @amichai-gloat in https://github.com/open-webui/mcpo/pull/196
- feat: support hot reload on config change by @taylorwilsdon in https://github.com/open-webui/mcpo/pull/212
- enh: Rename Streamable HTTP type to match spec best practices, add helper function by @taylorwilsdon in https://github.com/open-webui/mcpo/pull/210
- docs: readme: correct '--headers' to '--header' by @amichai-gloat in https://github.com/open-webui/mcpo/pull/195
- Add dockerignore by @krewi1 in https://github.com/open-webui/mcpo/pull/208
- doc: Changelog & Readme Updates for 0.17 by @taylorwilsdon in https://github.com/open-webui/mcpo/pull/213
- 0.0.17 by @taylorwilsdon in https://github.com/open-webui/mcpo/pull/216
- Raise and alias by @taylorwilsdon in https://github.com/open-webui/mcpo/pull/224
New Contributors
- @amichai-gloat made their first contribution in https://github.com/open-webui/mcpo/pull/196
- @krewi1 made their first contribution in https://github.com/open-webui/mcpo/pull/208
Full Changelog: https://github.com/open-webui/mcpo/compare/v0.0.16...v0.0.17
- 🔄 Hot Reload Support for Configuration Files: Added
- v0.0.162025-07-02 · 2025-07-02 11:46 UTC
查看更新说明
[0.0.16] - 2025-07-02
Added
- 🔁 Enhanced Endpoint Support for Arbitrary Return Types: Endpoints can now return any JSON-serializable value—removing limitations on tool outputs and enabling support for more diverse workflows, including advanced data structures or dynamic return formats.
- 🪵 Improved Log Clarity with Streamlined Print Trace Output: Internal logging has been upgraded with more structured and interpretable print traces, giving users clearer visibility into backend tool behavior and execution flow—especially helpful when debugging multi-agent sequences or nested toolchains.
Fixed
- 🔄 Resolved Infinite Loop Edge Case in Custom Schema Inference: Fixed a bug where circular references ($ref) caused schema processing to hang or crash in rare custom schema setups—ensuring robust and reliable auto-documentation even for deeply nested models.
用户点评
登录用户的真实使用记录,可按版本和硬件筛选还没有人点评。第一个说出真实体验的人最有价值。
⚡️ mcpo
Expose any MCP tool as an OpenAPI-compatible HTTP server—instantly.
mcpo is a dead-simple proxy that takes an MCP server command and makes it accessible via standard RESTful OpenAPI, so your tools "just work" with LLM agents and apps expecting OpenAPI servers.
No custom protocol. No glue code. No hassle.
🤔 Why Use mcpo Instead of Native MCP?
MCP servers usually speak over raw stdio, which is:
- 🔓 Inherently insecure
- ❌ Incompatible with most tools
- 🧩 Missing standard features like docs, auth, error handling, etc.
mcpo solves all of that—without extra effort:
- ✅ Works instantly with OpenAPI tools, SDKs, and UIs
- 🛡 Adds security, stability, and scalability using trusted web standards
- 🧠 Auto-generates interactive docs for every tool, no config needed
- 🔌 Uses pure HTTP—no sockets, no glue code, no surprises
What feels like "one more step" is really fewer steps with better outcomes.
mcpo makes your AI tools usable, secure, and interoperable—right now, with zero hassle.
🚀 Quick Usage
We recommend using uv for lightning-fast startup and zero config.
uvx mcpo --port 8000 --api-key "top-secret" -- your_mcp_server_command
Or, if you’re using Python:
pip install mcpo
mcpo --port 8000 --api-key "top-secret" -- your_mcp_server_command
To use an SSE-compatible MCP server, simply specify the server type and endpoint:
mcpo --port 8000 --api-key "top-secret" --server-type "sse" -- http://127.0.0.1:8001/sse
You can also provide headers for the SSE connection:
mcpo --port 8000 --api-key "top-secret" --server-type "sse" --header '{"Authorization": "Bearer token", "X-Custom-Header": "value"}' -- http://127.0.0.1:8001/sse
To use a Streamable HTTP-compatible MCP server, specify the server type and endpoint:
mcpo --port 8000 --api-key "top-secret" --server-type "streamable-http" -- http://127.0.0.1:8002/mcp
You can also run mcpo via Docker with no installation:
docker run -p 8000:8000 ghcr.io/open-webui/mcpo:main --api-key "top-secret" -- your_mcp_server_command
Example:
uvx mcpo --port 8000 --api-key "top-secret" -- uvx mcp-server-time --local-timezone=America/New_York
That’s it. Your MCP tool is now available at http://localhost:8000 with a generated OpenAPI schema — test it live at http://localhost:8000/docs.
🤝 To integrate with Open WebUI after launching the server, check our docs.
🌐 Serving Under a Subpath (--root-path)
If you need to serve mcpo behind a reverse proxy or under a subpath (e.g., /api/mcpo), use the --root-path argument:
mcpo --port 8000 --root-path "/api/mcpo" --api-key "top-secret" -- your_mcp_server_command
All routes will be served under the specified root path, e.g. http://localhost:8000/api/mcpo/memory.
🔄 Using a Config File
You can serve multiple MCP tools via a single config file that follows the Claude Desktop format.
Enable hot-reload mode with --hot-reload to automatically watch your config file for changes and reload servers without downtime:
Start via:
mcpo --config /path/to/config.json
Or with hot-reload enabled:
mcpo --config /path/to/config.json --hot-reload
Example config.json:
{
"mcpServers": {
"memory": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-memory"]
},
"time": {
"command": "uvx",
"args": ["mcp-server-time", "--local-timezone=America/New_York"],
"disabledTools": ["convert_time"] // Disable specific tools if needed
},
"mcp_sse": {
"type": "sse", // Explicitly define type
"url": "http://127.0.0.1:8001/sse",
"headers": {
"Authorization": "Bearer token",
"X-Custom-Header": "value"
}
},
"mcp_streamable_http": {
"type": "streamable-http",
"url": "http://127.0.0.1:8002/mcp"
} // Streamable HTTP MCP Server
}
}
Each tool will be accessible under its own unique route, e.g.:
Each with a dedicated OpenAPI schema and proxy handler. Access full schema UI at: http://localhost:8000/<tool>/docs (e.g. /memory/docs, /time/docs)
🔐 OAuth 2.1 Authentication
mcpo supports OAuth 2.1 authentication for MCP servers that require it. The implementation defaults to dynamic client registration, so most servers only need minimal configuration:
{
"mcpServers": {
"oauth-protected-server": {
"type": "streamable-http",
"url": "http://localhost:8000/mcp",
"oauth": {
"server_url": "http://localhost:8000"
}
}
}
}
OAuth Configuration Options
Basic Options:
server_url(required): OAuth server base URLstorage_type: "file" (persistent) or "memory" (session-only, default: "file")callback_port: Local port for OAuth callback (default: 3030)use_loopback: Auto-open browser for auth (default: true)
Advanced Options (rarely needed): For servers that don't support dynamic client registration, you can specify static client metadata:
{
"mcpServers": {
"legacy-oauth-server": {
"type": "streamable-http",
"url": "http://api.example.com/mcp",
"oauth": {
"server_url": "http://api.example.com",
"client_metadata": {
"client_name": "My MCPO Client",
"redirect_uris": ["http://localhost:3030/callback"]
}
}
}
}
}
Note: Avoid setting
scope,authorization_endpoint, ortoken_endpointin the config. These are automatically discovered from the server's OAuth metadata during the dynamic registration flow.
On first connection, mcpo will:
- Perform dynamic client registration (if supported)
- Open your browser for authorization
- Capture the OAuth callback automatically
- Store tokens securely (in
~/.mcpo/tokens/for file storage) - Use tokens for all subsequent requests
OAuth is supported for streamable-http server types. See OAUTH_GUIDE.md for detailed documentation.
🔧 Requirements
- Python 3.8+
- uv (optional, but highly recommended for performance + packaging)
🛠️ Development & Testing
To contribute or run tests locally:
-
Set up the environment:
# Clone the repository git clone https://github.com/open-webui/mcpo.git cd mcpo # Install dependencies (including dev dependencies) uv sync --dev -
Run tests:
uv run pytest -
Running Locally with Active Changes:
To run
mcpowith your local modifications from a specific branch (e.g.,my-feature-branch):# Ensure you are on your development branch git checkout my-feature-branch # Make your code changes in the src/mcpo directory or elsewhere # Run mcpo using uv, which will use your local, modified code # This command starts mcpo on port 8000 and proxies your_mcp_server_command uv run mcpo --port 8000 -- your_mcp_server_command # Example with a test MCP server (like mcp-server-time): # uv run mcpo --port 8000 -- uvx mcp-server-time --local-timezone=America/New_YorkThis allows you to test your changes interactively before committing or creating a pull request. Access your locally running
mcpoinstance athttp://localhost:8000and the auto-generated docs athttp://localhost:8000/docs.
🪪 License
MIT
🤝 Contributing
We welcome and strongly encourage contributions from the community!
Whether you're fixing a bug, adding features, improving documentation, or just sharing ideas—your input is incredibly valuable and helps make mcpo better for everyone.
Getting started is easy:
- Fork the repo
- Create a new branch
- Make your changes
- Open a pull request
Not sure where to start? Feel free to open an issue or ask a question—we’re happy to help you find a good first task.
✨ Star History
✨ Let's build the future of interoperable AI tooling together!