Serveur MCP ExStruct
Commit 4 oct. 2026Lit les classeurs Excel pour les convertir en JSON structuré et applique des modifications par patch afin que les agents IA puissent extraire, lire et modifier les données de feuilles de calcul.
Aussi connu sous harumiWeb/exstruct
- Étoiles
- 203
- Outils
- —
- Téléchargements, 30 jours
- —
- Dernière version
- —
- Dernier commit
- 4 oct. 2026
- Licence
- BSD-3-Clause
Qu'est-ce que ExStruct MCP ?
ExStruct est un serveur MCP. Lit les classeurs Excel pour les convertir en JSON structuré et applique des modifications par patch afin que les agents IA puissent extraire, lire et modifier les données de feuilles de calcul.
Résumé généré à partir du README du projet
À propos du MCP server ExStruct
La fonction principale d'exstruct est de convertir les classeurs Excel en JSON structuré pour le traitement par IA. Cet outil permet aux développeurs et aux agents IA d'extraire, de lire et de modifier les données de feuilles de calcul via une interface structurée. Il prend en charge différents modes d'extraction, notamment un mode light pour le parsing direct OOXML sur Linux et macOS, et un mode standard pour une extraction enrichie utilisant Excel COM sur Windows.
Les utilisateurs peuvent interagir avec le serveur via plusieurs outils spécialisés tels que exstruct_extract, exstruct_patch et exstruct_read_formulas. Le système est conçu pour des intégrations gérées par l'hôte où des contrôles de sécurité et des restrictions de chemin sont nécessaires. Il peut produire des données aux formats JSON, YAML ou TOON et propose des fonctionnalités telles que l'extraction de formules et l'ajustement de la détection de tableaux. Pour commencer, vous pouvez lancer le serveur en utilisant uvx avec l'extra exstruct[mcp], en spécifiant un répertoire racine pour l'accès aux fichiers.
Ce que vous pouvez faire avec
- 1Convertir des feuilles de calcul en JSONUn agent IA peut transformer un fichier Excel en un format JSON structuré pour faciliter le prétraitement RAG.
- 2Extraire des éléments complexes de classeursVous pouvez récupérer non seulement les valeurs des cellules, mais aussi les formes, les graphiques et les formules d'un classeur.
Extrait du README du projet. Chaque cas d'utilisation est vérifié par rapport à une citation du document.
Vérifications automatisées
Exécuté le 14 nov. 2026Rapport complet →Pas encore vérifié. Un serveur nécessite un score de 80, aucune faille sérieuse et suffisamment de données pour que nous puissions effectuer les vérifications. Fonctionnement des vérifications · Ce qu'il faut corriger pour gagner des points
- Dépôt source lié et accessibleharumiweb/exstruct is public and reachablegithub.com/harumiweb/exstruct ↗Réussi
- Le nom du package correspond au dépôt sourceNon vérifié
- Provenance du build (attestation Sigstore)Non vérifié
- Licence open source (OSI)BSD-3-Clausespdx.org/licenses/BSD-3-Clause.html ↗Réussi
- Commit ou version publiée au cours de l'année écouléeLast commit or release 2026-10-04github.com/harumiweb/exstruct ↗Réussi
- OpenSSF ScorecardNon vérifié
- Nom du package non proche d'un package populaireNon vérifié
- Aucun avis critique dans le package ou ses dépendancesNon vérifié
- Aucune instruction cachée destinée au modèle0 tool descriptions and the README read; no override phrases, credential paths or hidden charactersRéussi
- Les outils destructifs sont étiquetésNon vérifié
- Le point de terminaison distant répond à la poignée de main MCPNon vérifié
README
Voir sur GitHubExStruct — Excel Structured Extraction Engine
ExStruct reads Excel workbooks into structured data and applies patch-based editing workflows through a shared core. It provides extraction APIs, a JSON-first editing CLI, and an MCP server for host-managed integrations, with options tuned for LLM/RAG preprocessing, reviewable edit flows, and local automation.
- In COM/Excel environments (Windows), it performs rich extraction.
- In non-COM environments (Linux/macOS):
- direct OOXML parsing extracts cells, shapes, charts, table candidates, and print areas on a best-effort basis
- if the LibreOffice runtime is available, cells, table candidates, shapes, and charts are also extracted on a best-effort basis
Detection heuristics, editing workflows, and output modes are adjustable for LLM/RAG pipelines and local automation.
Main Features
- Excel -> structured JSON: outputs cells, shapes, charts, SmartArt, table candidates, merged-cell ranges, print areas, and auto page-break areas by sheet or by area.
- Output modes:
light: cells + table candidates + print areas + best-effort shapes/charts via direct OOXML for.xlsx/.xlsmlibreoffice: best-effort non-COM mode for.xlsx/.xlsm. When the LibreOffice runtime is available, it adds merged cells, shapes, connectors, and chartsstandard: Excel COM mode with texted shapes + arrows, charts, SmartArt, and merged-cell rangesverbose: outputs all shapes with width/height and also emits cell hyperlinks
- Formula extraction: emits
formulas_map(formula string -> cell coordinates) via OOXML or the selected openpyxl/COM path. It is enabled by default inverboseand can be controlled withinclude_formulas_map. - Formats: JSON (compact by default,
--prettyfor formatting), YAML, and TOON (optional dependencies). - Workbook editing interfaces: use the editing CLI for primary ExStruct edit flows, keep MCP for host-owned safety controls, and use
exstruct.editonly when you need the same patch contract from Python. - Table detection tuning: heuristics can be adjusted dynamically through the API.
- Hyperlink extraction: in
verbosemode, or withinclude_cell_links=True, cell links are emitted inlinks. - Safe fallback:
lightuses direct OOXML for.xlsx/.xlsmwithout Excel COM or LibreOffice. Unsupported OOXML orcolors_maprequests restart the complete openpyxl compatibility pipeline with anooxml_compatibilitywarning; partial results are discarded. A drawing failure isolated to one sheet remains best-effort.
Installation
pip install exstruct
Optional extras:
- Border-clustering acceleration:
pip install exstruct[fast](SciPy). Normal direct light extraction uses Python clustering. SciPy acceleration andEXSTRUCT_BORDER_CLUSTER_BACKENDselection apply to other modes and compatibility extraction; NumPy remains a core dependency. - YAML:
pip install pyyaml - TOON:
pip install python-toon - Rendering (PDF/PNG): Excel +
pip install pypdfium2 pillow(mode=libreofficeis not supported) - Install these extras at once:
pip install exstruct[yaml,toon,render,fast]
Platform note:
- On Debian/Ubuntu/WSL, install LibreOffice together with
python3-uno. ExStruct probes a compatible system Python automatically formode=libreoffice; if your environment needs an explicit interpreter, setEXSTRUCT_LIBREOFFICE_PYTHON_PATH=/usr/bin/python3. - LibreOffice Python detection now runs the bundled bridge in
--probemode before selection. An incompatibleEXSTRUCT_LIBREOFFICE_PYTHON_PATHfails fast instead of surfacing a delayed bridgeSyntaxErrorduring extraction. - If the isolated temporary LibreOffice profile fails before the UNO socket becomes ready, ExStruct retries once with the shared/default LibreOffice profile as a compatibility fallback and reports per-attempt startup detail if both launches fail.
Quick Start CLI
exstruct input.xlsx > output.json # compact JSON to stdout by default
exstruct input.xlsx -o out.json --pretty # write pretty JSON to a file
exstruct input.xlsx --format yaml # YAML (requires pyyaml)
exstruct input.xlsx --format toon # TOON (requires python-toon)
exstruct input.xlsx --sheets-dir sheets/ # write one file per sheet
exstruct input.xlsx --auto-page-breaks-dir auto_areas/ # always shown; execution requires standard/verbose + Excel COM
exstruct input.xlsx --alpha-col # output column keys as A, B, ..., AA
exstruct input.xlsx --include-backend-metadata # include shape/chart backend metadata
exstruct input.xlsx --mode light # cells + table candidates + best-effort OOXML shapes/charts
exstruct input.xlsx --mode libreoffice # best-effort extraction of shapes/connectors/charts without COM
exstruct input.xlsx --pdf --image # PDF and PNGs (Excel COM required)
Auto page-break export is available from both the API and the CLI when Excel/COM is available. The CLI always exposes --auto-page-breaks-dir, but validates it at execution time.
mode=libreoffice rejects --pdf, --image, and --auto-page-breaks-dir early, and mode=light also rejects --auto-page-breaks-dir. Use standard or verbose with Excel COM for those features.
By default, the CLI keeps legacy 0-based numeric string column keys ("0", "1", ...). Use --alpha-col when you need Excel-style keys ("A", "B", ...).
By default, serialized shape/chart output omits backend metadata (provenance, approximation_level, confidence) to reduce token usage. Use --include-backend-metadata or the corresponding Python/MCP option when you need it.
Quick Start Editing CLI
exstruct patch --input book.xlsx --ops ops.json --backend openpyxl
exstruct patch --input book.xlsx --ops - --dry-run --pretty < ops.json
exstruct make --output new.xlsx --ops ops.json --backend openpyxl
exstruct ops list
exstruct ops describe create_chart --pretty
exstruct validate --input book.xlsx --pretty
patchandmakeprint JSONPatchResultto stdout.ops list/ops describeexpose the public patch-op schema.validatereports workbook readability (is_readable,warnings,errors).
Recommended edit flow:
- Build patch ops.
- Run
exstruct patch --dry-runand inspectPatchResult, warnings, and diff. - Pin
--backend openpyxlwhen you want the dry run and the real apply to use the same engine. - If you keep
--backend auto, inspectPatchResult.engine; on Windows/Excel hosts the real apply may switch to COM. - Re-run without
--dry-runonly after the result is acceptable.
ExStruct CLI Skill
ExStruct also ships one repo-owned Skill for agents that should follow the editing CLI safely instead of rediscovering the workflow each time.
Canonical repo source:
.agents/skills/exstruct-cli/
You can install it with the following single command:
npx skills add harumiWeb/exstruct/.agents/skills --skill exstruct-cli
If your runtime cannot use npx skills add, place the same folder manually
into a local skill directory that discovers SKILL.md-based skills.
Use this Skill when the agent needs help choosing between patch, make,
validate, ops list, and ops describe, or when it should follow the safe
validate -> dry-run -> inspect -> apply -> verify workflow.
Example prompt for agents:
Use
$exstruct-clito choose the right ExStruct editing CLI command, follow a safe validate/dry-run/inspect workflow, and explain any backend constraints for this workbook task.
MCP Server (stdio)
MCP is the integration / compatibility layer around the same editing core. Use
it when you need host-managed path restrictions, transport mapping, artifact
mirroring, or approval-aware agent execution. For ordinary Python workbook
editing, openpyxl / xlwings are usually a better fit. For local shell or
agent workflows, prefer the editing CLI.
Quick Start with uvx (recommended)
You can run it directly without installation:
uvx --from 'exstruct[mcp]' exstruct-mcp --root C:\data --log-file C:\logs\exstruct-mcp.log --on-conflict rename
Benefits:
- no
pip installrequired - automatic dependency management
- isolated environment
- easy version pinning:
uvx --from 'exstruct[mcp]==0.4.4' exstruct-mcp
Traditional installation
You can also install it with pip:
pip install exstruct[mcp]
exstruct-mcp --root C:\data --log-file C:\logs\exstruct-mcp.log --on-conflict rename
Available tools:
| Tool name | Description |
|---|---|
exstruct_extract |
Extracts data from a workbook. |
exstruct_capture_sheet_images |
Captures sheet images. |
exstruct_make |
Creates a new workbook. |
exstruct_patch |
Applies editing patches to a workbook. |
exstruct_read_json_chunk |
Reads extracted JSON chunks. |
exstruct_read_range |
Reads cells from a specified range. |
exstruct_read_cells |
Reads data cell by cell. |
exstruct_read_formulas |
Reads cell formulas. |
exstruct_validate_input |
Validates input data. |
For more details and API usage, see the documentation site: MCP Server
Quick Start Python Extraction
from pathlib import Path
from exstruct import extract, export, set_table_detection_params
# Tune table detection (optional)
set_table_detection_params(table_score_threshold=0.3, density_min=0.04)
# Modes: "light" / "standard" / "verbose"
wb = extract("input.xlsx", mode="standard") # standard does not emit links by default
export(wb, Path("out.json"), pretty=False) # compact JSON
export(wb, Path("out.json"), include_backend_metadata=True) # opt into backend metadata
# Helpful model methods: iteration, indexing, and direct serialization
first_sheet = wb["Sheet1"] # get a sheet with __getitem__
for name, sheet in wb: # __iter__ yields (name, SheetData)
print(name, len(sheet.rows))
wb.save("out.json", pretty=True) # save WorkbookData based on extension
first_sheet.save("sheet.json") # save SheetData the same way
print(first_sheet.to_yaml()) # YAML string (requires pyyaml)
print(first_sheet.to_json(include_backend_metadata=True)) # opt in when needed
# ExStructEngine: per-instance configuration
from exstruct import (
DestinationOptions,
ExStructEngine,
FilterOptions,
FormatOptions,
OutputOptions,
StructOptions,
export_auto_page_breaks,
)
engine = ExStructEngine(
options=StructOptions(mode="verbose"), # verbose includes hyperlinks by default
output=OutputOptions(
format=FormatOptions(pretty=True),
filters=FilterOptions(
include_shapes=False,
include_backend_metadata=True,
), # opt into backend metadata when needed
destinations=DestinationOptions(sheets_dir=Path("out_sheets")), # save per-sheet files
),
)
wb2 = engine.extract("input.xlsx")
engine.export(wb2, Path("out_filtered.json"))
# Enable hyperlinks in standard mode
engine_links = ExStructEngine(options=StructOptions(mode="standard", include_cell_links=True))
with_links = engine_links.extract("input.xlsx")
# Export one file per print area
from exstruct import export_print_areas_as
export_print_areas_as(wb, "areas", fmt="json", pretty=True)
# Extract / export auto page-break areas (COM only; raises if no auto breaks exist)
engine_auto = ExStructEngine(
output=OutputOptions(
destinations=DestinationOptions(auto_page_breaks_dir=Path("auto_areas"))
)
)
wb_auto = engine_auto.extract("input.xlsx") # includes SheetData.auto_print_areas
engine_auto.export(wb_auto, Path("out_with_auto.json"))
export_auto_page_breaks(wb_auto, "auto_areas", fmt="json", pretty=True)
Note (non-COM environments): even when Excel COM is unavailable, cells + table_candidates are still returned, and .xlsx / .xlsm keep best-effort OOXML shapes / charts when available.
Table Detection Parameters
from exstruct import set_table_detection_params
set_table_detection_params(
table_score_threshold=0.35, # raise it to be stricter
density_min=0.05,
coverage_min=0.2,
min_nonempty_cells=3,
)
Higher values reduce false positives. Lower values reduce missed detections.
Output Modes
- light: direct OOXML cells + table candidates + print areas and best-effort shapes/connectors/charts for
.xlsx/.xlsm. The normal path does not import openpyxl, pandas, SciPy, or xlwings. - standard: texted shapes + arrows, charts (when COM is available), and table candidates. Cell hyperlinks are emitted only when
include_cell_links=True. - verbose: all shapes, charts,
table_candidates, hyperlinks, andcolors_map.
Error Handling / Fallback
- If Excel COM is unavailable, extraction falls back to cells + table candidates automatically;
.xlsx/.xlsmstill preserve best-effort OOXML shapes/charts when available. - A per-sheet drawing failure omits that sheet's affected drawing artifacts while preserving healthy sheets. An unsupported OOXML construct or failure in any other direct pipeline stage discards all partial OOXML data, restarts the complete openpyxl compatibility pipeline, and logs
ooxml_compatibility. - The CLI writes errors to stdout/stderr and exits with a non-zero status on failure.
Optional Rendering
Excel and pypdfium2 are required:
exstruct input.xlsx --pdf --image --dpi 144
This writes <output>.pdf and PNG files under <output>_images/.
Example 1: Excel Structuring Demo
To show how far exstruct can structure Excel, we parse an Excel workbook that combines the following three elements on a single sheet and show an LLM reasoning example based on the JSON output.
- a table (sales data)
- a line chart
- a flowchart built only with shapes
The image below is the actual sample Excel sheet.

