Skip to main content
Glama
edi-mcp

edi-mcp

by heocoi

edi-mcp

Let AI agents read, validate and acknowledge EDI documents.

An MCP (Model Context Protocol) server that parses raw X12 and EDIFACT interchanges into structured JSON, validates envelope integrity, produces plain-language summaries, and generates 997 Functional Acknowledgments. Zero runtime dependencies beyond the MCP SDK - the tokenizer is hand-rolled and reads delimiters from the wire, the way real-world files demand.

Works with Claude (Desktop, Code, API), Cursor, and any MCP-compatible client.

Why

EDI predates JSON by decades and still moves most B2B commerce: purchase orders (850/ORDERS), invoices (810/INVOIC), ship notices (856). None of it is reachable by no-code AI connectors - there is no REST API to point Zapier at, just structured text flowing over AS2/SFTP. This server gives an AI agent eyes on that traffic:

  • "Summarize the PO that just landed in the inbox folder"

  • "Does this 810 match the PO number and line totals we sent?"

  • "Draft the 997 acknowledgment for this interchange"

Related MCP server: SignalEDI MCP Server

Tools

Tool

What it does

parse_edi

Raw X12/EDIFACT (auto-detected) → structured JSON: envelope, groups, transactions, segments

validate_edi

Envelope integrity: control number agreement (ISA/IEA, GS/GE, ST/SE, UNB/UNZ, UNH/UNT) + declared counts

summarize_edi

Plain-language business summary. Deep support: X12 850/810/856, EDIFACT ORDERS/INVOIC. Other types get a segment inventory

generate_997_ack

X12 997 Functional Acknowledgment answering an interchange, sender/receiver swapped, AK2/AK5 per transaction

Quick start

git clone https://github.com/heocoi/edi-mcp.git
cd edi-mcp
npm install && npm run build

Claude Code:

claude mcp add edi -- node /path/to/edi-mcp/dist/index.js

Claude Desktop (claude_desktop_config.json):

{
  "mcpServers": {
    "edi": {
      "command": "node",
      "args": ["/path/to/edi-mcp/dist/index.js"]
    }
  }
}

Then try: "Parse samples/850-purchase-order.edi and tell me the PO number, ship-to address and order value."

Example

Input (X12 850, abbreviated):

ISA*00*...*ZZ*ACMECORP*ZZ*WIDGETSUPPLY*260719*1030*U*00401*000000101*0*P*>~
GS*PO*ACMECORP*WIDGETSUPPLY*20260719*1030*101*X*004010~
ST*850*0001~
BEG*00*SA*PO-2026-4521**20260719~
PO1*1*48*EA*9.75**VP*WS-4417*UP*012345678905~
...

summarize_edi output:

X12 interchange 000000101 - ACMECORP → WIDGETSUPPLY, dated 2026-07-19

## 850 Purchase Order (control 0001)
- Purchase Order PO-2026-4521 dated 2026-07-19 (type SA)
- Ship-to: Acme Corp Warehouse 7
- Line 1: 48 EA @ 9.75 - VP WS-4417, UP 012345678905
- Line 2: 12 CS @ 142.00 - VP WS-9902
- Computed order value: 2172.00
- CTT declares 2 line item(s)

Design notes

  • Delimiters come from the wire, not from config. X12 delimiters are read from the ISA segment itself; EDIFACT service characters from UNA when present, standard defaults otherwise. EDIFACT release-character escaping (?+ → literal +) is honored.

  • Lenient parse, strict validate. parse_edi recovers what it can and reports anomalies as warnings; validate_edi is the strict pass. Real-world EDI is messy - a parser that throws on the first oddity is useless for triage.

  • Acknowledgment policy is explicit. decideAckStatus() in src/ack997.ts maps validation results to A/E/R. Default: clean → A, structural errors → R. Trading partner agreements differ; the policy is one small function on purpose.

Scope and roadmap

Current scope is read/triage/acknowledge - the 80% of daily EDI pain that needs no certification. Not yet included: 999 Implementation Acknowledgment, transaction-set-level schema validation (dictionaries per version), generating outbound 810/856, AS2 transport. Tracking the MCP 2026-07-28 spec revision.

Custom integrations

I build custom MCP servers for systems that no off-the-shelf connector covers: legacy ERPs, proprietary internal tools, SOAP/EDI/flat-file pipelines. If your business runs on a system your AI tools can't see, reach out: anhphong.pham@gmail.com · anhphong.dev

License

MIT

Available Tools

4 tools
generate_997_ackGenerate 997 Functional AcknowledgmentA

Build an X12 997 Functional Acknowledgment answering the given X12 interchange (sender/receiver swapped, one AK2/AK5 pair per transaction). The ack status follows envelope validation: clean file → A, structural errors → R.

Inputs: content (required), ack_control_number.

parse_ediParse EDI to JSONA

Parse a raw X12 or EDIFACT document (auto-detected) into structured JSON: envelope metadata, functional groups, transactions and their segments. Use this when you need to read individual fields.

Inputs: content (required).

summarize_ediSummarize EDI in plain languageA

Produce a human-readable business summary of an EDI document. Understands X12 850/810/856/997 and EDIFACT ORDERS/INVOIC in detail; other transaction types get a segment inventory.

Inputs: content (required).

validate_ediValidate EDI envelopesA

Check structural integrity of an X12 or EDIFACT document: control number agreement (ISA/IEA, GS/GE, ST/SE, UNB/UNZ, UNH/UNT) and declared segment/transaction counts. Returns errors and warnings.

Inputs: content (required).

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.9/5.0

    Scored across 4 tools

    Disambiguation5/5

    Each tool has a distinct purpose: parse converts raw EDI to structured JSON, validate checks structural integrity, summarize produces a business summary, and generate_997_ack creates an acknowledgment. There is no overlap.

    Naming Consistency5/5

    All tool names follow a consistent verb_noun pattern in snake_case (parse_edi, validate_edi, summarize_edi, generate_997_ack), making them predictable and easy to navigate.

    Tool Count4/5

    With 4 tools covering parsing, validation, summarization, and acknowledgment generation, the count is appropriate for a focused EDI utility. It could be expanded slightly for more advanced operations, but it's well-scoped.

    Completeness3/5

    The set covers key operations (read, validate, summarize, respond) but lacks tools for editing, converting, or batch processing EDI documents. This leaves notable gaps for complex workflows.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      Validates EU electronic invoices (Peppol, XRechnung, FatturaPA, etc.) and explains validation error codes, enabling AI coding agents to check invoice validity and get fixes before rejection.
      3
      46 npm
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      Enables 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.
      7
      62 npm
      MIT
    • A
      license
      C
      quality
      D
      maintenance
      Provides deterministic data parsing and enrichment for AI agents, including bank statements, trade history, EDI, PDFs to structured markdown, and atomic enrichment for amounts, dates, and addresses, with strict schema enforcement to prevent hallucinations.
      37
      43 npm
      2
      ISC
    • F
      license
      Not graded
      quality
      D
      maintenance
      Enables 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.
      -