本仓库是 MCP(Model Context Protocol)Server / Client 与 Web UI 的示例整合项目:提供可运行的 MCP Server 模板、连接多 MCP 服务的 Agent 后端、Vue 前端聊天界面,以及基于 Nginx + Docker Compose 的统一网关与编排。
| 目录 | 说明 |
|---|---|
mcp_server_template/ |
Python MCP Server 模板(示例工具:health_check、echo、add、get_current_time 等) |
mcp_agent/ |
MCP Agent 后端(FastAPI):读取 mcp.json 连接 MCP、聚合工具、/chat 与 SSE 流式 /chat/stream、UI 控制 schema 等 |
mcp_web_ui/ |
Vue 3 + Vite 前端:健康检查、工具展示、图文聊天、SSE 流式展示 |
mcp_integration/ |
集成层:Nginx 反向代理、Compose 编排,不含业务代码 |
各子目录内均有更细的说明,见对应 README.md(Agent 另含测试与配置说明)。
flowchart LR
Browser[浏览器] --> Nginx[Nginx 网关\nmcp_integration]
Nginx --> WebUI[mcp_web_ui]
Nginx --> Agent[mcp_agent]
Agent --> MCPServer[mcp_server_template]
Agent --> LLM[Ollama / Qwen 等]
- 前端通过网关访问 Agent API;Agent 作为 MCP 客户端连接本仓库内的 MCP Server(及你在
mcp.json中配置的其它服务)。 - 单独本地开发时:前端 dev 模式可将
/agent代理到 Agent(默认127.0.0.1:21001),详见mcp_web_ui/README.md。
在仓库根目录进入集成模块,复制环境变量后启动(会构建并拉起 Server / Agent / Web UI / 网关):
cd mcp_integration
cp env.example .env
bash start.sh浏览器访问:http://127.0.0.1:21080/
常用验证:
curl http://127.0.0.1:21080/health
curl http://127.0.0.1:21080/agent/health更多参数(跳过构建、--pull、--https、切换 MCP transport 等)见 mcp_integration/README.md 与 mcp_integration/QUICK_START.md。
| 路径前缀 | 转发目标 |
|---|---|
/ |
Web UI |
/agent/ |
Agent 后端 |
/mcp/、/sse/ |
MCP Server 的 MCP / SSE 端点 |
/health |
网关自身健康检查 |
| 端口 | 服务 |
|---|---|
| 21080 | 统一入口(Nginx) |
| 21002 | Web UI 容器直连(一般经 21080 访问即可) |
| 21001 | Agent |
| 21000 | MCP Server |
HTTPS、证书与镜像加速等配置仍以 mcp_integration 文档为准。
- mcp_server_template/README.md — MCP Server 本地 / Docker 运行
- mcp_agent/README.md — API 列表、
mcp.json、多模型与 transport 切换 - mcp_web_ui/README.md — 前端开发与代理说明
- mcp_integration/README.md — 编排、
start.sh参数与环境变量