mcp-remote
(Node.js) 和 mcp-proxy
(Python) 是两个主流的MPC代理工具,可以实现MCP服务器传输协议转换,支持将 Remote MCP server (基于SSE 或 http streaming)转换成 stdio 模式的本地 MPC server ,便于不同MCP客户端与MCP服务器间的通信适配。本文以Q CLI 配置 AWS Knowledge MCP Server 远程MPC服务器为例,对比评测两个MPC代理工具的实际性能表现。
测试环境
- 操作系统: Linux (aarch64)
- Node.js: v20.19.0
- npm: 10.8.2
- uv: 0.6.14
- Python: 3.12.3
测试结果
指标 | mcp-remote (Node.js) | mcp-proxy (Python) | 胜者 | ||
---|---|---|---|---|---|
安装时间 | 3.288s | 0.373s | 🏆 mcp-proxy | ||
最大内存使用 | 70,748 KB (~69MB) | 52,936 KB (~52MB) | 🏆 mcp-proxy | ||
CPU 时间 (User) | 0.31s | 0.41s | 🏆 mcp-remote | ||
CPU 时间 (System) | 0.06s | 0.05s | 🏆 mcp-proxy | ||
启动连接时间 | ~1.0s | ~1.0s | 🤝 平手 |
对测试结果分析如下:
🏆 mcp-proxy (Python) 的优势:
- 安装速度快 9 倍:0.373s vs 3.288s
- 内存占用少 25%:52MB vs 69MB
- 系统调用效率略高
- 包管理更高效:uv 比 npm 快很多
🏆 mcp-remote (Node.js) 的优势:
- CPU 使用效率更高:用户态 CPU 时间更少 (0.31s vs 0.41s)
- 运行时性能稳定
🤝 相似表现:
- 连接建立时间基本相同 (~1.0s)
- 运行时稳定性都很好
- 都能成功代理 MCP 连接
结论
实际测试表明,Python 工具 mcp-proxy
在安装速度、内存使用等关键指标上都优于 Node.js 工具 mcp-remote
。这主要得益于:
- uv 的高效包管理:比传统 npm 快很多
- 现代 Python 异步库:httpx 等库的优化
- 更精简的依赖树:27 个包 vs 81 个包
基于实际测试结果,推荐使用 mcp-proxy,
理由:
- 更好的用户体验:安装快速,资源占用少
- 更适合生产环境:内存效率高,适合资源受限场景
- 现代化工具链:uv 是新一代 Python 包管理工具
Q CLI mcp.json 配置示例:
{
"mcpServers": {
"aws-knowledge-mcp-server": {
"command": "uvx",
"args": [
"mcp-proxy",
"--transport",
"streamablehttp",
"https://knowledge-mcp.global.api.aws"
]
}
}
}
详细测试数据
1. 安装时间测试
mcp-remote (npm):
$ time npm install -g mcp-remote
added 81 packages in 3s
real 0m3.288s
user 0m1.379s
sys 0m0.237s
mcp-proxy (uv):
$ time uv tool install mcp-proxy
Installed 27 packages in 9ms
real 0m0.373s
user 0m0.027s
sys 0m0.064s
2. 内存使用测试
mcp-remote:
Maximum resident set size (kbytes): 70748
User time (seconds): 0.31
System time (seconds): 0.06
mcp-proxy:
Maximum resident set size (kbytes): 52936
User time (seconds): 0.41
System time (seconds): 0.05
3. 连接测试
两个工具都能成功连接到 https://knowledge-mcp.global.api.aws
,连接建立时间相近。
mcp-remote 连接日志:
[39247] Connecting to remote server: https://knowledge-mcp.global.api.aws
[39247] Connected to remote server using StreamableHTTPClientTransport
[39247] Proxy established successfully
mcp-proxy 连接日志:
[I] HTTP Request: POST https://knowledge-mcp.global.api.aws "HTTP/1.1 200 OK"
[I] Negotiated protocol version: 2025-03-26
测试命令参考
安装命令:
# mcp-remote
npm install -g mcp-remote
# mcp-proxy
uv tool install mcp-proxy
测试命令:
# mcp-remote
npx mcp-remote https://knowledge-mcp.global.api.aws
# mcp-proxy
uvx mcp-proxy --transport streamablehttp https://knowledge-mcp.global.api.aws
性能测试命令:
# 内存测试
/usr/bin/time -v timeout 3s [command]
# 连接测试
time timeout 1s [command]
Comments
Post a Comment