zrald1-excel-mcp-server
v1.0.0
Published
A comprehensive MCP server for Excel file operations and manipulation with AI agent support
Maintainers
Readme
Excel MCP Server
A comprehensive Model Context Protocol (MCP) server for Excel file operations and manipulation, designed specifically for AI agent integration. This server enables AI assistants like Claude, ChatGPT, and other MCP-compatible agents to create, read, modify, and analyze Excel files with full programmatic control.
🚀 Key Features
📊 Complete Excel Operations
- File Management: Create, open, save, copy, move, and delete Excel files
- Worksheet Operations: Add, remove, rename, and copy worksheets
- Cell Operations: Read, write, format cells with support for formulas and data types
- Table Management: Create, format, and manipulate Excel tables
- Chart Generation: Create various chart types (column, line, pie, bar) with customization
- Formula Support: Set and execute Excel formulas with cross-sheet references
🤖 AI Agent Optimized
- MCP Protocol Compliance: Full Model Context Protocol specification support
- Tool Discovery: All 20+ Excel tools discoverable by AI agents
- Schema Validation: Complete JSON schemas for all parameters
- Error Handling: Informative error messages for AI debugging
- Complex Workflows: Support for multi-step business scenarios
🎯 Production Ready
- High Performance: Handles large datasets (10,000+ rows) efficiently
- Concurrent Support: Multiple AI agents can use simultaneously
- Cross-Platform: Windows, macOS, and Linux compatibility
- Memory Optimized: Efficient memory usage with cleanup mechanisms
- Comprehensive Testing: 500+ test cases with 85%+ code coverage
Features
- File Operations: Create, open, save, move, delete, rename Excel files
- Workbook Management: Properties, protection, and metadata
- Worksheet Operations: Create, delete, rename, copy, move sheets
- Table Management: Create, delete, format, and manipulate tables
- Cell Operations: Read, write, format cells and ranges
- Advanced Features: Charts, pivot tables, conditional formatting
- Formula Support: Calculate and manipulate Excel formulas
- Styling: Comprehensive formatting and styling options
Installation
npm install
npm run buildUsage
npm startDevelopment
npm run dev
npm run watch # For continuous compilationTesting
The Excel MCP Server includes a comprehensive test suite to ensure all functionality works correctly and is production-ready for AI agents.
Test Categories
- Unit Tests: Test individual ExcelService methods in isolation
- Integration Tests: Test MCP tools integration with the protocol
- End-to-End Tests: Test complete workflows and real-world scenarios
- Performance Tests: Test with large datasets and concurrent operations
Running Tests
# Install dependencies
npm install
# Run all tests
npm test
# Run tests with coverage
npm test -- --coverage
# Run specific test categories
npm test tests/unit/ # Unit tests only
npm test tests/integration/ # Integration tests only
# Run tests in watch mode (for development)
npm run test:watch
# Use the comprehensive test runner
node scripts/test-runner.js full # Complete test suite
node scripts/test-runner.js unit # Unit tests only
node scripts/test-runner.js coverage # With coverage reportTest Coverage
The test suite maintains high coverage standards:
- Statements: 80%+ coverage
- Branches: 80%+ coverage
- Functions: 80%+ coverage
- Lines: 80%+ coverage
Test Documentation
For detailed testing information, see tests/README.md which includes:
- Test structure and organization
- Writing new tests
- Debugging tests
- Custom matchers
- Performance benchmarks
- Troubleshooting guide
API Documentation
The server exposes the following tools through the MCP protocol:
File Operations
excel_create_file- Create a new Excel fileexcel_open_file- Open an existing Excel fileexcel_save_file- Save the current workbookexcel_move_file- Move/rename Excel filesexcel_delete_file- Delete Excel files
Worksheet Operations
excel_create_sheet- Create a new worksheetexcel_delete_sheet- Delete a worksheetexcel_rename_sheet- Rename a worksheetexcel_copy_sheet- Copy a worksheetexcel_list_sheets- List all worksheets
Table Operations
excel_create_table- Create a new tableexcel_delete_table- Delete a tableexcel_format_table- Format table appearanceexcel_add_table_data- Add data to tables
Cell Operations
excel_read_cells- Read cell values and formattingexcel_write_cells- Write data to cellsexcel_format_cells- Apply formatting to cellsexcel_set_formula- Set formulas in cells
Advanced Features
excel_create_chart- Create chartsexcel_create_pivot_table- Create pivot tablesexcel_apply_conditional_formatting- Apply conditional formatting
Validation for AI Agents
The Excel MCP Server has been thoroughly tested to ensure AI agents can successfully:
- Discover Tools: All MCP tools are properly registered with valid schemas
- Execute Operations: File, worksheet, cell, and table operations work reliably
- Handle Errors: Graceful error handling with informative error messages
- Process Large Data: Efficient handling of large Excel files and datasets
- Maintain Data Integrity: Consistent data handling across all operations
Example AI Agent Usage
// AI agents can discover available tools
const tools = await mcpServer.listTools();
// Execute file operations
await mcpServer.callTool('excel_create_file', {
filePath: '/path/to/report.xlsx',
overwrite: false
});
// Manipulate data
await mcpServer.callTool('excel_write_cells', {
filePath: '/path/to/report.xlsx',
sheetName: 'Data',
range: 'A1:C10',
data: [/* your data */]
});
// Create visualizations
await mcpServer.callTool('excel_create_chart', {
filePath: '/path/to/report.xlsx',
sheetName: 'Data',
chartType: 'column',
dataRange: 'A1:B10',
title: 'Sales Report'
});Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add comprehensive tests for new functionality
- Ensure all tests pass:
node scripts/test-runner.js full - Submit a pull request
Development Workflow
# Set up development environment
npm install
npm run build
# Run tests during development
npm run test:watch
# Before submitting PR
node scripts/test-runner.js fullLicense
MIT
