xlwings
MCP server from hyunjae-labs/xlwings-mcp-server
claude mcp add --transport stdio hyunjae-labs-xlwings-mcp-server uvx xlwings-mcp-server \ --env EXCEL_MCP_VISIBLE="Show Excel windows (default: false)" \ --env EXCEL_MCP_CALC_MODE="Calculation mode (default: automatic)" \ --env EXCEL_MCP_DEBUG_LOG="Enable debug logging (default: 0)" \ --env EXCEL_MCP_SESSION_TTL="Session time-to-live in seconds (default: 600)" \ --env EXCEL_MCP_MAX_SESSIONS="Maximum concurrent sessions (default: 8)"
How to use
This MCP server provides a session-based interface to automate Excel workbooks through xlwings. It exposes tools to open and manage Excel sessions, read and write data, apply formulas, format ranges, and create charts or tables within persistent workbook sessions. Use the MCP client to call tools that are prefixed with mcp__xlwings-mcp-server__ (for example, open_workbook, write_data_to_excel, apply_formula, create_chart, and close_workbook). Start the server with the recommended Python uvx entry or run it directly via Python, and then interact with it through the MCP protocol by issuing tool calls and handling session IDs for subsequent operations.
How to install
Prerequisites:
- Python 3.10 or higher
- Windows OS (required for xlwings COM integration)
- Microsoft Excel installed
Install via pip (recommended):
pip install xlwings-mcp-server
From source:
git clone https://github.com/yourusername/xlwings-mcp-server.git
cd xlwings-mcp-server
pip install -e .
Using uv (recommended for MCP):
uv add xlwings-mcp-server
Start the server:
xlwings-mcp-server
Or directly:
python -m xlwings_mcp
Additional notes
Tips and common considerations:
- Environment variables control session management and Excel behavior (TTL, max sessions, debug logging, visibility, and calculation mode). Adjust these in the MCP config or environment before starting the server.
- The server runs per-session in a separate Excel instance to ensure isolation and stability.
- If you encounter a COM error, verify that Excel is properly installed and that Excel.exe is not running in a restricted state.
- The MCP config uses stdio transport; you can adapt to other transports if supported in your environment.
- Sample MCP configuration is included in the README (.mcp.json) for quick setup.
Related MCP Servers
mcp-vegalite
MCP server from isaacwasserman/mcp-vegalite-server
github-chat
A Model Context Protocol (MCP) for analyzing and querying GitHub repositories using the GitHub Chat API.
nautex
MCP server for guiding Coding Agents via end-to-end requirements to implementation plan pipeline
pagerduty
PagerDuty's official local MCP (Model Context Protocol) server which provides tools to interact with your PagerDuty account directly from your MCP-enabled client.
futu-stock
mcp server for futuniuniu stock
mcp -boilerplate
Boilerplate using one of the 'better' ways to build MCP Servers. Written using FastMCP