Skip to main content
Glama
RajendraPrasad96536

Maharashtra Medicine MCP Server

Maharashtra Medicine MCP Server — Cloudflare Workers

FastMCP server for Maharashtra wholesale medicine purchase analysis, deployed as a Python Worker on Cloudflare's global edge network.


Project Structure

medicine-mcp-server/
├── src/
│   └── worker.py                         ← FastMCP server (all 10 tools)
├── data/
│   └── maharashtra_wholesale_medicine_purchase.csv   ← upload to R2, not deployed
├── .github/
│   └── workflows/
│       └── deploy.yml                    ← GitHub Actions auto-deploy
├── wrangler.toml                         ← Cloudflare Workers config
├── pyproject.toml                        ← Python deps + pywrangler config
└── README.md

Architecture

MCP Client (Claude Desktop / mcp-remote)
        │  HTTPS  (Streamable HTTP transport)
        ▼
Cloudflare Workers Edge
  ┌─────────────────────────────┐
  │  on_fetch()                 │
  │     │                       │
  │     ▼                       │
  │  MedicineServer             │
  │  (Durable Object)           │
  │     │                       │
  │     ├─ FastMCP tools ──────►│ env.GEMINI_API_KEY  (Secret)
  │     │                       │
  │     └─ _get_df() ──────────►│ env.MEDICINE_DATA   (R2 bucket)
  └─────────────────────────────┘
  • CSV data lives in Cloudflare R2 — fetched once per Worker isolate, then cached in memory for the lifetime of the isolate.

  • Gemini API key is stored as a Cloudflare Secret — never in source code.

  • Transport is Streamable HTTP at /mcp — the current MCP spec standard.


One-Time Setup

Prerequisites

# Node.js 18+  (for wrangler CLI)
node --version

# Python 3.11+ and uv
pip install uv
uv tool install pywrangler

# Wrangler CLI
npm install -g wrangler

# Authenticate wrangler with your Cloudflare account
npx wrangler login

Step 1 — Clone & configure

git clone https://github.com/YOUR_ORG/medicine-mcp-server.git
cd medicine-mcp-server

Open wrangler.toml and uncomment + fill in your account_id:

account_id = "abc123..."    # from dash.cloudflare.com → Overview

Step 2 — Create the R2 bucket

npx wrangler r2 bucket create medicine-mcp-data

Step 3 — Upload the CSV to R2

npx wrangler r2 object put medicine-mcp-data/maharashtra_wholesale_medicine_purchase.csv \
  --file ./data/maharashtra_wholesale_medicine_purchase.csv

Verify the upload:

npx wrangler r2 object get medicine-mcp-data/maharashtra_wholesale_medicine_purchase.csv \
  --file /tmp/verify.csv && wc -l /tmp/verify.csv

Step 4 — Store your Gemini API key as a secret

npx wrangler secret put GEMINI_API_KEY
# Paste your key when prompted (get one free at https://aistudio.google.com/app/apikey)

Step 5 — Deploy

uv run pywrangler deploy

Your server is now live at:

https://medicine-mcp-server.<your-account>.workers.dev/mcp

GitHub Actions Auto-Deploy

Every push to main triggers an automatic deploy via .github/workflows/deploy.yml.

Add these two secrets in your GitHub repo (Settings → Secrets and variables → Actions):

Secret

Where to find it

CLOUDFLARE_API_TOKEN

dash.cloudflare.com → My Profile → API Tokens → Create Token → "Edit Cloudflare Workers" template

CLOUDFLARE_ACCOUNT_ID

dash.cloudflare.com → Overview → API section

After adding secrets, any git push origin main will auto-deploy.


Local Development

# Start local dev server (uses local R2 simulation — no real R2 calls)
uv run pywrangler dev

# Server available at http://localhost:8787/mcp
# Test with MCP Inspector: npx @modelcontextprotocol/inspector http://localhost:8787/mcp

Connecting Claude Desktop

Add to claude_desktop_config.json:

{
  "mcpServers": {
    "medicine": {
      "command": "npx",
      "args": [
        "mcp-remote",
        "https://medicine-mcp-server.<your-account>.workers.dev/mcp"
      ]
    }
  }
}

Available Tools

#

Tool

Purpose

1

search_medicines

Search by product / manufacturer / supplier / buyer

2

get_invoice_details

Full line-items for one or more invoices

3

filter_by_schedule

Filter by drug schedule (H, H1, X, G, OTC)

4

get_expiry_alerts

Medicines expiring within N days

5

analyse_supplier

Spend & invoice summary for a supplier

6

analyse_buyer

Purchase history & schedule mix for a buyer

7

top_products_by_spend

Ranked products by taxable amount / quantity

8

gst_summary

CGST / SGST / IGST breakdown by invoice/supplier/buyer

9

cold_chain_and_narcotic_items

Cold-chain & Schedule X items

10

natural_language_query

Free-form NL question answered by Gemini


Updating the CSV

To replace the CSV with a newer file:

npx wrangler r2 object put medicine-mcp-data/maharashtra_wholesale_medicine_purchase.csv \
  --file ./data/your_new_file.csv

# The Worker's in-memory cache resets automatically on the next isolate cold-start.
# Force an immediate reset by redeploying:
uv run pywrangler deploy

Useful Commands

# Stream live logs from production
uv run pywrangler tail

# List R2 objects
npx wrangler r2 object list medicine-mcp-data

# List secrets
npx wrangler secret list

# Delete a secret
npx wrangler secret delete GEMINI_API_KEY
-
security - not tested
F
license - not found
-
quality - not tested

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/RajendraPrasad96536/inventory-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server