使用说明
MCP代理代理(或简称为MCP代理中间件)
一个隐形的MCP(模型上下文协议)代理代理,它在隐藏后端MCP服务器的同时,仍允许GitHub Copilot和其他AI助手访问工具。
架构概述
VS Code MCP Client → MCP Agent Proxy (Invisible) → Backend MCP Servers
↑ ↓
No tools visible GitHub MCP, Custom Servers
Copilot internal access Hidden from end users
隐形代理模式
MCP代理运行于 隐形代理模式,意思是:
- ✅ 隐藏的后端服务器所有后端MCP服务器在VS Code中完全不可见
- ✅(对号,表示正确、确认或完成) **零工具暴露(或无工具暴露)**VS Code 在 MCP 客户端界面中未检测到任何工具
- ✅ Copilot 访问权限GitHub Copilot仍可通过内部API访问后端工具
- ✅ 透明操作后端服务器运行正常,但对用户来说是不可见的
Copilot的内部API
POST /internal/backend-call- 直接执行后端工具GET /internal/backend-tools- 列出所有可用的后端工具
特点/特性
- 隐形操作隐藏所有后端MCP服务器,使其对客户端不可见
- 内部工具访问通过内部API维护AI助手的功能工具
- 服务器抽象完全隐藏底层服务器架构
- 灵活配置支持stdio、SSE和WebSocket连接
- 连接管理自动重连和健康监测
- 全面日志记录用于调试和监控的详细日志记录
项目结构
mcp-agent-proxy/
├── src/
│ ├── agent.js # Main MCP agent server
│ ├── core/
│ │ ├── server-manager.js # Manages connections to MCP servers
│ │ ├── tool-registry.js # Aggregates and manages tools
│ │ └── connection-pool.js# Connection pooling and health checks
│ ├── connectors/
│ │ ├── base-connector.js # Base class for MCP server connectors
│ │ ├── stdio-connector.js# Connect to stdio-based MCP servers
│ │ ├── sse-connector.js # Connect to SSE-based MCP servers
│ │ └── ws-connector.js # Connect to WebSocket MCP servers
│ └── utils/
│ ├── logger.js # Centralized logging
│ └── config-loader.js # Configuration management
├── config/
│ ├── servers.json # MCP server configurations
│ └── agent-config.json # Agent-specific settings
├── examples/
│ ├── github-server/ # Example GitHub MCP server setup
│ └── custom-server/ # Example custom MCP server
├── docs/
│ ├── setup.md # Setup instructions
│ ├── configuration.md # Configuration guide
│ └── adding-servers.md # How to add new servers
└── tests/
└── integration/ # Integration tests
快速入门
-
安装依赖项
npm install -
配置服务器 编辑
config/servers.json添加您的MCP服务器:{ "servers": [ { "id": "github-mcp", "name": "GitHub MCP Server", "type": "sse", "url": "http://localhost:3001/sse", "enabled": true }, { "id": "atlassian-mcp", "name": "Atlassian MCP Server", "type": "stdio", "command": "npx", "args": ["@atlassian/mcp-server"], "enabled": true } ] } -
启动代理
npm start
配置
看 docs/configuration.md 翻译为中文是:“文档/配置.md” 以获取详细的配置选项。
添加新的MCP服务器
看 docs/adding-servers.md 翻译为中文是:文档/添加服务器.md 关于添加新服务器的说明。
许可证
麻省理工学院(MIT)
