BatchIt MCP server

Combine tool calls into a single batch_execute call.
Back to servers
Setup instructions
Provider
Ryan Joachim
Release date
Jan 28, 2025
Language
TypeScript
Stats
31 stars

The MCP BatchIt server acts as an aggregator for Model Context Protocol (MCP) tools, allowing you to batch multiple tool calls into a single request to reduce overhead and token usage for AI agents. Instead of making separate calls for each MCP tool operation, you can combine them in one efficient request.

Installation

To set up the MCP BatchIt server:

git clone https://github.com/ryanjoachim/mcp-batchit.git
cd mcp-batchit
npm install
npm run build
npm start

The server will start on STDIO by default, allowing your AI agent or any MCP client to spawn it:

mcp-batchit is running on stdio. Ready to batch-execute!

How It Works

BatchIt exposes a single tool called batch_execute that:

  1. Takes a batch of operations you want to perform
  2. Connects to the actual target MCP server (like a filesystem server) behind the scenes
  3. Executes each operation in parallel (up to your configured limit)
  4. Returns a consolidated result with all operation responses

Key Features

  • Parallel Execution - Run multiple operations simultaneously with maxConcurrent option
  • Error Handling - Stop remaining operations if one fails using stopOnError option
  • Timeout Control - Set timeout limits with timeoutMs
  • Connection Caching - Reuses connections to downstream MCP servers

Usage Examples

Multi-Phase Operations

When working with operations that depend on previous results, you'll need to structure your requests in phases:

Phase 1: Information Gathering

This example shows how to read multiple files in a single request:

{
  "targetServer": {
    "name": "filesystem",
    "serverType": {
      "type": "filesystem",
      "config": {
        "rootDirectory": "/path/to/your/project"
      }
    },
    "transport": {
      "type": "stdio",
      "command": "cmd.exe",
      "args": [
        "/c",
        "npx",
        "-y",
        "@modelcontextprotocol/server-filesystem",
        "/path/to/your/project"
      ]
    }
  },
  "operations": [
    {
      "tool": "read_file",
      "arguments": {
        "path": "/path/to/your/project/package.json"
      }
    },
    {
      "tool": "read_file",
      "arguments": {
        "path": "/path/to/your/project/README.md"
      }
    }
  ],
  "options": {
    "maxConcurrent": 2,
    "stopOnError": true,
    "timeoutMs": 30000
  }
}

Phase 2: Creating Files Based on Previous Results

After processing the gathered information, you can create multiple files in another batch:

{
  "targetServer": {
    "name": "filesystem",
    "serverType": {
      "type": "filesystem",
      "config": {
        "rootDirectory": "/path/to/your/project"
      }
    },
    "transport": {
      "type": "stdio",
      "command": "cmd.exe",
      "args": [
        "/c",
        "npx",
        "-y",
        "@modelcontextprotocol/server-filesystem",
        "/path/to/your/project"
      ]
    }
  },
  "operations": [
    {
      "tool": "create_directory",
      "arguments": {
        "path": "/path/to/your/project/output-directory"
      }
    },
    {
      "tool": "write_file",
      "arguments": {
        "path": "/path/to/your/project/output-directory/file1.md",
        "content": "# Generated Content\n\nThis content was created based on previous information..."
      }
    },
    {
      "tool": "write_file",
      "arguments": {
        "path": "/path/to/your/project/output-directory/file2.md",
        "content": "# More Generated Content\n\nAdditional information processed from phase 1..."
      }
    }
  ],
  "options": {
    "maxConcurrent": 1,
    "stopOnError": true,
    "timeoutMs": 30000
  }
}

Important Limitations

  • No Data Passing Between Operations: If one operation depends on another's output, you need to make separate batch calls
  • Single Target Server: Each batch call can only reference one target MCP server
  • All Results Returned Together: You get all operation results at the end of the batch

Troubleshooting

If you encounter "Tool not found" errors, ensure your transport configuration is pointing to the actual MCP server (like @modelcontextprotocol/server-filesystem) rather than the BatchIt aggregator itself.

When using stopOnError: true with concurrent operations, any operations already in progress will complete, but no new ones will start after a failure occurs.

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "batchit" '{"command":"npx","args":["-y","mcp-batchit"]}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "batchit": {
            "command": "npx",
            "args": [
                "-y",
                "mcp-batchit"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

{
    "mcpServers": {
        "batchit": {
            "command": "npx",
            "args": [
                "-y",
                "mcp-batchit"
            ]
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later