Sample Excel: sample/sample.xlsx
1. Input: Excel Sheet Overview
This sample Excel contains the following data:
1) Table (sales data)
| Month | Product A | Product B | Product C |
|---|---|---|---|
| Jan-25 | 120 | 80 | 60 |
| Feb-25 | 135 | 90 | 64 |
| Mar-25 | 150 | 100 | 70 |
| Apr-25 | 170 | 110 | 72 |
| May-25 | 160 | 120 | 75 |
| Jun-25 | 180 | 130 | 80 |
2) Chart (line chart)
- Title: Sales Data
- Series: Product A / Product B / Product C (six months)
- Y-axis: 0-200
3) Flowchart made with shapes
The sheet includes the following flow:
- Start / End
- Format check
- Loop (items remaining?)
- Error handling
- Yes/No decision for sending email
2. Output: structured JSON generated by exstruct (excerpt)
Below is a shortened JSON output example from parsing the workbook above.
{
"book_name": "sample.xlsx",
"sheets": {
"Sheet1": {
"rows": [
{
"r": 3,
"c": {
"1": "月",
"2": "製品A",
"3": "製品B",
"4": "製品C"
}
},
...
],
"shapes": [
{
"id": 1,
"text": "開始",
"l": 148,
"t": 220,
"kind": "shape",
"type": "AutoShape-FlowchartProcess"
},
{
"id": 2,
"text": "入力データ読み込み",
"l": 132,
"t": 282,
"kind": "shape",
"type": "AutoShape-FlowchartProcess"
},
{
"l": 193,
"t": 246,
"kind": "arrow",
"begin_arrow_style": 1,
"end_arrow_style": 2,
"begin_id": 1,
"end_id": 2,
"direction": "N"
},
...
],
"charts": [
{
"name": "Chart 1",
"chart_type": "Line",
"title": "売上データ",
"y_axis_range": [
0.0,
200.0
],
"series": [
{
"name": "製品A",
"name_range": "Sheet1!$C$3",
"x_range": "Sheet1!$B$4:$B$9",
"y_range": "Sheet1!$C$4:$C$9"
},
...
],
"l": 377,
"t": 25
}
],
"table_candidates": [
"B3:E9"
]
}
}
}
3. How AI (Copilot / LLM) interprets the JSON
Below is a Markdown reconstruction of the Excel workbook. It expresses the table, chart, and flowchart as separate structures.
---
## Sales Data Table
| Month | Product A | Product B | Product C |
| ---------- | --------- | --------- | --------- |
| 2025-01-01 | 120 | 80 | 60 |
| 2025-02-01 | 135 | 90 | 64 |
| 2025-03-01 | 150 | 100 | 70 |
| 2025-04-01 | 170 | 110 | 72 |
| 2025-05-01 | 160 | 120 | 75 |
| 2025-06-01 | 180 | 130 | 80 |
---
## Sales Data (Line Chart)
- Chart title: **売上データ**
- Chart type: line chart
- Y-axis range: 0 to 200
- Data series:
- Product A: 120 -> 135 -> 150 -> 170 -> 160 -> 180
- Product B: 80 -> 90 -> 100 -> 110 -> 120 -> 130
- Product C: 60 -> 64 -> 70 -> 72 -> 75 -> 80
---
## Process Flow (Mermaid Flowchart)
```mermaid
flowchart TD
A[Start]
B[Load input data]
C{Is the format valid?}
D[Process one item]
E{Items remaining?}
F[Generate output]
G{Send email?}
H[Show error]
I[Send email]
J[Finish]
A --> B
B --> C
C -->|yes| D
C --> H
D --> E
E --> F
F --> G
G -->|yes| I
G -->|no| J
H --> J
I --> J
```
Example 2: A General Application Form
Excel data

