Excel MCP Server

Excel MCP Server

Enables AI assistants to perform comprehensive Microsoft Excel operations including data analysis, cell editing, advanced formatting, and VBA execution on Windows systems. It provides a structured workflow for managing workbooks and worksheets through a dedicated Model Context Protocol interface.

Category
访问服务器

README

日本語 README

A comprehensive Model Context Protocol (MCP) server for Microsoft Excel operations. Enables AI assistants to perform data analysis, cell editing, formatting, border styling, VBA execution, and complete worksheet management through a structured workflow.

Key Features

Prioritized Workflow Tools

  • Step 1: essential_inspect_excel_data - MANDATORY first step for understanding data structure
  • Final Step: essential_check_excel_format - MANDATORY final verification of layout and formatting

Advanced Excel Operations

  • Data Analysis & Reading - Comprehensive sheet analysis with statistics
  • Cell Editing - Single cell or range editing with array support
  • Formatting Control - Font colors, background colors, text styles, alignment
  • Border Management - Complete border styling with multiple styles and colors
  • VBA Execution - Simplified and stable VBA code execution
  • Workbook Management - Multi-workbook handling and navigation

Requirements

  • Windows OS (Required for COM integration)
  • Microsoft Excel installed and running
  • Node.js 18 or higher
  • Python 3.8 or higher

Installation

1. Clone the repository

git clone https://github.com/kousunh/excel-mcp-server.git
cd excel-mcp-server

2. Run setup script

The setup script will create a Python virtual environment and install all dependencies.

Windows (Command Prompt):

setup.bat

Windows (PowerShell):

.\setup.bat

Linux/Mac (WSL):

./setup.sh

3. Configure Claude Desktop

Add to your claude_desktop_config.json:

{
  "mcpServers": {
    "excel-mcp": {
      "command": "node",
      "args": ["C:/path/to/excel-mcp-server/src/index.js"],
      "env": {},
      "cwd": "C:/path/to/excel-mcp-server"
    }
  }
}

4. Configure Cursor

Add to your Cursor settings:

{
  "mcpServers": {
    "Excel-mcp": {
      "command": "node",
      "args": [
        "C:\\path\\to\\excel-mcp-server\\src\\index.js"
      ]
    }
  }
}

Available Tools

Priority Tools (Use in Order)

essential_inspect_excel_data - STEP 1 - ALWAYS USE FIRST

Analyzes Excel data structure and content before any operations. Essential for understanding current state, sheet structure, data types, and content. Works with both open and closed files.

essential_check_excel_format - FINAL STEP - MANDATORY VERIFICATION

Validates layout and formatting after any changes. Use multiple times to check different ranges. If layout/format issues found, fix and re-verify.

Core Operations

edit_cells

Edit single cells or ranges with optimized performance for large data operations.

set_cell_formats

Apply comprehensive formatting to cell ranges including font colors, background colors, bold, italic, underline, font size, font name, and text alignment.

set_cell_borders

Apply detailed border styling to cell ranges. Supports various border styles (thin, thick, medium, double, dotted, dashed) and colors for different positions (top, bottom, left, right, inside, outside).

Utility Tools

get_open_workbooks

Lists all currently open Excel workbooks.

set_active_workbook

Switches between open workbooks.

get_all_sheet_names

Lists all sheets in a workbook.

navigate_to_sheet

Switches to a specific sheet.

get_excel_status

Checks if Excel is running and responsive.

VBA Execution

execute_vba

Executes custom VBA code in Excel. Creates a temporary Sub procedure, executes it, and automatically cleans up. Supports error handling and unique procedure naming to avoid conflicts.

Usage Examples

Basic Workflow

1. "First, analyze the current Excel data structure"
2. "Edit cells A1:C3 with employee data"
3. "Set borders around the data range"
4. "Apply formatting with bold headers and colored backgrounds"
5. "Finally, verify the layout and formatting"

Data Operations

"Analyze the sales data in workbook 'Sales2024.xlsx'"
"Edit range A1:D10 with quarterly sales figures"
"Apply borders to create a table structure"
"Format headers with bold font and blue background"
"Verify the final layout looks correct"

Workflow Best Practices

  1. Always start with essential_inspect_excel_data to understand current state
  2. Use dedicated tools (edit_cells, set_cell_formats, set_cell_borders) instead of VBA when possible
  3. Always end with essential_check_excel_format to confirm changes
  4. Use execute_vba for custom VBA logic when standard tools are insufficient
  5. Verify multiple ranges if working with large spreadsheets

Troubleshooting

  1. Excel not found: Ensure Excel is running with at least one workbook open
  2. Tool timeouts: Large operations automatically use extended timeouts (60 seconds)
  3. VBA errors: Simplified VBA execution reduces hanging and freezing issues
  4. Format verification: Use verification tool multiple times for different ranges
  5. Permission errors: Enable "Trust access to the VBA project object model" in Excel Trust Center

Security

  • Server operates only on local Excel files
  • VBA code runs in temporary modules that are automatically deleted
  • Python virtual environment isolates dependencies
  • No network access or external file operations

License

MIT License - see LICENSE file for details.

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Test thoroughly with Excel operations
  5. Submit a pull request

Version 2.0 Changes:

  • Added prioritized workflow tools with clear naming
  • Implemented comprehensive formatting and border controls
  • Optimized performance for large data operations
  • Simplified and stabilized VBA execution
  • Added mandatory verification step for quality assurance

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选