{
  "markdown": "# mcp-server-spreadsheet\n\nmcp-name: io.github.marekrost/mcp-server-spreadsheet\n\nData-first MCP server for reading and writing spreadsheet files (`.xlsx`, `.csv`, `.ods`).\n\n## Key features\n\n- **Multi-format** — works with Excel (`.xlsx`), CSV (`.csv`), and OpenDocument (`.ods`) files through a unified tool interface.\n- **Dual mode** — cell-level workbook operations and a DuckDB-powered SQL query engine, interleaved freely on the same file.\n- **Workbook essentials** — worksheets, rows, columns, cells, search.\n- **Data-only** — preserves existing formatting but only reads and writes values.\n- **Stateless** — every call specifies `file` and `sheet` explicitly; no handles or sessions.\n- **Atomic saves** — writes go to a temp file, then `os.replace()` into the target path.\n- **Type coercion on write** — numeric strings become numbers, everything else is text.\n- **SQL across sheets** — JOINs, GROUP BY, aggregates, subqueries via in-memory DuckDB; mutations write back to the file.\n- **CSV as single-sheet workbook** — CSV files are treated as a workbook with one sheet named `default`.\n\n## Requirements\n\n- Python 3.10+\n\n## Installation\n\n### From PyPI (recommended)\n\nNo local checkout needed — just configure your MCP client (see below).\n\n### From source (for development)\n\n```bash\ngit clone https://github.com/marekrost/mcp-server-spreadsheet.git\ncd mcp-server-spreadsheet\nuv sync\n```\n\n## Usage\n\n### Claude Desktop\n\nAdd to your `claude_desktop_config.json`:\n\n**Using PyPI (recommended):**\n\n```json\n{\n  \"mcpServers\": {\n    \"mcp-server-spreadsheet\": {\n      \"command\": \"uvx\",\n      \"args\": [\"mcp-server-spreadsheet\"]\n    }\n  }\n}\n```\n\n**Using local source:**\n\n```json\n{\n  \"mcpServers\": {\n    \"mcp-server-spreadsheet\": {\n      \"command\": \"uv\",\n      \"args\": [\"run\", \"--directory\", \"/path/to/mcp-server-spreadsheet\", \"main.py\"]\n    }\n  }\n}\n```\n\n### Claude Code\n\nAdd to your `.mcp.json`:\n\n**Using PyPI (recommended):**\n\n```json\n{\n  \"mcpServers\": {\n    \"mcp-server-spreadsheet\": {\n      \"command\": \"uvx\",\n      \"args\": [\"mcp-server-spreadsheet\"]\n    }\n  }\n}\n```\n\n**Using local source:**\n\n```json\n{\n  \"mcpServers\": {\n    \"mcp-server-spreadsheet\": {\n      \"command\": \"uv\",\n      \"args\": [\"run\", \"--directory\", \"/path/to/mcp-server-spreadsheet\", \"main.py\"]\n    }\n  }\n}\n```\n\n### Standalone (stdio transport)\n\n```bash\n# PyPI\nuvx mcp-server-spreadsheet\n\n# Local source\nuv run main.py\n```\n\n### Restricting file access to a directory (optional)\n\nSet `MCP_SPREADSHEET_ROOT` to confine all path arguments to a single directory tree. Paths outside it are rejected with a clear error returned to the agent.\n\n```json\n{\n  \"mcpServers\": {\n    \"mcp-server-spreadsheet\": {\n      \"command\": \"uvx\",\n      \"args\": [\"mcp-server-spreadsheet\"],\n      \"env\": { \"MCP_SPREADSHEET_ROOT\": \"/home/me/spreadsheets\" }\n    }\n  }\n}\n```\n\nUnset (the default), any path the server process can access is allowed.\n\n## Format notes\n\n| Format | Sheets | Formulas | Types |\n|---|---|---|---|\n| `.xlsx` | Multiple | Preserved as strings | Native (int, float, date, bool) |\n| `.ods` | Multiple | Not preserved | Native (int, float, date, bool) |\n| `.csv` | Single (`default`) | N/A | Inferred on load (int, float, text) |\n\nSheet management tools (`add_sheet`, `delete_sheet`, `copy_sheet`) raise an error for CSV files.\n\n## Tools\n\n### Workbook Operations\n\n| Tool | Description |\n|---|---|\n| `list_workbooks` | List all spreadsheet files in a directory (non-recursive) |\n| `create_workbook_file` | Create a new empty spreadsheet file (format by extension) |\n| `copy_workbook` | Copy an existing file to a new path |\n\n### Sheet Operations\n\n| Tool | Description |\n|---|---|\n| `list_sheets` | List all sheet names in a workbook |\n| `add_sheet` | Add a new sheet (optional name and position) |\n| `rename_sheet` | Rename an existing sheet |\n| `delete_sheet` | Delete a sheet by name |\n| `copy_sheet` | Duplicate a sheet within a workbook (optional new name and position) |\n\n### Reading Data\n\n| Tool | Description |\n|---|---|\n| `read_sheet` | Read entire sheet as rows (optional row/column bounds) |\n| `read_cell` | Read a single cell value, e.g. `B3` |\n| `read_range` | Read a rectangular range, e.g. `A1:D10` |\n| `get_sheet_dimensions` | Get row and column count of the used range |\n\n### Writing Data\n\n| Tool | Description |\n|---|---|\n| `write_cell` | Write a value to a single cell |\n| `write_range` | Write a 2D array starting at a given cell |\n| `append_rows` | Append rows after the last used row |\n| `insert_rows` | Insert blank or pre-filled rows at a position (shifts rows down) |\n| `delete_rows` | Delete rows by index (shifts rows up) |\n| `clear_range` | Clear values in a range without removing rows/columns |\n| `copy_range` | Copy a block of cells to another location (optionally to a different sheet) |\n\n### Column Operations\n\n| Tool | Description |\n|---|---|\n| `insert_columns` | Insert blank columns at a position |\n| `delete_columns` | Delete columns by index |\n\n### Search\n\n| Tool | Description |\n|---|---|\n| `search_sheet` | Search for a value or regex pattern, returns matching cell references |\n\n### Table Mode (SQL)\n\n| Tool | Description |\n|---|---|\n| `describe_table` | Inspect column names, inferred types, row count, and sample values |\n| `sql_query` | Execute a read-only SQL `SELECT` (supports JOINs across sheets, GROUP BY, aggregates, subqueries) |\n| `sql_execute` | Execute `INSERT INTO`, `UPDATE`, or `DELETE FROM` — writes changes back to the file |\n\nSQL examples:\n\n```sql\n-- Filter and sort\nSELECT name, revenue FROM Sales WHERE status = 'Active' ORDER BY revenue DESC LIMIT 20\n\n-- Cross-sheet JOIN\nSELECT o.order_id, c.name FROM Orders o JOIN Customers c ON o.customer_id = c.id\n\n-- Aggregate\nSELECT department, COUNT(*) AS n, AVG(salary) AS avg FROM Employees GROUP BY department\n\n-- Mutate\nUPDATE Sales SET status = 'Closed' WHERE quarter = 'Q1' AND revenue < 1000\nDELETE FROM Logs WHERE date < '2024-01-01'\n```\n\nSheet names with spaces must be quoted: `SELECT * FROM \"Q1 Sales\"`.\n\n#### Sheets whose table doesn't start at row 1\n\nAll three SQL tools accept `header_row` and `data_start_row`. Each can be an\nint (applied to every sheet) or a `{sheet_name: row}` mapping (sheets not\nlisted fall back to the default). Use `header_row` when column titles live\nbelow row 1, and `data_start_row` when extra rows (e.g. a units row) sit\nbetween the header and the data.\n\n```python\n# Header on row 3, data follows immediately\nsql_query(file, 'SELECT * FROM \"People\"', header_row=3)\n\n# Mixed workbook: People headers at row 3, Orders header at row 1 with a\n# units row at row 2.\nsql_query(\n    file,\n    'SELECT * FROM \"Orders\" o JOIN \"People\" p ON o.name = p.name',\n    header_row={\"People\": 3, \"Orders\": 1},\n    data_start_row={\"Orders\": 3},\n)\n```\n\n`sql_execute` preserves rows above `header_row` when writing changes back.\n\n## Running tests\n\n```bash\nuv sync --group dev\nuv run pytest\n```\n\nEvery tool is exercised against `.xlsx`, `.csv`, and `.ods` fixtures generated into a temp directory.\n\n## Common Parameters\n\nEvery sheet-level tool accepts:\n\n| Parameter | Required | Description |\n|---|---|---|\n| `file` | yes | Path to the spreadsheet file (.xlsx, .csv, or .ods) |\n| `sheet` | no | Sheet name. Defaults to the first sheet in the workbook |\n\nAll row/column indices are **1-based**. Cell references use A1 notation (`A1`, `$B$2`).\n",
  "bytes": 7314,
  "sha": "245a981124611e59876caf68816100a97cdf84dce21ee1f81c77a7a07dbd9a2a",
  "repo_slug": "marekrost/mcp-server-spreadsheet",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_marekrost_mcp_server_spreadshe_7307a958/readme"
}