xlsx-tools-mcp
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@xlsx-tools-mcpsum the values in column C of the sheet named 'Expenses'"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
xlsx-tools-mcp
An MCP server for reading and writing Excel (.xlsx) files with high accuracy, while preserving the file's existing structure, styles, and formulas.
Overview
xlsx-tools-mcp exposes 20 Model Context Protocol (MCP) tools that give an LLM agent accurate, structure-preserving read and write access to Excel .xlsx files. It runs as a standard stdio MCP server: you install it and register it with an MCP client (Claude Code, OpenCode, etc.), and the client's agent can list sheets, read cell ranges, search values, aggregate data, write cells/formulas, manage sheets/rows/columns, apply styles, and force formula recalculation.
It is built around the principle that editing an existing workbook should not destroy what it doesn't touch.
Features
Structure-preserving writes via openpyxl — writes load the existing workbook and save it back, preserving styles, merged cells, comments, and any aspect the edit doesn't touch.
Never-stale formula results via LibreOffice recalculation — openpyxl writes formula strings but never evaluates them. After every value/formula write the server runs a headless LibreOffice pass to recompute real results, then returns
errors_found— any Excel error values (#REF!,#DIV/0!,#N/A, …) produced by the recalculation.Fast reads via python-calamine — a Rust-backed parser for accurate, fast type inference, with an automatic openpyxl fallback when you need formulas/styles/comments or when calamine can't parse the file.
pandas-based grouping/aggregation —
aggregate_sheetgroups and aggregates on top of the normal read path, so merged cells and styling in the source range are preserved before flattening.Per-file locking — concurrent tool calls (or other processes) touching the same workbook are serialized via a sibling
<path>.lockfile (filelock), so writes never interleave and corrupt the file.XML-bomb protection — the
defusedxmlpackage is an automatic dependency; openpyxl detects it and uses its hardened XML parser, so hostilexlsxXML can't expand into resource exhaustion.Preload files at startup — set
XLSX_MCP_FILESto preload one or more workbooks; tools can then be called withpathomitted or with a short alias instead of a full filesystem path.
Related MCP server: mcp-xlsx-server
Architecture
┌──────────────────────── Supervisor (MCP transport, stdio)
│ src/xlsx_tools_mcp/server.py 20 MCP tools + instructions
│ src/xlsx_tools_mcp/settings.py env vars, preloaded files, path resolution
│ src/xlsx_tools_mcp/locking.py per-file <path>.lock serialization
│ src/xlsx_tools_mcp/errors.py domain error types
│ src/xlsx_tools_mcp/recalc.py LibreOffice headless recalc + error scanning
│
├─ Read path
│ src/xlsx_tools_mcp/io/reader.py calamine primary → openpyxl fallback
│ src/xlsx_tools_mcp/io/transform.py pandas aggregation on read results
│
└─ Write path
src/xlsx_tools_mcp/io/writer.py openpyxl → LibreOffice recalc → scan errorsThe io layer (io/) is deliberately decoupled from the MCP transport (server.py). Each MCP tool is a thin wrapper that resolves the target path, takes the per-file lock, and calls one io-layer function. This keeps the core logic independent of MCP, so it can be tested directly (see tests/).
The recalculation tradeoff
After a write that touches cell values or formulas, the server runs soffice --headless --convert-to xlsx on the file so every formula gets a real computed value. This round-trip recomputes formulas but re-exports the whole workbook — it is a tradeoff, not a guarantee of bit-perfect preservation. Features that openpyxl would otherwise preserve may not survive identically: pivot tables, charts, data validation, some formats, and some defined names.
If you're working on a structurally complex workbook where that risk matters, you can pass recalculate=False on the value/formula-writing tools (write_cells, append_rows, insert_rows, delete_rows, insert_columns, delete_columns) to save with openpyxl only and skip the round-trip entirely.
Requirements
Python ≥ 3.10
LibreOffice — optional but recommended. Needed only for formula recalculation. Without it, writes still succeed (saved via openpyxl) but formulas are not recomputed and a warning is returned in the
messagefield.
Install LibreOffice:
# macOS
brew install --cask libreoffice
# Debian / Ubuntu
sudo apt-get install -y libreoffice-calcThe server finds LibreOffice by checking soffice / libreoffice on PATH and the standard macOS install location (/Applications/LibreOffice.app/Contents/MacOS/soffice).
Installation
The server speaks stdio transport (standard MCP): after installation it waits for an MCP client to connect and call tools. You don't usually run it yourself; you register it with a client.
1. From PyPI via uvx (recommended — no clone)
uvx xlsx-tools-mcpuvx fetches and runs the published package without polluting your project. This is the simplest way to power up an MCP client (see configuration snippets below).
2. From source
git clone https://github.com/ruriazz/xlsx-tools-mcp.git
cd xlsx-tools-mcp
uv sync
# run the server (useful for local dev / debugging):
uv run xlsx-tools-mcp3. Via pip
pip install xlsx-tools-mcpThis installs the console entry point, so you can run the server directly:
xlsx-tools-mcpConfiguration for MCP clients
The simplest registration for every client uses uvx xlsx-tools-mcp (no clone, always the published version).
Claude Code
claude mcp add xlsx-tools-mcp -- uvx xlsx-tools-mcpOr via .mcp.json in your project:
{
"mcpServers": {
"xlsx-tools-mcp": { "command": "uvx", "args": ["xlsx-tools-mcp"] }
}
}OpenCode
In opencode.json (project) or ~/.config/opencode/opencode.json (global):
{
"mcp": {
"xlsx-tools-mcp": { "type": "local", "command": ["uvx", "xlsx-tools-mcp"], "enabled": true }
}
}When running from a source clone
If you cloned the repo instead of installing from PyPI, point the client at your local checkout by swapping uvx xlsx-tools-mcp for the dynamic uv run form (use the absolute path to the clone):
Claude Code .mcp.json:
{
"mcpServers": {
"xlsx-tools-mcp": {
"command": "uv",
"args": ["--directory", "/absolute/path/to/xlsx-reader", "run", "xlsx-tools-mcp"]
}
}
}OpenCode:
{
"mcp": {
"xlsx-tools-mcp": {
"type": "local",
"command": ["uv", "--directory", "/absolute/path/to/xlsx-reader", "run", "xlsx-tools-mcp"],
"enabled": true
}
}
}Replace /absolute/path/to/xlsx-reader with the actual location of your clone.
Preloading files (XLSX_MCP_FILES)
Set the XLSX_MCP_FILES environment variable in the MCP server config env section (not your interactive shell — the server is launched by the client) to preload workbooks at startup. Format: comma-separated alias=absolute/path entries, or bare absolute paths:
XLSX_MCP_FILES=name=/abs/path/to/name.xlsx,report=/data/report.xlsxBare paths get an alias defaulting to the filename:
XLSX_MCP_FILES=/abs/path/to/sales.xlsxWith alias/filename as the alias:
One file configured → every tool can be called with
pathomitted entirely.Multiple files configured → pass the alias (or filename) as
path.list_configured_files()returns the alias → absolute-path mapping.Raw absolute and relative paths still work for files you didn't preload.
Claude Code — .mcp.json with preloading:
{
"mcpServers": {
"xlsx-tools-mcp": {
"command": "uvx",
"args": ["xlsx-tools-mcp"],
"env": {
"XLSX_MCP_FILES": "report=/data/report.xlsx,sales=/data/sales.xlsx"
}
}
}
}OpenCode with preloading:
{
"mcp": {
"xlsx-tools-mcp": {
"type": "local",
"command": ["uvx", "xlsx-tools-mcp"],
"env": { "XLSX_MCP_FILES": "report=/data/report.xlsx,sales=/data/sales.xlsx" },
"enabled": true
}
}
}Tool reference
All 20 tools. Unless noted, path accepts a filesystem path, a preloaded alias/filename, or may be omitted when exactly one file is preloaded. create_workbook is the exception — its path is required because a new file is never preloaded.
Response shape (all write tools): every write tool returns
{"saved": bool, "recalculated": bool, "errors_found": list, "message": str}. When non-empty,errors_foundis a list of{"sheet": "...", "cell": "B2", "error": "#DIV/0!"}.
Inspect / Read
Tool | Description |
| List files preloaded at startup via |
| List every sheet in the workbook with approximate row/column counts (calamine). |
| Workbook-level metadata: per-sheet exact dimensions, |
| Read cell values as a 2D array addressed absolutely from A1. |
| Full detail for a single cell: value (cached computed), formula, number format, font (bold/italic/size/color), fill color, merge state, comment. |
| Substring search across one or all sheets. |
| Group and aggregate with pandas. |
Write
Tool | Description |
| Create a new |
| Write values and/or formulas into specific cells. |
| Append rows after the last used row. |
| Add a new empty sheet. |
| Delete a sheet. Fails if it's the only sheet left. |
| Insert blank rows before |
| Delete rows starting at |
| Insert blank columns before |
| Delete columns starting at |
| Merge a rectangular range (e.g. |
| Undo a merge on a previously-merged range. |
| Apply formatting to a range (e.g. |
| Force a LibreOffice headless recalculation pass and report any formula errors found. |
Example payload — write_cells
A call writing a formula and a value:
{
"sheet": "Sheet1",
"cells": [
{ "cell": "A1", "value": 100 },
{ "cell": "B1", "formula": "=A1*2" }
],
"recalculate": true,
"path": "/data/budget.xlsx"
}Matching response:
{
"saved": true,
"recalculated": true,
"errors_found": [],
"message": "Recalculated with LibreOffice headless."
}If a formula this touches produced an error, errors_found would look like:
{
"saved": true,
"recalculated": true,
"errors_found": [
{ "sheet": "Sheet1", "cell": "C5", "error": "#DIV/0!" }
],
"message": "Recalculated with LibreOffice headless."
}Security & concurrency
XML-bomb protection —
defusedxmlis an automatic dependency of this package. openpyxl auto-detects it and uses its hardened XML parser, so a malicious.xlsx(a zip of XML) can't trigger entity-expansion resource exhaustion. No configuration needed.Per-file locking — every read/write acquires a sibling
<path>.lockfile (viafilelock). Concurrent tool calls or other processes touching the same workbook are serialized so writes never interleave and corrupt the file.Recalc timeout —
XLSX_MCP_RECALC_TIMEOUT(seconds, default60) caps how long the LibreOffice recalculation pass may run.Lock timeout —
XLSX_MCP_LOCK_TIMEOUT(seconds, default10) caps how long a tool will wait to acquire the per-file lock before failing.
Troubleshooting
errors_foundis empty even though my formula is broken — recalculation likely didn't run. Check themessagefield: if it says LibreOffice wasn't found, the file was saved via openpyxl as-is and formulas were not recomputed (cached values may be stale). Install LibreOffice (see Requirements).Recalculation is slow or times out — raise
XLSX_MCP_RECALC_TIMEOUT(default 60s). On timeout, the file is still saved, butrecalculatedwill befalseandmessagesays the recalc timed out.LockTimeoutErroron concurrent access — another operation holds the lock. RaiseXLSX_MCP_LOCK_TIMEOUT(default 10s), or retry when the other operation finishes."Sheet not found" — the error message lists the available sheet names, so you can pick the correct one.
pathrequired / no file configured — you called a tool withoutpathbut no (or multiple) files are preloaded. Preload one file viaXLSX_MCP_FILES, pass an explicit alias, or pass a raw path.
Development / Contributing
See CONTRIBUTING.md. Run the test suite with:
uv run pytestThis server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Alicense-qualityDmaintenanceMCP server for reading and writing .xls (Excel 97-2003) files, enabling data manipulation, sheet listing, and metadata retrieval.MIT
- AlicenseAqualityBmaintenanceMCP server for reading and writing Excel (xlsx) files using SheetJS, providing tools to list sheets, read data, create files, add sheets, and update cells.515MIT
- Alicense-qualityBmaintenanceMCP server for Excel-compatible formula evaluation and workbook operations, enabling agents to open, inspect, mutate, recalculate, and save .xlsx files in-memory over stdio.27Apache 2.0
- AlicenseAqualityBmaintenanceMCP server for reading and inspecting local Excel files (.xlsx, .xlsm, .xls, .xlsb, .ods) with tools for inspecting metadata, reading ranges, and profiling structure.315MIT
Related MCP Connectors
MCP server for generating rough-draft project plans from natural-language prompts.
This MCP server enables users to perform scientific computations regarding linear algebra and vect…
Educational MCP server with 17 math/stats tools, visualizations, and persistent workspace
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/ruriazz/xlsx-tools-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server