edi-mcp-server
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
edi-mcp-server
Problem
An AI model that reads raw X12 text guesses at segment meaning and miscounts segments, so its answers
about a failed EDI file are often wrong. edi-mcp-server is a small Model Context Protocol (MCP) server
that gives the model exact tools to parse, validate, explain, acknowledge, and compare X12 files. All X12
rules come from the x12val package of the sibling repository
x12-edi-validator. GS1 checks come from the
gs1 binary of gs1-toolkit-rs.
Related MCP server: SignalEDI MCP Server
Quick start
git clone https://github.com/andrew-myers-collab/x12-edi-validator
git clone https://github.com/andrew-myers-collab/edi-mcp-server
cd edi-mcp-server
python -m venv .venv
.venv/bin/python -m pip install -r requirements.txt # Windows: .venv\Scripts\python.exe
.venv/bin/python demo.pyThe server looks for x12val in ../x12-edi-validator. Set X12VAL_PATH to use another folder.
The two GS1 tools need the gs1 binary (cargo build --release in ../gs1-toolkit-rs, or set GS1_BIN).
Without it, all other tools work and the GS1 tools return MCP007.
Start the server: python -m edi_mcp (stdio) or python -m edi_mcp --http --port 8766 (127.0.0.1 only).
Variable | Default |
|
|
|
|
|
|
|
|
MCP client config example
{
"mcpServers": {
"edi": {
"command": "/path/to/edi-mcp-server/.venv/bin/python",
"args": ["-m", "edi_mcp"],
"env": {
"PYTHONPATH": "/path/to/edi-mcp-server",
"X12VAL_PATH": "/path/to/x12-edi-validator",
"GS1_BIN": "/path/to/gs1-toolkit-rs/target/release/gs1"
}
}
}
}Sample output
Real output of python demo.py from the GitHub Actions workflow (Linux, Python 3.12, with the gs1 binary built from gs1-toolkit-rs). All 48 tests ran there with no skip. With no gs1 binary, the gs1_check line prints SKIPPED.
> list_samples -> 14 samples
> validate_x12 945_qty_mismatch.edi -> 2 error(s)
seg 12 W12 QTY002: ordered 5 - shipped 4 = 1, but W1204 is 3
> explain_rule QTY002 -> QTY002 (error) | 945 W12: quantity ordered minus quantity shipped does not equal the quantity difference. | Why: W1204 must equal ordered minus shipped, or the partner books the wrong backorder.
> explain_segment 945_qty_mismatch.edi pos 12 -> W12 Warehouse Item Detail: W1202 Quantity Ordered = 5 ...
> summarize_document 945_good.edi -> 945 key DEMO-1001, ship to Acme Distribution, 2 lines, shipped 14
> diff_x12 945_good.edi 945_v2.edi (ignore control) -> 3 difference(s)
> make_997 945_qty_mismatch.edi -> AK9*R
> gs1_check 2000000000016 -> invalid, 2000000000016 INVALID GTIN-13 check digit is wrong: expected 5, found 6
> guard: sample "../README.md" -> refused MCP002
all expected results matchedTools
Every tool that reads X12 takes exactly one of text or sample (a name from list_samples).
Each tool returns one JSON object.
Tool | Input | Returns |
| none |
|
|
| name, text |
| text/sample, | delimiters, isa_problem, envelope, segments (pos, id, elements), truncated |
|
| summary (files, errors, warnings), findings |
|
| rule, severity, text (from |
| text/sample, | pos, id, name, elements (ref, name, value), findings at that segment |
| text/sample | sets: set, control, key, ship_to, lines, totals, errors |
| text/sample, | ack (997 text), statuses (AK9 per group) |
|
| same, differences |
|
| results: code, valid, text (from |
|
| results: line, input, valid, elements, errors |
Resources: x12://rules (rule catalog as JSON) and x12://samples/{name} (sample text).
Prompt: review_edi_file(sample) gives the steps: validate, explain each rule, summarize, propose fixes.
summarize_document uses the same document key as x12val DUP001 (940 W0502, 945 W0602, 846 BIA03,
947 W1502, 856 BSN02, 944 W1703). totals holds the sum that x12val QTY001 checks, keyed by element
(940 W0101, 945 W1203, 846 QTY02, 856 SN102, 944 W0701; the 947 has no QTY001 sum).
Guards
A refused call returns a tool error. The SDK puts Error executing tool <name>: before the server
message; the server message starts with the rule ID.
ID | Refuses |
MCP001 | input text longer than |
MCP002 | a |
MCP003 | both or neither of |
MCP004 | a |
MCP005 |
|
MCP006 |
|
MCP007 |
|
MCP008 | a GS1 list that is empty or over 20 items, an item over 200 characters or that starts with |
python -m edi_mcp exits 0 on a normal stop and 2 when x12val cannot be imported or the samples
folder is missing.
How it uses x12val
The server imports x12val from X12VAL_PATH (put at the front of sys.path once) and copies none
of its code. It calls parser.parse_text and find_delimiters, validator.validate, RULES,
SET_SPECS and total, rules_config.parse_config, explain.explain, ack.build_997, and
diff.diff_texts. tools/make_samples.py builds the samples with x12val.builder.
validate_x12 passes all sources to one validate call, so DUP001 and ENV009 work across files.
Design notes
One module per job:
server.py(tools, resources, prompt),dictionary.py(segment and element names),gs1.py(runs thegs1binary),settings.py(environment and the x12val import).Tools never take a file path and never write a file. A sample name must match
^[A-Za-z0-9_.-]{1,64}$and be insamples/manifest.json; the path comes from the manifest.The GS1 tools run
gs1withsubprocess.run([...], shell=False, timeout=10). Exit code 1 means invalid data, not a tool failure. No check-digit or AI-table code lives here.HTTP mode binds 127.0.0.1 only and has no
--hostoption.Tests use the in-process client (
async with Client(build_server(settings))), plus one stdio and one HTTP subprocess test. Run:python -m unittest discover -s tests -t .Regenerate the samples:
python tools/make_samples.py.
Limits
Only the six transaction sets x12val supports (940, 945, 846, 947, 856, 944) in the 004010-style layout it reads. The tool does not check a trading partner's implementation guide.
No authentication: stdio is local, and HTTP binds to localhost only.
No AS2/SFTP, no sending of EDI, no new validation rules (they belong in x12val or gs1-toolkit-rs).
The
gs1output shape thatgs1.pyreads (text forcheck, JSON results forparse --jsonanddl parse --json, data passed as arguments) is not verified against the real binary in this repository. The stub intests/gs1_stub.pyfollows that assumed shape; the CI-only test class runs the same inputs on the real binary.The element dictionary covers the segments x12val checks, the envelope, and the segments in the samples. Other segments show
(not in dictionary).
All data in this repository is synthetic: "Acme Distribution", DEMO-1001, and similar fake values.
References
Model Context Protocol specification, version 2026-07-28. The server uses the protocol version that the pinned
mcpSDK 2.3.0 negotiates.ASC X12 transaction sets 940, 945, 846, 947, 856, 944, 997 (version 004010 layout).
GS1 General Specifications, Release 26.0 (January 2026), read through gs1-toolkit-rs.
License
MIT. See LICENSE.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
OCR, transcription, file extraction, and image generation for AI agents via MCP.
Read XEDI business documents and ask Xavier using your own AI assistant.
Free MCP debugging tools for AI agents and developers. Diagnose failed API and MCP tool calls, identify HTTP errors, validate tool arguments against supported JSON Schema rules, and get actionable troubleshooting recommendations.
Unified MCP Server is a remote MCP connector for AI agents and vertical AI products that provides access to 22,000+ authorized SaaS tools across 400+ integrations and 24 categories directly inside LLMs (Claude, GPT, Gemini, Cohere). Tools operate only on explicitly authorized customer connections, enabling agents to safely read and write against live third-party systems.
Related MCP Servers
- AlicenseAqualityDmaintenanceLet AI agents read, validate and acknowledge EDI documents. Parses raw X12 and EDIFACT interchanges into structured JSON, validates envelope integrity, produces plain-language summaries, and generates 997 Functional Acknowledgments.4MIT

SignalEDI MCP Serverofficial
AlicenseAqualityCmaintenanceEnables AI assistants to parse, validate, send, and inspect X12 EDI documents via the SignalEDI Core API, with optional QuickBooks integration and a demo mode for keyless local testing.7MIT- FlicenseNot gradedqualityDmaintenanceEnables AI agents to parse and analyze PDF invoices, including text, field, and table extraction, OCR for scanned documents, ZUGFeRD support, compliance validation, and batch processing via MCP.-
- FlicenseNot gradedqualityDmaintenanceEnables AI assistants to parse, validate, summarize, and convert X12 EDI documents (such as 850 purchase orders and 810 invoices) into structured JSON through callable MCP tools.-