Fedex

From mvanhorn/printing-press-library · View interactive version

Fedex is an AI agent skill from the GitHub repository mvanhorn/printing-press-library. REST-native FedEx CLI for small business shippers, with rate-shopping, bulk CSV labels, an address book, and a local SQLite ledger no other tool has. Trigger phrases: `ship a package via FedEx`, `rate-shop FedEx services`, `bulk-print FedEx labels from CSV`, `save a FedEx recipient`, `issue a FedEx

How to use this skill

Skill file

FedEx — Printing Press CLI

Prerequisites: Install the CLI

This skill drives the fedex-pp-cli binary. You must verify the CLI is installed before invoking any command from this skill. If it is missing, install it first:

  1. Install via the Printing Press installer. It defaults binaries to $HOME/.local/bin on macOS/Linux and %LOCALAPPDATA%\Programs\PrintingPress\bin on Windows:

```bash

npx -y @mvanhorn/printing-press-library install fedex --cli-only

```

  1. Verify: fedex-pp-cli --version
  2. Ensure the reported install directory is on $PATH for the agent/runtime that will invoke this skill.

If the npx install fails (no Node, offline, etc.), fall back to a direct Go install (requires Go 1.26.6 or newer):

go install github.com/mvanhorn/printing-press-library/library/commerce/fedex/cmd/fedex-pp-cli@latest

If --version reports "command not found" after install, the runtime cannot see the binary directory on $PATH. Do not proceed with skill commands until verification succeeds.

When to Use This CLI

Use fedex-pp-cli when you run a small-to-medium shipping operation and want to programmatically interact with the FedEx REST API. Right fit for: e-commerce stores creating labels from order CSVs, customer-service teams generating return labels, ops teams tracking in-flight shipments, and SMB owners who want a local ledger of every shipment and rate quote for accounting. The local SQLite archive makes it the right tool for analytical queries over historical shipments. Choose this CLI over multi-carrier SaaS (ShipStation, Shippo) when you only need FedEx, want to own your data, and prefer terminal/agent automation over web UIs.

Unique Capabilities

These capabilities aren't available in any other tool for this API.

Save money, save time

_When picking the cheapest viable service for a shipment, this collapses 6+ API calls into one ranked answer. The headline cost-saving command for SMB shippers._

```bash

fedex rate shop --from 90210 --to 10001 --weight 5lb --json --select rates.serviceType,rates.totalNetCharge,rates.transitTime

```

_The 'I ship 30 packages a day' workflow. Replaces clicking through FedEx Ship Manager one label at a time._

```bash

fedex ship bulk --csv orders.csv --service GROUND --output labels/ --resume --yes

```

_E-commerce customer-service workflow. Issuing a return label is the most common post-sale interaction._

```bash

fedex return create --tracking 794633071234 --reason damaged --email customer@example.com --yes

```

_Direct cost savings — the only feature with a quantifiable per-call $ impact._

```bash

fedex address validate --street '1600 Amphitheatre Pkwy' --city 'Mountain View' --state CA --zip 94043 --country US --cache

```

_International shipments require ETD; this collapses an error-prone multi-step into one atomic action._

```bash

fedex ship etd --invoice invoice.pdf --orig CN --dest US --recipient-name 'Acme' --weight 2kg --service FEDEX_INTERNATIONAL_PRIORITY

```

Local state that compounds

_Ergonomic parity with paid SaaS competitors. Eliminates retyping addresses for repeat customers._

```bash

fedex address save acme --street '500 Main St' --city Denver --state CO --zip 80202 --country US

```

_Replaces tracking-poll dedupe glue agents would otherwise write._

```bash

fedex track diff --since 1h --json

```

_Most SMBs don't have provisioned push webhooks. Polling daemon is the universal alternative._

```bash

fedex track watch --tracking 794633071234 --interval 10m --webhook https://example.com/hook

```

_'Did we ship to ACME last week?' — a question SMBs ask constantly._

```bash

fedex archive 'warehouse 47' --service GROUND --json

```

_'How much did I spend on FedEx last month?' — the question every SMB owner asks._

```bash

fedex spend report --since 30d --by service --json

```

_Closes the loop on accounting reconciliation without manual data entry._

```bash

fedex export --format csv --since 30d --output fedex-april.csv

```

_Closes the warehouse-day workflow loop in one command._

```bash

fedex manifest --date 2026-05-02 --close --output manifest.md

