使用说明
MCP网关
通过单个接口聚合多个MCP资源服务器的MCP网关。
特性
- MCP代理:用于访问多个MCP服务器的单个端点
- 批处理请求工具:优化了多个工具调用的并行执行
- 配置合并:适用于Claude桌面配置
配置路径
网关按以下顺序查找配置文件:
- 环境变量:
MCP_CONFIG_PATH如果设置 - Claude桌面配置:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - 窗户:
%APPDATA%/Claude/claude_desktop_config.json - Linux:
~/.config/Claude/claude_desktop_config.json
- macOS:
- 违约:
config.json在当前目录中
与Claude合并配置
网关可以读取 proxyBatchMcpServers Claude桌面配置中的部分:
{
"mcpServers": {
"mcp-gateway": {
"command": "npx",
"args": [
"-y",
"@thinkware/mcp-gateway"
]
}
},
"proxyBatchMcpServers": {
"filesystem": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-filesystem",
"/Users/username/Desktop",
"/path/to/other/allowed/dir"
],
"toolOverrides": {
"read_file": {
"enabled": true,
"description": "Read complete contents of a file\nInput: path (string)\nReads complete file contents with UTF-8 encoding"
},
"read_multiple_files": {
"enabled": false
}
}
},
"server-1": {
"command": "/path/to/server1/build/index.js",
"toolOverrides": {
"some_tool": {
"enabled": true,
"description": "Custom description"
}
}
}
}
}
服务器配置选项
| 选项 | 类型 | 描述 | 必填 |
|---|---|---|---|
command |
string | 服务器可执行文件的路径 | 是(对于命令服务器) |
args |
string[] | 命令参数 | 否 |
env |
object | 环境变量 | 否 |
url |
string | SSE端点URL | 是(适用于SSE服务器) |
toolOverrides |
对象 | 工具自定义 | 否 |
工具替代选项
| 选项 | 类型 | 描述 | 默认值 |
|---|---|---|---|
enabled |
boolean | 启用/禁用工具 | true |
description |
string | 自定义工具描述 | 原始描述 |
disabled |
boolean | 禁用整个工具 | false |
环境变量
{
"mcpServers": {
"mcp-gateway": {
"command": "npx",
"args": [
"-y",
"@thinkware/mcp-gateway"
],
"env": {
"MCP_GATEWAY_LOG_FILE": "/path/to/logs/mcp-gateway.log"
}
}
}
}
发展
# Install dependencies
npm install
# Development with auto-rebuild
npm run dev
# Build
npm run build