yupcoding1/mcp_server_excel
3.1
If you are the rightful owner of mcp_server_excel and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.
A Python-based Model Context Protocol (MCP) server for advanced Excel file manipulation.
MCP Excel Server
A Python-based Model Context Protocol (MCP) server for advanced Excel file manipulation. This project exposes Excel file operations (create, read, write, format, etc.) as MCP resources and tools, making it easy to automate and integrate Excel workflows.
Table of Contents
- Project Structure
- Features
- Requirements
- Setup
- Running the Server
- Usage
- Docker Usage
- Environment Variables
- Directory Details
- Development Notes
- References
Project Structure
.
├── advanced_server.py # Advanced MCP server with async support
├── main.py # Main MCP server (FastMCP)
├── excel_fucntion.py # All Excel file manipulation functions
├── requirements.txt # Python dependencies
├── Dockerfile # Docker build for advanced_server.py
├── Docker_advanced.txt # Alternate Dockerfile for advanced_server.py
├── run_local.bat # Windows batch script to run the server
├── run_local.sh # Bash script to run the server
├── .env # Environment variables (e.g., EXCEL_FILES_DIR)
├── excel_files/ # Directory for Excel files (auto-created)
└── __pycache__/ # Python bytecode cache
Features
- List, create, rename, and delete Excel files and sheets
- Read/write cell values, rows, columns, and ranges
- Merge/unmerge cells, set borders, auto-fit columns
- Write formulas, save as new file
- All operations exposed as MCP tools/resources
- Async server (advanced_server.py) and FastMCP server (main.py)
- Docker support for easy deployment
Requirements
- Python 3.11+
- openpyxl
- python-dotenv
- pydantic
- mcp
Install dependencies:
pip install -r requirements.txt
Setup
- Clone the repository and navigate to the project directory.
- Ensure you have Python 3.11+ installed.
- (Optional) Edit
.envto setEXCEL_FILES_DIR(default:./excel_files). - Install dependencies:
pip install -r requirements.txt
Running the Server
On Windows (PowerShell or CMD):
run_local.bat
On Linux/macOS:
./run_local.sh
This will start the MCP Excel server using main.py and create the excel_files/ directory if it does not exist.
To run the advanced async server:
python advanced_server.py
Usage
- The server exposes Excel file operations as MCP resources and tools.
- Integrate with any MCP-compatible client or use the CLI for testing.
- See
main.pyandadvanced_server.pyfor all available tools and their parameters.
Docker Usage
Build and run with the provided Dockerfile:
docker build -t mcp-excel-server .
docker run -it --rm -v $(pwd)/excel_files:/app/excel_files mcp-excel-server
- The default entrypoint runs
advanced_server.py. - To use
main.py, edit theCMDin the Dockerfile. - The Excel files directory is mounted for persistence.
Environment Variables
EXCEL_FILES_DIR: Directory for storing Excel files (default:./excel_files).- Set in
.env, or via environment when running Docker or scripts.
- Set in
Directory Details
excel_files/: All Excel files created/modified by the server are stored here.__pycache__/: Python bytecode cache (can be ignored).
Development Notes
- All Excel logic is in
excel_fucntion.py. - Add new tools/resources by editing
main.pyoradvanced_server.py. - For custom environments, update
.envor pass variables directly. - For MCP protocol details, see modelcontext/model-context-protocol.
References
Author: Mohammed Abbasi
License: Use as you want.