ExStruct JSON
(Truncated for brevity)
{
"book_name": "ja_form.xlsx",
"sheets": {
"Sheet1": {
"rows": [
{ "r": 1, "c": { "0": "介護保険負担限度額認定申請書" } },
{
"r": 3,
"c": { "0": "(申請先)", "7": " 年 月 日" }
},
{ "r": 4, "c": { "1": "X市長 " } },
...
],
"table_candidates": ["B25:C26", "C37:D50"],
"merged_cells": {
"schema": ["r1", "c1", "r2", "c2", "v"],
"items": [
[55, 5, 55, 10, "申請者が被保険者本人の場合には、下記について記載は不要です。"],
[54, 8, 54, 10, " "],
[51, 5, 52, 6, "有価証券"],
...
]
}
}
}
}
ExStruct JSON -> Markdown via LLM reasoning
# Long-Term Care Insurance Burden Limit Certification Application
(Submitted to) Year Month Day
Mayor of City X
Attach the related documents below and apply for certification of the burden limit for food and housing expenses.
---
## Insured Person Information
| Item | Value |
| ---- | ----- |
| Furigana | |
| Name | |
| Insured Person Number | |
| Personal Number | |
| Date of Birth | Meiji / Taisho / Showa Year Month Day |
| Address | |
| Contact | |
---
## Long-Term Care Facility Entered / Hospitalized In
| Item | Value |
| ---- | ----- |
| Facility name / location | |
| Contact | |
| Date of entry / admission | Year Month Day |
If the applicant has not entered a care insurance facility, or uses short stay only, this section is not required.
---
## Presence of a Spouse
| Item | Value |
| ---- | ----- |
| Spouse | Yes / No |
If "No", the following spouse section is not required.
---
## Spouse Information
| Item | Value |
| ---- | ----- |
| Furigana | |
| Name | |
| Date of Birth | Meiji / Taisho / Showa Year Month Day |
| Personal Number | |
| Address | Postal code |
| Contact | |
| Address as of January 1 of this year (if different) | Postal code |
| Tax status | Municipal resident tax: taxable / non-taxable |
---
## Declaration of Income and Other Status
Check the applicable item below.
- □ 1. Livelihood protection recipient
- □ 2. Old-age welfare pension recipient in a household exempt from municipal resident tax
- □ 3. Person exempt from municipal resident tax whose taxable pension income + survivor/disability pension + other income totals **800,000 JPY or less per year**
- □ 4. Same as above, but **over 800,000 JPY up to 1,200,000 JPY**
- □ 5. Same as above, but **over 1,200,000 JPY**
Survivor pension includes widow's pension, widower's pension, mother's pension, quasi-mother's pension, and orphan's pension.
---
## Declaration of Deposits and Other Assets
- □ The total amount of deposits, securities, and other assets is below the following threshold:
- Category 2: 10 million JPY (20 million JPY for couples)
- Category 3: 6.5 million JPY (16.5 million JPY for couples)
- Category 4: 5.5 million JPY (15.5 million JPY for couples)
- Category 5: 5 million JPY (15 million JPY for couples)
- Second insured persons (ages 40-64): Categories 3-5 must be 10 million JPY or less (20 million JPY for couples)
### Asset breakdown
| Item | Amount |
| ---- | ------ |
| Deposits | JPY |
| Securities (estimated value) | JPY |
| Other (including cash / debt) | JPY (describe) |
---
Questions sur ExStruct MCP
Que peut faire le MCP server ExStruct avec les classeurs Excel ?
Il extrait les données du classeur en JSON structuré et permet la lecture de cellules, de plages et de formules, la capture d'images de feuilles, ainsi que l'application de patchs de modification ou la création de nouveaux classeurs.
Quels outils le MCP server ExStruct expose-t-il ?
Les outils incluent exstruct_extract, exstruct_capture_sheet_images, exstruct_make, exstruct_patch, exstruct_read_json_chunk, exstruct_read_range, exstruct_read_cells, exstruct_read_formulas et exstruct_validate_input.
Comment puis-je exécuter le MCP server ExStruct sans l'installer ?
Utilisez uvx avec l'extra mcp, en passant des options telles que --root, --log-file et --on-conflict.
Qu'est-ce qu'ExStruct extrait d'un classeur ?
Selon le mode choisi, il extrait les cellules, les formes, les graphiques, le SmartArt, les candidats tableaux, les plages de cellules fusionnées, les zones d'impression et les hyperliens.
ExStruct nécessite-t-il l'installation d'Excel ou de LibreOffice ?
Le mode light fonctionne via un parsing direct OOXML sans COM ni LibreOffice ; l'extraction enrichie utilise LibreOffice ou Excel COM.