mcpipe 的
](https://www.npmjs.com/package/mcpipe) ](https://www.npmjs.com/package/mcpipe)
基于stdio的MCP服务器的包装器,添加调试、工具名称前缀和环境管理。
快速开始
# Debug MCP communication
npx mcpipe --debug your-mcp-server
# Avoid tool name conflicts
npx mcpipe --name myserver your-mcp-server
# Load environment variables
npx mcpipe --env-file .env your-mcp-server
# Combine features
npx mcpipe --debug --name myserver --env-file .env your-mcp-serverMCP客户端中的使用
在服务器命令前加上mcpipe。
_之前_:
{
"my_server": {
"command": "npx",
"args": ["my-mcp-server", "--config", "path/to/config"]
}
}_之后(带调试和工具前缀)_:
{
"my_server": {
"command": "npx",
"args": ["mcpipe", "--debug", "--name", "myserver", "npx", "my-mcp-server", "--config", "path/to/config"]
}
}特性
调试日志记录(--debug)
- 查看客户端和服务器之间的所有JSON-RPC消息
- 监控流程生命周期事件
- 请参见工具名称转换
工具名称前缀(--name prefix)
- 运行同一服务器的多个实例
- 避免不同服务器之间的工具名称冲突
- 服务器以名称公开的工具
foo将以该名称向您的客户公开 `
_foo` 相反
环境加载(--env-file path)
- 从以下位置加载变量
.env文件 - 保守MCP客户端配置的秘密
- 注意:如果您只想加载环境而不加载其他功能,请考虑 envmcp
选项
--debug,-d:启用stderr的调试日志记录- `--name
, -n `:为工具名称添加前缀
- `--env-file
, -e `:加载环境文件
调试输出示例
[2024-01-15 10:30:01.125] [myserver_CLIENT→SERVER] {"jsonrpc":"2.0","method":"tools/list","id":1}
[2024-01-15 10:30:01.128] [myserver_SERVER→CLIENT] {"jsonrpc":"2.0","result":{"tools":[{"name":"fetch"}]},"id":1}
[2024-01-15 10:30:01.128] [myserver_TRANSFORM] Tool names prefixed with: myserver_
[2024-01-15 10:30:01.129] [myserver_SERVER→CLIENT] (Modified) {"jsonrpc":"2.0","result":{"tools":[{"name":"myserver_fetch"}]},"id":1}环境文件格式
KEY=value
ANOTHER_KEY=another value
# This is a comment
QUOTED_VALUE="value with spaces"许可证
麻省理工学院
