MCP Proxy Server

MCP Proxy Server

镜像

概述

MCP代理服务器通过一个统一接口聚合多个MCP资源服务器,充当中心枢纽来管理多个服务器的能力。

主要功能

  • 聚合多个MCP资源服务器的资源、工具和提示
  • 智能路由请求到适当的后端服务器
  • 统一界面和一致的URI方案

安装与配置

  1. 创建配置文件
cp config.example.json config.json
  1. 编辑配置文件,指定要连接的服务器:
{
  "servers": [
    {
      "name": "Server 1",
      "transport": {
        "command": "/path/to/server1/build/index.js"
      }
    },
    {
      "name": "Server 2",
      "transport": {
        "command": "server2-command",
        "args": ["--option1", "value1"]
      }
    }
  ]
}
  1. 启动服务器
MCP_CONFIG_PATH=./config.json mcp-proxy-server

开发环境

# 安装依赖
npm install

# 构建服务器
npm run build

# 开发模式(自动重构)
npm run watch

与Claude Desktop集成

添加配置到Claude Desktop配置文件:

  • MacOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%/Claude/claude_desktop_config.json
{
  "mcpServers": {
    "mcp-proxy": {
      "command": "/path/to/mcp-proxy-server/build/index.js",
      "env": {
        "MCP_CONFIG_PATH": "/absolute/path/to/your/config.json"
      }
    }
  }
}

调试

使用MCP Inspector进行调试:

npm run inspector

然后在浏览器中访问提供的URL以使用调试工具。