第 25 期:MCP 综合实战 — 构建 AI 驱动的全能工作台
终极目标:全能 AI 工作台
把前四期学到的 MCP 技能整合为一个统一入口的 AI 工作台:用自然语言驱动一切。
graph TB
User["👤 用户
'帮我查一下上周的 Bug 报告,
整理后发邮件给技术主管'"]
User --> Agent[🤖 AI Agent
GPT-4o + Memory]
Agent -->|"Step 1"| GH["🐙 MCP: GitHub
搜索 label:bug 的 Issues"]
Agent -->|"Step 2"| RAG["🔍 MCP: RAG 知识库
检索相关的解决方案"]
Agent -->|"Step 3"| Code["💻 Code Tool
整理为 Markdown 报告"]
Agent -->|"Step 4"| Email["📧 MCP: Email Server
发送给 [email protected]"]
Agent -->|"Step 5"| DT["📊 Data Tables
记录'已处理'状态"]
style Agent fill:#ff6d5b,stroke:#e55a4e,color:#fff完整架构
graph TB
subgraph "入口层"
Chat[💬 Chat Trigger
Web UI]
TG[📱 Telegram Bot]
Slack[💬 Slack Bot]
end
subgraph "Agent 层"
Agent[🤖 AI Agent
System Prompt + Memory]
end
subgraph "MCP 工具层"
MCP1[🐙 GitHub: Issues/PRs/Code]
MCP2[🔍 RAG: 产品知识库]
MCP3[📧 Email: SMTP 发送]
MCP4[🐘 DB: PostgreSQL 查询]
MCP5[📂 Files: 文件读写]
end
subgraph "运维层"
Registry[📋 Server 注册表]
Health[💓 健康检查]
Monitor[📊 使用量监控]
end
Chat & TG & Slack --> Agent
Agent --> MCP1 & MCP2 & MCP3 & MCP4 & MCP5
Registry & Health & Monitor --> MCP1 & MCP2 & MCP3 & MCP4 & MCP5
style Agent fill:#ff6d5b,stroke:#e55a4e,color:#fff完整 docker-compose.yml
# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
# 全能工作台 Docker Compose 配置
# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
services:
# ── 核心服务 ────────────────────────────────
n8n:
image: n8nio/n8n:latest
ports: ["5678:5678"]
environment:
- N8N_ENCRYPTION_KEY=${N8N_ENCRYPTION_KEY}
- DB_TYPE=postgresdb
- DB_POSTGRESDB_HOST=postgres
- N8N_RUNNERS_ENABLED=true # Code 节点沙箱
volumes: [n8n_data:/home/node/.n8n]
depends_on: [postgres, qdrant]
networks: [workspace]
postgres:
image: postgres:16-alpine
environment:
- POSTGRES_USER=n8n
- POSTGRES_PASSWORD=${PG_PASSWORD}
volumes: [pg_data:/var/lib/postgresql/data]
networks: [workspace]
qdrant:
image: qdrant/qdrant:latest
ports: ["6333:6333"]
volumes: [qdrant_data:/qdrant/storage]
networks: [workspace]
# ── MCP Server 集群 ────────────────────────
mcp-github:
image: ghcr.io/modelcontextprotocol/server-github:latest
environment: [GITHUB_PERSONAL_ACCESS_TOKEN=${GITHUB_TOKEN}]
networks: [workspace]
mcp-filesystem:
image: ghcr.io/modelcontextprotocol/server-filesystem:latest
volumes: [./shared:/data]
command: /data
networks: [workspace]
mcp-postgres:
image: ghcr.io/modelcontextprotocol/server-postgres:latest
environment:
- DATABASE_URL=postgresql://n8n:${PG_PASSWORD}@postgres:5432/n8n
networks: [workspace]
volumes:
n8n_data:
pg_data:
qdrant_data:
networks:
workspace:
driver: bridge
模块五总结
mindmap
root((模块五: MCP 生态))
Ep 21 MCP 原理
协议架构 (Client/Server)
三种能力 (Tools/Resources/Prompts)
传输方式 (stdio/SSE)
Ep 22 MCP Client
Docker 部署 MCP Server
GitHub / Filesystem 实战
自动工具发现
Ep 23 MCP Server
n8n 暴露工作流为 Tool
Claude Desktop 集成
多工具 Server
Ep 24 服务编排
注册表管理
健康检查工作流
动态路由/故障切换
Ep 25 综合实战
全能 AI 工作台
完整 Docker Compose
多入口多工具架构下一步
最后的模块六将进入多智能体生产架构——错误处理、子工作流编排、版本管理与团队协作的企业级最佳实践。