Files
sbroenne__mcp-server-excel/src/ExcelMcp.McpServer
Stefan Broenner fc9a78d7aa Add table style completions and presets for LLM discoverability (#203)
Fixes #202

## Changes

### 1. Table Style Completions
- Created table_styles.md with 60+ preset table styles
- Added tableStyle parameter handler to ExcelCompletionHandler
- Provides autocomplete for Light (1-21), Medium (1-28), Dark (1-11) styles

### 2. Enhanced Prompt Documentation
- Expanded excel_table.md with style categories and naming patterns
- Added popular style recommendations (Medium2, Medium9, Light9, Dark1)
- Documented style behavior and empty string behavior

### 3. TableStylePresets Class
- Created TableStylePresets.cs mirroring NumberFormatPresets pattern
- Documented 23+ common table styles as constants with descriptions
- Provides IntelliSense for developers

### 4. Updated Tests
- Updated test files to use TableStylePresets.Medium2 constant
- Added CompletionHandlerTests for autocomplete verification
- All 22 tests pass (18 table + 4 completion tests)

## Test Results
- Build: 0 warnings, 0 errors
- Feature=Tables: 18 tests passed
- CompletionHandler: 4 tests passed

## Benefits
- LLMs get autocomplete suggestions for table styles
- Consistent with existing NumberFormatPresets/PivotTableStylePresets
- Better developer experience (IntelliSense)
- Complete documentation for table styling
2025-11-19 05:23:06 +00:00
..

ExcelMcp - Model Context Protocol Server for Excel

mcp-name: io.github.sbroenne/mcp-server-excel

NuGet NuGet Downloads GitHub

Control Excel with Natural Language through AI assistants like GitHub Copilot, Claude, and ChatGPT. This MCP server enables AI-powered Excel automation for Power Query, DAX measures, VBA macros, PivotTables, and more.

➡️ Learn more and see examples

Also includes a powerful CLI for RPA (Robotic Process Automation) and scripting workflows.

🛡️ 100% Safe - Uses Excel's Native COM API

Unlike third-party libraries that manipulate .xlsx files (risking corruption), ExcelMcp uses Excel's official COM automation API. This guarantees zero risk of file corruption while you work interactively with live Excel files - see your changes happen in real-time. Currently supports 163 operations across 12 specialized tools with active development expanding capabilities.

Requirements: Windows OS + Excel 2016+

🚀 Installation

Quick Setup Options:

  1. VS Code Extension - One-click install for GitHub Copilot
  2. Manual Install - Works with Claude Desktop, Cursor, Cline, Windsurf, and other MCP clients
  3. MCP Registry - Find us at registry.modelcontextprotocol.io

Manual Installation (All MCP Clients):

# Install MCP Server
dotnet tool install --global Sbroenne.ExcelMcp.McpServer

# Configure your AI assistant
# See examples/mcp-configs/ for ready-to-use configs

Supported AI Assistants:

  • ✅ GitHub Copilot (VS Code, Visual Studio)
  • ✅ Claude Desktop
  • ✅ Cursor
  • ✅ Cline (VS Code Extension)
  • ✅ Windsurf
  • ✅ Any MCP-compatible client

📖 Detailed setup instructions: Installation Guide

🎯 Quick config examples: examples/mcp-configs/

🛠️ What You Can Do

12 specialized MCP tools for comprehensive Excel automation:

  1. Power Query & M Code (11 actions) - Create, edit, optimize Power Query transformations with AI assistance
  2. Power Pivot / Data Model (14 actions) - Build DAX measures, manage relationships, discover model structure, refresh data model
  3. Excel Tables (23 actions) - Automate table creation, filtering, sorting, column management, structured references, number formatting
  4. PivotTables (18 actions) - Create and configure PivotTables for interactive data analysis
  5. Ranges & Data (43 actions) - Get/set values/formulas, number formatting, visual formatting (font, fill, border, alignment), data validation, find/replace, sort, insert/delete, hyperlinks, merge, conditional formatting, cell protection
  6. VBA Macros (6 actions) - Import, update, run VBA code with version control integration
  7. Data Connections (9 actions) - Manage OLEDB, ODBC, Text, Web connections and properties
  8. Worksheets (16 actions) - Lifecycle management, tab colors, visibility controls
  9. Named Ranges (7 actions) - Manage parameters and configuration through named ranges
  10. File Operations (6 actions) - Create Excel workbooks (.xlsx/.xlsm), open/close workbook, save, test
  11. Conditional Formatting (2 actions) - Add and clear conditional formatting rules

Total: 11 tools with 155 operations

AI-Powered Workflows:

  • 💬 Natural language Excel commands through GitHub Copilot or Claude
  • 🔄 Optimize Power Query M code for performance and readability
  • 📊 Build complex DAX measures with AI guidance
  • 📋 Automate repetitive data transformations and formatting
  • 🤖 RPA: Comprehensive CLI for robotic process automation, CI/CD, and batch processing

💡 Example Use Cases

"Optimize all my Power Queries in this workbook"
→ AI analyzes M code, optimizes query folding, improves step organization

"Create a PivotTable showing sales by region and product"
→ AI creates PivotTable, adds fields, sets aggregations, applies formatting

"Format revenue columns as currency with bold headers and blue background"
→ AI applies number formatting, font styles, and cell colors

"Build a DAX measure for year-over-year growth"
→ AI writes DAX formula, sets currency format, adds to Data Model

"Export all Power Query M code to Git for version control"
→ CLI batch exports all queries to .pq files for source control workflows


📋 Additional Resources

License: MIT
Platform: Windows only (requires Excel 2016+)
Support: GitHub Issues