Excel MCP Server

Excel MCP Server

site icon
2025.04.12 104
GoExcel 数据处理自动化工具开发效率
Excel MCP Server 是一个基于 Model Context Protocol (MCP) 的服务,专门用于读取和写入 Microsoft Excel 文件的数据。它支持多种 Excel 文件格式,包括 xlsx、xlsm、xltx 和 xltm,提供了丰富的功能来处理 Excel 文件中的文本值、公式以及屏幕截图(仅限 Windows)。
View on GitHub

Overview

基本能力

产品定位

Excel MCP Server 是一个专门用于处理 Microsoft Excel 文件数据的服务,适用于需要自动化操作 Excel 文件的场景。

核心功能

  • 读取 Excel 文件中的文本值
  • 写入文本值到 Excel 文件
  • 读取 Excel 文件中的公式
  • 写入公式到 Excel 文件
  • 从 Excel 文件中捕获屏幕图像(仅限 Windows)

适用场景

  • 自动化 Excel 数据处理
  • 批量修改 Excel 文件内容
  • 提取 Excel 文件中的数据和公式
  • 生成 Excel 文件的屏幕截图(仅限 Windows)

工具列表

  • read_sheet_names: 列出 Excel 文件中的所有工作表名称
  • read_sheet_data: 从 Excel 工作表中读取数据(支持分页)
  • read_sheet_formula: 从 Excel 工作表中读取公式(支持分页)
  • read_sheet_image: 从 Excel 工作表中读取数据作为图像(仅限 Windows,支持分页)
  • write_sheet_data: 将数据写入 Excel 工作表
  • write_sheet_formula: 将公式写入 Excel 工作表

常见问题解答

  • 仅支持 Node.js 20.x 或更高版本
  • 屏幕截图功能仅限 Windows 平台
  • 可以通过环境变量 EXCEL_MCP_PAGING_CELLS_LIMIT 调整单次分页操作读取的最大单元格数(默认 4000)

使用教程

使用依赖

  • Node.js 20.x 或更高版本

安装教程

通过 NPM 安装

对于 Windows:

{
    "mcpServers": {
        "excel": {
            "command": "cmd",
            "args": ["/c", "npx", "--yes", "@negokaz/excel-mcp-server"],
            "env": {
                "EXCEL_MCP_PAGING_CELLS_LIMIT": "4000"
            }
        }
    }
}

对于其他平台:

{
    "mcpServers": {
        "excel": {
            "command": "npx",
            "args": ["--yes", "@negokaz/excel-mcp-server"],
            "env": {
                "EXCEL_MCP_PAGING_CELLS_LIMIT": "4000"
            }
        }
    }
}

通过 Smithery 安装

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

调试方式

安装完成后,可以通过调用提供的工具函数来测试服务是否正常工作。例如: - 使用 read_sheet_names 列出 Excel 文件中的工作表名称 - 使用 read_sheet_data 读取工作表数据 - 使用 write_sheet_data 写入数据到工作表

许可证

该项目遵循 MIT 开源许可条款,请参阅 MIT 了解完整条款。