Powerful MCP server for programmatic Excel (.xlsx) manipulation and automation
A comprehensive MCP (Model Context Protocol) server that provides AI assistants with powerful Excel manipulation capabilities. This server enables programmatic creation, modification, and management of Excel files through standardized MCP tools, supporting data operations, formatting, formulas, charts, and PostgreSQL database integration.
- ✨ Key Features
- 🚀 Installation
- ⚙️ Deployment Modes
- 🔧 Configuration
- 📚 Available Tools
- 🧪 Testing
- 🧩 Project Structure
- 🔧 Development
- 🤝 Contributing
- 📄 License
- 📊 Comprehensive Excel Operations: Create, read, modify workbooks and worksheets with full data manipulation support
- 🎨 Advanced Formatting: Apply styles, fonts, colors, borders, and cell formatting with precision
- 📈 Data Visualization: Generate charts, pivot tables, and graphics programmatically
- 🗄️ Database Integration: Direct PostgreSQL integration for seamless data import/export
- ⚡ Formula Support: Apply and validate Excel formulas with error handling
- 🔒 Security First: File path validation, access control, and robust error handling
- 🚀 Multiple Deployment Modes: DXT package, traditional MCP server, or standalone CLI
- 🤖 AI-Ready: Optimized for AI assistant integration via Model Context Protocol
- Python 3.11+: Modern Python with type hints support
- UV Package Manager: Install UV (recommended) or use pip
- Git: For cloning the repository
- Desktop Extensions (DXT) : for create packages .dxt for claude desktop Install DXT
git clone https://github.com/LuiccianDev/mcp_excel_office.git
cd mcp_excel_office
# Install production dependencies
uv sync
# Install with development dependencies
uv sync --dev
# Install all dependency groups (dev + test)
uv sync --all-groups
# Install the package
pip install .
# Development installation (editable)
pip install -e ".[dev,test]"
# Build distributable package
uv build
# Install from built package
uv pip install dist/mcp_excel-*.whl
The MCP Excel Office Server supports three deployment modes to fit different workflows and environments:
Best for: Integrated DXT ecosystem users who want seamless configuration management.
-
Package the project:
dxt pack
-
Configuration: The DXT package automatically handles dependencies and provides user-friendly configuration through the manifest.json:
directory
: Base directory for file operationspostgres_connection_string
: PostgreSQL database connection (marked as sensitive)
-
Usage: Once packaged, the tool integrates directly with DXT-compatible clients with automatic user configuration variable substitution.
-
Server Configuration: this proyect include the files manifest.json for building package .dxt
for more details see DXT Package Documentation.
Best for: Standard MCP server deployments with existing MCP infrastructure.
Add to your MCP configuration file (e.g., Claude Desktop's mcp_config.json
):
# create packages
uv build
#install packages
pip install dist/archivo*.whl
The next steps is configuractiosn en mcp
{
"mcpServers": {
"mcp_excel": {
"command": "uv",
"args": ["run", "mcp_excel"],
"env": {
"DIRECTORY": "user/to/path/directory",
"POSTGRES_CONNECTION_STRING": "postgres_connection_string"
}
}
}
}
Alternative configuration with CLI arguments:
{
"mcpServers": {
"mcp_excel": {
"command": "uv",
"args": [
"run", "-m", "mcp_excel",
"--path", "user/to/path/directory",
"--postgres", "postgres_connection_string"
]
}
}
}
Best for: Direct command-line usage, scripting, and automation without MCP protocol overhead.
# Run with environment variables
export DIRECTORY="/path/to/your/files"
export POSTGRES_CONNECTION_STRING="postgresql://user:pass@localhost/db"
python -m mcp_excel
# Or run with command-line arguments
python -m mcp_excel --path "/path/to/files" --postgres "postgresql://user:pass@localhost/db"
# Using UV
uv run mcp_excel_office --help
Puedes instalar y ejecutar el servidor MCP Excel Office fácilmente usando Docker. Esto garantiza un entorno aislado y reproducible.
Para más detalles y opciones avanzadas de configuración con Docker, consulta el archivo Docker.md
.
DIRECTORY
: Base directory for file operations (required for security)POSTGRES_CONNECTION_STRING
: PostgreSQL connection string for database operations (optional)
The server validates all configuration on startup and provides clear error messages for:
- Missing required environment variables
- Invalid directory paths
- Malformed database connection strings
- File access permissions
Todas las herramientas disponibles para manipulación de Excel, operaciones de datos, formato, fórmulas, gráficos y base de datos están documentadas en detalle en el archivo TOOLS.md
. Consulta ese archivo para ver la lista completa de herramientas, sus parámetros y ejemplos de uso.
mcp_excel_office/
├── src/mcp_excel/ # Main package
│ ├── __init__.py # Package initialization
│ ├── __main__.py # CLI entry point
│ ├── server.py # MCP server implementation
│ ├── register_tools.py # Tool registration
│ ├── tools/ # MCP tool implementations
│ │ ├── content_tools.py # Data read/write operations
│ │ ├── excel_tools.py # Basic workbook operations
│ │ ├── format_tools.py # Cell formatting and styling
│ │ ├── formulas_excel_tools.py # Formula operations
│ │ ├── graphics_tools.py # Charts and visualizations
│ │ └── db_tools.py # Database integration
│ ├── core/ # Core functionality
│ ├── utils/ # Utility functions
│ └── exceptions/ # Custom exceptions
├── tests/ # Test suite
│ ├── test_content_tools.py # Content operations tests
│ ├── test_excel_tools.py # Basic operations tests
│ ├── test_format_tools.py # Formatting tests
│ ├── test_formulas_excel_tools.py # Formula tests
│ ├── test_graphics_tools.py # Graphics tests
│ └── test_db_tools.py # Database tests
├── pyproject.toml # Project configuration
├── manifest.json # DXT package configuration
├── TOOLS.md # Detailed tool documentation
└── README.md # This file
# Run all tests
uv run pytest
# Install development dependencies
uv sync --dev
# Install pre-commit hooks
uv run pre-commit install
# Run quality checks
uv run pre-commit run --all-files
# Format code with Ruff
uv run ruff format
# Check code style
uv run ruff check
# Type checking with MyPy
uv run mypy src/
# Run all quality checks
uv run pre-commit run --all-files
uv sync --dev
: Install development dependenciesuv run ruff check
: Code style and quality checksuv run mypy src/
: Type checking with strict configurationuv run pytest
: Run test suite with coverageuv build
: Build distributable package
We welcome contributions! Please follow these guidelines:
- Bug Reports: Open an issue with detailed reproduction steps
- Feature Requests: Describe your use case and proposed solution
- Questions: Check existing issues or start a discussion
This project is licensed under the MIT License. See the LICENSE file for details.
MCP Excel Office Server
Empowering AI assistants with comprehensive Excel manipulation capabilities
🏠 GitHub • 🔗 MCP Protocol • 📚 Tool Documentation
Created with by LuiccianDev