mcp-server-excel
Excel automation for AI - Sheets, Power Query, DAX, VBA, Tables, Ranges and more. Windows only.
MCP 服务配置
复制以下 JSON 到 OPClaw 或其他 MCP 客户端的配置文件中即可使用
{
"mcpServers": {
"Sbroenne.ExcelMcp.McpServer": {
"args": [],
"command": ""
}
}
}
可用工具 (5 个)
该服务在 MCP 协议中暴露的工具,AI 可按需调用
tavily_search 14 个参数 需填 1 项
Search the web for current information on any topic. Use for news, facts, or data beyond your knowledge cutoff. Returns snippets and source URLs.
必填参数:query
tavily_extract 6 个参数 需填 1 项
Extract content from URLs. Returns raw page content in markdown or text format.
必填参数:urls
tavily_crawl 11 个参数 需填 1 项
Crawl a website starting from a URL. Extracts content from pages with configurable depth and breadth.
必填参数:url
tavily_map 8 个参数 需填 1 项
Map a website's structure. Returns a list of URLs found starting from the base URL.
必填参数:url
tavily_research 2 个参数 需填 1 项
Perform comprehensive research on a given topic or question. Use this tool when you need to gather information from multiple sources to answer a question or complete a task. Returns a detailed response based on the research findings.
必填参数:input
服务介绍
ExcelMcp - MCP Server for Microsoft Excel
Automate Excel with AI - A Model Context Protocol (MCP) server for comprehensive Excel automation through conversational AI.
MCP Server for Excel enables AI assistants (GitHub Copilot, Claude, ChatGPT) to automate Excel through natural language commands. Automate Power Query, DAX measures, VBA macros, PivotTables, Charts, formatting, and data transformations (22 tools with 211 operations).
CLI vs MCP Server
This package provides both CLI and MCP Server interfaces. Choose based on your use case:
| Interface | Best For | Why |
|---|---|---|
CLI (excelcli) |
Coding agents (Copilot, Cursor, Windsurf) | 64% fewer tokens - single tool, no large schemas. Better for cost-sensitive, high-throughput automation. |
| MCP Server | Conversational AI (Claude Desktop, VS Code Chat) | Rich tool discovery, persistent connection. Better for interactive, exploratory workflows. |
| Metric | CLI | MCP Server | Winner |
|---|---|---|---|
| Tokens | ~59K | ~163K | 馃弳 CLI (64% fewer) |
Key insight: MCP sends 22 tool schemas to the LLM on each request (~100K+ tokens). CLI wraps everything in one excel_execute tool and offloads guidance to a skill file.
Installation:
# CLI for coding agents
dotnet tool install --global Sbroenne.ExcelMcp.CLI
excelcli --help
# MCP Server for AI assistants (or use VS Code extension)
dotnet tool install --global Sbroenne.ExcelMcp.McpServer
馃洝锔� 100% Safe - Uses Excel's Native COM API - Zero risk of file corruption. Unlike third-party libraries that manipulate .xlsx files directly, this project uses Excel's official API ensuring complete safety and compatibility.
馃挕 Interactive Development - See results instantly in Excel. Create a query, run it, inspect the output, refine and repeat. Excel becomes your AI-powered workspace for rapid development and testing.
馃И LLM-Tested Quality - Tool behavior validated with real AI agents using agent-benchmark. We test that LLMs correctly understand and use our tools.
Optional CLI Tool: For advanced users who prefer command-line scripting, ExcelMcp includes a CLI interface for RPA workflows, CI/CD pipelines, and batch automation.
馃殌 Quick Start (1 Minute)
Requirements: Windows OS + Microsoft Excel 2016+
猸� Recommended: VS Code Extension (One-Click Setup)
Fastest way to get started - everything configured automatically: Install from Marketplace
The extension opens automatically after installation with a quick start guide!
For Claude Desktop (One-Click Install)
Download the .mcpb file from the latest release and double-click to install.
For Visual Studio, Cursor, Windsurf, or other MCP clients:
馃摉 [Complete Installation Guide 鈫抅(docs/INSTALLATION.md) - Step-by-step setup for all AI assistants with ready-to-use config files
鈿狅笍 Important: Close all Excel files before using ExcelMcp. The server requires exclusive access to workbooks during automation (Excel COM limitation).
馃幆 What You Can Do
22 specialized tools with 211 operations:
- 馃攧 Power Query (1 tool, 11 ops) - Atomic workflows, M code management, load destinations
- 馃搳 Data Model/DAX (2 tools, 18 ops) - Measures with auto-formatted DAX, relationships, model structure
- 馃帹 Excel Tables (2 tools, 27 ops) - Lifecycle, filtering, sorting, structured references
- 馃搱 PivotTables (3 tools, 30 ops) - Creation, fields, aggregations, calculated members/fields
- 馃搲 Charts (2 tools, 26 ops) - Create, configure, series, formatting, data labels, trendlines
- 馃摑 VBA (1 tool, 6 ops) - Modules, execution, version control
- 馃搵 Ranges (4 tools, 42 ops) - Values, formulas, formatting, validation, protection
- 馃搫 Worksheets (2 tools, 16 ops) - Lifecycle, colors, visibility, cross-workbook moves
- 馃攲 Connections (1 tool, 9 ops) - OLEDB/ODBC management and refresh
- 馃彿锔� Named Ranges (1 tool, 6 ops) - Parameters and configuration
- 馃搧 Files (1 tool, 6 ops) - Session management and workbook creation
- 锟斤笍 Slicers (1 tool, 8 ops) - Interactive filtering for PivotTables and Tables
- 锟金煄� Conditional Formatting (1 tool, 2 ops) - Rules and clearing
馃摎 [Complete Feature Reference 鈫抅(FEATURES.md) - Detailed documentation of all 211 operations
馃挰 Example Prompts
Create & Populate Data:
- "Create a new Excel file called SalesTracker.xlsx with a table for Date, Product, Quantity, Unit Price, and Total with sample data"
- "Put this data in A1:C4 - Name, Age, City / Alice, 30, Seattle / Bob, 25, Portland"
- "Add a formula column that calculates Quantity times Unit Price"
Analysis & Visualization:
- "Create a PivotTable from this data showing total sales by Product, then add a bar chart"
- "Use Power Query to import products.csv, load it to the Data Model, and create a measure for Total Revenue"
- "Create a slicer for the Region field so I can filter the PivotTable interactively"
- "Create a relationship between the Orders and Products tables using ProductID"
Formatting & Styling:
- "Format the Price column as currency and highlight values over $500 in green"
- "Convert this range to an Excel Table with a blue style and add a totals row"
- "Make the headers bold with a dark background and auto-fit column widths"
Automation:
- "Export all Power Query M code to files for version control"
- "Run the UpdatePrices macro"
- "Show me Excel while you work" - watch changes in real-time
馃懃 Who Should Use This?
Perfect for:
- 鉁� Data analysts automating repetitive Excel workflows
- 鉁� Developers building Excel-based data solutions
- 鉁� Business users managing complex Excel workbooks
- 鉁� Teams maintaining Power Query/VBA/DAX code in Git
Not suitable for:
- 鉂� Server-side data processing (use libraries like ClosedXML, EPPlus instead)
- 鉂� Linux/macOS users (Windows + Excel installation required)
- 鉂� High-volume batch operations (consider Excel-free alternatives)
馃搵 Additional Information
CLI for Coding Agents (Recommended)
For coding agents like GitHub Copilot, Cursor, and Windsurf, use the CLI instead of MCP Server. CLI invocations are more token-efficient: they avoid loading large tool schemas into the model context, allowing agents to act through concise commands.
# Install CLI
dotnet tool install --global Sbroenne.ExcelMcp.CLI
# Agent workflow (use -q for clean JSON output)
excelcli -q session open C:DataReport.xlsx # Returns {"sessionId":1,...}
excelcli -q range set-values --session 1 --sheet Sheet1 --range A1 --values '[["Hello"]]'
excelcli -q session save --session 1
excelcli -q session close --session 1
Key features:
-q/--quietflag for clean JSON output (no banner)- Auto-suppresses banner when output is piped
- All commands output parseable JSON
- Session pattern for efficient Excel reuse
Run excelcli --help for all commands, or excelcli <command> --help for action-specific options.
馃摎 [CLI Skill for Agents 鈫抅(skills/excel-cli/SKILL.md) | [CLI Guide 鈫抅(src/ExcelMcp.CLI/README.md)
Agent Skills (Cross-Platform AI Guidance)
Skills are auto-installed by the VS Code extension. For other platforms:
# CLI skill (for coding agents - Copilot, Cursor, Windsurf, Codex, etc.)
npx skills add sbroenne/mcp-server-excel --skill excel-cli
# MCP skill (for conversational AI - Claude Desktop, VS Code Chat)
npx skills add sbroenne/mcp-server-excel --skill excel-mcp
Supports 43+ agents including: claude-code, github-copilot, cursor, windsurf, gemini-cli, codex, goose, and more.
馃摎 [Agent Skills 鈫抅(skills/README.md)
馃敡 How It Works - COM Interop Architecture
ExcelMcp uses Windows COM automation to control the actual Excel application (not just .xlsx files).
This means you get:
- 鉁� Full Excel Feature Access - Power Query engine, VBA runtime, Data Model, calculation engine, pivot tables
- 鉁� True Compatibility - Works exactly like Excel UI, no feature limitations
- 鉁� Live Data Operations - Refresh Power Query, connections, Data Model in real workbooks
- 鉁� Interactive Development - Immediate Excel feedback as AI makes changes
- 鉁� All File Formats - .xlsx, .xlsm, .xlsb, even legacy formats
馃挕 Tip: Watch Excel While AI Works
By default, Excel runs hidden for faster automation. To see changes in real-time, just ask:
- "Show me Excel while you work"
- "Let me watch what you're doing"
- "Open Excel so I can see the changes"
The AI will display the Excel window so you can watch every operation happen live - great for learning or verifying changes!
Technical Requirements:
- 鈿狅笍 Windows Only - COM interop is Windows-specific
- 鈿狅笍 Excel Required - Microsoft Excel 2016 or later must be installed
- 鈿狅笍 Desktop Environment - Controls actual Excel process (not for server-side processing)
馃摎 [Complete MCP Server Guide 鈫抅(src/ExcelMcp.McpServer/README.md) - Detailed tool documentation and examples
Project Information
License: MIT License - see LICENSE file
Privacy: See PRIVACY.md for our privacy policy
Contributing: See CONTRIBUTING.md for guidelines
Built With: This entire project was developed using GitHub Copilot AI assistance - mainly with Claude but lately with Auto-mode.
Acknowledgments:
- Microsoft Excel Team - For comprehensive COM automation APIs
- Model Context Protocol community - For the AI integration standard
- Open Source Community - For inspiration and best practices