erp-mcp

erp-mcp

Exposes ERP data (production orders, inventory, BOM, customers) to any MCP client through a backend-neutral interface, with a mock backend for testing.

Category
访问服务器

README

erp-mcp

An open-source Model Context Protocol server that exposes ERP data — production orders, inventory, BOM, customers — to any MCP client (Claude Desktop, Cursor, the MCP Inspector, or the Prodline analytics platform).

Backend-neutral by design: a clean adapter seam (ERPBackend) maps each ERP into one product-neutral contract. It ships with a mock backend so you can run and test it today with zero ERP access; planned real backends include ERPNext, 用友 U8, and 畅捷通.

Part of Prodline. The connector is intentionally standalone and MIT-licensed — the proprietary value lives in Prodline's expertise engine, not here. We benefit from distribution.


What it exposes

Kind Name Description
Resource erp://orders All production orders
Resource erp://inventory Current stock levels
Resource erp://customers Customer master data
Resource erp://bom Bill of materials
Tool query_orders(status, customer, due_before, due_after) Filter orders
Tool get_bom(product_code) BOM for one product
Tool get_inventory(part_no) Stock for one part
Prompt overdue_orders Orders past due date
Prompt low_stock_alert Materials below reorder point
Prompt due_this_week Orders due in the next 7 days

Order records carry order_no (the natural key), so an export drops straight into Prodline's production_orders via the standard ingestion pipeline.


Quick start (mock backend — no ERP needed)

pip install -e .
ERP_PRODUCT=mock erp-mcp          # runs over stdio

Configuration via .env: both erp-mcp and erp-agent auto-load a .env file (found by walking up from the working directory) on startup. Copy the template and fill it in:

cp .env.example .env             # then edit .env with your ERP_PRODUCT + credentials

Real environment variables always win over .env (so an MCP client's env block or a shell export overrides it). .env is gitignored; .env.example is the committed reference.

Inspect it interactively:

npx @modelcontextprotocol/inspector erp-mcp

Use it in Claude Desktop — add to claude_desktop_config.json:

{
  "mcpServers": {
    "erp": {
      "command": "erp-mcp",
      "env": { "ERP_PRODUCT": "mock" }
    }
  }
}

Then ask Claude: "Which orders are overdue?" or "List materials below reorder point."


Testing layers

This connector is built so the first two layers need no ERP account at all:

Layer What it proves ERP account?
L1 Prodline's ingestion turns this server's output into production_orders No — point Prodline at ERP_PRODUCT=mock
L2 The MCP surface is correct (resources/tools/prompts) No — run under MCP Inspector / Claude Desktop
L3 The real ERP data path (auth + endpoints + data shapes) Yes — see below

Run the unit tests (L1/L2 logic, no client, no ERP):

pip install -e ".[dev]"
pytest

Feeding Prodline — the on-prem sync agent

For automated sync into the Prodline platform, run the bundled agent (erp-agent) on the same LAN. It reads the ERP locally via the connector and pushes outbound to Prodline — Prodline never connects into the customer network (firewall-friendly).

PRODLINE_URL=https://app.prodline.ai \
PRODLINE_TOKEN=<per-tenant connector token> \
ERP_PRODUCT=mock \
erp-agent

Each run:

  1. fetches the collection plan from Prodline (GET /api/connector/collection-plan) — what entities to pull, delta vs snapshot, schedule
  2. for each due entity, pulls rows from the ERP (delta passes filter updated_after=<local watermark>)
  3. pushes the batch outbound (POST /api/connector/ingest), which reconciles into Prodline (idempotent upsert by order_no, user-edited fields sticky)
  4. advances the local watermark (AGENT_STATE_FILE)

Run it continuously with the built-in loop, or one-shot under an external scheduler:

erp-agent                       # one pass, then exit (for cron / Task Scheduler)
erp-agent --interval 1800       # loop: sync every 30 min until stopped (or AGENT_INTERVAL_SECONDS=1800)

A delta cadence keeps data fresh cheaply (orders / work orders / quality inspections pull only rows changed since the last watermark); the weekly snapshot pass reconciles edits. Inventory / BOM / routings are snapshot pulls (current-state / low-churn). The agent is a thin generic pump — what's available comes from the connector, what to collect comes from the server-pushed plan — so it rarely needs updating.

Protocol & compatibility

This repo and the Prodline platform are separate — the only coupling is the /api/connector/* HTTP contract, so it's versioned (src/erp_mcp/protocol.py, PROTOCOL_VERSION) and checked on every sync via the X-Connector-Protocol header:

  • The agent sends its version and refuses to sync against a server on an incompatible MAJOR (pushing mismatched row shapes would silently corrupt data). The server likewise answers 426 Upgrade Required to an incompatible agent.
  • Same MAJOR ⇒ compatible; a MINOR bump is a backward-compatible addition (new optional field, new entity). Bump MAJOR only for a breaking shape change.

If you change a request/response shape, bump PROTOCOL_VERSION here and CONNECTOR_PROTOCOL_VERSION on the platform in lockstep. tests/test_protocol.py (here) and the platform's test_connector_contract.py pin both ends.


Going live (L3) — implementing a real backend

The server only ever calls the ERPBackend interface (src/erp_mcp/backends/base.py). Adding a real product = implementing that interface.

ERPNext / Frappe (ERP_PRODUCT=erpnext) — implemented ✅

  • Read-only via the Frappe REST API. In ERPNext: user → API Access → Generate Keys, then set ERPNEXT_URL / ERPNEXT_API_KEY / ERPNEXT_API_SECRET.
  • Mappings: Sales Order (+ Sales Order Item) → orders; BOM (+ BOM Item) → BOM; Bin (+ Item) → inventory; Customer → customers. Manufacturing depth (Phase B): Work Order → work orders; BOM Operation → routing steps; Quality Inspection → quality inspections (→ Prodline's B19 tables). See src/erp_mcp/backends/erpnext.py.
  • Stand up a dev instance with frappe_docker and load the manufacturing demo data to test end-to-end. Mapping is unit-tested (mocked) in tests/test_erpnext_backend.py — no live instance needed for CI.

用友 U8 (ERP_PRODUCT=u8) — stub

  • Free developer test accounts during development — you can build and integration-test without a paying customer or a purchased OpenAPI module (the customer buys that only for production: ~¥3,000/yr operating mode).
  • Docs: https://open.yonyouup.com/ · Support: https://u8open.yonyou.com/
  • Implement src/erp_mcp/backends/u8.py.

畅捷通 好会计 / T+ (ERP_PRODUCT=chanjet)

Heads-up: Chinese open platforms commonly require enterprise real-name verification (企业实名认证) to register a developer app, even for sandbox keys. Have your company identity ready.

Each backend method maps one ERP API call → a normalized model in src/erp_mcp/models.py. The MCP surface and all downstream consumers stay unchanged.

src/erp_mcp/
├── server.py            # MCP resources / tools / prompts (never changes per-product)
├── models.py            # normalized Order / BomLine / InventoryItem / Customer
└── backends/
    ├── base.py          # ERPBackend protocol — the adapter seam
    ├── __init__.py      # get_backend() — selects by ERP_PRODUCT
    ├── mock.py          # in-memory fixtures (L1/L2)
    ├── u8.py            # 用友 U8 (L3 — implement me)
    └── chanjet.py       # 畅捷通 (L3 — implement me)

License

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选