logistics-mcp
Enables AI assistants to query and manage logistics shipment data, supporting operations like tracking, quoting, and performance analysis via nine tools backed by a demo dataset or a REST API.
README
logistics-mcp
Operations teams ask questions about shipments all day — "where is SBY-1042", "which route missed its SLA last month", "what would 12 kg to Makassar cost". The answers sit in a logistics system that an AI assistant cannot see. This MCP server exposes that system as nine tools, so Claude can answer from the actual data instead of from a screenshot the user pasted into the chat.
It runs out of the box against a bundled demo dataset (200 synthetic shipments across 6 cities over 3 months), so you can try every tool without credentials. Point it at your own backend by setting two environment variables.
The domain model comes from a production logistics platform I built (Next.js + Supabase, deployed on GCP). This repo contains the MCP server and a synthetic demo dataset, not the client application; no real customer names, rates, or operational data appear anywhere in it.
Architecture
Claude (Desktop / Code)
| MCP, stdio
v
logistics-mcp
tool handlers <- zod-validated inputs, row/byte caps, actionable errors
|
LogisticsSource <- one interface; handlers do not know which side is active
/ \
demo source rest source
fixtures/*.json LOGISTICS_API_URL + LOGISTICS_API_TOKEN (Bearer)
The demo source reads the checked-in fixture JSON. The rest source expects the upstream
contract documented below. Writes are disabled unless ALLOW_WRITES=1; in demo mode an
update_shipment_status call mutates memory only and never touches the fixture files.
Install
Claude Desktop (claude_desktop_config.json):
{
"mcpServers": {
"logistics": {
"command": "npx",
"args": ["-y", "logistics-mcp"]
}
}
}
Claude Code:
claude mcp add logistics -- npx -y logistics-mcp
Both configurations need nothing else: no URL, no token, no clone. To connect your own
backend instead of the demo data, add LOGISTICS_API_URL and LOGISTICS_API_TOKEN to the
server's environment.
What a conversation looks like
Recorded against the demo dataset.
You: What's the status of shipment SBY-1003?
Claude calls track_shipment and gets the public timeline:
{
"spNumber": "SBY-1003",
"events": [
{ "at": "2026-07-11T05:35:01.991Z", "status": "READY", "location": "Surabaya", "description": "Shipment registered and waiting for pickup" },
{ "at": "2026-07-11T14:35:01.991Z", "status": "PICKED_UP", "location": "Surabaya", "description": "Picked up from sender" },
{ "at": "2026-07-12T11:35:01.991Z", "status": "IN_TRANSIT", "location": "Surabaya to Yogyakarta", "description": "On the way to the destination region" },
{ "at": "2026-07-13T02:35:01.991Z", "status": "AT_HUB", "location": "Yogyakarta hub", "description": "Arrived at destination sorting hub" },
{ "at": "2026-07-13T13:35:01.991Z", "status": "OUT_FOR_DELIVERY", "location": "Yogyakarta", "description": "With the courier for final delivery" },
{ "at": "2026-07-14T21:35:01.991Z", "status": "DELIVERED", "location": "Yogyakarta", "description": "Delivered to the recipient" }
]
}
You: And what would 12 kg to Makassar cost on STANDARD?
quote_shipping_rate resolves the layered rate table and shows the math:
{
"freight": 174000,
"currency": "IDR",
"breakdown": {
"pricePerKg": 14500,
"minCharge": 25000,
"appliedRule": "destination_special",
"formula": "max(ceil(12 * 14500), 25000)"
},
"alternatives": [
{ "product": "ECONOMY", "freight": 68400 },
{ "product": "EXPRESS", "freight": 312000 }
]
}
Other questions the demo data supports: "which route had the worst on-time rate in June"
(delivery_performance), "what's on the next load to Surabaya" (list_manifests →
get_manifest), "show everything Kirana Textiles shipped that's still in transit"
(search_shipments), "which customers still have unpaid invoices" (list_invoices).
Tools
| Tool | What it answers |
|---|---|
search_shipments |
Find shipments by status, date range, route, or customer (limit default 20, max 100) |
get_shipment |
Full detail: items, extra charges, total amount, status history |
track_shipment |
Public tracking timeline, without internal ops notes |
quote_shipping_rate |
Price for route + weight + product, with the winning rate rule and the math |
list_manifests |
Outbound loads per region and date, with counts and total weight |
get_manifest |
Contents of one load |
delivery_performance |
Per-route on-time rate, average transit days, exception counts for a period |
list_invoices |
Customer invoices by payment status or customer, with amount and due date |
update_shipment_status |
Write. Disabled unless ALLOW_WRITES=1 |
Configuration
| Variable | Default | Effect |
|---|---|---|
LOGISTICS_API_URL |
(empty) | Empty: bundled demo dataset. Set: REST backend at this URL |
LOGISTICS_API_TOKEN |
(empty) | Bearer token for the REST backend. Required when the URL is set |
ALLOW_WRITES |
0 |
Only the exact value 1 enables update_shipment_status |
LOGISTICS_TIMEOUT_MS |
10000 |
Per-call timeout for the data source |
LOGISTICS_MAX_RESPONSE_BYTES |
100000 |
Responses above this are trimmed with a note on how to narrow the query |
If LOGISTICS_API_URL is set without a token, the server exits with a message naming the
missing variable. It does not fall back to demo data — a demo answer presented as
production data is worse than an error.
REST backend contract
The rest source expects these endpoints under LOGISTICS_API_URL, all with
Authorization: Bearer <LOGISTICS_API_TOKEN>:
GET /shipments?status&from&to&origin&destination&customer&limit&offset
GET /shipments/:spNumber
GET /shipments/:spNumber/tracking
GET /rates?origin&destination
GET /manifests?region&date&limit&offset
GET /manifests/:id
GET /invoices?status&customer&limit&offset
POST /shipments/:spNumber/status { "status": "...", "note": "..." }
Response shapes match the TypeScript interfaces in src/sources/types.ts.
Security notes
- Read-only by default. The single write tool stays off unless
ALLOW_WRITES=1, and when it is off the tool says how to enable it instead of failing with a generic error. - No credentials in the repo and no credential defaults in code. The token comes from the
environment and is sent only to
LOGISTICS_API_URL. - Tool errors return sentences the model can act on ("no shipment matches SBY-9999; check the number or use search_shipments"), not stack traces or raw upstream responses.
- List responses are capped in rows and in bytes, so one tool call cannot flood the client's context window.
- stdio transport only; the server opens no network listener of its own.
Development
npm install
npm run build # tsc
npm test # vitest, runs against the demo dataset
npm run generate:fixtures # regenerate fixtures/data deterministically
fixtures/generate.ts uses a fixed seed; regeneration must produce byte-identical output.
If it does not, the generator picked up nondeterminism — fix the generator, never hand-edit
the JSON. The demo-data review checklist in .claude/agents/demo-data-reviewer.md covers
the consistency rules the dataset must satisfy (chronology, rate math, cross-file
references).
The .claude/ setup is part of the repo's workflow, not decoration: a review subagent
(agents/demo-data-reviewer.md), a fixture-check skill (skills/check-fixtures/), and two
hooks wired in settings.json — hooks/no-stdout-log.sh keeps stray console.log out of
the stdio server, and hooks/no-null-bytes.sh blocks git commit when a staged text file
contains null bytes (a guard against UTF-16 output from PowerShell redirects, which once
published an empty README to npm).
Limitations
- stdio only; no HTTP/SSE transport.
- The demo dataset is synthetic and small by design (200 shipments). Aggregations like
delivery_performancefetch up to 1000 rows and stop there. - No OAuth; the REST adapter authenticates with a static bearer token.
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。