Excel File Processor MCP server

Enables direct interaction with Excel files for reading sheet names, extracting data, and managing workbook caching to improve performance with large spreadsheets.
Back to servers
Provider
Zhiwei Xu
Release date
Mar 19, 2025
Language
TypeScript
Package
Stats
1.3K downloads
19 stars

Excel MCP Server is a powerful tool that allows you to read, write, and analyze Excel files through a Model Context Protocol (MCP) server. It provides comprehensive Excel file manipulation capabilities with built-in caching and logging functionalities.

Installation Options

Via Smithery (Recommended)

For Claude Desktop users, you can easily install the Excel MCP server using Smithery:

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

Manual Installation

You can manually configure the Excel MCP server by adding the appropriate configuration to your MCP servers setup.

For Windows:

{
  "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"
        }
    }
  }
}

For other platforms:

{
  "mcpServers": {
    "excel": {
        "command": "npx",
        "args": ["--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"
        }
    }
  }
}

Note: The LOG_PATH environment variable is optional. If not set, logs will be stored in the 'logs' folder under the application root directory. Other environment variables are also optional.

Usage

Analyzing Excel Structure

Analyze Structure

analyzeExcelStructure({
  fileAbsolutePath: "/path/to/your/file.xlsx",
  headerRows: 1
})

This will return the Excel file structure including sheet list and column headers in JSON format.

Export Structure to Template

exportExcelStructure({
  sourceFilePath: "/path/to/source.xlsx",
  targetFilePath: "/path/to/template.xlsx",
  headerRows: 1
})

This exports the structure (sheets and headers) to a new Excel template file.

Reading Excel Files

Get Sheet Names

readSheetNames({
  fileAbsolutePath: "/path/to/your/file.xlsx"
})

This returns all sheet names from the Excel file.

Read Specific Sheet

readDataBySheetName({
  fileAbsolutePath: "/path/to/your/file.xlsx",
  sheetName: "Sheet1",
  headerRow: 1,
  dataStartRow: 2
})

This reads data from a specific sheet in the Excel file.

Read All Sheets

readSheetData({
  fileAbsolutePath: "/path/to/your/file.xlsx",
  headerRow: 1,
  dataStartRow: 2
})

This reads data from all sheets in the Excel file.

Writing Excel Files

Write to Specific Sheet

writeDataBySheetName({
  fileAbsolutePath: "/path/to/your/file.xlsx",
  sheetName: "Sheet1",
  data: [
    { column1: "value1", column2: "value2" },
    { column1: "value3", column2: "value4" }
  ]
})

This writes data to a specific sheet (overwrites if the sheet exists).

Create New Excel File with Multiple Sheets

writeSheetData({
  fileAbsolutePath: "/path/to/new/file.xlsx",
  data: {
    "Sheet1": [
      { column1: "value1", column2: "value2" }
    ],
    "Sheet2": [
      { columnA: "valueA", columnB: "valueB" }
    ]
  }
})

This creates a new Excel file with data in multiple sheets.

Managing Cache

Clear File Cache

clearFileCache({
  fileAbsolutePath: "/path/to/your/file.xlsx"
})

This clears cached data for the specified Excel file.

Configuration

Environment Variables

The Excel MCP server can be configured using the following environment variables:

  • LOG_PATH: Path where log files are stored (default: 'logs' folder)
  • CACHE_MAX_AGE: Cache expiration time in hours (default: 1)
  • CACHE_CLEANUP_INTERVAL: Cache cleanup interval in hours (default: 4)
  • LOG_RETENTION_DAYS: Number of days to keep logs (default: 7)
  • LOG_CLEANUP_INTERVAL: Log cleanup interval in hours (default: 24)

How to add this MCP server to Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "cursor-rules-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "cursor-rules-mcp"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later