Home / MCP / Excel MCP Server

Excel MCP Server

Excel file processing server that reads, writes, and analyzes Excel files via MCP with automatic caching and logging.

typescript
Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
    "mcpServers": {
        "excel_win": {
            "command": "cmd",
            "args": [
                "/c",
                "npx",
                "--yes",
                "@zhiweixu/excel-mcp-server"
            ],
            "env": {
                "LOG_PATH": "[set an accessible absolute path]",
                "CACHE_MAX_AGE": "1",
                "CACHE_CLEANUP_INTERVAL": "4",
                "LOG_RETENTION_DAYS": "7",
                "LOG_CLEANUP_INTERVAL": "24"
            }
        }
    }
}

Excel MCP Server powers reading, writing, and analyzing Excel files through the Model Context Protocol (MCP). It makes it easy to integrate Excel file operations into your MCP client workflows with caching, logging, and structured data tooling.

How to use

You run this server locally as an MCP point that your client can connect to. It exposes tools to read worksheet names, read data from specific sheets or all sheets, write data to existing sheets or create new workbooks, and analyze or export the structure of your Excel files. The server automatically caches file contents for faster repeated access and keeps logs for operations. You can configure the server to manage cache lifetime and log retention to fit your environment.

How to install

Prerequisites: You need Node.js and npm installed on your machine.

Option A: Install via Smithery (for Claude Desktop) with automatic MCP integration.

npx -y @smithery/cli install @zhiwei5576/excel-mcp-server --client claude

Configuration and running

Run the MCP server using one of the provided configuration blocks. Choose the platform that matches how you want to run it. The Windows example uses cmd to run npx with the package, while the general example uses npx directly for other platforms.

{
  "mcpServers": {
    "excel": {
      "command": "cmd",
      "args": ["/c", "npx", "--yes", "@zhiweixu/excel-mcp-server"],
      "env": {
        "LOG_PATH": "[set an accessible absolute path]",
        "CACHE_MAX_AGE": "1",
        "CACHE_CLEANUP_INTERVAL": "4",
        "LOG_RETENTION_DAYS": "7",
        "LOG_CLEANUP_INTERVAL": "24"
      }
    }
  }
}
``n

What to configure

You may adjust the following environment variables to control caching and logging. LOG_PATH is optional; if you omit it, logs are stored in the application root under the logs folder.

- LOG_PATH: directory for log files (absolute path recommended).

- CACHE_MAX_AGE: how long to keep cached file content (hours).

- CACHE_CLEANUP_INTERVAL: how often to clean the cache (hours).

- LOG_RETENTION_DAYS: how many days to keep operation logs.

- LOG_CLEANUP_INTERVAL: how often to prune old logs (hours).

Tools and endpoints overview

This server provides a set of tools to work with Excel files. You can analyze structure, read and write data, and manage cache. Use these tools from your MCP client to perform the corresponding actions on Excel files.

Notes on usage

All interactions are performed through the MCP client using the exposed tools. The server handles caching automatically, with options to clear specific file caches when needed.

Available tools

analyzeExcelStructure

Get Excel file structure including sheet list and column headers in JSON format.

exportExcelStructure

Export Excel file structure (sheets and headers) to a new Excel template file.

readSheetNames

Get all sheet names from the Excel file.

readDataBySheetName

Get data from a specific sheet in the Excel file.

readSheetData

Get data from all sheets in the Excel file.

writeDataBySheetName

Write data to a specific sheet in the Excel file, overwriting if the sheet exists.

writeSheetData

Create a new Excel file with provided data.

clearFileCache

Clear cached data for a specified Excel file.