使用说明
⚡ MCPO 配置管理器
用于管理的Web用户界面 MCPO(Master Chief Petty Officer) (模型上下文协议到OpenAPI)服务器。
特点/功能
- 🎨(彩绘/艺术创作) 双输入模式 - 基于表单的用户界面和JSON编辑器
- 🔄 翻译为中文是:循环(或旋转) 自动重载 - 配置更改后会自动重启MCPO(内置监视器)
- 🐳(海豚) Docker就绪 - 单个集装箱,单一(或“单次”)
docker-compose up命令 - ⚡(闪电符号,常用于表示快速、能量或惊人的事物) 通用运行时 - 支持uvx、npx和docker命令
- 🛡️ 翻译为中文是:“护盾”或“盾牌”。这个符号通常用来表示保护、防御或安全的概念。 安全默认设置 - 始终保持至少一台服务器运行(防止崩溃)
- 🔐(锁形符号,常用于表示保密、安全或密码等) 认证 可选通过Caddy进行HTTP基本认证 + 使用MCPO API密钥保护
快速入门
# 1. Set up environment variables
cp .env.example .env
# Edit .env and set MCPO_API_KEY (required)
# 2. Start the service
docker-compose up -d
# 3. Access the UI
open http://localhost
# 4. View MCPO API docs
open http://localhost:8000/<server-name>/docs
你将获得:
- 用户界面:http://localhost(端口80)
- MCPO API:http://localhost:8000
- 包含默认时间服务器(可删除/替换)
- 配置更改时自动重启
服务器类型
用户界面支持三种类型的MCP服务器:
| 类型 | 描述 | 示例用例 |
|---|---|---|
| 项目 | 描述 | 其他信息 |
| 命令行工具 | Python/Node.js MCP 服务器 | ** |
| 服务器发送事件 | 远程HTTP端点 | ** |
| HTTP 流媒体 | 自定义流媒体服务器 |
STDIO Servers (uvx, npx, docker)
{
"mcpServers": {
"time": {
"command": "uvx",
"args": ["mcp-server-time", "--local-timezone=America/New_York"]
},
"memory": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-memory"]
},
"docker-example": {
"command": "docker",
"args": ["run", "-i", "--rm", "mcp/time"]
}
}
}
SSE Server
{
"mcpServers": {
"remote-sse": {
"type": "sse",
"url": "http://127.0.0.1:8001/sse",
"headers": {
"Authorization": "Bearer token"
}
}
}
}
Streamable HTTP Server
{
"mcpServers": {
"http-stream": {
"type": "streamable-http",
"url": "http://127.0.0.1:8002/mcp"
}
}
}
配置示例
建筑学
- 单个容器包含三个流程: Caddy(高尔夫球童)
- (端口80) - 反向代理,支持可选的HTTP基本认证 Streamlit 用户界面
- (localhost:8501) - 管理配置的网页界面 MCPO服务器
- (端口 8000) - 代理,将 MCP 服务器作为 OpenAPI 暴露出来 内置监视器
/config- 监视器
┌─────────────────────────────────────┐
│ Container (mcpo-ui) │
│ │
│ ┌─────────┐ ┌─────────────┐ │
│ │Caddy:80 │────>│Streamlit │ │
│ │(+auth) │ │localhost:8501│ │
│ └─────────┘ └──────┬──────┘ │
│ │ │
│ ▼ │
│ config.json │
│ │ │
│ ▼ │
│ ┌──────────┐ │
│ │MCPO:8000 │ │
│ └──────────┘ │
│ (auto-restarts) │
└─────────────────────────────────────┘
目录,更改时重启MCPO
# Copy project to new directory
cp -r . ../instance2
cd ../instance2
# Create .env with different ports and container name
cat > .env <<EOF
CONTAINER_NAME=mcpo-ui-2
UI_PORT=8080
MCPO_PORT=8001
MCPO_API_KEY=different-api-key
EOF
# Start second instance
docker-compose up -d
运行多个实例 环境变量 .env.example(参见
MCPO_API_KEY):MCPO认证的API密钥所需的;要求的CONTAINER_NAME)UI_PORT容器名称(默认:mcpo-ui)MCPO_PORT用于UI访问的HTTP端口(默认:80)MCPO_BASE_URLMCPO API端口(默认:8000)UI_USERNAME浏览器访问的基础URL(可选,用于反向代理设置)UI_PASSWORD_HASHHTTP 基本认证用户名(可选)
HTTP 基本认证密码哈希(可选)
安全
用户界面认证(可选):
# 1. Generate password hash (automatically escaped for .env)
docker run --rm caddy caddy hash-password --plaintext yourpassword | sed 's/\$/\$\$/g'
# 2. Add to .env (use the escaped output from above)
UI_USERNAME=admin
UI_PASSWORD_HASH=$$2a$$14$$...
# 3. Restart container
docker-compose restart
用户界面(UI)包含带有可选HTTP基本认证的Caddy反向代理: UI_USERNAME 离开 UI_PASSWORD_HASH 并且
留空以禁用身份验证。
- 替代身份验证选项: Coolify(注:此词可能为特定软件或项目的名称,直接翻译为中文可能无具体含义,故保留原样)
- - 在服务设置中启用内置的HTTP基本身份验证(如果使用Coolify) 外部反向代理
- - 使用带身份验证的nginx/Traefik 虚拟私人网络/防火墙
- 仅限制网络访问为受信任的IP地址
API 认证: MCPO_API_KEY MCPO端点受保护于
- 在生产环境中一定要设置这个!
Server returns 404
故障排除
- MCPO不在服务器根目录提供内容。请通过以下方式访问工具:
http://localhost:8000/<server-name>/docs - 文档:
http://localhost:8000/<server-name>/<tool-name>工具:
# ✅ View docs
curl http://localhost:8000/time/docs
# ✅ Call tool
curl -X POST http://localhost:8000/time/get_current_time \
-H "Content-Type: application/json" \
-d '{"timezone": "America/New_York"}'
Changes not reflected
# Check watcher logs
docker logs <watcher-container-name>
# Manual restart
docker restart <mcpo-container-name>
Docker permission errors (Linux)
# Add user to docker group
sudo usermod -aG docker $USER
newgrp docker
Container won't start
# View logs
docker-compose logs -f
# Rebuild
docker-compose up -d --build
(邮局)
├── ui/ # Streamlit UI source files
│ ├── app.py # Main UI application
│ ├── config.example.json # Default config template
│ └── requirements.txt # Python dependencies
├── Caddyfile # Caddy reverse proxy config (HTTP Basic Auth)
├── entrypoint.sh # Container entrypoint (manages all processes)
├── Dockerfile # Single image with Caddy + UI + MCPO + watcher
├── docker-compose.yml # Development setup
├── docker-compose.prod.yml # Production setup
└── config/ # Volume for config.json (auto-created)
项目结构:
生产部署
# Using docker-compose.prod.yml
docker compose -f docker-compose.prod.yml pull
docker compose -f docker-compose.prod.yml up -d
使用来自 GitHub Container Registry 的预构建镜像: ghcr.io/tonghualabs/mcpo-ui:latest
图片: 构建于 Streamlit(注:这是一个专有名词,通常不翻译,直接保留原名,但在中文语境下,也可以理解为“流式处理工具”或“即时应用开发平台”,具体含义需根据上下文判断。) 并且
