Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
966 changes: 943 additions & 23 deletions .github/copilot-instructions.md

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions .github/workflows/build-cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 10.0.x
dotnet-version: 9.0.x

- name: Restore dependencies
run: dotnet restore src/ExcelMcp.CLI/ExcelMcp.CLI.csproj
Expand All @@ -46,13 +46,13 @@ jobs:
- name: Verify CLI build
run: |
# Check excelcli main executable
if (Test-Path "src/ExcelMcp.CLI/bin/Release/net10.0/excelcli.exe") {
if (Test-Path "src/ExcelMcp.CLI/bin/Release/net9.0/excelcli.exe") {
Write-Output "✅ excelcli.exe built successfully"
$version = (Get-Item "src/ExcelMcp.CLI/bin/Release/net10.0/excelcli.exe").VersionInfo.FileVersion
$version = (Get-Item "src/ExcelMcp.CLI/bin/Release/net9.0/excelcli.exe").VersionInfo.FileVersion
Write-Output "Version: $version"

# Test CLI help command (safe - no Excel COM required)
$helpOutput = & "src/ExcelMcp.CLI/bin/Release/net10.0/excelcli.exe" --help
$helpOutput = & "src/ExcelMcp.CLI/bin/Release/net9.0/excelcli.exe" --help
if ($helpOutput -match "Excel Command Line Interface") {
Write-Output "✅ CLI help command working"
Write-Output "📋 Help output preview: $($helpOutput | Select-Object -First 3 | Out-String)"
Expand All @@ -78,4 +78,4 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: ExcelMcp-CLI-${{ github.sha }}
path: src/ExcelMcp.CLI/bin/Release/net10.0/
path: src/ExcelMcp.CLI/bin/Release/net9.0/
10 changes: 5 additions & 5 deletions .github/workflows/build-mcp-server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 10.0.x
dotnet-version: 9.0.x

- name: Restore dependencies
run: dotnet restore src/ExcelMcp.McpServer/ExcelMcp.McpServer.csproj
Expand All @@ -46,13 +46,13 @@ jobs:
- name: Verify MCP Server build
run: |
# Check MCP Server executable
if (Test-Path "src/ExcelMcp.McpServer/bin/Release/net10.0/Sbroenne.ExcelMcp.McpServer.exe") {
if (Test-Path "src/ExcelMcp.McpServer/bin/Release/net9.0/Sbroenne.ExcelMcp.McpServer.exe") {
Write-Output "✅ Sbroenne.ExcelMcp.McpServer.exe built successfully"
$mcpVersion = (Get-Item "src/ExcelMcp.McpServer/bin/Release/net10.0/Sbroenne.ExcelMcp.McpServer.exe").VersionInfo.FileVersion
$mcpVersion = (Get-Item "src/ExcelMcp.McpServer/bin/Release/net9.0/Sbroenne.ExcelMcp.McpServer.exe").VersionInfo.FileVersion
Write-Output "📦 MCP Server Version: $mcpVersion"

# Check for MCP server.json configuration
if (Test-Path "src/ExcelMcp.McpServer/bin/Release/net10.0/.mcp/server.json") {
if (Test-Path "src/ExcelMcp.McpServer/bin/Release/net9.0/.mcp/server.json") {
Write-Output "✅ MCP server.json configuration found"
} else {
Write-Warning "⚠️ MCP server.json configuration not found"
Expand All @@ -69,4 +69,4 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: ExcelMcp-MCP-Server-${{ github.sha }}
path: src/ExcelMcp.McpServer/bin/Release/net10.0/
path: src/ExcelMcp.McpServer/bin/Release/net9.0/
2 changes: 1 addition & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 10.0.x
dotnet-version: 9.0.x

# Initializes the CodeQL tools for scanning
- name: Initialize CodeQL
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-nuget.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 10.0.x
dotnet-version: 9.0.x

- name: Extract version from tag
id: version
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/release-cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 10.0.x
dotnet-version: 9.0.x

- name: Update CLI Version
run: |
Expand Down Expand Up @@ -60,11 +60,11 @@ jobs:
New-Item -ItemType Directory -Path "release/ExcelMcp-CLI-$version" -Force

# Copy CLI files
Copy-Item "src/ExcelMcp.CLI/bin/Release/net10.0/excelcli.exe" "release/ExcelMcp-CLI-$version/"
Copy-Item "src/ExcelMcp.CLI/bin/Release/net10.0/excelcli.dll" "release/ExcelMcp-CLI-$version/"
Copy-Item "src/ExcelMcp.CLI/bin/Release/net10.0/Sbroenne.ExcelMcp.Core.dll" "release/ExcelMcp-CLI-$version/"
Copy-Item "src/ExcelMcp.CLI/bin/Release/net10.0/excelcli.runtimeconfig.json" "release/ExcelMcp-CLI-$version/"
Copy-Item "src/ExcelMcp.CLI/bin/Release/net10.0/*.dll" "release/ExcelMcp-CLI-$version/" -Exclude "excelcli.dll", "Sbroenne.ExcelMcp.Core.dll"
Copy-Item "src/ExcelMcp.CLI/bin/Release/net9.0/excelcli.exe" "release/ExcelMcp-CLI-$version/"
Copy-Item "src/ExcelMcp.CLI/bin/Release/net9.0/excelcli.dll" "release/ExcelMcp-CLI-$version/"
Copy-Item "src/ExcelMcp.CLI/bin/Release/net9.0/Sbroenne.ExcelMcp.Core.dll" "release/ExcelMcp-CLI-$version/"
Copy-Item "src/ExcelMcp.CLI/bin/Release/net9.0/excelcli.runtimeconfig.json" "release/ExcelMcp-CLI-$version/"
Copy-Item "src/ExcelMcp.CLI/bin/Release/net9.0/*.dll" "release/ExcelMcp-CLI-$version/" -Exclude "excelcli.dll", "Sbroenne.ExcelMcp.Core.dll"

# Copy documentation
Copy-Item "docs/CLI.md" "release/ExcelMcp-CLI-$version/README.md"
Expand Down Expand Up @@ -100,7 +100,7 @@ jobs:
$quickStartContent += "- **GitHub**: https://github.com/sbroenne/mcp-server-excel`n`n"
$quickStartContent += "## Requirements`n`n"
$quickStartContent += "- Windows OS with Microsoft Excel installed`n"
$quickStartContent += "- .NET 10.0 runtime`n"
$quickStartContent += "- .NET 9.0 runtime`n"
$quickStartContent += "- Excel 2016+ (for COM interop)`n`n"
$quickStartContent += "## Features`n`n"
$quickStartContent += "- 40+ Excel automation commands`n"
Expand Down Expand Up @@ -162,7 +162,7 @@ jobs:
$releaseNotes += "``````n`n"
$releaseNotes += "### Requirements`n"
$releaseNotes += "- Windows OS with Microsoft Excel installed`n"
$releaseNotes += "- .NET 10.0 runtime`n"
$releaseNotes += "- .NET 9.0 runtime`n"
$releaseNotes += "- Excel 2016+ (for COM interop)`n`n"
$releaseNotes += "### Documentation`n"
$releaseNotes += "- Complete Command Reference: COMMANDS.md in package`n"
Expand Down
23 changes: 18 additions & 5 deletions .github/workflows/release-mcp-server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 10.0.x
dotnet-version: 9.0.x

- name: Update MCP Server Version
run: |
Expand All @@ -37,7 +37,20 @@ jobs:
$mcpContent = $mcpContent -replace '<FileVersion>[\d\.]+\.[\d\.]+</FileVersion>', "<FileVersion>$version.0</FileVersion>"
Set-Content $mcpCsprojPath $mcpContent

Write-Output "Updated MCP Server version to $version"
# Update MCP Server configuration
$serverJsonPath = "src/ExcelMcp.McpServer/.mcp/server.json"
$serverContent = Get-Content $serverJsonPath -Raw

# Update main version field (near top of file, not in _meta section)
$serverContent = $serverContent -replace '(\s*"version":\s*)"[\d\.]+"(\s*,\s*\n\s*"title")' , "`$1`"$version`"`$2"

# Update package version in packages array (specifically after identifier field)
$serverContent = $serverContent -replace '("identifier":\s*"Sbroenne\.ExcelMcp\.McpServer",\s*\n\s*"version":\s*)"[\d\.]+"', "`$1`"$version`""

Set-Content $serverJsonPath $serverContent

Write-Output "Updated MCP Server project version to $version"
Write-Output "Updated MCP Server configuration version to $version"

# Set environment variable for later steps
echo "PACKAGE_VERSION=$version" >> $env:GITHUB_ENV
Expand Down Expand Up @@ -68,7 +81,7 @@ jobs:
New-Item -ItemType Directory -Path "release/ExcelMcp-MCP-Server-$version" -Force

# Copy MCP Server files
Copy-Item "src/ExcelMcp.McpServer/bin/Release/net10.0/*" "release/ExcelMcp-MCP-Server-$version/" -Recurse
Copy-Item "src/ExcelMcp.McpServer/bin/Release/net9.0/*" "release/ExcelMcp-MCP-Server-$version/" -Recurse

# Copy documentation
Copy-Item "README.md" "release/ExcelMcp-MCP-Server-$version/"
Expand Down Expand Up @@ -98,7 +111,7 @@ jobs:
$readmeContent += "- Excel Development Focus - Power Query, VBA, worksheets`n`n"
$readmeContent += "## Requirements`n`n"
$readmeContent += "- Windows OS with Microsoft Excel installed`n"
$readmeContent += "- .NET 10.0 runtime`n"
$readmeContent += "- .NET 9.0 runtime`n"
$readmeContent += "- Excel 2016+ (for COM interop)`n`n"
$readmeContent += "## License`n`n"
$readmeContent += "MIT License - see LICENSE file for details.`n"
Expand Down Expand Up @@ -153,7 +166,7 @@ jobs:
$releaseNotes += "- excel_vba - VBA script management (list, export, import, update, run, delete)`n`n"
$releaseNotes += "### Requirements`n"
$releaseNotes += "- Windows OS with Microsoft Excel installed`n"
$releaseNotes += "- .NET 10.0 runtime`n"
$releaseNotes += "- .NET 9.0 runtime`n"
$releaseNotes += "- Excel 2016+ (for COM interop)`n`n"
$releaseNotes += "### Documentation`n"
$releaseNotes += "- Configuration Guide: See README.md in package`n"
Expand Down
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"cSpell.words": [
"Sbroenne"
]
}
103 changes: 63 additions & 40 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,68 +26,92 @@ A **Model Context Protocol (MCP) server** that enables **AI assistants** like Gi

## 🚀 Quick Start

### Install MCP Server using Microsoft's NuGet MCP Approach (Recommended)
### Install & Configure (2 Steps)

#### Step 1: Install .NET 10 SDK

```powershell
# Install .NET 10 SDK first (required for dnx command)
winget install Microsoft.DotNet.SDK.10

# Download and execute MCP server using dnx
dnx Sbroenne.ExcelMcp.McpServer@latest --yes
```

The `dnx` command automatically downloads the latest version from NuGet.org and executes the MCP server. This follows Microsoft's official [NuGet MCP approach](https://learn.microsoft.com/en-us/nuget/concepts/nuget-mcp) for packaging and distributing MCP servers.

> **Note:** The MCP server will appear to "hang" after startup - this is expected behavior as it waits for MCP protocol messages from your AI assistant.

### Configure with AI Assistants
#### Step 2: Configure GitHub Copilot MCP Server

**GitHub Copilot Integration:**
Create or modify `.vscode/mcp.json` in your workspace:

```json
// Add to your VS Code settings.json or MCP client configuration
{
"mcp": {
"servers": {
"excel": {
"command": "dnx",
"args": ["Sbroenne.ExcelMcp.McpServer@latest", "--yes"],
"description": "Excel development operations through MCP"
}
"servers": {
"excel": {
"command": "dnx",
"args": ["Sbroenne.ExcelMcp.McpServer", "--yes"]
}
}
}
```

That's it! The `dnx` command automatically downloads and runs the latest version when GitHub Copilot needs it.

## 🧠 **GitHub Copilot Integration**

To make GitHub Copilot aware of ExcelMcp in your own projects:

1. **Copy the Copilot Instructions** to your project:

```bash
# Copy ExcelMcp automation instructions to your project's .github directory
curl -o .github/copilot-instructions.md https://raw.githubusercontent.com/sbroenne/mcp-server-excel/main/docs/excel-powerquery-vba-copilot-instructions.md
```

2. **Configure VS Code** (optional but recommended):

```json
{
"github.copilot.enable": {
"*": true,
"csharp": true,
"powershell": true,
"yaml": true
}
}
```

### **Effective Copilot Prompting**

With the ExcelMcp instructions installed, Copilot will automatically suggest Excel operations through the MCP server. Here's how to get the best results:

```text
"Use the excel MCP server to..." - Reference the configured server name
"Create an Excel workbook with Power Query that..." - Natural language Excel tasks
"Help me debug this Excel automation issue..." - For troubleshooting assistance
"Export the VBA code from this Excel file..." - Specific Excel operations
```

### Alternative AI Assistants

**Claude Desktop Integration:**

Add to your Claude Desktop MCP configuration:

```json
// Add to Claude Desktop MCP configuration
{
"mcpServers": {
"excel": {
"command": "dnx",
"args": ["Sbroenne.ExcelMcp.McpServer@latest", "--yes"]
"args": ["Sbroenne.ExcelMcp.McpServer", "--yes"]
}
}
}
```

### Build from Source
**Direct Command Line Testing:**

```powershell
# Clone and build
git clone https://github.com/sbroenne/mcp-server-excel.git
cd mcp-server-excel
dotnet build -c Release

# Run MCP server
dotnet run --project src/ExcelMcp.McpServer

# Run tests (requires Excel installed locally)
dotnet test --filter "Category=Unit"
# Test the MCP server directly
dnx Sbroenne.ExcelMcp.McpServer --yes
```

> **Note:** The MCP server will appear to "hang" after startup - this is expected behavior as it waits for MCP protocol messages from your AI assistant.

## ✨ Key Features

- 🤖 **MCP Protocol Integration** - Native support for AI assistants through Model Context Protocol
Expand All @@ -109,7 +133,6 @@ dotnet test --filter "Category=Unit"
| **[🔧 ExcelMcp.CLI](docs/CLI.md)** | Command-line interface for direct Excel automation |
| **[📋 Command Reference](docs/COMMANDS.md)** | Complete reference for all 40+ CLI commands |
| **[⚙️ Installation Guide](docs/INSTALLATION.md)** | Building from source and installation options |
| **[🤖 GitHub Copilot Integration](docs/COPILOT.md)** | Using ExcelMcp with GitHub Copilot |
| **[🔧 Development Workflow](docs/DEVELOPMENT.md)** | Contributing guidelines and PR requirements |
| **[📦 NuGet Publishing](docs/NUGET_TRUSTED_PUBLISHING.md)** | Trusted publishing setup for maintainers |

Expand Down Expand Up @@ -148,14 +171,14 @@ dotnet test --filter "Category=Unit"

## 6️⃣ MCP Tools Overview

The MCP server provides 6 resource-based tools for AI assistants:
The MCP server provides 6 focused resource-based tools for AI assistants:

- **excel_file** - File management (create, validate, check-exists)
- **excel_powerquery** - Power Query operations (list, view, import, export, update, refresh, delete)
- **excel_worksheet** - Worksheet operations (list, read, write, create, rename, copy, delete, clear, append)
- **excel_parameter** - Named range management (list, get, set, create, delete)
- **excel_cell** - Cell operations (get-value, set-value, get-formula, set-formula)
- **excel_vba** - VBA script management (list, export, import, update, run, delete)
- **excel_file** - Excel file creation (1 action: create-empty) 🎯 *Only Excel-specific operations*
- **excel_powerquery** - Power Query M code management (11 actions: list, view, import, export, update, delete, set-load-to-table, set-load-to-data-model, set-load-to-both, set-connection-only, get-load-config)
- **excel_worksheet** - Worksheet operations and bulk data handling (9 actions: list, read, write, create, rename, copy, delete, clear, append)
- **excel_parameter** - Named ranges as configuration parameters (5 actions: list, get, set, create, delete)
- **excel_cell** - Individual cell precision operations (4 actions: get-value, set-value, get-formula, set-formula)
- **excel_vba** - VBA macro management and execution (6 actions: list, export, import, update, run, delete)

> 🧠 **[Complete MCP Server Guide →](src/ExcelMcp.McpServer/README.md)** - Detailed MCP integration and AI examples

Expand Down
15 changes: 15 additions & 0 deletions Sbroenne.ExcelMcp.sln
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ExcelMcp.Core", "src\ExcelM
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ExcelMcp.McpServer", "src\ExcelMcp.McpServer\ExcelMcp.McpServer.csproj", "{C9CF661A-9104-417F-A3EF-F9D5E4D59681}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ExcelMcp.Core.Tests", "tests\ExcelMcp.Core.Tests\ExcelMcp.Core.Tests.csproj", "{FFEFF3B4-C490-4255-8A47-C1FFA23A97D7}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -87,6 +89,18 @@ Global
{C9CF661A-9104-417F-A3EF-F9D5E4D59681}.Release|x64.Build.0 = Release|Any CPU
{C9CF661A-9104-417F-A3EF-F9D5E4D59681}.Release|x86.ActiveCfg = Release|Any CPU
{C9CF661A-9104-417F-A3EF-F9D5E4D59681}.Release|x86.Build.0 = Release|Any CPU
{FFEFF3B4-C490-4255-8A47-C1FFA23A97D7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FFEFF3B4-C490-4255-8A47-C1FFA23A97D7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FFEFF3B4-C490-4255-8A47-C1FFA23A97D7}.Debug|x64.ActiveCfg = Debug|Any CPU
{FFEFF3B4-C490-4255-8A47-C1FFA23A97D7}.Debug|x64.Build.0 = Debug|Any CPU
{FFEFF3B4-C490-4255-8A47-C1FFA23A97D7}.Debug|x86.ActiveCfg = Debug|Any CPU
{FFEFF3B4-C490-4255-8A47-C1FFA23A97D7}.Debug|x86.Build.0 = Debug|Any CPU
{FFEFF3B4-C490-4255-8A47-C1FFA23A97D7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FFEFF3B4-C490-4255-8A47-C1FFA23A97D7}.Release|Any CPU.Build.0 = Release|Any CPU
{FFEFF3B4-C490-4255-8A47-C1FFA23A97D7}.Release|x64.ActiveCfg = Release|Any CPU
{FFEFF3B4-C490-4255-8A47-C1FFA23A97D7}.Release|x64.Build.0 = Release|Any CPU
{FFEFF3B4-C490-4255-8A47-C1FFA23A97D7}.Release|x86.ActiveCfg = Release|Any CPU
{FFEFF3B4-C490-4255-8A47-C1FFA23A97D7}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -97,5 +111,6 @@ Global
{C2345678-2345-2345-2345-23456789ABCD} = {0AB3BF05-4346-4AA6-1389-037BE0695223}
{819048D2-BF4F-4D6C-A7C3-B37869988003} = {827E0CD3-B72D-47B6-A68D-7590B98EB39B}
{C9CF661A-9104-417F-A3EF-F9D5E4D59681} = {827E0CD3-B72D-47B6-A68D-7590B98EB39B}
{FFEFF3B4-C490-4255-8A47-C1FFA23A97D7} = {0AB3BF05-4346-4AA6-1389-037BE0695223}
EndGlobalSection
EndGlobal
Loading