Leopards Courier MCP
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Leopards Courier MCP Track these three consignment numbers and summarize their latest statuses."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Leopards Courier MCP
An unofficial, self-hosted Model Context Protocol server for Leopards Courier Pakistan eCommerce merchant accounts. Use natural language to track consignments, retrieve COD payment records, inspect shipping charges, and (when explicitly enabled) book and manage shipments.
Status: v0.2.0 pre-release — offline tests pass; mandatory SDK, package build, dependency audit and live staging validation are not yet complete. Do not deploy for production. Not affiliated with Leopards Courier. No live carrier or MCP client interoperability certification. Each merchant supplies their own credentials; this is not a shared hosted service.
Features
21 typed MCP tools for tracking, booking, invoices, rates, shipper advice and merchant operations.
Local stdio and private Streamable HTTP (
/mcp) using the official Python MCP SDK v1.Read-only and staging defaults; explicit confirmation and opt-in for mutations, plus separate production write opt-in. Durable local booking reservations prevent repeat bookings through the same journal.
No automatic retries or redirects; request timeouts and bounded response sizes.
Optional authenticated, deduplicating status push webhook with SQLite persistence.
Synthetic tests, CI workflow, MIT license and security policy.
Related MCP server: mcp-tcs-courier
Quick start
Requirements: Python 3.10–3.13, a Leopards eCommerce merchant account and API credentials. Generate your API key and password under API Settings → API Management in the merchant portal. Request separate staging credentials if needed.
After obtaining the source, run:
cd leopards-courier-mcp
python3 -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
python -m pip install -e '.[dev,webhook]'Configure the following in your shell or secret manager. .env.example documents the settings but is not automatically loaded. On Windows use PowerShell $env:NAME = 'value'. Do not place real credentials in shell history, screenshots, chat messages or repository files.
read -r -s -p 'Merchant API key: ' LCS_API_KEY; echo
read -r -s -p 'Merchant API password: ' LCS_API_PASSWORD; echo
export LCS_API_KEY LCS_API_PASSWORD
export LCS_ENV=staging
export LCS_ALLOW_WRITES=false
leopards-mcpThe command starts an MCP stdio server, not an interactive shell. Configure an MCP client to start that executable with the secret environment inherited from the client or secret manager. Example local client configuration (replace the absolute path; exact config format depends on the client):
{
"mcpServers": {
"leopards-courier": {
"command": "/absolute/path/leopards-courier-mcp/.venv/bin/leopards-mcp",
"args": ["--transport", "stdio"]
}
}
}GUI applications may not inherit terminal variables. Inject secrets using the client's secure environment configuration or a local secret-manager launcher; do not commit the launcher or secret values.
Connect to ChatGPT
Start
leopards-mcp --transport streamable-http(local endpointhttp://127.0.0.1:8000/mcp).Use a supported private access mechanism, such as OpenAI Secure MCP Tunnel, or an authenticated MCP gateway over HTTPS. Do not expose the bare HTTP listener publicly. The project does not implement an OAuth authorization server.
In a supported ChatGPT account, use Plugins → Add custom MCP server and select the private connection or authenticated server URL. See OpenAI setup and eligibility.
Test
list_cities, thentrack_shipmentswith a known staging CN. Check results against the merchant portal. Enable production only after validating responses.
Full custom MCP write support depends on account/workspace eligibility. Installing this repository alone does not grant ChatGPT plan access or deploy a server.
Example requests
“Track these three consignment numbers and summarize their latest statuses.”
“Find consignments booked against order DEMO-001.”
“Show COD payment references and billed shipping charges for these CNs.”
“List invoice records and identify which shipments need reconciliation.”
“Show the quote for 500g from the selected origin city to the destination city.”
“Prepare a shipment booking. Show the fields and ask for approval before booking.”
Tool reference
Tool | Mode | Merchant API operation |
| Read | getAllCities |
| Read | trackBookedPacket |
| Read | getBookedPacketLastStatus |
| Read | getShipmentDetailsByOrderID |
| Read | getPaymentDetails |
| Read | getShippingCharges |
| Read | getTariffDetails |
| Read | getInvoices |
| Read | getBankList |
| Read | getShipperDetails |
| Read | getElectronicProofOfDelivery |
| Read | downloadLoadSheet (JSON) |
| Read | shipperAdviceList (older filter schema) |
| Read | shipperAdviceList (paginated filter schema) |
| Read | activityLog |
| Write | bookPacket |
| Write | configurable batch endpoint |
| Write | cancelBookedPackets |
| Write | generateLoadSheet |
| Write | createShipper |
| Write | updateShipperAdvice |
Configuration
Variable | Default | Meaning |
| required | Merchant credential |
| required | Merchant credential |
| staging |
|
| false | Exact |
| false | Additional explicit |
| unset | Required private persistent SQLite path for single and batch bookings |
| unset | Exact batch API name confirmed by carrier |
| required for webhook | Random shared secret, at least 32 characters |
| X-LCS-Webhook-Secret | Agreed custom authentication header |
| events.sqlite3 | Private persistent SQLite file |
For mutations, verify the existing order first, present all consequential details to the operator, and obtain approval. The carrier does not document idempotency keys. The confirmation argument is an extra safety gate, not evidence of approval; use client-level approval controls. After an uncertain response, use shipments_by_order_id, tracking or the portal before retrying. Local limits: 50 CNs per request, 25 batch bookings/advice updates, 31 calendar days per date range, 100 paginated advice records. The local booking model requires an order ID to improve reconciliation. Bookings reserve order IDs in a private local SQLite journal before making the request. All workers for the same merchant must share the same persistent file. An order remains reserved even after a timeout, rejection or crash; do not delete the journal, rotate credentials to bypass it, or change order IDs to replay an uncertain write. Reconcile manually with Leopards before deciding how to resolve an exceptional reservation. The guard does not detect earlier portal bookings, bookings through other systems, different API keys, separate journals or different merchant order IDs; always check the portal first. No carrier-wide idempotency is claimed.
Push webhook (optional)
This is a separate service, not a public MCP endpoint. Install the webhook extra, set a strong random LCS_WEBHOOK_SECRET, then run:
leopards-webhookThe service listens on 127.0.0.1:8001/webhooks/leopards. Configure a TLS-enabled, rate-limited reverse proxy for that route only, and share the callback URL plus the agreed secret header with Leopards. The Push API document permits custom headers but does not specify a signing algorithm. Do not expose your MCP listener alongside this callback. The webhook accepts a data array of events and returns HTTP 202 with the carrier's documented success shape. It deduplicates CN/status/activity date, stores only these three values, and discards receiver names/reasons. Timestamps are kept without an assumed timezone. No downstream Shopify sync or automatic actions are performed. See API notes and security.
Development and verification
python -m pytest -q --cov=leopards_mcp --cov-branch --cov-fail-under=90
python -m compileall -q src tests
python -m build
python -m pip_audit --strictTests use synthetic data and mocked HTTP transport. CI installs the declared SDK and requires registration, stdio, and Streamable HTTP checks. A missing SDK fails collection; skips and expected failures fail the test gate. See release audit for the actual local results and open blockers. Before production, validate every needed endpoint in staging with your own merchant account, including permission and partial failure behavior. Native PDF load-sheet downloads are not implemented; JSON details and booking slip links are supported. Do not infer a successful bank deposit from a courier invoice status.
Troubleshooting
Credentials missing: set both environment variables in the MCP process, not only in a shell the client never reads.
Carrier rejected request: confirm account environment, API access, field values and portal status. Errors are intentionally sanitized to avoid leaking credentials or customer data.
Batch booking blocked: verify the exact endpoint with Leopards; no automatic fallback is used.
HTTP redirect or timeout: inspect the carrier portal. Never replay an uncertain write blindly.
Large responses: narrow dates or CNs; full invoice responses may require carrier-side support if they exceed the local response cap.
License and attribution
MIT for this project's original code and documentation. Leopards trademarks and merchant API documentation belong to their respective owners. The original vendor PDFs are intentionally not distributed. This independent project is not endorsed by the carrier. Users are responsible for complying with merchant API terms, customer privacy requirements and appropriate authorization.
Available Tools
21 toolsactivity_logARead-onlyIdempotent
Read paginated merchant activity log; filter by product, status or consignment.
Inputs: start, length, status, product, +1 more.
batch_book_shipmentsADestructive
Book multiple shipments (local cap 25). Requires verified LCS_BATCH_ENDPOINT and explicit user confirmation. Never replay an uncertain batch.
Inputs: packets (required), confirm.
book_shipmentADestructive
Book a shipment. Check the order ID for duplicates first and obtain explicit user confirmation before setting confirm=true.
Inputs: packet (required), confirm.
cancel_shipmentsADestructive
Cancel booked consignments. Confirm exact CNs with user before setting confirm=true; eligibility decided by carrier.
Inputs: cn_numbers (required), confirm.
create_shipperBDestructive
Create a shipper account, potentially including sensitive bank details. Explicitly confirm all details first. Returned login secrets are stripped; use portal for credentials.
Inputs: shipper (required), confirm.
generate_load_sheetBDestructive
Generate a new load sheet for selected CNs and courier; confirm before creation.
Inputs: cn_numbers (required), courier_code (required), courier_name (required), confirm.
list_banksBRead-onlyIdempotent
Get supported bank IDs from the carrier (uses documented POST example).
Inputs: no named parameters.
list_citiesARead-onlyIdempotent
List carrier city IDs, available shipment types and origin/destination permissions.
Inputs: no named parameters.
list_invoicesARead-onlyIdempotent
List merchant invoice/cheque records and payment status; reconcile against actual bank receipts.
Inputs: no named parameters.
load_sheet_detailsARead-onlyIdempotent
Retrieve JSON shipment details for an existing load sheet; not a new load sheet.
Inputs: load_sheet_id (required).
payment_detailsARead-onlyIdempotent
Get payment status and invoice/cheque references for up to 50 consignments; not proof of bank receipt.
Inputs: cn_numbers (required).
proof_of_deliveryBRead-onlyIdempotent
Retrieve electronic proof of delivery metadata; may contain signatures and location. Do not automatically download links.
Inputs: cn_numbers (required).
shipments_by_order_idARead-onlyIdempotent
Find existing consignments by merchant order IDs; use before booking or after uncertain writes.
Inputs: order_ids (required).
shipment_statusesARead-onlyIdempotent
Retrieve last shipment statuses for an inclusive date range (max 31 calendar days locally).
Inputs: to_date (required), from_date (required).
shipper_advice_by_dateCRead-onlyIdempotent
List consignments needing shipper advice using the documented date-range request variant.
Inputs: to_date (required), from_date (required), origin_city, destination_city.
shipper_advice_listBRead-onlyIdempotent
List shipper advice using the newer paginated variant. Use a narrow date or CN filter.
Inputs: start, length, status, product, +5 more.
shipper_detailsBRead-onlyIdempotent
Retrieve shipper details using a carrier-approved lookup parameter and value; may include financial/identity data. Verify supported parameters with carrier.
Inputs: request_param (required), request_value (required).
shipping_chargesBRead-onlyIdempotent
Retrieve billed shipment, COD, return and tax charges for up to 50 consignments.
Inputs: cn_numbers (required).
tariff_quoteBRead-onlyIdempotent
Get merchant tariff using weight, shipment type ID, city IDs and COD amount (zero if prepaid). Verify tariff weight unit with carrier.
Inputs: cod_amount (required), origin_city (required), packet_weight (required), shipment_type (required), +1 more.
track_shipmentsBRead-onlyIdempotent
Track up to 50 merchant consignments, including activity history and current status.
Inputs: cn_numbers (required).
update_shipper_adviceADestructive
Submit shipper advice codes RA or RT. Verify the meaning and consequence with carrier and confirm each record with user before setting confirm=true.
Inputs: advices (required), confirm.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 21 tools
Most tools map to a distinct resource (invoices, banks, POD, load sheets, booking, cancellation), but there are clear overlaps: track_shipments vs shipment_statuses vs activity_log all report consignment status, and shipper_advice_by_date vs shipper_advice_list are explicitly two request variants of the same operation. The descriptions do help resolve these (date-range vs paginated variant, activity history vs last-status), but an agent must read carefully to pick correctly.
All names are snake_case, which is good, but the verb convention is split: write operations use verb_noun (book_shipment, cancel_shipments, create_shipper, update_shipper_advice) while most reads are bare noun phrases (payment_details, shipping_charges, shipper_details, load_sheet_details, activity_log) and others prefix list_ (list_cities, list_invoices, list_banks). The read/write split has some internal logic, but list-like operations are unpredictable in naming.
21 tools is on the heavy end for a courier integration surface, and a few slots are spent on redundancy (shipper_advice_by_date vs shipper_advice_list, track_shipments vs shipment_statuses) rather than new capability. The breadth of the underlying domain (booking, tracking, finance, shipper management, load sheets) makes the size defensible, but it sits at the borderline.
Core lifecycle is well covered: quote, book (single and batch), track, status, cancel, load sheet generation and retrieval, POD, charges, invoices, payments, shipper creation and shipper advice. Gaps are minor but real: there is no update/delete for shipments or shippers (create only), no label/waybill retrieval, and no pickup or return-shipment operations.
Maintenance
Related MCP Connectors
Configure parcelLab journeys, tracking pages and returns portals, and query delivery analytics.
Track parcels, list shipments and dispatch orders, and read statuses in InPost.
Real-time order tracking for Shopify merchants: look up, list, and refresh shipments.
Multi-carrier shipping functionality with built-in, discounted carrier accounts. Compare rates, generate PDF shipping labels, schedule pickups and track packages in automated way or in your chatbox, no coding required. This is a demo server that is functional with no account needed and no auth. For production use please find our production version.
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables AI clients to quote, ship, track, void, and manage shipments via the Deftship multi-carrier shipping API using natural language commands.32MIT
- AlicenseNot gradedqualityDmaintenanceCommunity MCP wrapper for TCS Courier public APIs, enabling courier service interactions through natural language.MIT
- AlicenseNot gradedqualityDmaintenanceEnables courier rate checks, order management, shipping, and tracking via Shiprocket's API through natural language.ISC
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to track packages, rate and create shipments, manage pickups and customs documentation, and perform international shipping logistics checks through natural language.MIT