sheet-compressor
Compresses spreadsheets into compact encodings, enables Q&A on sheet content, and extracts structured order data via LLM calls.
README
sheet-compressor MCP Server
An MCP server that wraps the sheet-compressor library, exposing it to
Claude Desktop / Claude Code over stdio. It demonstrates all three MCP
primitives — Tool, Resource, Prompt — plus a stretch extract_orders
tool that makes one Claude call on Bedrock to return schema-valid order JSON.
See docs/PRD.md for the full spec, CONTEXT.md
for the domain vocabulary, and PRODUCTION.md for the
enterprise path (transport, deploy, governance, observability, CI gates).
Install
Python 3.10+.
pip install -r requirements.txt
cp .env.example .env # adjust LLM_PROVIDER / AWS_REGION / model ids
extract_orders needs AWS credentials in the standard chain
(~/.aws/credentials, SSO, instance role) or — if you flip
LLM_PROVIDER=anthropic — ANTHROPIC_API_KEY in your environment. The Core
primitives (compress_spreadsheet, example_sheet, sheet_qa) make no
LLM calls and need no credentials.
Register
Claude Desktop
mcp install server.py
Or hand-edit claude_desktop_config.json:
{
"mcpServers": {
"sheet-compressor": {
"command": "python",
"args": ["/absolute/path/to/server.py"],
"env": {
"LLM_PROVIDER": "bedrock",
"AWS_REGION": "us-east-1",
"BEDROCK_MODEL_ID": "anthropic.claude-haiku-4-5"
}
}
}
}
Restart Claude Desktop and the tool, resource, and prompt appear in the client.
Claude Code
Add a .mcp.json at the repo root (or ~/.claude/mcp.json for global):
{
"mcpServers": {
"sheet-compressor": {
"command": "python",
"args": ["/absolute/path/to/server.py"],
"env": {
"LLM_PROVIDER": "bedrock",
"AWS_REGION": "us-east-1",
"BEDROCK_MODEL_ID": "anthropic.claude-haiku-4-5"
}
}
}
}
Then /mcp inside Claude Code confirms sheet-compressor is connected and
lists the three primitives + the stretch tool.
Demo
The demo runs against examples/northstar-auto-q3-2025.xlsx (the
automotive hero file: regional dealer-group sales, deliberately messy —
merged headers, stacked per-region tables, blank gaps). One-line summary, in
the client:
Use sheet-compressor to compress
examples/northstar-auto-q3-2025.xlsx, then usesheet_qato tell me which region had the most orders, then runextract_orderson the same file and report the total revenue.
That asks the client to walk the three primitives in sequence:
compress_spreadsheetturns the hero file into the compact anchor encoding and returns its token figures.sheet_qawraps the encoding with the anchor reader explainer + thesheetQAtask template so the model can decode the sheet and answer the region question from cell values — no extra LLM call from the server.extract_orderscompresses the sheet again and makes one Bedrock call with structured outputs to return{orders: [...], total_revenue}.
This is the flow the eval harness regression-tests, and the
flow PRODUCTION.md describes hardening for enterprise
deployment.
Tool — compress_spreadsheet
compress_spreadsheet(xlsx_path: str,
encoding: str = "anchor",
sheet: str | None = None) -> dict
Returns {encoding, compressed, tokenEstimate, rawBaselineTokens, savingsRatio}.
encoding∈{anchor, invertedIndex, formatAggregation}. Defaultanchoris value-preserving and ships with a reader prompt — see ADR-0002.sheetselects a worksheet by name in a multi-sheet workbook.
Makes no LLM calls — the AI reasoning happens in the client.
Resource — sheet://examples/{name}
Returns the bundled example sheet in the default anchor encoding so a
client can see the format before sending its own data. Known names:
sample-orders (the generic order ledger). Unknown names return a clear
ValueError.
Prompt — sheet_qa
sheet_qa(encoding_text: str, question: str, encoding: str = "anchor") -> str
Composes the encoding's reader explainer with the library's sheetQA task
template, substituting {ENCODING} and {QUESTION}. Hand this back to the
client and the model has everything it needs to decode the compressed sheet
and answer the question — no extra round-trip through this server.
Stretch tool — extract_orders
extract_orders(xlsx_path: str, sheet: str | None = None) -> dict
Compresses xlsx_path (anchor encoding), then makes one Claude call —
on Bedrock by default per
ADR-0001 —
with structured outputs, returning:
{
"orders": [
{order_id, order_date, dealership, region, make, model,
qty, unit_price, total, status},
...
],
"total_revenue": <number>
}
The provider is selected by LLM_PROVIDER (bedrock | anthropic); the
model id is a config value — live-swap Haiku 4.5 → Opus 4.8 by editing the
client's env block. This is the only place the server itself calls an LLM.
Tests
python -m pytest tests/
Tests run at Seam 1 (the tool functions) against both the bundled
examples/sample-orders.xlsx ledger and the automotive hero file, and at
Seam 2 (extract_orders against a fake LLM provider) — fully deterministic,
no network. The upstream sheet-compressor library is left unmodified.
Eval harness
python -m sheet_compressor_mcp.evals
Golden cases over the hero file, scored against the real LLM provider
(per .env — Bedrock primary, Anthropic-direct fallback). Network-dependent
and separate from the unit suite. Prints [PASS] / [FAIL] per
expectation with a final N/M expectations passed summary, and exits non-zero
if any expectation failed (so a CI script can gate on it). The shipped suite
checks coverage (all four regions present, ≥100 orders extracted), schema
fidelity (every order has every required field; regions/makes drawn from the
sheet's known sets), and totals consistency (total_revenue == sum of order
totals).
Layout
server.py # MCP registration (FastMCP, stdio)
sheet_compressor_mcp/
tools.py # pure tool functions — tested directly
extract.py # extract_orders stretch tool
llm.py # LLM provider abstraction (Bedrock + Anthropic)
evals.py # golden-case eval harness (real-provider)
examples/
build_hero_file.py # generator for the automotive hero file
northstar-auto-q3-2025.xlsx
build_ledger.py # generator for the bundled generic ledger
sample-orders.xlsx
tests/
test_compress_spreadsheet.py
test_example_sheet.py
test_sheet_qa.py
test_extract_orders.py
test_evals.py
PRODUCTION.md # the enterprise path — transport, deploy,
# governance, observability, CI eval gates
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。