Intelligent batch processing MCP service - converts API definitions to Excel templates for batch data construction and upload.
- 🎯 Smart Template Generation: Generate Excel templates from TypeScript interfaces, Swagger definitions, or SQL DDL
- 📊 Rich Excel Functionality: Data validation (dropdown menus), field descriptions (comments), style formatting
- 🚀 Concurrency Control: Smart control of API call concurrency to avoid service overload
- 🔄 Result Feedback: Execution results written back to Excel for easy review and analysis
- 🌳 Nested Object Support: Automatic handling of dot notation (e.g.,
user.address.city)
- Runtime: Node.js 18+ / Bun
- Language: TypeScript
- MCP SDK: @modelcontextprotocol/sdk (Latest version, using McpServer API)
- Excel: exceljs
- HTTP: axios
- Concurrency: p-limit
- Validation: zod
# Using pnpm
pnpm install
# Or using bun
bun install# Using pnpm
pnpm run build
# Or using bun
bun run build# Using pnpm
pnpm run test
# Or using bun
bun run testThis will generate a test_users_template.xlsx file containing:
- Styled headers
- Required field markers (red)
- Field descriptions (cell comments)
- Dropdown menus for enum fields
- Sample data row
Add to your MCP client configuration file:
{
"mcpServers": {
"batch-master": {
"command": "node",
"args": ["/path/to/batch-master/dist/index.js"]
}
}
}Or using bun:
{
"mcpServers": {
"batch-master": {
"command": "bun",
"args": ["/path/to/batch-master/src/index.ts"]
}
}
}Generate an Excel template with data validation and formatting.
Parameters:
filename: Output file pathcolumns: Array of column definitionskey: Field key (supports dot notation)title: Column headertype: Data type (string, number, boolean, enum, date)required: Whether the field is requireddescription: Field descriptionoptions: Enum options (for dropdown menus)width: Column width
**Example:**le:**
{
"filename": "./users_template.xlsx",
"columns": [
{
"key": "user.name",
"title": "User Name",
"type": "string",
"required": true,
"description": "User's full name"
},
{
"key": "user.city",
"title": "City",
"type": "enum",
"options": ["Beijing", "Shanghai", "Guangzhou", "Shenzhen"],
"required": true
}
]
}Execute batch API calls from an Excel file.
Parameters:
filename: Excel file pathconfig: API configurationapiUrl: API endpoint URLmethod: HTTP method (default: POST)headers: Request headersconcurrency: Concurrency limit (default: 5, max: 50)timeout: Timeout in milliseconds (default: 30000)
columns: Column definitions (must match the template)
Example:
{
"filename": "./users_template.xlsx",
"config": {
"apiUrl": "https://api.example.com/users",
"method": "POST",
"headers": {
"Authorization": "Bearer your-token"
},
"concurrency": 10
},
"columns": [...]
}-
Parse API Definition
- AI parses user-provided TypeScript interfaces, Swagger JSON, or SQL DDL
- Converts to standardized column definition format
-
Generate Excel Template
- Call the
generate_templatetool - Generate Excel file with validation rules
- Call the
-
Fill Data
- User fills in batch data in Excel
- Use dropdown menus and comments for input assistance
-
Batch Execute
- Call the
batch_executetool - System reads Excel data and executes API calls
- Generate result file (
_result.xlsx)
- Call the
-
Review Results
- Check execution status and response information in result file
- Handle failed records
batch-master/
├── src/
│ ├── types.ts # Core type definitions
│ ├── schemas.ts # Zod validation schemas
│ ├── template-generator.ts # Excel template generator
│ ├── batch-executor.ts # Batch executor
│ ├── index.ts # MCP Server entry point
│ └── test-excel.ts # Test script
├── package.json
├── tsconfig.json
└── README.md
# Type checking
pnpm run type-check
# Development mode (with watch)
pnpm run dev
# Test Excel generation
pnpm run test- AI parses user management API documentation
- Generate template with fields like name, email, role, etc.
- Administrator fills in 100 user records
- Batch execute creation with concurrency limited to 10 requests
- Review results and handle failed records
- Generate template from order API schema
- Export pending orders to Excel
- Modify status field (using dropdown menu)
- Batch execute PUT requests for updates
- Verify update results
- Row 1 of the Excel template is the header, row 2 is sample data, actual data starts from row 3
- Nested objects use dot notation (e.g.,
user.address.city) - Enum fields automatically generate dropdown menus (applied to first 1000 rows)
- Concurrency should not be too high; adjust based on target API capacity
- Result file saves all request responses for troubleshooting
MIT
Issues and Pull Requests are welcome!