How to Drive Native Excel with ExcelMcp for AI Agent Automation
How can you enable AI assistants to directly interact with Microsoft Excel to build complex data models, generate PivotTables, and refresh Power Query connections?
Traditional automation approaches rely on third-party libraries to parse raw .xlsx files. This strategy strips away dynamic formula recalculations and prevents you from triggering live VBA macros or internal Excel calculation engines. ExcelMcp bridges this gap using the Model Context Protocol (MCP) and Windows COM automation, giving AI tools like GitHub Copilot, Claude, and Cursor direct control over a running Microsoft Excel instance.
What ExcelMcp Solves: Native COM Engine Automation
File-parsing automation tools often corrupt complex workbooks, strip formulas, or lose precise formatting. ExcelMcp circumvents these file-parsing limitations by driving the Excel.Application COM interface directly within your desktop environment. Instead of editing raw files, your AI acts directly inside a live Excel session.
Core Capabilities
-
Native Engine Interaction: Refreshes Power Query connections, recalculates DAX measures, runs VBA macros, and evaluates native Python =PY()functions. -
Dual-Interface Architecture: Provides both an MCP Server (optimized for conversational AI) and a CLI (optimized for coding agents and scripting workflows). -
Deep Feature Coverage: Offers 26 specialized tools with 232 distinct operations, covering PivotTables, Charts, Slicers, Conditional Formatting, and Data Models. -
Visual Verification: Captures screenshots of specified ranges or entire worksheets as PNGs, enabling vision-capable Large Language Models (LLMs) to verify visual output.
┌──────────────────────┐ ┌──────────────────────┐
│ MCP Server │ │ CLI (excelcli) │
│ (Conversational AI) │ │ (Coding Agents/CI) │
└──────────┬───────────┘ └──────────┬───────────┘
│ In-Process Calls │ Named Pipe
▼ ▼
┌──────────────────────┐ ┌──────────────────────┐
│ ExcelMCP Service │ │ ExcelMCP Service │
│ (Session Management) │ │ (Background Daemon)│
└──────────┬───────────┘ └──────────┬───────────┘
▼ ▼
Core Commands Core Commands
▼ ▼
┌──────────────────────────────────────────────────────┐
│ Excel COM API │
│ (Live Excel.Application) │
└──────────────────────────────────────────────────────┘
Prerequisites and System Requirements
Verify that your system meets these baseline requirements before installing ExcelMcp:
System Dependencies
-
Operating System: Windows OS (required for COM Interop). -
Excel Version: Microsoft Excel 2016 or newer (Desktop installation required). -
Runtime: Standalone .exedistributions include all dependencies—no additional .NET runtime installation is necessary.
Operational Note: Close all open Excel workbooks before running automation workflows to prevent file-locking conflicts.
Deployment Paths: MCP Server vs. CLI
ExcelMcp provides two independent entry points. Select the deployment path that aligns with your execution environment.
1. Conversational AI Path: Installing the MCP Server
Recommended for Claude Desktop, VS Code Chat, or Windsurf.
-
VS Code Extension: Search for and install sbroenne.excel-mcpdirectly from the VS Code Marketplace. -
Claude Desktop: Download the .mcpbbundle from the latest release page and import it into Claude Desktop. -
Standalone Executable: Extract mcp-excel.exefrom the release archive and add its location to your systemPATH.
2. Coding Agent Path: Installing the CLI
Recommended for terminal-centric workflows like Cursor or GitHub Copilot CLI. The CLI shares core logic with the MCP server via Roslyn source generators while reducing context window consumption.
| Deployment Route | Command / Source |
|---|---|
| Standalone Zip (No Runtime Needed) | Extract excelcli.exe from ExcelMcp-CLI-{version}-windows.zip |
| Global .NET Tool | dotnet tool install --global Sbroenne.ExcelMcp.CLI |
| Copilot Plugin Marketplace | copilot plugin install excel-cli@mcp-server-excel-plugins |
After installing the binary, configure your environment with the following helper command:
# Automatically register mcp-excel across supported coding agents
npx add-mcp "mcp-excel" --name excel-mcp
Note: Running
npxcommands requires Node.js on your machine. Install it viawinget install OpenJS.NodeJS.LTSif needed.
Configuring Agent Skills for Contextual Guidance
Agent Skills provide structured guidance that teaches LLMs how to select and call ExcelMcp operations efficiently. Over 43 AI agent environments support this configuration standard, including Claude Code, Cursor, and Windsurf.
Interactive and Targeted Skill Installation Commands
Run these terminal commands to configure skill packages for your environment:
# Interactive installation: Select CLI skill, MCP skill, or both
npx skills add sbroenne/mcp-server-excel
# Install the token-efficient CLI skill for coding agents
npx skills add sbroenne/mcp-server-excel --skill excel-cli
# Target specific agent platforms (e.g., Cursor or Claude Code)
npx skills add sbroenne/mcp-server-excel --skill excel-cli -a cursor
npx skills add sbroenne/mcp-server-excel --skill excel-mcp -a claude-code
# Install the CLI skill globally across all user profile environments
npx skills add sbroenne/mcp-server-excel --skill excel-cli --global
Manual Skill Installation Steps
For air-gapped or restricted environments, install skill packages manually:
-
Download excel-skills-v{version}.zipfrom the GitHub Release page. -
Extract the archive to view the skill folders:
-
skills/excel-cli/: Tailored for coding tools like Cursor and GitHub Copilot. -
skills/excel-mcp/: Tailored for conversational environments like Claude Desktop and VS Code Chat.
-
Copy the relevant skill folder to your assistant’s skill directory:
-
GitHub Copilot: ~/.copilot/skills/ -
Claude Code: .claude/skills/ -
Cursor: .cursor/skills/
Benchmark: CLI vs. MCP Server Context Usage
Choosing between the CLI and the MCP Server affects model context usage during long-running agent tasks. Here is benchmark data comparing both interfaces on identical Excel automation tasks:
| Performance Metric | CLI Mode (excelcli) |
MCP Server Mode | Efficiency Advantage |
|---|---|---|---|
| Context Token Consumption | ~59K Tokens | ~163K Tokens | CLI uses ~64% fewer tokens |
| Architecture | Single tool wrapper over background daemon | 26 tool schemas over a persistent connection | CLI eliminates repeated schema injections |
| Primary Use Case | Coding agents, scripts, and CI/CD pipelines | Interactive exploration and visual analysis | Optimized per workflow |
In agent workflows, routing calls through the CLI keeps token usage low because the assistant does not need to re-parse 26 tool schemas on every turn. This keeps the prompt context clear for complex formula logic and multi-step data transformations.
Tool Capabilities and Practical Prompts
ExcelMcp organizes its 232 operations across 26 specialized tool domains.
Capabilities Breakdown
ExcelMcp Automation Domains
├── Core Data & Formatting
│ ├── Excel Tables (2 tools, 27 operations)
│ ├── Ranges (4 tools, 46 operations)
│ └── Conditional Formatting (1 tool, 2 operations)
├── Advanced Analytics & Modeling
│ ├── Power Query (1 tool, 12 operations)
│ ├── Data Model/DAX (2 tools, 19 operations)
│ └── PivotTables (3 tools, 30 operations)
├── Visualization & Interaction
│ ├── Charts (2 tools, 29 operations)
│ ├── Slicers (1 tool, 8 operations)
│ └── Screenshot (1 tool, 2 operations)
└── System & Execution Control
├── Calculation Mode (1 tool, 3 operations)
├── Window Management (1 tool, 9 operations)
└── File/VBA Session (2 tools, 12 operations)
Prompt Examples by Use Case
Scenario 1: Creating Tables and Formula Columns
Prompt:
“Create a new Excel file named SalesTracker.xlsx. On Sheet1, add a table with headers Date, Product, Quantity, Unit Price, and Total, and populate it with 3 sample data rows. Then, add a formula column calculating Quantity multiplied by Unit Price.”
Scenario 2: Data Modeling, PivotTables, and Slicers
Prompt:
“Import products.csv using Power Query and load it into the Data Model. Build a relationship between the Orders and Products tables using ProductID, create a DAX measure for Total Revenue, and generate a PivotTable summarized by product with a Region slicer attached.”
Scenario 3: Formatting and Range Styling
Prompt:
“Format the Price column as currency and highlight values over $500 in green. Convert range A1:E15 into an Excel Table using a blue style with a totals row enabled. Apply bold, centered styling to section headers A1:G1 and A12:G12 simultaneously.”
Note: Use the range tool for number and date formatting. Use range_format for visual formatting like cell fills, borders, and column auto-fitting.
Scenario 4: Real-Time Execution Monitoring (Agent Mode)
Excel operates silently in the background by default to maximize execution speed. You can ask the AI agent to make the Excel window visible whenever you want to monitor its progress:
Prompt:
“Show me Excel while you work so I can watch you build the dashboard and charts.”
ExcelMcp will invoke its Window Management features to bring the Excel application into view, displaying real-time updates in the status bar (e.g., ExcelMcp: Building PivotTable from Sales data...).
Deployment Checklist and Quick Reference
[System Requirement] Windows OS | Microsoft Excel 2016+
│
├── Conversational Workflow ──> Install MCP Server ──> Run npx add-mcp "mcp-excel"
│
└── Coding Agent Workflow ──> Install CLI (excelcli) ──> Configure excel-cli Skill (64% Token Reduction)
Verification Checklist
-
Close all active excel.exeinstances. -
Download either mcp-excel.exeorexcelcli.exefrom the latest release. -
Run npx skills add sbroenne/mcp-server-excelto attach the appropriate skills to your agent. -
Issue a test prompt like “Create a blank workbook and populate cell A1” to verify your COM connection.
Frequently Asked Questions (FAQ)
Can I run ExcelMcp on macOS or Linux?
No. ExcelMcp relies directly on the Windows COM Interop framework to control the Excel.Application process, which requires a Windows environment with Microsoft Excel installed.
Do I need the .NET 10 Runtime installed on my machine?
Not if you download the standalone binary zip releases (.zip), which come pre-packaged with all required execution binaries. A .NET 10 runtime is only required if you install the tools via dotnet tool install.
How does ExcelMcp differ from file-parsing libraries like OpenPyXL or EPPlus?
File-parsing libraries modify underlying file archives offline, without triggering calculation engines. ExcelMcp automates the active Excel application directly. This allows it to evaluate live DAX measures, execute VBA macros, evaluate =PY() formulas, and refresh Power Query models.
Why does CLI mode consume fewer tokens than MCP Server mode?
The MCP Server exposes 26 individual tool schemas (totaling 232 operations) to the LLM context window on every turn, adding ~100K+ tokens to long prompts. The CLI mode streamlines this interface into a single command wrapper, reducing token usage by ~64%.
Why should I close all open Excel files before running tasks?
ExcelMcp requires exclusive access to target workbooks during write operations. Pre-existing file locks from open Excel instances can trigger COM access violations.
Can I monitor Excel visually while the agent performs operations?
Yes. Although Excel runs hidden by default for performance, asking your AI agent to “Show me Excel” triggers window management commands that display the live desktop instance in real time.

