
spreadsheet-kit MCP
io.github.PSU3D0由 GitHub 帳號 PSU3D0 發布v0.11.1更新於 Oct 27, 2026
Agent-safe Excel workbook analysis, editing, recalc, and verification tools.
概覽
本機 MCP 伺服器,讓助理以具狀態、適合代理的方式讀取、分析、編輯、重算並驗證 Excel 活頁簿。
- 可以做什麼
- 檢視活頁簿:列出工作表、辨識區域與表格、讀取指定範圍、儲存格、版面、具名範圍與活頁簿中繼資料,支援分頁與匯出為 CSV 或 grid JSON。
- 搜尋與分析:依標籤或語意尋找值、搜尋公式、彙整公式複雜度、追蹤公式,並在變更前預覽結構性參照影響。
- 寫入與重構:批次修改值、樣式、公式模式、結構、欄寬、版面與規則,並支援附加列、複製範本列與列帶,皆可先試跑預覽。
- 重算與驗證:呼叫原生計算引擎重算,再證明目標儲存格的變化並與基準活頁簿做差異比對。
- 工作階段管理:事件溯源式編輯,支援日誌、分支、復原/重做、取出、套用與產出為新檔案。
- 契約化:探索、驗證並綁定檢查 SheetPort 清單,以 JSON 輸入執行;另有選用的截圖與 VBA 檢視工具。
- 適用情境
- 當助理需要處理真實的 .xlsx 或 .xlsm 檔案而非截圖時使用:多輪建模、需要重算與證明的批次修改,或契約驅動的試算表自動化。適合希望先試跑預覽並做驗證、而不是盲目寫入儲存格的場景。
- 執行需求
- 以本機程序透過 stdio(或回環位址上的 HTTP)執行,可用原生二進位檔或已發布的 Docker 映像。需要一個活頁簿工作區根目錄,透過命令列參數或 SPREADSHEET_MCP_WORKSPACE 指定。寫入與重算工具預設關閉,需設定 SPREADSHEET_MCP_RECALC_ENABLED;完整版 Docker 映像已包含。不需帳號或 API 金鑰。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 spreadsheet-kit MCP,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
agent-spreadsheet
[CI] [Crates.io] [npm] [License]
agent-spreadsheet is the tool interaction service for agent-based spreadsheet usage.
It gives agents a safe, inspectable, token-efficient way to read, analyze, mutate, verify, and operationalize Excel workbooks without falling back to brittle UI automation.
If you want an agent to work with spreadsheets like a real system instead of a screenshot puppet, this is the stack.
What this project is
agent-spreadsheet ships a unified spreadsheet interaction layer across three surfaces:
The WASM build (agent-spreadsheet-wasm) is the SDK's local runtime, not a separate product surface: JS and TypeScript code targets one object model and the execution substrate (server vs embedded engine) is a configuration choice.
In 0.16 these surfaces share the resident Rust document/evaluator runtime and 32-operation registry. Explicit native sessions automatically start a private journal-backed host. SDK/WASM and genuine just-bash sessions retain their history in memory; XLSX export saves a document snapshot, not a restartable session journal. Warm edit/recalculate/read loops avoid XLSX serialization and repeated evaluator ingestion. See runtime guarantees and limits and the SDK/just-bash examples.
Supported workbook modes:
.xlsx/.xlsm— read + write.xls/.xlsb— discovery/read-oriented workflows only
Powered by Formualizer
Default in-process calculation uses Formualizer — a permissively licensed (MIT/Apache-2.0) spreadsheet engine written in Rust: formula parsing, dependency-graph recalculation, 400+ Excel functions, dynamic arrays, and deterministic evaluation built for agents. No Excel COM or headless LibreOffice is required. Optional LibreOffice integration remains available, but Formualizer is the release-critical backend.
That native engine is why this project can offer what most spreadsheet tooling for agents cannot: recalculate the actual workbook, trace which cells changed and why, and prove it — not just read cached values or push blind edits.
Embedding spreadsheet logic in your own product rather than driving workbooks as an agent? Use Formualizer directly (Rust, Python, JS/WASM).
Why agents use agent-spreadsheet
Built for tool use, not just humans
- deterministic JSON contracts
- schema and example discovery from the CLI itself
- explicit pagination and compact output modes
- machine-readable warnings and error envelopes
Safe mutation, not blind mutation
- dry-run first workflows
- stateless output modes and overwrite safety
- event-sourced session editing
- verification surfaces for proving downstream outcomes
- structural impact analysis before risky workbook changes
Spreadsheet-aware, not generic file editing
- region detection
- table and footer-aware append helpers
- template row / row band cloning
- formula-specific replace and diagnostics
- named range CRUD
- recalculation + diff + proof flows
Good agent ergonomics
- nested command groups with legacy alias compatibility
- token-efficient reads
- exact-cell inspection and layout inspection
- workflow helpers for the repetitive parts agents usually get wrong
What is new / what makes this stack different
The current surface is much stronger than a plain “read some cells” tool. Major capabilities now include:
aspas the primary CLI withagent-spreadsheetpreserved as a compatibility alias- grouped verification via
asp verify proofandasp verify diff - preview-first workflow helpers for:
write appendwrite clone-template-rowwrite clone-row-band
- formula-safe batch workflows with parse-policy diagnostics
- cell/layout/export/import inspection surfaces
- named range management (
write name define|update|delete) - formula-only replacement (
write formulas replace) - event-sourced session editing with log, branch, undo/redo, fork, apply, and materialize
- SheetPort manifest lifecycle + execution for contract-driven spreadsheet automation
Install
Shell installer
The installer downloads a prebuilt CLI to ~/.local/bin and creates the asp command. Pin a release with ASP_VERSION=0.16.0, set ASP_INSTALL_DIR to choose another destination, or pass --mcp to install the MCP server too:
npm
This installs both asp (the primary command) and agent-spreadsheet (the compatibility alias) from a prebuilt native binary. No Rust toolchain is required.
cargo-binstall
This installs the prebuilt CLI in seconds.
Cargo
This builds the CLI from source. Formualizer (the native Rust recalc engine) is included by default.
mise
MCP server
Docker
JavaScript SDK
Prebuilt binaries
Download raw binaries and archives from GitHub Releases.
Published native assets include:
- Linux x86_64
- Linux arm64
- macOS x86_64
- macOS arm64
- Windows native binaries are not shipped for 0.16; native release validation targets Linux and macOS
Start here: the core workflows
1) Orient the workbook before reading cells
2) Inspect exactly what an agent needs
3) Do a safe stateless edit → recalc → proof → diff loop
A representative label-mode lookup:
4) Preview structural risk before mutating the workbook
This is intentionally read-only. It surfaces shifted spans, absolute-reference warnings, token counts, and optional before/after formula samples.
5) Use workflow helpers instead of reinventing row logic
6) Use a stateful session when the edit story gets complex
And when you need proper history and branching:
7) Turn workbook interfaces into contracts with SheetPort
CLI overview
The primary CLI is asp.
agent-spreadsheet remains available as a compatibility alias, so both of these are valid:
Preferred command groups
asp read ...asp analyze ...asp write ...asp workbook ...asp verify ...asp session ...asp sheetport ...
Legacy aliases
Legacy flat commands are still normalized to the new nested surface where practical. That makes migration easier for older prompts, docs, and automation.
Discoverability built into the CLI
When an agent is unsure of payload shape, it can ask the tool directly:
Canonical machine calls use the same registry and dispatcher as other surfaces. asp schema <canonical-op> and asp example <canonical-op> project the native adapter contract: resource_id and, for verification, baseline_resource_id are omitted from required JSON because --bind and --baseline inject ephemeral resources. The host-independent asp registry --all remains unchanged.
--bind reads the current workbook, while --baseline supplies the second workbook only for verify_workbook. Canonical mutable CLI calls require exactly one persistence target: --output <path> writes a new file or --in-place atomically replaces the bound file; pure preview persists nothing and accepts neither. Durable fork, checkpoint, stage, and history operations are intentionally absent from stateless CLI discovery. This is a core design principle: the surface should explain itself to the agent.
Command families
read — extraction and inspection
Why these matter for agents
Agents rarely need “the whole spreadsheet.” They need:
- the right region
- the right page
- the right cells
- just enough layout to understand intent
That is why the read surface combines region detection, structured reads, detail inspection, and explicit continuation.
analyze — search, diagnostics, and impact understanding
Why this matters
Headless spreadsheet automation wins when it can explain consequences, not just execute mutations. ref-impact, formula-trace, and grouped diagnostics are all part of that story.
write — safe mutations and workflow helpers
Safety model
Most mutating commands support a strict mode matrix:
--dry-run--in-place--output <PATH>
This matters for agents because it allows:
- dry-run planning
- non-destructive execution
- explicit overwrite control
Formula maintenance
Formula mutation is now a first-class surface:
Named range maintenance
workbook — file-level flows
verify — proof, not vibes
Why verification matters
Most spreadsheet automation tools stop at “the edit applied.”
agent-spreadsheet goes further:
- did the target cells change the way we expected?
- did the workbook introduce new errors?
- which changes were direct edits vs recalculation fallout?
- what changed overall, grouped in a way an agent can reason about?
This verification layer is a big part of why this project is a serious agent substrate rather than a utility script.
session — event-sourced stateful editing
The session surface is for workflows that are too complex for a single stateless write.
What sessions give you
- persistent editing state
- staged dry-run operations
- compare-and-swap apply semantics
- logs and replayability
- branch/switch/fork flows
- undo / redo / checkout
- explicit materialization back to a workbook file
Canonical loop
History and branching
Use sessions when you want repeatability, auditability, and multi-step safety.
sheetport — spreadsheet interfaces as executable contracts
SheetPort is the workflow surface for turning workbook inputs/outputs into explicit machine contracts.
Manifest lifecycle
Bind-check + run
Use this when you want a workbook to behave less like an opaque file and more like a declared service interface.
Output contracts for agents
Canonical vs compact shapes
All commands default to JSON. Many also support:
Policy:
- canonical keeps the full stable schema
- compact removes wrapper noise where the contract allows it while preserving continuation fields and command-specific semantics
Shape policy:
- Canonical (default): preserve the full response schema.
- range-values: returns a stable
values: [...]envelope in both canonical and compact modes. - range-values default encoding: dense JSON (
dense.encoding = "dense_v1") withdictionary+ run-lengthrow_runs. - range-values
--include-formulas: includes sparse formula coordinates in dense mode (dense.formulas), or a matrix in explicitjsonformat. - read-table and sheet-page: compact preserves the active branch and continuation fields (
next_offset,next_start_row). - formula-trace compact: omits per-layer
highlightswhile preservinglayersandnext_cursor.
Deterministic pagination loops
sheet-page machine contract
- Inspect top-level
formatbefore reading payload fields. format=full: read top-levelrowsplus optionalheader_rowandnext_start_row.format=compact: readcompact.headers,compact.header_row,compact.rowsplus optionalnext_start_row.format=values_only: readvalues_only.rowsplus optionalnext_start_row.- Continuation is always driven by top-level
next_start_rowwhen present. - Global
--shape compactpreserves the activesheet-pagebranch; it does not flattensheet-pagepayloads.
Machine continuation example:
- Request page 1 without
--start-row. - If
next_start_rowis present, callsheet-pageagain with--start-row <next_start_row>. - Stop when
next_start_rowis omitted.
Self-describing payloads
When the agent is unsure what to send, ask for a schema or example:
Batch payload examples
All batch payloads use a top-level envelope object. Most commands require {"ops":[...]}; column-size-batch prefers {"sheet_name":"...","ops":[...]} and also accepts per-op sheet_name inside {"ops":[...]}.
transform-batch payloads (@transform_ops.json)
- Minimal:
{"ops":[{"kind":"fill_range","sheet_name":"Sheet1","target":{"kind":"range","range":"B2:B4"},"value":"0"}]} - Advanced:
{"ops":[{"kind":"replace_in_range","sheet_name":"Sheet1","target":{"kind":"region","region_id":1},"find":"N/A","replace":"","match_mode":"contains","case_sensitive":false,"include_formulas":true}]}
style-batch payloads (@style_ops.json)
- Minimal:
{"ops":[{"sheet_name":"Sheet1","target":{"kind":"range","range":"B2:B2"},"patch":{"font":{"bold":true}}}]} - Advanced:
{"ops":[{"sheet_name":"Sheet1","target":{"kind":"cells","cells":["B2","B3"]},"patch":{"number_format":"$#,##0.00","alignment":{"horizontal":"right"}},"op_mode":"merge"}]}
write batch formula-pattern payloads (@formula_ops.json)
- Minimal:
{"ops":[{"sheet_name":"Sheet1","target_range":"C2:C4","anchor_cell":"C2","base_formula":"B2*2"}]} - Advanced:
{"ops":[{"sheet_name":"Sheet1","target_range":"C2:E4","anchor_cell":"C2","base_formula":"B2*2","fill_direction":"both","relative_mode":"excel"}]} relative_modevalid values:excel,abs_cols,abs_rows
structure-batch payloads (@structure_ops.json)
- Minimal:
{"ops":[{"kind":"rename_sheet","old_name":"Summary","new_name":"Dashboard"}]} - Advanced:
{"ops":[{"kind":"copy_range","sheet_name":"Sheet1","dest_sheet_name":"Summary","src_range":"A1:C4","dest_anchor":"A1","include_styles":true,"include_formulas":true}]}
column-size-batch payloads (@column_size_ops.json)
- Minimal (preferred):
{"sheet_name":"Sheet1","ops":[{"range":"A:A","size":{"kind":"width","width_chars":12.0}}]} - Advanced (preferred):
{"sheet_name":"Sheet1","ops":[{"target":{"kind":"columns","range":"A:C"},"size":{"kind":"auto","min_width_chars":8.0,"max_width_chars":24.0}}]} - Also accepted (harmonized shape):
{"ops":[{"sheet_name":"Sheet1","range":"A:A","size":{"kind":"width","width_chars":12.0}}]}
sheet-layout-batch payloads (@layout_ops.json)
- Minimal:
{"ops":[{"kind":"freeze_panes","sheet_name":"Sheet1","freeze_rows":1,"freeze_cols":1}]} - Advanced:
{"ops":[{"kind":"set_page_setup","sheet_name":"Sheet1","orientation":"landscape","fit_to_width":1,"fit_to_height":1}]}
rules-batch payloads (@rules_ops.json)
- Minimal:
{"ops":[{"kind":"set_data_validation","sheet_name":"Sheet1","target_range":"B2:B4","validation":{"kind":"list","formula1":"\"A,B,C\""}}]} - Advanced:
{"ops":[{"kind":"set_conditional_format","sheet_name":"Sheet1","target_range":"C2:C10","rule":{"kind":"expression","formula":"C2>100"},"style":{"fill_color":"#FFF2CC","bold":true}}]}
write batch formula-pattern clears cached results for touched formula cells; run workbook recalculate to refresh computed values.
Formula parse policy
Formula-aware commands support:
fail— abortwarn— continue and attach grouped diagnosticsoff— skip silently
This lets agents choose between strictness and progress depending on the workflow.
CLI reference excerpts
read values <file> <sheet> <range> [range...] [--format dense\|json\|values\|csv] [--include-formulas]read cells <file> <sheet> <target> [target...] [--include-empty]read page <file> <sheet> --format <full|compact|values_only> [--start-row ROW] [--page-size N]workbook create <path> [--sheets Inputs,Calc,...] [--overwrite]analyze find-value <file> <query> [--sheet S] [--mode value\|label] [--label-direction right\|below\|any]write batch transform <file> --ops @ops.json (--dry-run\|--in-place\|--output PATH)
Formula write-path provenance (write_path_provenance)
Formula-writing commands emit optional provenance metadata for troubleshooting:
written_via: write path (edit,transform_batch,apply_formula_pattern)formula_targets: sheet/cell or sheet/range targets touched by formula writes
Debug compare workflow:
- Apply the same formula target via two paths.
- Compare
write_path_provenance.written_viaandformula_targetsin responses. - Use
inspect-cellsplusrecalculateto compare resulting behavior.
Financial presentation starter defaults
- Keep label columns (often column A) explicitly sized (roughly
24–36chars) to prevent clipping. - Apply consistent number formats by semantic type:
- Currency:
"$"#,##0.00_);[Red]("$"#,##0.00) - Percent:
0.0% - Integer/count:
#,##0
- Currency:
- Apply
sheet-layout-batchfreeze panes after header layout stabilizes.
JSON output is compact by default; use --quiet to suppress warnings.
Global --output-format csv is currently unsupported; use command-specific CSV options like read table --table-format csv.
MCP server quickstart
The MCP surface is the stateful server version of agent-spreadsheet.
Use it when you want:
- workbook caching across calls
- fork lifecycle instead of stateless file replacement
- multi-turn agent workflows
- screenshots and richer server-side orchestration
Claude Code / Claude Desktop
Add to ~/.claude.json or project .mcp.json:
Docker
:latest is the read-only slim image (write/fork/recalc tools disabled); :latest-full includes the write tools and recalculation (LibreOffice-backed).
HTTP mode
The same process also serves a plain canonical HTTP route for programmatic clients that do not speak MCP:
Canonical errors return the canonical error envelope with the status mapped from the error code (400 invalid request, 404 unknown operation / resource, 409 revision conflict, 500 operation failed, 501 capability unavailable). Like /mcp, /v1 has no authentication; the loopback default bind is the security boundary. See docs/architecture/canonical-http-route.md.
Configuration
Every setting is available as a CLI flag (agent-spreadsheet-mcp --help), an environment variable, or a config file key (--config file.yaml). CLI takes precedence over the config file.
Setting any of the timeout/limit variables (TOOL_TIMEOUT_MS, MAX_RESPONSE_BYTES, MAX_PAYLOAD_BYTES, MAX_CELLS, MAX_ITEMS) to 0 disables that limit.
MCP tool surface
The default MCP router is generated from the canonical operation registry. A write-capable baseline exposes 27 operations: 17 discovery/read/analysis operations and 10 write/lifecycle operations. Capability-backed deployments can add screenshot_sheet, sheetport_manifest, execute_sheetport, and inspect_vba, for up to 31. Nineteen canonical operations are read-only.
Each tool uses the registry descriptor's closed input schema and returns the canonical schema_version / operation / resource_id / revision_id / data envelope. A revision_id identifies the complete observable resource state, not only workbook cell-content bytes: recalculation, evaluation/provenance state, or lifecycle metadata can advance it without a content edit. Clients must use the revision from the latest response envelope for compare-and-swap, cursor, and freshness decisions rather than computing or retaining a content hash. Static MCP annotations report the descriptor's worst-case risk; descriptions identify action-specific risk. close_workbook is excluded because cache eviction is runtime administration.
For the complete operation list and contracts, see Canonical Operation Surface. To add the legacy 0.13 names for one compatibility window, set SPREADSHEET_MCP_SLIM_SURFACE=false; shared names use their legacy schema and envelope in compatibility mode and are registered only once.
JS SDK
agent-spreadsheet-sdk is the app-facing integration layer — the one surface JS/TS code should target.
It provides generated canonical convenience methods, legacy input aliases, unchanged canonical envelopes, and typed capability errors. The complete 31-operation manifest supplies schemas and methods, while availability always comes from the selected live backend.
Backends are a configuration choice, not separate APIs:
- MCP backend — connect to a running
agent-spreadsheet-mcpserver (shared state, forks, multi-client) - Embedded WASM backend — the engine runs in-process on workbook bytes, no server or filesystem required (browser, Node, serverless). The
agent-spreadsheet-wasmcrate in this repo is that backend's build artifact; it is an internal dependency of the SDK, not a package you consume directly.
Install:
Backend status: MCP backend is stable and negotiates operations through live tool discovery (or an explicit supportedOperations list); the embedded WASM backend derives support from its generated binding's operations() descriptors and is tested against the real wasm-bindgen Node package in CI.
Recalc backends
Formula recalculation is pluggable.
Feature notes:
recalc-formualizeris enabled by defaultrecalc-libreofficeis available for LibreOffice-backed builds- read and many write flows still work without recalc; only recalculate itself requires a backend
Docker images
Published at ghcr.io/psu3d0/agent-spreadsheet-mcp:
Examples:
Workspace layout
Package roles
Architecture notes
Core ideas:
- one semantic core shared across CLI, MCP, session, and WASM-facing work
- region detection for structural awareness
- token-efficient defaults so agents do not over-read spreadsheets
- verification as a first-class feature rather than an afterthought
- workflow helpers for the common mutations that spreadsheet agents repeatedly struggle with
Token-efficient workflow reference:
Recommended progression:
- discover workbook + sheets
- detect regions / table-like structures
- inspect only the exact region or cells needed
- mutate with dry-run or session staging
- recalculate if needed
- verify proof and review grouped diffs
Development
Local MCP iteration:
Or point your MCP client directly at the local binary:
Read more
- CLI package README:
npm/agent-spreadsheet - Core crate README:
crates/agent-spreadsheet - MCP crate README:
crates/agent-spreadsheet-mcp - JS SDK README:
npm/agent-spreadsheet-sdk - WASM wrapper README:
crates/agent-spreadsheet-wasm - Packaging/versioning notes:
docs/PACKAGING.md - Heuristics and region detection:
docs/HEURISTICS.md - Recalc architecture:
docs/RECALC.md
License
Apache-2.0
來源:README.md,提交 9cc6c50
工具
0版本歷史
1- v0.11.1最新Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分