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
Scout Monitoring MCP
sponsorPut performance and error data directly in the hands of your AI assistant.
Alpha Vantage MCP Server
sponsorAccess financial market data: realtime & historical stock, ETF, options, forex, crypto, commodities, fundamentals, technical indicators, & more
Scientific Computation MCP
Provides tools for scientific computation, including tensor storage, linear algebra, vector calculus, and visualization.
Openapi MCP
An MCP server that lets LLMs inspect and interact with OpenAPI specifications.
MCP Toolbox
A toolkit for enhancing LLM capabilities by providing tools to interact with external services and APIs via the Model Context Protocol (MCP).
MCP Server Template
A template for creating MCP servers using Python.
MCP Sandbox
An interactive sandbox to safely execute Python code and install packages in isolated Docker containers.
MCP Terminal
An MCP server for accessing the terminal and managing git repositories.
Svelte MCP
Official Svelte MCP server, provides docs and suggestions on the generated code.
BioMCP
Enhances large language models with protein structure analysis capabilities, including active site analysis and disease-protein searches, by connecting to the RCSB Protein Data Bank.
Linkinator
A Model Context Protocol (MCP) server that provides link checking capabilities using linkinator. This allows AI assistants like Claude to scan webpages and local files for broken links.
Postman Tool Generation
Generates AI agent tools from Postman collections and requests using the Postman API.