```

_Escape hatch for arbitrary analytics over the local ledger._

```bash

fedex sql "select serviceType, count(*) as n, sum(net_charge) as spend from shipments where created_at > date('now','-30 days') group by serviceType order by spend desc"

```

Setup smoothness

_Avoids the most common 'why won't my labels print' failure mode for first-time users._

```bash

fedex doctor

```

Command Reference

addresses — Address validation

availability — Service availability, special-service options, and transit times

consolidations — Consolidate multiple shipments into one fulfillment (advanced; for high-volume 3PLs)

endofday — Submit and modify Ground end-of-day close (daily manifest)

freight_pickups — Schedule, check, and cancel freight (LTL) pickups

freight_shipments — Create freight (LTL) shipments (for industrial shippers)

globaltrade — Global trade regulatory details (HS codes, restrictions)

locations — Find FedEx Office, dropoff, and pickup locations

openship — Build multi-piece shipments progressively before confirming (advanced; not needed for typical SMB workflows)

pickups — Schedule, check availability, and cancel Express/Ground pickups

postal — Postal code validation and country servicing

rates — Rate quotes for Express, Ground, Home, Ground Economy, and freight

shipments — Create, validate, cancel, and retrieve shipments

track — Track shipments by tracking number, reference, TCN, or associated shipment; retrieve documents and configure notifications

Hand-written commands

Finding the right command

When you know what you want to do but not which command does it, ask the CLI directly:

fedex-pp-cli which "<capability in your own words>"

which resolves a natural-language capability query to the best matching command from this CLI's curated feature index. Exit code 0 means at least one match; exit code 2 means no confident match — fall back to --help or use a narrower query.

Recipes

Rate-shop and select cheapest service

fedex rate shop --from 90210 --to 10001 --weight 5lb --json --select rates.serviceType,rates.totalNetCharge,rates.transitTime

Returns every applicable service type with cost and transit time so the agent (or human) picks the right balance.

Bulk ship with resume

fedex ship bulk --csv orders.csv --service GROUND --output labels/ --resume --concurrency 2 --yes

Creates labels for every row in orders.csv, respects the FedEx 1 req/s burst limit via cliutil.AdaptiveLimiter, and resumes from the last successful row if interrupted.

Save a recipient and ship to them

fedex address save acme --street '500 Main St' --city Denver --state CO --zip 80202 --country US

Address book lookup avoids retyping recipient details across every shipment.

Issue a return label

fedex return create --tracking 794633071234 --reason damaged --json --yes

Generates a Ground Call Tag against the original tracking; PDF/ZPL label is emitted for the customer.

Monthly spend report by service

fedex spend report --since 30d --by service --json --select service,total_net_charge,shipment_count

Joins shipments + rate quotes from the local ledger; answers 'where did I spend money on FedEx this month'.

Auth Setup

FedEx uses OAuth2 client_credentials. Inject the project Client ID and Client Secret through FEDEX_API_KEY and FEDEX_SECRET_KEY (or the Track-specific variables) and run fedex-pp-cli auth login; the CLI caches only the short-lived bearer token. Production label printing requires per-project Bar Code Analysis Group (BAG) approval from FedEx — fedex-pp-cli doctor surfaces approval status before you hit it.

Run fedex-pp-cli doctor to verify setup.

Writes, approval, and duplicate protection

Commands that change FedEx state (shipments create/cancel/tag/tag_cancel, ship bulk, ship etd, return create, pickups create/cancel, freight_pickups create/cancel, freight_shipments create, endofday close/modify, manifest --close, openship * writes, consolidations * writes, track notifications) only send when you pass --yes. --agent never implies --yes, and a saved profile cannot set it. Use --dry-run to preview the request shape first; a dry run needs no approval and sends nothing.

Writes are never retried automatically. If an identical write (same FedEx origin, method, path, and request body) succeeded, is still in flight, or ended with an unknown outcome in the last 24 hours, the CLI refuses it instead of buying a second label or booking a second pickup. Check FedEx (track number, shipments results) after an unknown outcome; pass --allow-duplicate only when a second identical operation is really what you want. The local write ledger stores request digests, never request bodies.

shipments create accepts one shipper, one recipient, and one PDF label package. A successful create writes that PDF under the private data directory labels/ and stores an operational shipment row, not the raw FedEx body. pickups create checks availability (or records an override) before scheduling and keeps the confirmation, carrier, date, and location in the local ledger. pickups cancel reuses those identifiers. Transport errors, HTTP 5xx, oversized bodies, and unusable success payloads are outcome_unknown; operations reconcile updates that operational row. Pickup scheduling reports that row's operation id in the CLI error and as MCP operation_id. operations reconcile --action cancel_pickup requires --pickup-confirmation. Cached OAuth tokens are bound to the FedEx origin that minted them (auth set-token requires --env sandbox or --env prod).

Agent Mode

Add --agent to any command. Expands to: --json --compact --no-input --no-color. It does not approve writes; pass --yes explicitly for commands that change FedEx state.

```bash

