Kookerella.FsOpenXmlDsl.Mcp
0.6.4
dotnet tool install --global Kookerella.FsOpenXmlDsl.Mcp --version 0.6.4
dotnet new tool-manifest
dotnet tool install --local Kookerella.FsOpenXmlDsl.Mcp --version 0.6.4
#tool dotnet:?package=Kookerella.FsOpenXmlDsl.Mcp&version=0.6.4
nuke :add-package Kookerella.FsOpenXmlDsl.Mcp --version 0.6.4
Kookerella.FsOpenXmlDsl.Mcp
An MCP (Model Context Protocol) server that exposes
Kookerella.FsOpenXmlDsl's Excel read/write/code-generation capabilities as tools any
MCP-compatible AI agent can call directly - build a workbook, read one back, or regenerate
its F#, C#, XML, or JSON representation - without writing any code itself.
Most Excel libraries only go one direction: build a workbook from scratch, or mutate an
existing one, through an imperative object model. This one also goes the other way - read
any existing .xlsx/.xlsm and hand back idiomatic, runnable F# or C# source (or plain
XML or JSON, each against a real schema) that rebuilds an equivalent file, and build a new
one from that XML/JSON directly. A decompiler for spreadsheets, not just a writer. That's
available three ways from this one binary: as MCP tools (generate_fsharp_script/
generate_csharp_script/generate_xml/create_workbook_from_xml/generate_json/
create_workbook_from_json, plus generate_xml_schema/generate_json_schema for the
schemas themselves) for an AI agent, as a plain CLI (fsopenxmldsl-mcp convert/build) for anyone who isn't going through an MCP client, and as direct library
calls (Workbook.generateScript/CsCodeGen.Generate/Xml.ofWorkbook/Xml.toWorkbook/
Json.ofWorkbook/Json.toWorkbook) for either to call themselves.
The XML/JSON directions each have two concrete uses beyond code generation: build an
.xlsx from XML/JSON a transform engine already produces (an XSLT pipeline, or any
templating/generation script, can target Excel with no code at all), and convert an
existing .xlsx to XML/JSON for version control - .xlsx is a binary ZIP, so git diff
on one is useless, but generate_xml/generate_json's output is deterministically ordered
(sorted by cell position, or by name for defined names) regardless of the source workbook's
own list order, so a real content change produces a small, isolated diff rather than a
spurious one from reshuffled rows.
This runs locally, as a subprocess your MCP client launches over stdio - there's no hosted service, no network address, and no account to sign up for. It's distributed as a .NET tool for exactly that reason: an MCP client just needs a command it can run, the same way it'd run any other CLI.
How this compares
Reviewing the ~19 Excel-focused MCP servers listed on Glama at the time of writing: most are
either Python/openpyxl-based generate-only tools, or COM/AppleScript controllers that
automate an actually-open, visible Excel window. A handful cover formulas, charts, or pivot
tables the way this one does. None of the ones we reviewed mention decompiling a workbook
into runnable source code, and none offer a schema-validated XML/JSON round trip - the two
things this server leads with:
- Round-trip fidelity as a tested guarantee, not a claim - build, save, read back, identical structure, validated against the real OOXML schema in the core library's own test suite. The generate-only tools we found have no equivalent check, by construction.
- Decompile to runnable source -
generate_fsharp_script/generate_csharp_scriptturn an existing.xlsxinto code that rebuilds it. We didn't find this capability in any of the servers we reviewed. - Schema-validated XML/JSON surfaces -
Xml.xsd/Json.schema.json, so any language (not just .NET) can drive this server, and a workbook becomes real,git diff-able text. - No Excel install required - several of the servers we reviewed need a live, visible desktop Excel session running via COM/AppleScript; this one is a pure OOXML library and needs nothing but the .NET runtime.
- Listed in the official MCP Registry as
io.github.MarkNicholls/fsopenxmldsl-mcp- none of the servers in either directory pass we reviewed showed this status.
Install
dotnet tool install -g Kookerella.FsOpenXmlDsl.Mcp
This installs the fsopenxmldsl-mcp command onto your PATH.
Configure your MCP client
Point your client at the installed command. For example, in a client that reads a JSON
config with a mcpServers map:
{
"mcpServers": {
"fsopenxmldsl": {
"command": "fsopenxmldsl-mcp"
}
}
}
Command-line usage
The same binary also works as a plain CLI, for converting a file without an MCP client at
all - fsopenxmldsl-mcp with no arguments starts the MCP server (as above); with a convert
or build first argument it runs once and exits:
fsopenxmldsl-mcp convert report.xlsx --lang csharp
Prints the equivalent C# source to stdout. Options:
--lang/-l(required) —fsharp,csharp,xml, orjson.-o/--output <file>— write the result to a file instead of stdout.--rebuild-as <name.xlsx>—fsharp/csharponly, the filename the generated script itself saves its rebuilt workbook to when run (defaultoutput.xlsx). Ignored for--lang xml/json, which have no script to embed a save path into.
fsopenxmldsl-mcp convert report.xlsx --lang fsharp -o report.fsx --rebuild-as rebuilt.xlsx
dotnet fsi report.fsx
build is the inverse of convert --lang xml/convert --lang json - it takes XML matching
Xml.xsd or JSON matching Json.schema.json and produces an .xlsx directly, for a caller
(e.g. an XSLT pipeline, or a plain JSON-emitting script) that already produces data that way
and wants to reach Excel without writing any code. Which format build reads is inferred
from the input file's own extension (.xml or .json):
fsopenxmldsl-mcp convert report.xlsx --lang xml -o report.xml # .xlsx -> XML
fsopenxmldsl-mcp build report.xml rebuilt.xlsx # XML -> .xlsx
fsopenxmldsl-mcp convert report.xlsx --lang json -o report.json # .xlsx -> JSON
fsopenxmldsl-mcp build report.json rebuilt.xlsx # JSON -> .xlsx
Demos
A full worked example of every convert/build direction above - decompiling one real
invoice template into C#, F#, an XSLT transform, and a plain JSON-generation script, each
wired up to real data and real tests proving the result stays schema-valid - lives in a
companion repo:
Kookerella.Demo.DecompileToSource.
Tools
create_workbook(path, sheets)— creates a new.xlsxfrom a simple grid of sheets/rows/cells. Each cell is given as plain text, the same way you'd type it into Excel: a leading=makes it a formula (e.g."=SUM(A1:A2)"),"true"/"false"makes a boolean, a bare number is numeric, anything else is text.read_workbook(path)— reads an existing.xlsx/.xlsmand returns its sheets and cells as JSON, using the same text convention ascreate_workbook's input (so a value round-trips through both tools unchanged).generate_fsharp_script(path, outputFileName)— reads an existing workbook and returns a self-contained F# script that rebuilds an equivalent file when run viadotnet fsi, using the fullKookerella.FsOpenXmlDslAPI.generate_csharp_script(path, outputFileName)— the C# equivalent, for a caller who wants pasteable/runnable C# rather than F#. Reads an existing workbook throughKookerella.CsOpenXmlDsl(the idiomatic C# wrapper - now full feature parity with the F# core, see its own scope below) and returns a self-contained.csfile targeting .NET 10's file-based apps feature:dotnet run <file>.cs, no.csprojneeded. References the publishedKookerella.CsOpenXmlDslNuGet package (via a#:packagedirective pinned to the version this server was built against), so the result runs on any machine with the .NET 10 SDK, not just this one.generate_xml(path)— a plain-data alternative to the twogenerate_*_scripttools: reads an existing workbook and returns it as XML, validated againstKookerella.FsOpenXmlDsl's own embedded schema (Xml.xsd). NooutputFileNameparameter, since the result is data, not a runnable script with a save path to embed.create_workbook_from_xml(xml, path)— the inverse ofgenerate_xml: builds a new workbook from XML matchingXml.xsdand saves it topath. Unlikecreate_workbook, this isn't limited to plain cell values - styling, tables, charts, and every other modeled feature can be expressed in the XML, since it goes through the same schemagenerate_xmlproduces.generate_json(path)— the JSON equivalent ofgenerate_xml: reads an existing workbook and returns it as JSON. Unlikegenerate_xml, there's no runtime JSON Schema validation built into the core library itself (seegenerate_json_schemabelow for why), but the documented shape is still retrievable.create_workbook_from_json(json, path)— the inverse ofgenerate_json: builds a new workbook from JSON matching the shapegenerate_jsonproduces and saves it topath. Same relationship tocreate_workbookascreate_workbook_from_xmlhas - not limited to plain cell values.generate_xml_schema()— returns the raw XSD (Xml.xsd) thatgenerate_xml/create_workbook_from_xmlconform to, so a caller authoring XML by hand or by transform (e.g. an XSLT stylesheet) can get real schema validation/autocomplete in their own editor or pipeline instead of reverse-engineering the shape from an example.generate_json_schema()— the JSON equivalent: returns the raw JSON Schema (Json.schema.json) thatgenerate_json/create_workbook_from_jsonconform to. This schema isn't validated against at runtime by the core library the wayXml.xsdis - JSON Schema has no .NET-built-in equivalent toSystem.Xml.Schema, so wiring that up there would mean adding a runtime dependency (JsonSchema.Net) to every consumer of the core library just for this. It's bundled in this Mcp tool specifically, purely to hand back on request.
Scope
create_workbook/read_workbook are a deliberately narrow first pass over the library, not
the whole thing: plain cell values and formulas only, addressed by a row/column grid per
sheet. Cell styling, tables, charts, images, pivot tables, sparklines, conditional
formatting, and everything else Kookerella.FsOpenXmlDsl supports aren't exposed through
those two tools — an agent that needs those should reference the library directly, or use
one of the other six workbook-decompiling tools on a file that already has them to see it
represented as source or data (generate_xml_schema/generate_json_schema are a separate
pair - they don't take a workbook at all, just hand back the schema itself). All six cover
the full worksheet/workbook-level feature set:
generate_fsharp_script the full F# core, generate_csharp_script/generate_xml/
create_workbook_from_xml/generate_json/create_workbook_from_json everything
Kookerella.CsOpenXmlDsl/Xml.fs/Json.fs model, which are now the same feature set as
the F# core. See the main project's
MAPPING.md
for the full picture of what the underlying library does and doesn't model.
create_workbook's formula cells never carry a cached value (there's no formula
evaluation engine anywhere in this stack - see the main project's README for why that
matters for anything that isn't opened in real Excel first).
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
This package has no dependencies.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.6.4 | 113 | 9/4/2026 |
| 0.6.3 | 117 | 8/29/2026 |
| 0.6.2 | 111 | 8/29/2026 |
| 0.6.1 | 104 | 8/28/2026 |
| 0.6.0 | 136 | 8/27/2026 |
| 0.5.1 | 119 | 8/26/2026 |
| 0.5.0 | 124 | 8/25/2026 |
| 0.4.0 | 110 | 8/25/2026 |
| 0.3.1 | 111 | 8/24/2026 |
| 0.3.0 | 109 | 8/24/2026 |
| 0.2.0 | 110 | 8/24/2026 |
| 0.1.3 | 123 | 8/23/2026 |
| 0.1.2 | 114 | 8/23/2026 |
| 0.1.1 | 102 | 8/23/2026 |
| 0.1.0 | 107 | 8/23/2026 |