Co-Pilot / 辅助式
更新于 25 days ago

mcp-server-excel

Ssbroenne
0.0k
sbroenne/mcp-server-excel
80
Agent 评分

💡 摘要

Excel的MCP服务器使AI助手能够通过自然语言命令自动化Excel任务。

🎯 适合人群

自动化工作流程的数据分析师创建基于Excel解决方案的开发人员管理复杂工作簿的业务用户维护Power Query/VBA/DAX代码的团队

🤖 AI 吐槽:该项目使用Excel的COM API,降低了文件损坏的风险。然而,确保敏感数据不会通过命令执行暴露。

安全分析中风险

该项目使用Excel的COM API,降低了文件损坏的风险。然而,确保敏感数据不会通过命令执行暴露。

ExcelMcp - MCP Server for Microsoft Excel

VS Code Marketplace Installs Downloads NuGet Downloads - MCP Server NuGet Downloads - CLI

Build MCP Server Build CLI Release NuGet MCP Server NuGet CLI

License: MIT .NET Platform Built with Copilot

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 → - 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 → - 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:\Data\Report.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 / --quiet flag 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 → | CLI Guide →

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.

📚 *

五维分析
清晰度8/10
创新性8/10
实用性9/10
完整性8/10
可维护性7/10
优缺点分析

优点

  • 全面的自动化能力
  • 支持多种AI助手
  • 互动开发环境

缺点

  • 需要Windows和Excel
  • 不适合服务器端处理
  • 不推荐高容量批处理操作

相关技能

pytorch

S
toolCode Lib / 代码库
92/ 100

“它是深度学习的瑞士军刀,但祝你好运能从47种安装方法里找到那个不会搞崩你系统的那一个。”

agno

S
toolCode Lib / 代码库
90/ 100

“它承诺成为智能体领域的Kubernetes,但得看开发者有没有耐心学习又一个编排层。”

nuxt-skills

S
toolCo-Pilot / 辅助式
90/ 100

“这本质上是一份组织良好的小抄,能把你的 AI 助手变成一只 Nuxt 框架的复读机。”

免责声明:本内容来源于 GitHub 开源项目,仅供展示和评分分析使用。

版权归原作者所有 sbroenne.