Skip to main content
Glama

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

loki_reference_data

enums

Valid order_statuses / task_statuses / rider_statuses / rider_types

loki_search_hubs

hubs

Find a PAC hub id from name/code (defaults to droplet)

loki_get_hub

hubs

Full hub detail by id

loki_search_orders

orders

Diagnostics orders for a PAC on a day — hub_id + day_query required

loki_count_orders_by_status

orders

Order counts by status (all/placed/completed/…) for a PAC+day

loki_get_order

orders

Full order detail by numeric id (tests, slot, status)

loki_get_order_timelines

orders

Date-keyed status history of an order

loki_search_batches

batches

Diagnostics batches (consignments) for a day

loki_get_batch_metrics

batches

Aggregate batch/assignment metrics for a day

loki_get_batch

batches

Full batch detail (orders + assigned_in_batch)

loki_search_riders

riders

Search riders/phlebos (shared infra)

loki_get_rider

riders

Full rider detail by numeric id

loki_get_hub_riders

riders

Phlebos attached to a PAC (optionally by type)

loki_get_phlebo_day_metrics

day tracking

Daily KPI summary (assigned/completed/distance/breach)

loki_get_phlebo_day_tasks

day tracking

Chronological day timeline (shift, login, task sequence)

loki_get_phlebo_planned_route

day tracking

Planned route waypoints + locations

loki_get_phlebo_actual_route

day tracking

Actual GPS pings (speed, battery, coolbox temp)

loki_search_phlebo_daily_metrics

day tracking

"Track Phlebos" board for a PAC+date

loki_get_hub_attendance_metrics

attendance

total_present / total_absent for hub(s) on a date

loki_get_rider_monthly_attendance

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_query is DD/MM/YYYY.

  • Batches (loki_search_batches, loki_get_batch_metrics): date is YYYY-MM-DD.

  • Phlebo day-tracking/attendance: date is YYYY-MM-DD; phlebo_id/rider_id is the numeric rider id.

  • Order detail/timeline: take the order's numeric id (from search rows), not the NNN-NNN display order_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.

  1. Open https://thor.1mg.com while logged in.

  2. DevTools → Application → Cookies → copy the authTokenThor value.

  3. 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

LOKI_TOKEN_FILE

~/.loki_token

Path to token file

LOKI_TOKEN

—

Token fallback if no file

LOKI_BASE_URL

https://thor.1mg.com/1mg_api

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.py

Notes

  • hub_id is mandatory for order/batch/phlebo lookups. Resolve PAC names → ids with loki_search_hubs.

  • See the date-format gotchas above — orders use DD/MM/YYYY, batches/phlebo use YYYY-MM-DD.

  • Intentionally read-only; no write/action tools (assign, auto_assign, etc.) are exposed.

Available Tools

18 tools
loki_get_hubA
Read-only

Get full detail for a single hub by its id (Mongo ObjectId string).

Inputs: hub_id (required).

loki_get_hub_attendance_metricsA
Read-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_ridersB
Read-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_orderA
Read-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_timelinesA
Read-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_routeA
Read-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_metricsA
Read-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_tasksA
Read-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_routeA
Read-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_riderA
Read-only

Get full detail for a single rider by numeric id.

Inputs: rider_id (required).

loki_get_rider_monthly_attendanceA
Read-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_taskA
Read-only

Get full detail for a single task by its id.

Inputs: task_id (required).

loki_reference_dataA
Read-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_hubsA
Read-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_ordersD
Read-only

Inputs: hub_id (required), city, page, status, +15 more.

loki_search_phlebo_daily_metricsA
Read-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_ridersB
Read-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_tasksD
Read-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

    B3.2/5.0

    Scored across 18 tools

    Disambiguation4/5

    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.

    Naming Consistency5/5

    All tools follow a consistent `loki_<verb>_<resource>` pattern with underscores separating words. No mixing of convention or case variability observed.

    Tool Count5/5

    18 tools is well-scoped for a logistics monitoring server, covering hubs, orders, riders, tasks, and reference data without being overwhelming.

    Completeness3/5

    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

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      A read-only MCP server for Cartrack fleet management, enabling listing vehicles and checking their last-known status and location.
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      MCP 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.
      13
      70 npm
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      MCP 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.
      8
      MIT