mcpo+OpenWebUI
A secure MCP-to-OpenAPI proxy server that converts MCP tools into OpenAPI compatible HTTP servers, with support for multiple server types and automatic API documentation.
⚡️ mcpo+OpenWebUI 結合MCP的開源聊天工具
📁 專案架構
核心功能
- MCP 工具轉換為 OpenAPI 兼容的 HTTP 服務器
- 支援多種 MCP 服務器類型
- 自動生成 API 文檔
- 提供安全認證機制
支援的服務器類型
- 標準 MCP 服務器
- SSE 兼容服務器
- Streamable HTTP 兼容服務器
🚀 部署方式
系統需求
- Python 3.8+
- uv(推薦)
部署選項
- 使用 uv 部署
uvx mcpo --port 8000 --api-key "top-secret" -- your_mcp_server_command
- 使用 Python pip 部署
pip install mcpo
mcpo --port 8000 --api-key "top-secret" -- your_mcp_server_command
- 使用 Docker 部署
docker run -p 8000:8000 ghcr.io/open-webui/mcpo:main --api-key "top-secret" -- your_mcp_server_command
🐳 Docker 部署
使用 Docker 啟動
- 直接使用 Docker 映像
docker run -p 8000:8000 ghcr.io/open-webui/mcpo:main --api-key "top-secret" -- your_mcp_server_command
- 使用 docker-compose 啟動
# 啟動服務
docker-compose up -d
# 查看日誌
docker-compose logs -f
# 停止服務
docker-compose down
Docker 部署注意事項
- 環境配置
- 使用
.env
文件管理 API 密鑰等敏感信息 - 可通過環境變數覆蓋預設配置
- 訪問路徑
- 主服務器:http://localhost:8000
- API 文檔:http://localhost:8000/docs
- 安全建議
- 生產環境請修改預設端口
- 使用強密碼作為 API 密鑰
- 定期更新 Docker 映像
📝 語法說明
基本命令格式
mcpo [選項] -- 命令
常用選項
--port
: 指定服務器端口(預設:8000)--api-key
: 設置 API 密鑰--server-type
: 指定服務器類型(sse/streamable_http)--config
: 指定配置文件路徑
配置文件格式
{
"mcpServers": {
"服務器名稱": {
"command": "命令",
"args": ["參數1", "參數2"],
"type": "服務器類型", // 可選
"url": "服務器URL" // 可選
}
}
}
服務器類型配置
- 標準 MCP 服務器
{
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-memory"]
}
- SSE 服務器
{
"type": "sse",
"url": "http://127.0.0.1:8001/sse"
}
- Streamable HTTP 服務器
{
"type": "streamable_http",
"url": "http://127.0.0.1:8002/mcp"
}
🔧 開發環境設置
- 克隆專案
git clone https://github.com/open-webui/mcpo.git
cd mcpo
- 安裝依賴
uv sync --dev
- 運行測試
uv run pytest
⚠️ 注意事項
安全建議
- 始終使用 API key 保護服務器
- 避免在生產環境使用預設端口
- 定期更新依賴包
訪問路徑
- 主服務器:http://localhost:8000
- API 文檔:http://localhost:8000/docs
- 工具特定文檔:http://localhost:8000//docs
常見問題
- 確保 Python 版本符合要求
- 檢查端口是否被占用
- 驗證 API key 設置
- 確認服務器類型配置正確
📚 相關資源
🤝 貢獻指南
歡迎提交 Pull Request 或開 Issue 討論新功能。
Related Servers
Nessus MCP Server
An MCP server for interacting with the Tenable Nessus vulnerability scanner.
Loki MCP Server
A Go-based server to query Grafana Loki logs using the Model Context Protocol (MCP).
CircleCI
Enable AI Agents to fix build failures from CircleCI.
Hyperliquid
Interact with the Hyperliquid decentralized exchange by integrating its SDK.
Ghibli Video
Generates AI images and videos using the GPT4O Image Generator API.
MCP-CLI Adapter
Use command line tools in a secure fashion as MCP tools.
Voiceflow MCP Client
A Node.js client that integrates with remote MCP servers to provide tools for Voiceflow Agents.
BundlerMCP
Query information about dependencies in a Ruby project's Gemfile.
MCP Sandbox
Execute Python code and install packages safely within isolated Docker containers.
MCPJungle
A self-hosted MCP Server registry for private AI agents, supporting both PostgreSQL and SQLite databases.