πŸ“– Looking for karrio's legacy docs? Visit docs.karrio.io

Karrio MCP Server

Overview

The Karrio MCP Server (@karrio/mcp) connects AI assistants to your Karrio shipping API through the Model Context Protocol (MCP). It exposes shipping tools and carrier resources so Claude, Cursor, VS Code Copilot, and any other MCP-compatible client can rate shipments, purchase labels, track packages, and inspect API logs β€” all through natural language.

Key capabilities:

  • 10 shipping tools covering rates, labels, tracking, pickups, manifests, and carrier management
  • MCP Resources for a live carrier capability catalog
  • stdio + Streamable HTTP transport β€” works locally and as a remote service
  • Works with any Karrio instance β€” Karrio Cloud or self-hosted

Prerequisites

  • A running Karrio instance (cloud or self-hosted)
  • A Karrio API key (Settings β†’ API Keys in the dashboard)
  • Node.js 18 or later

Installation

The easiest way is to run the MCP server on demand with npx β€” no global install needed:

1KARRIO_API_URL=https://your-karrio-instance.com \ 2KARRIO_API_KEY=your_api_key \ 3npx -y @karrio/mcp

Or install globally:

1npm install -g @karrio/mcp

Environment Variables

VariableRequiredDescription
KARRIO_API_URLβœ…Base URL of your Karrio instance (e.g. https://api.karrio.io)
KARRIO_API_KEYβœ…API key from your Karrio account settings

Claude Desktop Setup

Add the server to your Claude Desktop configuration file.

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json

1{ 2 "mcpServers": { 3 "karrio": { 4 "command": "npx", 5 "args": ["-y", "@karrio/mcp"], 6 "env": { 7 "KARRIO_API_URL": "https://your-karrio-instance.com", 8 "KARRIO_API_KEY": "your_api_key" 9 } 10 } 11 } 12}

Restart Claude Desktop after saving. You should see a hammer icon (πŸ”¨) in the chat input indicating the tools are available.

Claude Code (CLI)

1claude mcp add karrio -- npx -y @karrio/mcp \ 2 --api-url https://your-karrio-instance.com \ 3 --api-key YOUR_KEY

Cursor Setup

Add to .cursor/mcp.json in your project or ~/.cursor/mcp.json globally:

1{ 2 "mcpServers": { 3 "karrio": { 4 "command": "npx", 5 "args": ["-y", "@karrio/mcp"], 6 "env": { 7 "KARRIO_API_URL": "https://your-karrio-instance.com", 8 "KARRIO_API_KEY": "your_api_key" 9 } 10 } 11 } 12}

Enable the server in Cursor β†’ Settings β†’ MCP β†’ select β€œkarrio”.

VS Code / GitHub Copilot

Add to .vscode/mcp.json:

1{ 2 "servers": { 3 "karrio": { 4 "command": "npx", 5 "args": ["-y", "@karrio/mcp"], 6 "env": { 7 "KARRIO_API_URL": "https://your-karrio-instance.com", 8 "KARRIO_API_KEY": "your_api_key" 9 } 10 } 11 } 12}

Available Tools

Quick Reference

ToolDescriptionRead-only
get_shipping_ratesQuote rates from multiple carriersβœ…
list_carriersBrowse the carrier catalogβœ…
list_carrier_connectionsList configured carrier accountsβœ…
create_shipmentPurchase a shipping label❌
get_shipmentRetrieve a shipment by IDβœ…
list_shipmentsPaginated shipment list with filtersβœ…
cancel_shipmentCancel and void a label❌
track_packageTrack a package by tracking numberβœ…
list_api_logsBrowse API request logsβœ…
get_api_logInspect a specific log entry with carrier tracesβœ…
list_tracing_recordsRaw carrier API request/response recordsβœ…

get_shipping_rates

Fetch rate quotes from multiple carriers for a package. Returns ranked rates with carrier name, service, price, and estimated delivery.

Parameters:

ParameterTypeRequiredDescription
origin_postal_codestringβœ…Origin postal/zip code
origin_country_codestringβœ…ISO 2-letter country code
dest_postal_codestringβœ…Destination postal/zip code
dest_country_codestringβœ…ISO 2-letter country code
weightnumberβœ…Package weight
weight_unitLB|KG|OZ|Gβ€”Weight unit (default: LB)
carrier_idsstring[]β€”Limit to specific carrier accounts

list_carrier_connections

List carrier accounts connected to your Karrio instance β€” the carriers configured with credentials you can use for rating, shipping, and tracking.

Parameters: carrier_name, limit, offset


list_shipments

Paginated list of shipments with optional filters.

Parameters: status, carrier_name, created_after, created_before, limit, offset


create_shipment

Create a shipment and purchase a shipping label.

⚠️ This action purchases a label and incurs a charge. Confirm details with the user before calling.

Parameters: shipper address, recipient address, parcel dimensions, carrier_name, service, label_type


track_package

Track a package by tracking number. Returns current status, location, estimated delivery, and full event history across 50+ carriers.

Parameters:

ParameterTypeRequiredDescription
tracking_numberstringβœ…Package tracking number
carrier_namestringβ€”Carrier slug (auto-detected if omitted)

list_api_logs

Browse API request logs. Useful for debugging shipping calls, investigating errors, or auditing carrier API usage.

Parameters: api_endpoint, method, status_code, status, date_after, date_before, entity_id, limit


get_api_log

Inspect a specific API log entry in full detail β€” request data, response body, and all associated carrier API tracing records.

Parameters: log_id (number)


list_tracing_records

Raw carrier API tracing records β€” the actual requests and responses exchanged with carrier APIs (FedEx, UPS, DHL, etc.).

Parameters: key, request_log_id, date_after, date_before, limit

Usage Examples

Here are natural language prompts and the tools they invoke:

β€œWhat’s the cheapest way to ship a 2 lb package from 10001 to 90210?”
β†’ get_shipping_rates

β€œShow me my last 10 shipments.”
β†’ list_shipments

β€œTrack package 1Z999AA10123456784.”
β†’ track_package

β€œWhich carriers do I have connected?”
β†’ list_carrier_connections

β€œShow me all failed API requests from today.”
β†’ list_api_logs with status: "failed" and date_after

β€œWhat did karrio send to FedEx for shipment ship_abc123?”
β†’ list_api_logs with entity_id: "ship_abc123", then get_api_log on the result

β€œCreate a FedEx Ground label from New York to LA for a 5 lb box.”
β†’ get_shipping_rates, then create_shipment after user confirms

Self-Hosting

Running as a Persistent HTTP Service

For remote or multi-client deployments, run the server with Streamable HTTP transport:

1karrio-mcp --api-key YOUR_KEY --http --port 3100

The server exposes:

  • POST /mcp β€” MCP session endpoint
  • GET /health β€” Health check

Connect Claude Desktop to the remote server:

1{ 2 "mcpServers": { 3 "karrio": { 4 "url": "http://your-server:3100/mcp", 5 "headers": { 6 "Authorization": "Bearer your_token" 7 } 8 } 9 } 10}

Docker

1FROM node:20-alpine 2RUN npm install -g @karrio/mcp 3ENV KARRIO_API_URL=https://your-karrio-instance.com 4ENV KARRIO_API_KEY=your_api_key 5CMD ["karrio-mcp"]

Building from Source

1git clone https://github.com/karrioapi/karrio.git 2cd karrio/packages/mcp 3npm install 4npm run build 5# Run tests 6npm test 7# Run against a live server 8KARRIO_API_URL=http://localhost:5002 KARRIO_API_KEY=your_key npm test

Troubleshooting

”Authentication credentials were not provided”

Your API key is missing or incorrect. Verify:

  1. KARRIO_API_KEY is set in your MCP config env block
  2. The key is valid β€” test with curl -H "Authorization: Token YOUR_KEY" http://your-karrio/v1/shipments

Tools not showing in Claude

  1. Fully quit and reopen Claude Desktop (not just close the window)
  2. Check ~/Library/Logs/Claude/mcp-server-karrio.log for startup errors
  3. Validate your JSON config at jsonlint.com

”No rates returned”

  • Verify the carrier connection is active: list_carrier_connections
  • Ensure origin/destination postal codes and country codes are valid
  • Check if the carrier supports the requested service for that lane

Slow or timing out

  • Check your Karrio instance is reachable from the MCP server host
  • For remote HTTP transport, increase the client timeout in your MCP client settings

Running live integration tests

1cd packages/mcp 2KARRIO_API_URL=http://127.0.0.1:5002 KARRIO_API_KEY=your_key npm run test:integration

Tests are skipped automatically in CI when environment variables are absent.