MCP BatchIt 是一款强大的工具,它能够通过单个请求执行多个操作,极大地提升操作效率,为用户提供便捷的使用体验。
使用 MCP BatchIt 工具,您可以按照以下步骤进行操作:
{
"targetServer": {
"name": "filesystem",
"serverType": {
"type": "filesystem",
"config": {
"rootDirectory": "C:/Users/Chewy/Documents/GitHub/ryanjoachim/mcp-batchit"
}
},
"transport": {
"type": "stdio",
"command": "cmd.exe",
"args": [
"/c",
"npx",
"-y",
"@modelcontextprotocol/server-filesystem",
"C:/Users/Chewy/Documents/GitHub/ryanjoachim/mcp-batchit"
]
}
}
}
{
"operations": [
{
"tool": "create_directory",
"arguments": {
"path": "C:/Users/Chewy/Documents/GitHub/ryanjoachim/mcp-batchit/memory-bank"
}
},
{
"tool": "write_file",
"arguments": {
"path": "C:/Users/Chewy/Documents/GitHub/ryanjoachim/mcp-batchit/memory-bank/productContext.md",
"content": "# MCP BatchIt Product Context\\n\\n## Purpose\\n..."
}
},
// 其他操作类似
]
}
{
"options": {
"maxConcurrent": 1,
"stopOnError": true,
"timeoutMs": 30000
}
}
以下是一个完整的使用示例,包含指定目标服务器、定义操作和配置选项:
{
"targetServer": {
"name": "filesystem",
"serverType": {
"type": "filesystem",
"config": {
"rootDirectory": "C:/Users/Chewy/Documents/GitHub/ryanjoachim/mcp-batchit"
}
},
"transport": {
"type": "stdio",
"command": "cmd.exe",
"args": [
"/c",
"npx",
"-y",
"@modelcontextprotocol/server-filesystem",
"C:/Users/Chewy/Documents/GitHub/ryanjoachim/mcp-batchit"
]
}
},
"operations": [
{
"tool": "create_directory",
"arguments": {
"path": "C:/Users/Chewy/Documents/GitHub/ryanjoachim/mcp-batchit/memory-bank"
}
},
{
"tool": "write_file",
"arguments": {
"path": "C:/Users/Chewy/Documents/GitHub/ryanjoachim/mcp-batchit/memory-bank/productContext.md",
"content": "# MCP BatchIt Product Context\\n\\n## Purpose\\n..."
}
}
],
"options": {
"maxConcurrent": 1,
"stopOnError": true,
"timeoutMs": 30000
}
}
是的。BatchIt 不会在同一个请求中传递数据。建议采用多阶段调用(如上文示例所示)。
这是因为你的 transport
可能指向了聚合器脚本本身,而不是真正的 MCP 服务器。请确保引用类似 @modelcontextprotocol/server-filesystem
的真实 MCP 服务器。
当然可以。如果某个子操作失败,已启动的其他子操作会继续运行,但尚未启动的操作将被跳过。
不一定。默认情况下,BatchIt 会缓存连接,直到出现空闲超时。你也可以通过设置 keepAlive
配置选项来控制此行为。
是的。最终响应将包含所有在错误发生前完成的子操作状态,以及失败的子操作。如果启用了 stopOnError
,后续操作将被跳过。
MIT