Leopards Courier MCP Server
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
Leopards Courier MCP Server
An open-source Model Context Protocol (MCP) server for the Leopards Courier eCom Merchant API (v2.0). With it, an AI assistant such as Claude, Cursor or any other MCP client can book, track and manage Leopards shipments for you, using your own merchant account.
You can ask things like:
"Track KI1234567890 and tell me where it is."
"What would a 1.5 kg parcel from Karachi to Lahore with Rs 3,000 COD cost?"
"Book a packet for Ali Raza, 0300-1234567, House 12, DHA Lahore, Rs 2,500 COD."
"Which of last week's parcels are still undelivered? Re-attempt the ones in Lahore."
"Has Leopards paid me for these 10 CNs yet?"
This is a community project. It is not made, endorsed or supported by Leopards Courier Services.
Contents
Related MCP server: Shiprocket MCP
Features
20 tools covering the Leopards merchant API: cities, booking (single and batch), tracking, cancellation, load sheets, shipper advice, COD payments, tariffs, shipping charges, invoices, proof of delivery and sub-shippers.
Bring your own credentials. The server stores no API keys. Each request carries the caller's own Leopards key and password, so one deployment can serve many merchants.
Streamable HTTP transport, stateless, so it runs on serverless platforms. It deploys to Vercel without changes.
Production and staging. One environment variable switches to the Leopards staging API for testing.
Clear errors. Leopards' own error messages are passed back to the assistant, and bad input (empty lists, more than 50 CNs, unknown advice statuses) is rejected before anything reaches Leopards.
Built with FastMCP 3, FastAPI and httpx.
How authentication works
Leopards authenticates every API call with an API key and an API password. This server does not keep either. The MCP client sends them with each request, and the server forwards them to Leopards for that one call.
The server reads credentials from the first of these that is present:
Method | How to send it |
Bearer token (recommended) |
|
Separate headers |
|
Query string (last resort) |
|
Server fallback (private deployments only) |
|
In the bearer token, everything after the first colon is treated as the
password, so passwords that contain : work.
If no credentials are found, tools return a message explaining how to supply them, and nothing is sent to Leopards.
Getting your Leopards API credentials
Log in to your Leopards merchant portal account (via leopardscourier.com).
Open API Settings → API Management.
Generate an API key and choose an API password.
For testing, ask Leopards for staging credentials and run the server with
LEOPARDS_ENV=staging (see Configuration). Staging bookings
are not real shipments.
Quick start (run locally)
You need Python 3.10 or later.
git clone https://github.com/Muhammadzainattiq/leopards-mcp.git
cd leopards-mcp
python3 -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -r requirements.txt uvicorn
uvicorn app:app --port 8000The MCP endpoint is now http://127.0.0.1:8000/mcp. Opening
http://127.0.0.1:8000/ shows a JSON summary of the server and its tools.
Check that it works:
# List the tools (no credentials needed)
python smoke_test.py
# Also call get_all_cities with your own credentials (read-only)
python smoke_test.py http://127.0.0.1:8000/mcp YOUR_API_KEY YOUR_API_PASSWORD --callDeploy your own server on Vercel
The repo is ready for Vercel's Python runtime: app.py exposes a FastAPI app,
and vercel.json sets a 60-second function timeout.
From the CLI:
npm i -g vercel
vercel deploy --prodFrom the dashboard: fork this repo, then import it at vercel.com/new. Vercel detects FastAPI on its own.
Your MCP endpoint is https://<your-deployment>.vercel.app/mcp.
Leave LEOPARDS_API_KEY / LEOPARDS_API_PASSWORD unset on any deployment
other people can reach. See Security notes.
Any host that runs an ASGI app works too (Render, Railway, Fly.io, a VPS, and
so on). Run uvicorn app:app --host 0.0.0.0 --port $PORT.
Connect an MCP client
Replace <server> with http://127.0.0.1:8000 for a local server or your
deployment URL, and fill in your own key and password.
Claude Code
claude mcp add --transport http leopards <server>/mcp \
--header "Authorization: Bearer <api_key>:<api_password>"Claude Desktop
Claude Desktop connects to remote servers through mcp-remote. Add this to
claude_desktop_config.json (Settings → Developer → Edit Config):
{
"mcpServers": {
"leopards": {
"command": "npx",
"args": [
"-y", "mcp-remote", "<server>/mcp",
"--header", "Authorization: Bearer ${LEOPARDS_AUTH}"
],
"env": { "LEOPARDS_AUTH": "<api_key>:<api_password>" }
}
}
}Claude.ai (web) custom connector
Claude.ai connectors cannot send custom headers, so use the query-string form:
<server>/mcp?api_key=<api_key>&api_password=<api_password>Read Security notes first: the credentials then sit inside the URL.
Cursor
Add to ~/.cursor/mcp.json (or .cursor/mcp.json in a project):
{
"mcpServers": {
"leopards": {
"url": "<server>/mcp",
"headers": { "Authorization": "Bearer <api_key>:<api_password>" }
}
}
}VS Code (GitHub Copilot)
Add to .vscode/mcp.json:
{
"servers": {
"leopards": {
"type": "http",
"url": "<server>/mcp",
"headers": { "Authorization": "Bearer <api_key>:<api_password>" }
}
}
}Any other client, or your own code
Use the streamable HTTP transport and send one of the auth headers above. With the FastMCP Python client:
import asyncio
from fastmcp import Client
async def main():
# A plain string is sent as "Authorization: Bearer <string>".
async with Client("http://127.0.0.1:8000/mcp", auth="API_KEY:API_PASSWORD") as client:
result = await client.call_tool("track_packets", {"track_numbers": ["KI1234567890"]})
print(result.data)
asyncio.run(main())Tools reference
Tools marked ⚠️ change real shipments or account data. MCP clients usually ask before running a tool. Read the arguments before you approve one of these.
Reference data
Tool | What it does | Arguments |
| Lists every city with its numeric ID, shipment types, and whether it can be an origin or destination. Other tools need these IDs. | none |
| Lists banks and their IDs, for | none |
Booking and cancelling
Tool | What it does | Arguments |
| Quotes the charges for a packet before booking. |
|
⚠️ | Books one packet. Returns its tracking (CN) number and slip link. |
|
⚠️ | Books several packets in one call. |
|
⚠️ | Cancels booked packets. |
|
Tracking and lookups
Tool | What it does | Arguments |
| Current status and full tracking history. |
|
| Every packet booked in a date range, with its latest status. |
|
| Finds shipments by your own order IDs. |
|
| Receiver name and relation, GPS location, signature image. |
|
Load sheets
Tool | What it does | Arguments |
| Creates a load sheet for the courier picking up your parcels. Returns a |
|
| Gets the sheet as a base64 PDF, or its packet data as JSON. |
|
Undelivered parcels (shipper advice)
Tool | What it does | Arguments |
| Parcels waiting for your instruction after a failed delivery. Each has the | all optional: |
⚠️ | Tells Leopards to re-attempt ( |
|
| Advice you have already given, and what happened. | all optional: |
Money
Tool | What it does | Arguments |
| Whether COD has been paid out, the amount, and invoice or cheque details. |
|
| What Leopards charged for packets already booked. |
|
| Invoices and cheques Leopards has issued to you. | none |
Sub-shippers
Tool | What it does | Arguments |
⚠️ | Creates a shipper under your account. Returns its shipment ID, which |
|
| Looks up shippers by a field. |
|
Packet fields
Field names match the Leopards API exactly.
Field | Required | Notes |
| yes | Grams, e.g. |
| yes | Number of pieces |
| yes | COD amount; |
| yes | City ID from |
| yes | City ID, or |
| yes | Customer name |
| yes | Customer phone |
| yes | Customer address |
| yes | Note for the rider |
| no | Sender details. Default |
| no | Your own order ID; lets you look the packet up later |
| no | Volumetric dimensions |
| no | Book on behalf of a sub-shipper |
| no | Extra customer contacts |
| no | Defaults to overnight |
| no | Default to the sender's |
| no | Extra key/value pairs, e.g. |
| no |
|
Every tool returns Leopards' response as-is: a status / error envelope plus
the data. A Leopards error comes back as a tool error that contains Leopards'
own message.
Configuration
All settings are environment variables, and all are optional. See
.env.example.
Variable | Default | Purpose |
|
|
|
| per | Overrides the API base URL completely |
|
| Seconds to wait for Leopards on each call |
| unset | Fallback key for requests that bring none. Private deployments only |
| unset | Fallback password. Private deployments only |
Security notes
Never set the fallback credentials on a shared or public deployment. Anyone who finds the URL could then book and cancel shipments on that account. The landing page (
GET /) reportsshared_fallback_credentials_configured, so you can check.Prefer headers to the query string. URLs are written to server, proxy and browser logs. Use the query-string form only for clients that cannot send headers, and only on a server you run yourself.
The server keeps nothing. Credentials are read from each request, forwarded to Leopards over HTTPS and discarded. They are never stored, cached or logged by this code. Your hosting platform's request logs are a separate matter.
If you use someone else's deployment, you are trusting its operator with your credentials. Running your own copy takes a few minutes.
Staging first. Try booking and cancelling on staging credentials before you point an assistant at your live account.
Found a security problem? Please open a GitHub issue without exploit details, or contact the maintainer privately.
Troubleshooting
Symptom | Likely cause |
| Your client isn't sending the header. Check the config, and that the bearer value is |
| Wrong key or password, or staging credentials on production (or the reverse). Check |
| Leopards changed or removed that endpoint. Please open an issue with the tool name. |
Timeouts | Leopards is slow or down. Raise |
A city name is rejected | Booking needs numeric city IDs. Ask the assistant to call |
Differences from the official guide
The live API doesn't always match the Leopards v2 PDF guide. This server follows the live API:
Batch booking uses
batchBookPackets. The guide'sbatchBookPacketv2/batchBookPacketsv2URLs return 404 on both production and staging.getBankListonly accepts GET. The guide's sample uses POST, which returns 405.shipperAdviceListis documented with two different request shapes. The server sends both sets of fields so either backend version reads the filters.
Project structure
.
├── app.py # ASGI entry point: FastAPI app, mounts MCP at /mcp
├── leopards/
│ ├── server.py # MCP tools, one per Leopards endpoint
│ ├── client.py # async HTTP client and response normalisation
│ └── config.py # environment configuration
├── smoke_test.py # connect, list tools, optionally call get_all_cities
├── requirements.txt
├── vercel.json
└── .env.exampleContributing
Issues and pull requests are welcome, especially reports of Leopards API behaviour that differs from what this server expects.
Fork the repo and create a branch.
Make the change. Keep one tool per Leopards endpoint, and use Leopards' field names.
Run the server locally and check your change with
smoke_test.py, using staging credentials for anything that books, cancels or changes data.Open a pull request describing what you changed and how you tested it.
License
MIT. Leopards Courier and its API belong to Leopards Courier Services (Pvt) Ltd; this project only calls their public merchant API.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Furgonetka MCP Server is an extension for LLMs (such as Claude) that integrates AI assistants with Poland's most popular courier brokerage platform. The server enables models to interact directly with services from various couriers (including InPost, DPD, DHL, UPS, and Poczta Polska) through a single, unified interface. With this integration, your AI stops just "writing about logistics" and starts actually managing it.
Manage Shipday orders, drivers, driver earnings, reports from your AI assistants.
India shipping for AI agents: Shiprocket courier serviceability, create orders, track AWB.
Multi-carrier shipping for AI agents: compare rates, buy labels, track packages, validate addresses
Related MCP Servers
- 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
- FlicenseNot gradedqualityDmaintenanceEnables merchants to connect their PostEx account to MCP clients, exposing tools to book and cancel COD orders, track parcels, generate load sheets and airway bills, and check settlement status using their own PostEx token.2-