fedex-pp-cli addresses --agent --select id,name,status

```

Agent Feedback

When you (or the agent) notice something off about this CLI, record it:

fedex-pp-cli feedback "the --since flag is inclusive but docs say exclusive"
fedex-pp-cli feedback --stdin < notes.txt
fedex-pp-cli feedback list --json --limit 10

Entries are stored locally at ~/.fedex-pp-cli/feedback.jsonl. They are never POSTed unless FEDEX_FEEDBACK_ENDPOINT is set AND either --send is passed or FEDEX_FEEDBACK_AUTO_SEND=true. Default behavior is local-only.

Write what surprised you, not a bug report. Short, specific, one line: that is the part that compounds.

Output Delivery

Every command accepts --deliver <sink>. The output goes to the named sink in addition to (or instead of) stdout, so agents can route command results without hand-piping. Three sinks are supported:

| Sink | Effect |

|------|--------|

| stdout | Default; write to stdout only |

| file:<path> | Atomically write output to <path> (tmp + rename) |

| webhook:<url> | POST the output body to the URL (application/json or application/x-ndjson when --compact) |

Unknown schemes are refused with a structured error naming the supported set. Webhook failures return non-zero and log the URL + HTTP status on stderr.

Named Profiles

A profile is a saved set of flag values, reused across invocations. Use it when a scheduled agent calls the same command every run with the same configuration - HeyGen's "Beacon" pattern.

fedex-pp-cli profile save briefing --json
fedex-pp-cli --profile briefing addresses
fedex-pp-cli profile list --json
fedex-pp-cli profile show briefing
fedex-pp-cli profile delete briefing --yes

Explicit flags always win over profile values; profile values win over defaults. agent-context lists all available profiles under available_profiles so introspecting agents discover them at runtime.

Exit Codes

| Code | Meaning |

|------|---------|

| 0 | Success |

| 2 | Usage error (wrong arguments) |

| 3 | Resource not found |

| 4 | Authentication required |

| 5 | API error (upstream issue) |

| 7 | Rate limited (wait and retry) |

| 10 | Config error |

Argument Parsing

Parse $ARGUMENTS:

  1. Empty, help, or --help → show fedex-pp-cli --help output
  2. Starts with install → ends with mcp → MCP installation; otherwise → see Prerequisites above
  3. Anything else → Direct Use (execute as CLI command with --agent)

MCP Server Installation

  1. Install the MCP server:

```bash

go install github.com/mvanhorn/printing-press-library/library/commerce/fedex/cmd/fedex-pp-mcp@latest

```

  1. Register with Claude Code:

```bash

claude mcp add fedex-pp-mcp -- fedex-pp-mcp

```

  1. Verify: claude mcp list

MCP Tools

fedex-pp-mcp serves stdio by default (--transport http --allow-http binds loopback only) and exposes 59 tools:

Read tools are annotated readOnlyHint: true. Tools that change FedEx state are annotated destructiveHint: true and run in a single call once your MCP client approves it; set your client to ask before destructive tools. Every write tool shares the CLI's duplicate protection (error_class: duplicate_refused, override with allow_duplicate: true) and never retries. Write results keep tracking numbers, charges, confirmation codes, and label URLs (request labelResponseOptions: URL_ONLY) but drop encoded label blobs and recipient details.

There is no generic endpoint executor, SQL tool, raw CLI passthrough, or tool that reads or writes a caller-chosen file path; export, import, tail, track watch, and ship etd stay CLI-only.

Direct Use

  1. Check if installed: which fedex-pp-cli

If not found, offer to install (see Prerequisites at the top of this skill).

  1. Match the user query to the best command from the Unique Capabilities and Command Reference above.
  2. Execute with the --agent flag:

```bash

fedex-pp-cli <command> [subcommand] [args] --agent

```

  1. If ambiguous, drill into subcommand help: fedex-pp-cli <command> --help.
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.