Skip to main content
Glama
Deftship MCP Server
by Kodeas

Deftship MCP Server

A Model Context Protocol server for the Deftship multi-carrier shipping API. It lets any MCP-capable AI client (Claude Desktop, Claude Code, Cursor, Codex CLI, and others) quote, ship, track, void and manage shipments in natural language using your Deftship API token.

What it can do

The full shipping lifecycle is exposed as tools:

Domain

Tools

Parcel

get rates, create draft, ship, void, get/track, merge labels, mark as shipped, list e-commerce orders

Freight

get rates, create draft, ship, void, get/track

Pickup

get rates, create, arrange, void, get

Insurance

get rate, book, void

Batch (beta)

create, add items, remove items, get, ship

Account

check balance, address book, validate address, service names, carrier status, create ticket

A typical flow: deftship_get_parcel_rates → choose a rate_id → deftship_ship_parcel → deftship_get_parcel to fetch the label and track it.

Related MCP server: Easyship MCP

Safety guardrails

Because an AI agent can drive this end to end, spending is deliberately hard to do by accident:

  • Sandbox by default. With DEFTSHIP_ENV=sandbox (the default) every operation runs against the isolated sandbox with a $10,000 dummy balance and never touches production. Going live is a deliberate one-line change.

  • Explicit confirmation. Every tool that spends your balance or is irreversible (ship, void, book_insurance, arrange_pickup, ship_batch) refuses to run unless called with "confirm": true, forcing the agent to surface the action to you first.

  • Honest tool hints. Read-only tools are marked readOnlyHint; spending tools are marked destructiveHint, so clients can prompt for approval.

Setup

1. Get an API token

Generate a sandbox token from your Deftship organisation's API page. Use sandbox while you test; switch to a production token only when you are ready to spend real money.

2. Configure your MCP client

Claude Desktop / Claude Code (claude_desktop_config.json or .mcp.json):

{
  "mcpServers": {
    "deftship": {
      "command": "npx",
      "args": ["-y", "@deftship/mcp"],
      "env": {
        "DEFTSHIP_API_TOKEN": "bearer-your-token-here",
        "DEFTSHIP_ENV": "sandbox"
      }
    }
  }
}

Codex CLI (~/.codex/config.toml):

[mcp_servers.deftship]
command = "npx"
args = ["-y", "@deftship/mcp"]
env = { DEFTSHIP_API_TOKEN = "bearer-your-token-here", DEFTSHIP_ENV = "sandbox" }

Cursor (.cursor/mcp.json): same shape as the Claude example above.

Environment variables

Variable

Required

Default

Description

DEFTSHIP_API_TOKEN

yes

—

Your Deftship API token.

DEFTSHIP_ENV

no

sandbox

sandbox or production. Determines the API URL.

Local development

npm install
npm run build      # compile TypeScript to dist/
npm run dev        # watch mode
DEFTSHIP_API_TOKEN=bearer-... npm start

The server speaks MCP over stdio. Do not write anything to stdout in tool code — stdout carries the JSON-RPC stream; diagnostics go to stderr.

Project structure

src/
  config.ts        env parsing, sandbox/production base URL resolution
  http.ts          fetch wrapper: auth, error + rate-limit normalization
  schemas.ts       shared Zod schemas (address, package, item, ...)
  server.ts        assembles the server and registers all tool modules
  index.ts         stdio entry point
  tools/
    helpers.ts     registration wrapper, confirm gate, result formatting
    parcel.ts freight.ts pickup.ts insurance.ts batch.ts account.ts

Tool schemas mirror the field tables in the official Deftship developer docs.

License

MIT

Available Tools

32 tools
deftship_add_batch_itemsAdd items to a batchA

Add more shipments to an existing batch. The batch must not be validating, processing or completed. Batch returns to 'validating' while new items are checked.

Inputs: batch_id (required), batch_shipments (required).

deftship_arrange_pickupArrange (book) a pickupA
Destructive

Book a previously created pickup order with the carrier. Returns the pickup confirmation number (prn). May charge your balance depending on carrier. Requires confirm=true.

Inputs: pickup_order_id (required), confirm.

deftship_book_insuranceBook insuranceA
Destructive

Purchase a previously quoted insurance by insurance_id. THIS CHARGES YOUR BALANCE. Requires confirm=true.

Inputs: insurance_id (required), confirm.

deftship_check_balanceCheck account balanceA
Read-only

Return your organisation's current Deftship balance and currency. Useful before shipping to confirm there are enough funds.

Inputs: no named parameters.

deftship_create_batchCreate shipment batchA

Create a shipment batch (beta; own-USPS-account only) with up to 1,000 shipments that share a shipper and service. Items are validated asynchronously; poll deftship_get_batch until status is 'ready', then deftship_ship_batch. Does not spend money yet.

Inputs: service (required), shipper_id (required), batch_shipments (required).

deftship_create_freight_orderCreate draft freight orderA

Create a draft freight order visible on the Open Orders page. Does not purchase. Returns the shipment_order_id. Pass shipment_order_id to update an existing draft.

Inputs: items (required), to_address (required), pickup_date (required), from_address (required), +7 more.

deftship_create_parcel_orderCreate draft parcel orderA

Create a draft parcel order that appears on the Open Orders page in the dashboard. Does not purchase a label. Returns the shipment_order_id. Pass shipment_order_id to update an existing draft.

Inputs: to_address (required), package_list (required), length_unit, weight_unit, +6 more.

deftship_create_pickup_orderCreate pickup orderA

Create a pickup order visible on the Pickup Orders page. Returns the full pickup order object including its id. Use deftship_arrange_pickup to actually book it with the carrier.

Inputs: pieces (required), carrier (required), id, close_time, +4 more.

deftship_create_ticketCreate a support ticketA

Open a support ticket against existing shipments (e.g. a claim or issue) by tracking number. Some ticket types carry a fee. Provide ticket_type_id, a reference, a message and the related tracking numbers.

Inputs: message (required), reference (required), ticket_type_id (required), tracking_numbers (required), +1 more.

deftship_get_address_bookGet saved addressesA
Read-only

Fetch your saved addresses. Use destination 'from' for sender addresses or 'to' for recipient addresses. Returns address records with their ids for use as from_address_id / to_address_id.

Inputs: destination (required).

deftship_get_batchGet batch statusA
Read-only

Fetch a batch's status, validation results, per-item details and (when completed) merged label PDF URLs. Optionally filter items by status: valid, invalid, completed, failed.

Inputs: batch_id (required), status.

deftship_get_carrier_statusGet carrier statusA
Read-only

Check the current operational status of a carrier (e.g. known outages or degraded service).

Inputs: carrier (required).

deftship_get_freightGet / track freightA
Read-only

Fetch a freight order's BOL number, label, POD and confirmed pickup window, either by shipment_order_id or by bol_number. Provide exactly one identifier.

Inputs: bol_number, shipment_order_id.

deftship_get_freight_ratesGet freight ratesA
Read-only

Quote LTL/FTL freight rates from all allowed carriers. Returns rates each with an id (rate_id) to ship, carrier, service, final_price, load_type (ltl/ftl), is_guaranteed, and has_enough_credits. Does not spend money.

Inputs: items (required), to_address (required), pickup_date (required), from_address (required), +6 more.

deftship_get_insurance_ratesGet insurance rateA
Read-only

Quote insurance for a shipment. Creates an insurance record and returns its id (insurance_id) and price. Use deftship_book_insurance with the id to purchase. Does not spend money.

Inputs: carrier (required), to_address (required), package_list (required), service_code (required), +5 more.

deftship_get_parcelGet / track a parcelA
Read-only

Fetch a parcel order's status, tracking numbers and label URL, either by shipment_order_id or by tracking_number. Use this to poll for a label after shipping and to track a shipment. Provide exactly one of the two identifiers.

Inputs: tracking_number, shipment_order_id.

deftship_get_parcel_ratesGet parcel ratesA
Read-only

Quote parcel shipping rates from all allowed carriers for a given from/to address and package list. Returns a list of rates, each with an id (rate_id) used to ship, carrier, service, final_price, eta, and has_enough_credits. Does not spend money. Optionally pass carrier to restrict to one carrier and speed up the response.

Inputs: to_address (required), package_list (required), carrier, length_unit, +6 more.

deftship_get_pickupGet a pickup orderA
Read-only

Fetch a previously created pickup order by id, including pieces and status.

Inputs: pickup_order_id (required).

deftship_get_pickup_ratesGet pickup ratesA
Read-only

Quote a carrier pickup. Returns the pickup order id plus base_price, fuel_price and final_price. Does not spend money.

Inputs: pieces (required), carrier (required), id, close_time, +4 more.

deftship_get_service_namesList carrier servicesA
Read-only

List available carrier services and their service codes. Use type 'shipment' for parcel/freight services or 'pickup' for pickup services.

Inputs: type.

deftship_list_ecommerce_parcelsList e-commerce draft parcelsA
Read-only

List draft parcel orders imported from connected e-commerce platforms (50 per page). Supports optional date range, platform and order_number filters. Rate limited to 20/min.

Inputs: end_date, platform, start_date, order_number.

deftship_mark_as_shippedMark orders as shippedA

Mark draft orders as shipped outside of Deftship (e.g. shipped with another provider). Optionally push fulfillment back to the connected e-commerce platform. Each order is identified by id or ecommerce_id (not both).

Inputs: orders (required), send_fulfillment.

deftship_merge_parcel_labelsMerge parcel labelsA

Merge multiple already-generated parcel labels into a single PDF. Returns the merged label URL. Only works for labels that already exist.

Inputs: ids (required).

deftship_remove_batch_itemsRemove items from a batchA

Remove specific items from a batch by their item hash ids (max 10,000). Also deletes the associated shipment orders. The batch must not be validating, processing or completed.

Inputs: batch_id (required), batch_shipment_ids (required).

deftship_ship_batchShip a batchA
Destructive

Ship all valid items in a batch. The batch must be in 'ready' status. THIS CHARGES YOUR BALANCE for every item in the batch. Processing is asynchronous; poll deftship_get_batch for labels. Requires confirm=true.

Inputs: batch_id (required), confirm.

deftship_ship_freightShip freight (book BOL)A
Destructive

Book a freight shipment using a rate_id from deftship_get_freight_rates. THIS CHARGES YOUR BALANCE. The BOL and label are delivered asynchronously to your token's webhook, or retrieved later with deftship_get_freight. Requires confirm=true.

Inputs: rate_id (required), confirm.

deftship_ship_parcelShip a parcel (buy label)A
Destructive

Purchase a parcel label using a rate_id from deftship_get_parcel_rates. THIS CHARGES YOUR BALANCE. The label and tracking numbers are delivered asynchronously to your token's webhook, or retrieved later with deftship_get_parcel. Requires confirm=true.

Inputs: rate_id (required), confirm.

deftship_validate_addressValidate an addressA
Read-only

Validate an address before shipping to avoid correction surcharges. Returns suggested/corrected address candidates and whether the address is residential.

Inputs: zip (required), country (required), street_1 (required), city, +6 more.

deftship_void_freightVoid a freight shipmentA
Destructive

Void a previously created freight order by shipment_order_id. May incur a void_fee. Requires confirm=true.

Inputs: shipment_order_id (required), confirm.

deftship_void_insuranceVoid insuranceA
Destructive

Void a previously booked insurance by insurance_id. Requires confirm=true.

Inputs: insurance_id (required), confirm.

deftship_void_parcelVoid a parcel shipmentA
Destructive

Void a previously created parcel order by shipment_order_id. May incur a void fee (returned as void_fee). Requires confirm=true.

Inputs: shipment_order_id (required), confirm.

deftship_void_pickupVoid a pickupA
Destructive

Void a previously created pickup order by id. Requires confirm=true.

Inputs: pickup_order_id (required), confirm.

Tool Schema Changelog

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

    TDQS

    A4.1/5.0

    Scored across 32 tools

    Disambiguation5/5

    Each tool has a distinct action-noun pattern with clear prefixes, and descriptions clarify boundaries (e.g., create vs. ship vs. void). Even similar operations like parcel vs. freight are clearly separated by domain.

    Naming Consistency5/5

    All tools follow a consistent 'deftship_verb_noun' naming convention with clear, descriptive verbs and nouns. No mixing of styles or vague terms.

    Tool Count3/5

    32 tools is significantly above the typical 3-15 range, covering a complex domain. While each tool serves a purpose, the count feels heavy for a single server, potentially overwhelming agents.

    Completeness5/5

    The tool surface covers the full lifecycle: rate quoting, order creation, shipping, voiding, insurance, pickup, batch operations, address validation, and support tickets. No obvious gaps for a shipping API.

    Maintenance

    ActivityInactive
    ResponsivenessLimited data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables AI agents to manage global shipping operations, including rate comparison, shipment creation, label purchasing, tracking, pickup scheduling, address validation, billing, and analytics, via natural language.
      32 npm
      MIT
    • A
      license
      B
      quality
      B
      maintenance
      Integrates the Machship freight management platform with MCP-compatible LLMs, enabling shipment creation, quotes, labels, and carrier management via natural language.
      125
      373 npm
      1
      ISC