Loki MCP
Loki MCP is a read-only MCP server for querying 1mg's diagnostics (phlebo/sample-collection) logistics platform, covering hubs, orders, batches, riders, and day-tracking data.
Reference Data
Fetch valid enumeration values for order statuses, task statuses, rider statuses/types, order categories, etc.
Hub Management
Search PAC (Phlebo Activity Center) hubs by name/code, with filters for type, status, and business client.
Retrieve full details for a specific hub by ID.
Order Management
Search diagnostics orders by hub, date (DD/MM/YYYY), status, category, slot, rider, pincode, and more.
Get aggregate order counts broken down by status for a hub and day.
Retrieve full details of a single order (tests, slot, status) by internal numeric ID.
View chronological status-change history of an order.
Batch Management
Search diagnostics batches/consignments for a given day (YYYY-MM-DD).
View aggregate batch and assignment metrics for a day.
Retrieve full batch details including constituent orders and assignments.
Rider & Phlebo Management
Search phlebos/riders by name, phone, code, status, or type.
Retrieve full profile of a single rider by numeric ID.
List all phlebos attached to one or more PAC hubs, optionally filtered by rider type.
Day Tracking & KPIs
Get daily KPI snapshots (assigned/completed/cancelled counts, distance, SLA breaches) for a phlebo on a given date.
View chronological task timelines (shift start, login, task sequence, SLA status).
View planned route waypoints and actual GPS paths (with speed, battery %, and coolbox temperature).
Access the "Track Phlebos" board — all phlebos at a hub on a date with live status, availability, battery, location, task counts, and coolbox temperature.
Attendance
Get attendance roll-up (total present/absent) for one or more hubs on a specific date.
Retrieve day-by-day attendance status and hours worked for a rider across an entire month.
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., "@Loki MCP search for delayed orders in hub Mumbai-Central"
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.
Loki MCP — Diagnostics (Droplet)
Read-only MCP server over Loki / Thor, scoped to 1mg's diagnostics (phlebo
sample-collection) logistics — not the pharmacy delivery surface. Every
order/batch tool targets the diagno endpoints. Diagnostics hubs are PACs
(Phlebo Activity Centers, business_client="droplet", type="PAC") and riders
are phlebos.
It talks to the same gateway the Thor admin UI uses (https://thor.1mg.com/1mg_api),
so no VPN or host setup is needed beyond a valid login token.
Tools
Tool | Surface | What it does |
| enums | Valid |
| hubs | Find a PAC hub id from name/code (defaults to |
| hubs | Full hub detail by id |
| orders | Diagnostics orders for a PAC on a day — hub_id + day_query required |
| orders | Order counts by status (all/placed/completed/…) for a PAC+day |
| orders | Full order detail by numeric id (tests, slot, status) |
| orders | Date-keyed status history of an order |
| batches | Diagnostics batches (consignments) for a day |
| batches | Aggregate batch/assignment metrics for a day |
| batches | Full batch detail (orders + assigned_in_batch) |
| riders | Search riders/phlebos (shared infra) |
| riders | Full rider detail by numeric id |
| riders | Phlebos attached to a PAC (optionally by type) |
| day tracking | Daily KPI summary (assigned/completed/distance/breach) |
| day tracking | Chronological day timeline (shift, login, task sequence) |
| day tracking | Planned route waypoints + locations |
| day tracking | Actual GPS pings (speed, battery, coolbox temp) |
| day tracking | "Track Phlebos" board for a PAC+date |
| attendance | total_present / total_absent for hub(s) on a date |
| attendance | Day-by-day attendance + hours for a rider/month |
All tools are read-only (readOnlyHint: true).
Date-format gotchas (they differ by surface)
Orders (
loki_search_orders,loki_count_orders_by_status):day_queryisDD/MM/YYYY.Batches (
loki_search_batches,loki_get_batch_metrics):dateisYYYY-MM-DD.Phlebo day-tracking/attendance:
dateisYYYY-MM-DD;phlebo_id/rider_idis the numeric rider id.Order detail/timeline: take the order's numeric
id(from search rows), not theNNN-NNNdisplayorder_id.
Related MCP server: DokaAI MCP Service POC
Auth
Thor authenticates with the authTokenThor JWT cookie. It is short-lived, so the
server reads it fresh on every call — refreshing never needs a restart.
Open https://thor.1mg.com while logged in.
DevTools → Application → Cookies → copy the
authTokenThorvalue.Paste it into the token file:
echo 'PASTE_TOKEN_HERE' > ~/.loki_token
When calls start returning 401/403, just overwrite ~/.loki_token with a fresh value.
Env var | Default | Purpose |
|
| Path to token file |
| — | Token fallback if no file |
|
| Gateway base |
Setup
cd loki-mcp
uv sync
echo 'PASTE_TOKEN_HERE' > ~/.loki_token
uv run python server.py # smoke test (Ctrl-C to stop)Register in Claude Code
claude mcp add loki -- /Users/abhishekjain/1mg-claude-code/toy-ptojects/loki-mcp/.venv/bin/python \
/Users/abhishekjain/1mg-claude-code/toy-ptojects/loki-mcp/server.pyNotes
hub_idis mandatory for order/batch/phlebo lookups. Resolve PAC names → ids withloki_search_hubs.See the date-format gotchas above — orders use
DD/MM/YYYY, batches/phlebo useYYYY-MM-DD.Intentionally read-only; no write/action tools (assign, auto_assign, etc.) are exposed.
Available Tools
18 toolsloki_get_hubARead-only
Get full detail for a single hub by its id (Mongo ObjectId string).
Inputs: hub_id (required).
loki_get_hub_attendance_metricsARead-only
Attendance roll-up for one or more hubs on a date: total_present / total_absent.
Inputs: date (required), hub_ids (required).
loki_get_hub_ridersBRead-only
List the riders attached to one or more hubs (optionally filtered by type). Useful to see who is available to fulfil orders at a hub.
Inputs: hub_ids (required), rider_type.
loki_get_orderARead-only
Get full detail for a single order.
IMPORTANT: this takes the order's internal numeric id (the id field
returned by loki_search_orders, e.g. "29879321"), NOT the human-facing
order_id / PO string (e.g. "PO17026268570467"). If you only have a PO
string, run loki_search_orders (order_id=) first and read its id.
Inputs: order_id (required).
loki_get_order_timelinesARead-only
Get the status/event timeline for an order -- the chronological history of state changes. Useful for debugging "why is this order stuck/late".
IMPORTANT: takes the order's internal numeric id (the id field from
loki_search_orders, e.g. 29879321), NOT the PO… order_id string.
Inputs: order_id (required).
loki_get_phlebo_actual_routeARead-only
The actual GPS location history for a phlebo/rider on a date: timestamped lat/long pings with speed, battery % and coolbox temperature. Use to verify where a rider actually went and device/coolbox health.
Inputs: date (required), phlebo_id (required).
loki_get_phlebo_day_metricsARead-only
Daily summary KPIs for one phlebo/rider on a given date: Total Assigned, Completed, Cancelled, Total Distance (planned/actual), SLA Breach, Time, and Sequence edits. The fast "how did this rider's day go" snapshot.
Inputs: date (required), phlebo_id (required).
loki_get_phlebo_day_tasksARead-only
The chronological day timeline for one phlebo/rider: shift start, login, and each task in expected sequence with status, group, SLA status and order timestamps. Use to debug a rider's route/sequence on a specific day.
Inputs: date (required), phlebo_id (required).
loki_get_phlebo_planned_routeARead-only
The planned route for a phlebo/rider on a date: ordered [lng,lat] waypoints plus order/home/hub locations. Compare with loki_get_phlebo_actual_route to spot route deviations.
Inputs: date (required), phlebo_id (required).
loki_get_riderARead-only
Get full detail for a single rider by numeric id.
Inputs: rider_id (required).
loki_get_rider_monthly_attendanceARead-only
A rider's day-by-day attendance for a month: per-date attendance_status (present/absent) and hours worked.
Inputs: year (required), month (required), rider_id (required).
loki_get_taskARead-only
Get full detail for a single task by its id.
Inputs: task_id (required).
loki_reference_dataARead-only
Fetch valid enumeration values used as filters across Loki.
Use this to discover the allowed values for status/type/category/fulfilled_by filters before calling the search tools.
Inputs: kind (required).
loki_search_hubsARead-only
Search logistics hubs. Use this first to find a hub's id (a Mongo ObjectId string) when you only know its name/code -- order and task search require hub_id.
Note on hub kinds: pharmacy delivery hubs are business_client="pharmacy" (types like RETAIL); diagnostics phlebo centers (PACs) are business_client="droplet", type="PAC". A "Sec-14 Gurgaon PAC" is therefore a droplet/PAC hub, not the same as the "sec_14_ggn_retail" pharmacy hub.
IMPORTANT: the server DEFAULTS business_client to "pharmacy" when it is
omitted, so a search for a diagnostics/phlebo hub returns nothing unless you
pass business_client="droplet". query is a substring match over both name
AND code, so short numeric queries (e.g. "14") also match hub codes.
Inputs: page, query, status, compact, +4 more.
loki_search_ordersDRead-only
Inputs: hub_id (required), city, page, status, +15 more.
loki_search_phlebo_daily_metricsARead-only
List all phlebos/riders working a hub on a date with their live day-tracking row: status, availability, battery, lat/long, last_seen, tasks_assigned, orders_completed, attendance_status, coolbox temperature, idle/offline time. This is the "Track Phlebos" board for a hub+day.
Inputs: date (required), hub_ids (required), page, per_page, +1 more.
loki_search_ridersBRead-only
Search riders (delivery agents / phlebos).
Use loki_reference_data('rider_statuses' | 'rider_types') for valid values.
Inputs: page, query, status, per_page, +2 more.
loki_search_tasksDRead-only
Inputs: hub_id (required), page, status, order_id, +9 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 18 tools
Most tools target distinct resources and actions, but two search tools lack descriptions, causing potential ambiguity. The distinction between similar rider tools is well-managed through detailed descriptions.
All tools follow a consistent `loki_<verb>_<resource>` pattern with underscores separating words. No mixing of convention or case variability observed.
18 tools is well-scoped for a logistics monitoring server, covering hubs, orders, riders, tasks, and reference data without being overwhelming.
The tools focus on reading and analytics but lack any creation, update, or deletion operations. This is acceptable for a monitoring surface, but the missing mutations create notable gaps for full lifecycle management.
Maintenance
Related MCP Connectors
An MCP server that exposes functionalities to use Zomato's services.
Read-only MCP server for ClassQuill, a tutoring-business-management platform.
MCP server for SkuVault — products, inventory, sales, purchase orders and stock adjustments.
Read-only MCP server for AIStatusDashboard status, incidents, metrics, and fallback recommendations.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceA read-only MCP server for Cartrack fleet management, enabling listing vehicles and checking their last-known status and location.MIT
- AlicenseAqualityDmaintenanceUnified MCP server providing business data APIs for Indian users, orders, and business metrics, deployable via Vercel.5MIT
- AlicenseAqualityBmaintenanceMCP server for the Yango Delivery B2B API, enabling price estimation, express-courier claim creation and confirmation, courier tracking, and recipient tracking links through natural language.1370 npmMIT
- AlicenseAqualityDmaintenanceMCP server for METRC cannabis track-and-trace API, focused on processor workflows like inventory checks, transfer reconciliation, and lab results, with read-only safety defaults.8MIT