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
Lean LSP
Interact with the Lean theorem prover via the Language Server Protocol (LSP), enabling LLM agents to understand, analyze, and modify Lean projects.
MCP-Logic
Provides automated reasoning for AI systems using the Prover9 and Mace4 theorem provers.
Revit MCP Python
A pyRevit-based MCP server for Autodesk Revit, enabling connection to any MCP-compatible client.
UI Prototype
A modern web application prototype built with React, TypeScript, and Material-UI, featuring authentication, internationalization, and Figma integration.
Laravel Codebase Introspection
Introspects Laravel codebases to provide structured information about views, routes, classes, and models using the mateffy/laravel-introspect package.
Maven Tools
Access real-time Maven Central intelligence for fast and accurate dependency information.
Remote MCP Server (Authless)
An example of a remote MCP server without authentication, deployable on Cloudflare Workers.
Figma MCP Server
Enables AI assistants to interact with Figma via WebSocket for reading data and design analysis.
DIY MCP
A from-scratch implementation of the Model Context Protocol (MCP) for building servers and clients, using a Chinese tea collection as an example.
MCP Prompt Server
Provides preset prompt templates as tools to assist clients like Cursor and Windsurf in executing various tasks.