MCP服务器代理工具

MCP-Remixer是一个代理服务,用于聚合多个MCP服务器、添加自定义工具、隐藏现有工具,并通过单一接口提供统一访问。

  • by DavidJBianco
  • Python
  • 本地部署
  • 8 星标
  • 更新于
在 GitHub 查看 DavidJBianco/MCP-Remixer

使用说明

mcp混音器

MCP服务器的代理,允许您添加自定义工具、隐藏现有工具,并将多个上游服务器聚合到一个界面中。

特性

  • 聚合多个MCP服务器 -将多个MCP服务器合并为一个
  • 自动工具名称解析 -处理上游流中冲突的工具名称(例如。, server_a.search 对比 server_b.search)
  • 添加自定义工具 -编写成为MCP工具的Python函数
  • 隐藏工具 -过滤掉你不想暴露的工具
  • 链条工具 -自定义工具可以调用上游工具
  • 优雅降级 -可选上游不会阻止启动
  • 环境变量支持 -使用 .env 文件和 ${VAR} 扩张
  • 审核日志记录 -将所有MCP事务记录到JSON文件中,以进行合规性和调试

安装

# Clone the repository
git clone https://github.com/DavidJBianco/MCP-Remixer.git
cd MCP-Remixer

# Install dependencies
uv sync

快速示例

# mcp-remixer.yaml
upstreams:
  filesystem:
    transport: stdio
    command: "npx"
    args: ["-y", "@modelcontextprotocol/server-filesystem", "/home/user/docs"]

hidden:
  tools:
    - "write_file"  # Hide this tool from clients

custom_tools:
  - "./tools/my_tools.py"

# Optional: Enable audit logging
audit:
  enabled: true
  log_file: ./audit.jsonl
  truncate: true  # Truncate large fields (recommended)
  max_content_length: 1024  # Per-field limit in bytes
# tools/my_tools.py
from mcp_remixer import tool, UpstreamClient

@tool(description="Read and summarize a file")
async def summarize_file(path: str, upstream: UpstreamClient):
    result = await upstream.call_tool("read_file", {"path": path})
    content = result.content[0].text
    return f"Summary: {content[:100]}..."
uv run mcp-remixer --config mcp-remixer.yaml

文档

与Claude Desktop一起使用

添加到您的 claude_desktop_config.json:

{
  "mcpServers": {
    "my-remix": {
      "command": "uv",
      "args": ["run", "--directory", "/path/to/MCP-Remixer", "mcp-remixer", "--config", "/path/to/mcp-remixer.yaml"]
    }
  }
}

建筑

┌─────────────────────────────────────────────────────────────┐
│                      MCP Client (Claude)                     │
└─────────────────────────────┬───────────────────────────────┘
                              │ stdio
┌─────────────────────────────▼───────────────────────────────┐
│                       mcp-remixer                            │
│  • Merge tools from upstreams                                │
│  • Apply prefixes / resolve collisions                       │
│  • Filter hidden tools                                       │
│  • Register custom tools                                     │
│  • Route tool calls to correct destination                   │
└─────────────────────────────────────────────────────────────┘
        │ stdio               │ sse/http            │ http
┌───────▼───────┐  ┌─────────▼────────┐  ┌────────▼────────┐
│  filesystem   │  │    remote_api    │  │  cloud_service  │
│    server     │  │     server       │  │     server      │
└───────────────┘  └──────────────────┘  └─────────────────┘

发展

# Install dev dependencies
uv sync --dev

# Run tests
uv run pytest

# Run with coverage
uv run pytest --cov=mcp_remixer --cov-report=html

许可证

麻省理工学院