shipkit-mcp
by ewmew11
README.md
# shipkit-mcp
[](https://github.com/ewmew11/shipkit-mcp/actions/workflows/ci.yml)
An [MCP](https://modelcontextprotocol.io) server that gives AI assistants cross-border shipping tools: rate quotes, chargeable-weight math, HS code lookup and landed-cost estimates. Built with **Bun**, **Elysia** and the **MCP TypeScript SDK v2**.
> All carriers, prices and duty rates here are **mock data** for demonstration. Don't use them for real shipments.
## Why
When you plan an international shipment, you have to answer several questions in order. Which HS code does the product fall under? Will the box be billed on actual or volumetric weight? Which carrier is cheapest, and which is fastest? What will the buyer pay in duty and VAT? This server exposes each step as an MCP tool, so an assistant like Claude can work through the whole flow in one conversation.
## Tools
| Tool | What it does |
| --- | --- |
| `calculate_chargeable_weight` | Compares actual and volumetric weight and returns the billable weight, rounded up to the next 0.5 kg |
| `quote_shipping_rates` | Quotes every carrier for a parcel and destination, sorted by price or speed |
| `search_hs_codes` | Finds 6-digit HS codes from a product description or a code prefix |
| `estimate_landed_cost` | Estimates duty, VAT/GST and the total landed cost |
There is also a **resource** (`shipkit://carriers`, the carrier catalogue) and a **prompt** (`plan_shipment`, a guided end-to-end flow).
Every tool declares an `outputSchema` and returns `structuredContent`, so clients receive typed JSON as well as text.
## Architecture
```
src/
├── app.ts Elysia app: /, /health, and /mcp (Streamable HTTP)
├── index.ts HTTP entrypoint
├── stdio.ts stdio entrypoint for desktop MCP clients
├── mcp/server.ts Tool, resource and prompt registration (zod schemas)
├── lib/ Pure business logic: rating, chargeable weight, customs
└── data/ Mock carriers, zones, HS codes and VAT rates
```
- **Pure logic, thin protocol layer.** The rating and customs math in `lib/` has no knowledge of MCP, which keeps it simple to unit test.
- **Web-standard handler.** `createMcpHandler()` from SDK v2 returns a `fetch(Request) => Response` handler, which Elysia mounts directly at `/mcp`. It serves clients on both the 2026-07-28 protocol and the older 2025 protocol.
- **Stateless.** Each request gets a fresh server instance, so it scales horizontally and needs no session store.
## Getting started
Requires [Bun](https://bun.sh) 1.3 or later.
```bash
bun install
bun run dev # http://localhost:3000/mcp
bun test # unit and end-to-end tests
```
### Try it with MCP Inspector
```bash
bun run dev
bun run inspect # then connect to http://localhost:3000/mcp
```
### Use it in Claude Code
```bash
claude mcp add --transport http shipkit http://localhost:3000/mcp
```
### Use it in Claude Desktop (stdio)
```json
{
"mcpServers": {
"shipkit": {
"command": "bun",
"args": ["/absolute/path/to/shipkit-mcp/src/stdio.ts"]
}
}
}
```
### Docker
```bash
docker build -t shipkit-mcp .
docker run -p 3000:3000 shipkit-mcp
```
## Example
> **You:** I'm sending a cotton T-shirt order to the UK. It's 1.2 kg in a 35×25×10 cm box, and the goods are worth $80. What's my cheapest option and the total landed cost?
The assistant calls `search_hs_codes` (→ `610910`), then `quote_shipping_rates` (destination `GB`, sorted by price), then `estimate_landed_cost` with the cheapest rate. It replies with a breakdown of shipping, duty and VAT.
## Testing
- **Unit tests** cover volumetric weight, zone lookup, quote sorting and filtering, weight limits, HS search and the landed-cost formula.
- **End-to-end tests** connect the official MCP client to the Elysia app through `app.handle()`, with no network port. They list tools, call them, check structured output and error handling, and read resources.
## Roadmap
- [ ] Bearer-token auth on `/mcp`
- [ ] Load the full HS nomenclature from SQLite (`bun:sqlite`)
- [ ] Currency conversion tool
- [ ] Deploy a public demo
## License
MIT
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues