Connect ShipEngine to ChatGPT: Automate Labels and Tracking
Learn how to connect ShipEngine to ChatGPT using Truto's managed MCP servers. Automate label generation, rate shopping, and real-time package tracking.
If you need to connect ShipEngine to ChatGPT to automate label generation, track shipments, or compare carrier rates, you need a Model Context Protocol (MCP) server. This server acts as the translation layer between ChatGPT's tool calling engine and ShipEngine's REST API. You can either build, host, and maintain this infrastructure yourself, or use a managed integration platform like Truto to dynamically generate a secure, authenticated MCP server URL.
If your team uses Claude, check out our guide on connecting ShipEngine to Claude or explore our broader architectural overview on connecting ShipEngine to AI Agents.
Giving a Large Language Model (LLM) read and write access to a shipping and logistics API is an engineering challenge. You have to handle complex nested JSON objects for package dimensions, stateful rate-shopping flows, and strict address validation logic. Every time an LLM attempts to create a label, it must correctly format weights, customs declarations, and carrier-specific service codes.
This guide breaks down exactly how to use Truto to generate a secure, managed MCP server for ShipEngine, connect it natively to ChatGPT, and execute complex fulfillment workflows using natural language.
Stop writing boilerplate API integration code. Let Truto generate secure, managed MCP servers for your AI agents in seconds. :::
The Engineering Reality of the ShipEngine API
A custom MCP server is a self-hosted integration layer. While the open MCP standard provides a predictable way for models to discover tools, implementing it against ShipEngine's API requires dealing with several domain-specific integration challenges.
If you decide to build a custom MCP server for ShipEngine, you own the entire API lifecycle. Here are the specific integration challenges that break standard CRUD assumptions when working with ShipEngine:
Stateful Rate Shopping vs Label Creation
ShipEngine offers two primary ways to create a shipping label. You can execute a direct purchase using create_a_ship_engine_label, which requires the LLM to know the exact carrier ID and service code upfront. Alternatively, you execute a stateful rate-shopping flow: first, call ship_engine_rates_estimate or create_a_ship_engine_rate to retrieve an array of rates, extract a specific rate_id, and then pass that ID into ship_engine_labels_create_from_rate. Your MCP server must explicitly define these dependencies in the tool descriptions, or the LLM will hallucinate service codes or try to pass raw dollar amounts into the label creation endpoint.
Label Render Formats and Async Processing
When a label is generated, ShipEngine does not just return a standardized object. It returns the label in the requested format (PDF, PNG, ZPL) and layout (e.g., 4x6). Furthermore, the API provides the label either as a temporary URL (label_download) or as an inline Base64 encoded string, dictated by the label_download_type parameter. If your AI agent needs to show the user a label, passing a 50kb Base64 string into the context window will degrade performance rapidly. You must constrain the LLM to request URL downloads and instruct it to return that URL to the user.
Unstructured Address Resolution
LLMs operate on unstructured text (e.g., "Ship this to John at 123 Main st in Austin Texas"). ShipEngine's core endpoints expect highly structured address objects (address_line1, city_locality, state_province, postal_code). If the LLM tries to manually parse an address, it will inevitably fail on edge cases like international postal codes or suite numbers. ShipEngine provides a specific ship_engine_addresses_recognize endpoint to parse unstructured text into valid schema. Your MCP tools must train the LLM to run this recognition step before attempting any label creation.
Step-by-Step: Connecting ShipEngine to ChatGPT
Truto eliminates the need to build a custom Node.js or Python server. Instead, Truto dynamically generates MCP tools from ShipEngine's API documentation and serves them over a secure JSON-RPC endpoint.
Step 1: Connect the ShipEngine Account
Before creating an MCP server, you must connect a ShipEngine account to your Truto environment.
- In the Truto dashboard, navigate to Integrated Accounts.
- Click New Integrated Account and select ShipEngine.
- Enter your ShipEngine API Key (obtained from the ShipEngine dashboard under API Management).
- Save the connection. Truto will securely store the credentials and handle all future authentication headers.
Step 2: Generate the MCP Server URL
You can generate the MCP server URL in two ways: via the Truto UI or programmatically via the API.
Method 1: Via the Truto UI
- Navigate to the integrated account page for your new ShipEngine connection.
- Click the MCP Servers tab.
- Click Create MCP Server.
- Give it a name (e.g., "ChatGPT Fulfillment Operations").
- Select your configuration. You can filter by methods (e.g., only allow
readoperations) or filter by tags (e.g., only allowlabelsandtracking). - Click Save and copy the generated MCP server URL (it will look like
https://api.truto.one/mcp/a1b2c3d4...).
Method 2: Via the Truto API For programmatic setups, you can generate this URL by making an API call to Truto.
curl -X POST https://api.truto.one/integrated-account/<INTEGRATED_ACCOUNT_ID>/mcp \
-H "Authorization: Bearer $TRUTO_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "ChatGPT Shipping Ops",
"config": {
"methods": ["read", "write", "custom"],
"tags": ["labels", "rates", "tracking", "shipments"]
}
}'The response contains the exact same url field you would get from the UI. This URL encodes the routing, authentication, and tool filters.
Step 3: Connect the Server to ChatGPT
With your Truto MCP URL in hand, you can now connect it to ChatGPT.
Method 1: Via the ChatGPT UI (For custom GPTs or Desktop) If you are using ChatGPT Plus, Team, or Enterprise, you can add custom connectors:
- In ChatGPT, open Settings -> Apps -> Advanced settings.
- Enable Developer mode.
- Under MCP servers / Custom connectors, click Add.
- Name your connector (e.g., "ShipEngine-Truto").
- Paste the Truto MCP URL into the Server URL field.
- Save. ChatGPT will immediately perform a handshake, run a
tools/listcommand, and register the available ShipEngine tools.
Method 2: Via Manual Configuration File (For local dev or testing)
If you are orchestrating an AI agent locally or wrapping ChatGPT APIs in your own application, you can connect via a Server-Sent Events (SSE) transport using the standard @modelcontextprotocol/server-sse package.
Create an mcp-config.json file:
{
"mcpServers": {
"shipengine": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-sse",
"--url",
"https://api.truto.one/mcp/<YOUR_TRUTO_TOKEN>"
]
}
}
}Your MCP client will read this configuration, connect to the Truto endpoint, and expose the ShipEngine tools to your LLM.
Hero Tools for ShipEngine Automation
Truto dynamically generates schemas for the entire ShipEngine API surface. Below are the highest-leverage tools available for AI-driven logistics workflows.
Parse Unstructured Text to Shipment
Tool: ship_engine_shipments_recognize
This tool is critical for natural language processing. It takes an unstructured block of text (like an email from a customer) and extracts structured shipping data, returning a confidence score, carrier ID, service code, ship-to, ship-from, and package weights.
"I just got an email from a customer: 'Hi, please send my replacement order to 456 Elm St, Suite 200, Denver CO 80203'. Run this through shipment recognition and show me the parsed address."
Retrieve Real-Time Package Tracking
Tool: ship_engine_labels_track
Retrieves real-time tracking information using a ShipEngine label ID. It returns detailed tracking events, estimated delivery dates, and current status codes.
"What is the current tracking status for label ID se-19384729? Tell me exactly where it was last scanned and the estimated delivery date."
Calculate Shipping Rates
Tool: create_a_ship_engine_rate
Calculates accurate shipping rates. You can provide an existing shipment_id or pass a full shipment object containing origin, destination, and package dimensions. This is essential for rate shopping before label purchase.
"Get shipping rates for a 2-pound package moving from postal code 90210 to 10001. Show me the cheapest option available across our connected carriers."
Create a Shipping Label
Tool: create_a_ship_engine_label
Directly purchases and generates a shipping label. It returns the tracking number, shipment cost, and a download URL for the PDF or PNG label.
"Create a shipping label for shipment ID se-993821 using the cheapest rate ID we just found. Make sure the output format is a PDF, and give me the download URL."
Void a Shipping Label
Tool: ship_engine_labels_void
Requests a refund for an unused label by voiding it. This requires the label_id and is frequently used when orders are cancelled or address mistakes are caught right after label generation.
"The customer just cancelled their order. Void the label se-11223344 and confirm that the refund request was approved."
List Connected Carriers
Tool: list_all_ship_engine_carriers
Lists all carriers currently connected to the ShipEngine account, returning their account numbers, current balances, and available services. Useful for checking if a specific carrier (like UPS or FedEx) is active before attempting to use it.
"List all active carriers on this account and tell me what the current account balance is for USPS."
To view the complete inventory of available ShipEngine tools, including parameters and JSON schemas, visit the ShipEngine integration page on Truto.
Workflows in Action
AI agents excel at executing multi-step operations that would normally require a human to click through multiple tabs in a logistics dashboard. Here are two real-world workflows you can execute once ShipEngine is connected to ChatGPT.
Workflow 1: Customer Support Resolving a Lost Package
Customer support teams spend significant time tracking lost packages and dispatching replacements. ChatGPT can orchestrate this entire workflow from a single prompt.
"Check the tracking on label se-555123. If it hasn't had an update in 5 days, void the original label, find the cheapest rate to ship a 1lb replacement to the same address, and buy a new label."
Step-by-step Execution:
- ChatGPT calls
ship_engine_labels_trackto retrieve the event history and status. - The model evaluates the timestamp of the last scan event.
- Seeing a 5-day delay, it calls
ship_engine_labels_voidto request a refund on the original label. - It calls
create_a_ship_engine_rateusing the shipment details from the original order to get current rates. - It evaluates the rates, selects the lowest cost, and calls
ship_engine_labels_create_from_rateto purchase the replacement label, outputting the new tracking number and PDF URL to the support agent.
sequenceDiagram
participant User as Support Agent
participant AI as ChatGPT
participant Truto as Truto MCP Server
participant ShipEngine as ShipEngine API
User->>AI: Track package, void if lost, create new label
AI->>Truto: call ship_engine_labels_track
Truto->>ShipEngine: GET /v1/labels/se-555123/track
ShipEngine-->>Truto: Tracking events (no update 5 days)
Truto-->>AI: Tool Result: Tracking events
AI->>Truto: call ship_engine_labels_void
Truto->>ShipEngine: PUT /v1/labels/se-555123/void
ShipEngine-->>Truto: Void approved
Truto-->>AI: Tool Result: Success
AI->>Truto: call create_a_ship_engine_rate
Truto->>ShipEngine: POST /v1/rates
ShipEngine-->>Truto: Array of carrier rates
Truto-->>AI: Tool Result: Rate IDs
AI->>Truto: call ship_engine_labels_create_from_rate
Truto->>ShipEngine: POST /v1/labels/rates/<rate_id>
ShipEngine-->>Truto: New label URL & Tracking
Truto-->>AI: Tool Result: New Label Data
AI-->>User: "Original voided. New tracking: 1Z9999. PDF: [Link]"Workflow 2: Automated Dispatch and Address Parsing
Operations managers often receive unstructured instructions from sales reps via email or chat. ChatGPT can convert this raw text into actionable logistics operations.
"My rep sent me this message: 'Ship a demo unit (weight 5 lbs) overnight to Acme Corp, Attn: Jane Doe, 100 Tech Blvd, San Jose CA 95110'. Parse this address, make sure we have enough funds in our FedEx account, and generate a FedEx Standard Overnight label."
Step-by-step Execution:
- ChatGPT calls
ship_engine_shipments_recognizepassing the raw text to extract a structured address object. - ChatGPT calls
list_all_ship_engine_carriersto retrieve thecarrier_idfor FedEx and check thebalancefield. - Assuming funds are sufficient, ChatGPT calls
create_a_ship_engine_labeldirectly, injecting the parsed address, the FedExcarrier_id, and theservice_codefor Standard Overnight. - It returns the final tracking number and label download link to the user.
Security and Access Control
Exposing an e-commerce API that physically spends money (buying postage) to an LLM requires strict security constraints. Truto's MCP servers are designed with built-in controls to limit the blast radius of AI actions.
- Method Filtering: When generating the server URL, you can limit tools by HTTP method. Setting
methods: ["read"]ensures the LLM can track packages (GET) but cannot accidentally purchase labels (POST). - Tag Filtering: ShipEngine tools are tagged by resource. You can restrict the MCP server to
tags: ["tracking", "carriers"]to hide all label creation and batch processing endpoints from the LLM entirely. - Expiration (TTL): For temporary workflows, you can pass an
expires_attimestamp. The MCP server and its KV storage will self-destruct exactly at the specified time, leaving no stale credentials active. - Layered Authentication: By default, the Truto MCP URL contains a secure hash. For higher security, setting
require_api_token_auth: trueforces the connecting client to also pass a valid Truto API bearer token. - Factual Note on Rate Limits: Truto does not retry, throttle, or apply backoff on rate limit errors. When ShipEngine returns an HTTP 429 Too Many Requests, Truto passes that error directly back to the caller. Truto normalizes upstream rate limit info into standardized headers (
ratelimit-limit,ratelimit-remaining,ratelimit-reset). The caller (your app or the LLM framework) is responsible for implementing retry/backoff logic.
Build Faster Logistics Automations
Integrating ShipEngine into an AI agent shouldn't require weeks of reading API documentation, handling complex payload structures, and building custom tool schemas.
By using Truto to generate a managed MCP server, you instantly bridge the gap between ChatGPT and your logistics stack. Your operations teams can execute complex rate shopping, tracking, and label generation workflows purely through natural language, backed by the security of method filtering and token management.
Stop writing boilerplate API integration code. Let Truto generate secure, managed MCP servers for your AI agents in seconds. :::
FAQ
- How do I handle ShipEngine API rate limits when using ChatGPT?
- Truto passes upstream HTTP 429 rate limit errors directly to the caller. It normalizes rate limit information into standard headers (ratelimit-limit, ratelimit-remaining, ratelimit-reset) per the IETF specification. The caller (or the client invoking the MCP server) is responsible for implementing any necessary retry or backoff logic.
- Can I restrict ChatGPT to only track shipments, preventing it from purchasing labels?
- Yes. When generating the MCP server in Truto, you can use method filtering to restrict the server to 'read' operations only, or use tag filtering to limit access to only the 'tracking' resource.
- How does ChatGPT get the actual label file (PDF/PNG)?
- ShipEngine returns a label download URL or base64-encoded string depending on the request parameters. ChatGPT can read this URL and present it to the user as a clickable link to download the generated PDF or PNG label.