mcpo
open-webui · open-webui/mcpo
Một máy chủ proxy MCP-to-OpenAPI đơn giản giúp hiển thị ngay lập tức bất kỳ công cụ MCP nào dưới dạng máy chủ HTTP tương thích OpenAPI, cho phép tích hợp rộng rãi hơn với các tác nhân LLM.
Một proxy server MCP-to-OpenAPI đơn giản, an toàn.
Xem trước
Bạn có thể làm gì với nó
- Làm cho một công cụ trực quan hóa dữ liệu dựa trên MCP có thể truy cập được đối với một tác nhân LLM chỉ hỗ trợ OpenAPI.
- An toàn hiển thị các công cụ máy chủ MCP cục bộ cho các dịch vụ tác nhân AI từ xa bằng khóa API tích hợp.
- Tự động tạo tài liệu tương tác cho các công cụ MCP bằng cách hiển thị chúng dưới dạng các điểm cuối OpenAPI.
Kiểm tra an toàn
Không thấy dấu hiệu rủi ro trong các file đã quét.
Quét tự động các file trong repo. Luôn xem lại code trước khi chạy.
Trích từ README
⚡️ 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