mcp-server-excel
AGENTS.md803 starsChanged 56 days agoMITView on GitHub
ExcelMcp automates installed desktop Excel through COM on Windows. Use PowerShell and the SDK selected by global.json. Desktop Excel is required for COM tests; GitHub-hosted runners do not have Excel. MCP Server and excelcli are equal entry points: behavior, defaults, validation, results, and documentation must agree. For an unfamiliar area, start with CONTEXT.md for the system map and terminology. Architecture decisions explain current choices and tradeoffs; read the records relevant to an architectural change, not the entire collection for every…
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.
Of the AGENTS.md files we read, the 11,773 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository6 other files it gives its agents.
- llm-tests/AGENTS.mdAGENTS.md
- tests/AGENTS.mdAGENTS.md
- vscode-extension/AGENTS.mdAGENTS.md
- excel-cli-report-formattingSkill
- excel-cliSkill
- excel-mcp-report-formattingSkill
The file
We split this AGENTS.md into the rules it gives an agent
11 rules. About 1 is common, 10 are distinctive, and 0 are very specific to this project.
≈1
Common · estimate
Many files like this have a rule of this kind.
≈10
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Distinctive: line 22
Before changing files, read the matching guides below, including nested AGENTS.md files.
- Distinctive: line 48
Keep agent-facing metadata, server instructions, skills, and recovery messages consistent with implemented behavior.
- Distinctive: line 52
When MCP and CLI spellings differ, show both explicitly or use native examples.
- Distinctive: line 54
Do not tell agents to create or retain workbook backup/recovery copies, or to work on duplicate workbooks as a prerequisite to requested …
- Distinctive: line 64
Do not automatically clean up or roll back workbook changes when an operation fails.
- Common: line 71
Keep customer/workbook data, credentials, connection strings, and private paths out of public artifacts.
- Distinctive: line 95
Run applicable existing checks, not replacement audits:
- Distinctive: line 137
Never commit directly or force-push to main.
- Distinctive: line 138
Never skip, disable, suppress, or bypass a Git hook for any reason, including transient failures or previously passing validation.
- Distinctive: line 148
Before finalizing a PR, resolve every review thread after addressing it, or dismiss it with a clear recorded reason when no change is …
- Distinctive: line 153
Follow .changeset/README.md for package names and validate the fragment against the PR's actual base before pushing.
≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
ExcelMcp agent instructions
ExcelMcp automates installed desktop Excel through COM on Windows. Use
PowerShell and the SDK selected by global.json. Desktop Excel is required
for COM tests; GitHub-hosted runners do not have Excel.
MCP Server and excelcli are equal entry points: behavior, defaults, validation,
results, and documentation must agree.
For an unfamiliar area, start with CONTEXT.md for the system map and terminology. Architecture decisions explain current choices and tradeoffs; read the records relevant to an architectural change, not the entire collection for every task. Surface conflicts before changing a decision. Actionable rules belong here and in the applicable guides below.
Work requests are tracked in GitHub Issues; see issue tracker. Contributor setup and client instruction discovery are in agent development.
Task-specific guidance
Before changing files, read the matching guides below, including nested
AGENTS.md files. Native discovery differs between Copilot, Claude Code, and
Codex; launching at the root does not guarantee every nested file is loaded.
Paths are relative to the repository root.
| Work | Required guidance |
src/**/*.cs | Runtime boundaries |
| Core commands/action models, Service, CLI, MCP, or generators | Generated contracts |
| Core or ComInterop C# | COM safety |
| Connection commands/sanitizer or connection tests/helpers/fixtures | Connections |
tests/**/*.cs | Testing strategy |
Workflows, project files, SDK/build configuration, PowerShell scripts, .changeset/** | Build and release |
| README/index files, FEATURES, CHANGELOG, SECURITY, PRIVACY, docs, specs, skills, or website | Documentation |
| Skill sources, Core command metadata, generators, MCP, or Build-AgentSkills.ps1 | Product agent guidance |
| MCP Server or MCP generator | MCP boundaries |
llm-tests/** | LLM evaluations |
Repository/agent instructions, CONTEXT, or docs/agents/** | Instruction maintenance |
vscode-extension/** | Extension |
videos/excel-mcp-intro/** | Video |
Implementation
- Core
[ServiceCategory]interfaces drive generated Service, CLI, and MCP routing. Change contracts/generators, not emitted code. Follow a changed contract through both entry points, tests, and shared guidance. - Keep agent-facing metadata, server instructions, skills, and recovery messages consistent with implemented behavior. Follow the product agent guidance above; do not edit generated or installed skill copies.
- Preserve exact tool, action, parameter, and flag names in agent guidance. When MCP and CLI spellings differ, show both explicitly or use native examples; do not replace identifiers with vague descriptions.
- Do not tell agents to create or retain workbook backup/recovery copies, or to work on duplicate workbooks as a prerequisite to requested edits. Explain destructive consequences without adding file-copy steps. Copying or exporting is appropriate only when part of the user's request.
- Production code must access workbook contents through Excel COM. Never open an Excel file as a ZIP/OOXML package or parse/modify its internal XML outside tests. Pre-open binary container detection may read only IRM/AIP protection metadata; it must not parse workbook content.
- Behavioral changes require a focused failing regression test before the fix. Documentation/configuration-only changes do not need synthetic tests.
- Do not automatically clean up or roll back workbook changes when an operation fails. Report the exact partial state and error so the agent can inspect the workbook and decide whether cleanup is appropriate.
Success == truerequires an empty or nullErrorMessage.- MCP Server and
excelcliare the only supported product entry points. Do not preserve or add public Core/ComInterop compatibility APIs for hypothetical external consumers when neither entry point uses them. - Keep customer/workbook data, credentials, connection strings, and private paths out of public artifacts. Keep temporary notes outside the repository.
Build and validation
dotnet restore Sbroenne.ExcelMcp.sln
dotnet build Sbroenne.ExcelMcp.sln -c Release --no-restoreBuild with zero warnings. Use targeted tests; see the
testing strategy. Run every Excel-dependent test command
sequentially; never overlap Excel test fixtures, test hosts, or E2E runs.
Runtime changes in Core, ComInterop, Service, CLI, MCP, or their generators also
require scripts\Test-E2E.ps1 locally with Excel. Report it as not run when
Excel is unavailable; build-only checks do not cover COM.
The Python evaluation suite under llm-tests/ is on-demand only, not part of the
normal development lifecycle. This includes offline checks, Excel fixture checks,
SDK discovery, and live agent comparisons. Run it and install its dependencies
only when the user explicitly requests evaluation work. Unrun evaluations or
unavailable Python/SDK dependencies are not implementation, commit, PR, or merge blockers.
This does not waive required .NET/COM/E2E validation or normal Git hooks.
Run applicable existing checks, not replacement audits:
& .\scripts\check-com-leaks.ps1
& .\scripts\Invoke-ExcelFreeTests.ps1 -Local -Contracts
& .\scripts\check-success-flag.ps1
& .\scripts\check-doc-counts.ps1 -SkipBuild
& .\scripts\check-dynamic-casts.ps1
& .\scripts\check-workbook-package-access.ps1-SkipBuild requires a successful Release solution build in this worktree.
Otherwise omit it. PRs record the root cause, affected contracts, and validation.
Code Review Rules
Report high-confidence defects introduced by the change, not style or unrelated cleanup. These checks apply to review tasks; they do not require installing dependencies, running builds, or editing code unless requested.
- Typed PIAs first, except documented runtime gaps (
Application.Run, VBE, Office-core). Do not reintroduce unavailable dependencies. Dynamic COM numeric values needConvert.*, not direct casts. - Acquired COM references require
finallycleanup, excluding session-owned objects. Process cleanup uses PID/start-time identity, never process names. 0x800A03ECis not a unique diagnosis. Preserve batch/Service error context, cancellation, and session recovery; a timeout must not become success.- Core contracts must agree across generated Service, CLI options/batch JSON, MCP schemas, and manual tool exceptions, including defaults and timeouts.
- MCP stdout, including bootstrap output, is JSON-RPC only.
- Agent-facing descriptions, server instructions, skills, and recovery messages must agree with actual defaults and advertised capabilities. Flag stale input names, nonexistent actions, missing parameter documentation, emojis, forced unrequested work, and screenshots required without an interactive desktop. Consent advice is not proof that server-side elicitation is implemented. Distinguish MCP input names from nested JSON keys, outputs, and CLI batch keys.
- Tests establish actual Excel state and returned fields, not only
Success. Generated artifacts must change through their source; use code-derived counts rather than copied literals.
Git and release
- Never commit directly or force-push to
main. - Never skip, disable, suppress, or bypass a Git hook for any reason, including transient failures or previously passing validation. Fix the failure or report the blocker, then rerun the normal hooked command.
- Rewriting a feature branch's remote history requires explicit user
authorization. Use
--force-with-leasewith the expected remote commit; never use plain--force. If the lease fails, stop and inspect the remote changes before retrying. - Coding-agent assignments requesting repository changes authorize delivery commits and a PR. Otherwise ask before commit/push. Merging and publishing require separate authorization.
- Before finalizing a PR, resolve every review thread after addressing it, or dismiss it with a clear recorded reason when no change is appropriate. Never leave review comments unanswered or unresolved.
- User-visible changes require a changeset; internal/docs/tests/CI changes use
the
skip-changelogPR label. Versions andCHANGELOG.mdare release-generated. Follow .changeset/README.md for package names and validate the fragment against the PR's actual base before pushing. - Plugin publication changes must follow
.github/workflows/docs/publish-plugins-setup.md#maintenance-and-updates; the published repository is output-only. - Unchanged plugin output must not create publication commits/tags. Marketplace
updates are opt-in and maintain one owned PR; follow
.github/workflows/docs/awesome-copilot-update-setup.mdfor comparison, guarded writes, catch-up, and pinned workflow compilation.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

