shiplabel-mcp

shiplabel-mcp

Carrier-agnostic shipping labels as a self-hostable MCP server. Build one shipment request, get a tracking number and a print-ready label back for DHL, DPD, UPS, FedEx, GLS, Sendcloud, and Shipcloud.

Category
访问服务器

README

shiplabel-mcp

Carrier-agnostic shipping labels as a self-hostable MCP server. Build one shipment request, get a tracking number and a print-ready label back — the same way for DHL, DPD, UPS, FedEx, GLS, Sendcloud, Shipcloud and DHL Return. Run it yourself, connect it to Claude (or any MCP client), and create labels straight from a chat, a script, or your own agent.

Carrier-direct: no account with anyone is required to run this — you bring your own account with the carrier(s) you ship with.

Built and open-sourced by Xentral, the ERP for growing product businesses. This server is fully standalone and needs no Xentral account.

Don't want to self-host? The same engine is available ready-to-use, fully hosted, as the Carrier Kit in Xentral AgentOS — no server to run, no setup: agent.xentral.com/en/starter-kits.


Try it in 2 minutes

Looking around needs no carrier account — list_carriers and describe_carrier work out of the box:

pip install shiplabel-mcp        # or: uv pip install shiplabel-mcp
shiplabel carriers               # lists every carrier, no credentials needed

Your first real label — the fastest path is Sendcloud (self-serve API key, no per-carrier contract). Grab a public/secret key and a shipping-method id from the Sendcloud panel, then:

export SHIPLABEL_SENDCLOUD_PUBLIC_KEY="..."
export SHIPLABEL_SENDCLOUD_SECRET_KEY="..."
export SHIPLABEL_SENDCLOUD_METHOD_ID="8"      # a shipping method from your panel
shiplabel create --carrier sendcloud --from examples/sendcloud_request.json --out label.pdf

Prefer DHL? The DHL sandbox needs no production contract. Full setup for every carrier: per-carrier guides · configuration.


How it works

Carriers are data, not code. One generic engine executes a declarative JSON spec per carrier (endpoints, auth, a payload template, response paths). You build a single canonical shipment request (address + parcel + options); the engine maps it onto the carrier's API and normalizes the response to tracking number + base64 label. Adding or tweaking a carrier is a JSON file, not a code change.

Supported carriers

Carrier Sandbox What you need (your own account)
dhl — DHL Paket (DE) developer.dhl.com app + DHL business/GKP contract — see the note below
dhl_return — DHL Return (DE) DHL returns API key + receiver id
dpd DPD business account (partner + cloud credentials)
ups UPS developer app + account number
fedex FedEx developer app + account number
gls GLS business account
sendcloud Sendcloud account (self-serve API key; aggregates PostNL, Swiss Post, Österr. Post, DPD, DHL…)
shipcloud Shipcloud account (self-serve API key) — spec shipped, not yet exercised in tests

Bring your own carrier account. Every production carrier API requires a business/shipping account with that carrier. This project provides the integration; it does not include and cannot provide carrier credentials. The easiest self-serve entry points are the aggregators Sendcloud and Shipcloud.

Per-carrier setup & examples

Each guide has a concrete example: where to register, the exact env config, an example request, and the command to create a label.

  • DHL — includes a free sandbox quickstart
  • GLS
  • UPS — has a sandbox
  • Sendcloud — self-serve keys, easiest to start
  • DPD
  • FedEx, Shipcloud and DHL Return follow the same pattern — run describe_carrier <code> for their keys and see the configuration guide below.

Configuration guide — how credentials and options reach any carrier (env vars, TOML profiles, inline config, sandbox flags, adding your own carrier). Same mechanism for all of them.

⚠️ DHL needs your own credentials

This repo ships no DHL keys. To use DHL you need:

  1. your own app on developer.dhl.com (client id + secret) — free to register; sandbox works immediately;
  2. for production, additionally a DHL business-customer contract (Post & DHL Geschäftskundenportal, "GKP") with a customer/billing number. You don't get this "out of the box" — you register with DHL as a business customer.

To try it out, the sandbox is enough (public DHL test login, see docs/carriers/dhl.md). Without a GKP contract you cannot create real (production) labels — that's a DHL requirement, not a limit of this tool.

Quickstart

Option A — Docker

git clone https://github.com/xentral/shiplabel-mcp.git
cd shiplabel-mcp
cp .env.example .env        # fill in the carrier(s) you use
docker compose up           # HTTP MCP server on http://127.0.0.1:8000/mcp

Option B — local (Python 3.11+)

