Excel MCP Server
Excel MCP Server is a Model Context Protocol (MCP) server that enables AI agents to manipulate Excel files without requiring Microsoft Excel to be installed. It allows for creating, reading, and modifying Excel workbooks, including advanced features like formulas, charts, and pivot tables. The current version is 0.1.8, and it maintains an active development pace with ongoing updates for features and protocol alignment.
Warnings
- breaking Tool names have been simplified, removing the 'excel_' prefix from many MCP tool names (e.g., 'excel_range' became 'range'). This requires updates in client configurations or prompts.
- breaking The command-line interface (CLI) underwent a significant redesign. Commands and their parameters, including the `--session` parameter, have changed.
- deprecated The Server-Sent Events (SSE) transport method is deprecated. Streamable HTTP transport is now the recommended method for remote connections.
- gotcha When using SSE or Streamable HTTP transports, the `EXCEL_FILES_PATH` environment variable must be set on the server side to specify the directory for Excel file storage and access. If not set, it defaults to `./excel_files`.
- gotcha Attempting to perform screen capture operations on Excel files (e.g., `excel_screen_capture`) on Windows can lead to the Excel file remaining locked after the operation, preventing further access or modification.
Install
-
pip install excel-mcp-server
Imports
- Server startup
python -m excel_mcp_server
Quickstart
import os
# These are example environment variables. For actual usage, they should be set in your shell
# or deployment environment before starting the server.
# For local stdio transport, EXCEL_FILES_PATH is often not required as paths are sent per tool call.
# For SSE/Streamable HTTP, EXCEL_FILES_PATH is crucial.
# OPENAI_API_KEY is an example if the server were to call an LLM provider.
os.environ['EXCEL_FILES_PATH'] = os.environ.get('EXCEL_FILES_PATH', './excel_files')
os.environ['FASTMCP_PORT'] = os.environ.get('FASTMCP_PORT', '8017')
# To start the server using the recommended Streamable HTTP transport:
# You would typically run this in a terminal or as part of a service.
# The server will listen on the specified port.
# Clients (e.g., AI agents) then connect to this endpoint.
# For demonstration, this code block only sets up environment variables. The server itself is a long-running process.
print(f"Excel MCP Server configured to use files in: {os.environ['EXCEL_FILES_PATH']}")
print(f"Excel MCP Server configured to listen on port: {os.environ['FASTMCP_PORT']} (if using HTTP transports)")
print("To start the server, run: uvx excel-mcp-server streamable-http (or python -m excel_mcp_server for older versions)")