pip install shiplabel-mcp          # or: uv pip install shiplabel-mcp
cp .env.example .env               # and export/source it, or set env vars directly
shiplabel-mcp                      # stdio server (for Claude Desktop / Claude Code)
shiplabel-mcp --http               # or streamable HTTP on 127.0.0.1:8000

Connect it to an MCP client

The server exposes three tools: list_carriers, describe_carrier, create_label.

Claude Desktop

Add to claude_desktop_config.json:

{
  "mcpServers": {
    "shiplabel": {
      "command": "shiplabel-mcp",
      "env": {
        "DHL_API_CLIENT_ID_SANDBOX": "your-dev-app-id",
        "DHL_API_CLIENT_SECRET_SANDBOX": "your-dev-app-secret",
        "SHIPLABEL_DHL_USERNAME": "your-gkp-user",
        "SHIPLABEL_DHL_PASSWORD": "your-gkp-password",
        "SHIPLABEL_DHL_ACCOUNTNUMBER": "your-billing-number",
        "SHIPLABEL_DHL_SANDBOX": "true"
      }
    }
  }
}

Claude Code

claude mcp add shiplabel \
  -e SHIPLABEL_DHL_SANDBOX=true \
  -e SHIPLABEL_DHL_USERNAME=... \
  -- shiplabel-mcp

HTTP mode

Start with shiplabel-mcp --http and point your client at http://127.0.0.1:8000/mcp (streamable HTTP transport).

Then just ask: "list the shipping carriers", "describe what dhl needs", "create a DHL label from Muster GmbH, Bonn to Erika Beispiel, Bonn, 1.5 kg."

Use it as a library or CLI

The MCP server is a thin wrapper over the shiplabel Python package, which you can also use directly:

from decimal import Decimal
from shiplabel import CanonicalShipmentRequest, CarrierSelection, Party, Parcel, create_label

req = CanonicalShipmentRequest(
    carrier=CarrierSelection(code="dhl", product="V01PAK"),
    sender=Party(name="Muster GmbH", street="Sträßchensweg", house_number="10",
                 postal_code="53113", city="Bonn", country="DE"),
    recipient=Party(name="Erika Beispiel", street="Kurt-Schumacher-Str.", house_number="20",
                    postal_code="53113", city="Bonn", country="DE"),
    parcels=[Parcel(id="p1", weight_kg=Decimal("1.5"))],
)
config = {"dhl_username": "...", "dhl_password": "...", "dhl_accountnumber": "...",
          "dhl_api_key": "...", "dhl_api_secret": "...", "dhl_sandbox": True}
result = create_label(config, req)
print(result.parcels[0].tracking_number)  # + result.parcels[0].label.data (base64 PDF)
shiplabel carriers                                  # list carriers
echo '{...}' | shiplabel create --carrier dhl --out label.pdf   # canonical request on stdin

See src/shiplabel/README.md for the full library / CLI reference and the canonical request shape.

Configuration

Copy .env.example and set only the carriers you use.

  • SHIPLABEL_<KEY> → the lowercase carrier config key <key> (e.g. SHIPLABEL_DHL_USERNAMEdhl_username).
  • DHL developer-app credentials are read from DHL_API_CLIENT_ID[_SANDBOX] / DHL_API_CLIENT_SECRET[_SANDBOX].
  • SHIPLABEL_CARRIERS_DIR — a directory of extra *.json specs to add or override carriers without forking.

Credentials can always also be passed inline per call (the MCP create_label config argument, or the library config dict) — inline wins over env.

See the configuration guide for TOML profiles, source precedence, sandbox flags, and the full canonical request shape.

Add a carrier

Drop a <code>.json spec into src/shiplabel/carriers/ (or a SHIPLABEL_CARRIERS_DIR). A spec has five parts — transport, auth, capabilities, request (a Jinja payload template), response. See src/shiplabel/README.md and dhl.json for a complete example. Modern REST/JSON carrier APIs fit the declarative model; carriers needing computed security (e.g. SOAP WSSE) are out of scope.

Security

  • Never commit credentials. .env, *.env (except .env.example) and carriers.toml are git-ignored.
  • Labels are returned as base64 blobs; the CLI writes them to disk only where you ask. Generated *.pdf/*.zpl/*.png are git-ignored.
  • Report vulnerabilities per SECURITY.md.

Development

uv venv && source .venv/bin/activate
uv pip install -e ".[dev]"
python -m pytest        # transport is mocked — no live carrier calls
ruff check .

License

MIT © Xentral ERP Software GmbH.

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选