Malaysia MyPriMe Scraper avatar

Malaysia MyPriMe Scraper

Pricing

from $0.01 / 1,000 results

Go to Apify Store
Malaysia MyPriMe Scraper

Malaysia MyPriMe Scraper

Pricing

from $0.01 / 1,000 results

Rating

0.0

(0)

Developer

John Tan

John Tan

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

17 days ago

Last modified

Categories

Security

Limited permissions

Share

MOH MyPriMe Pharmaceutical Claims Auditor MCP Server

A production-ready Model Context Protocol (MCP) server containerized with Docker that queries the Malaysia Ministry of Health (MOH) MyPriMe (Consumer Price Guide) database to audit pharmaceutical billing, calculate insurance markup percentages, and detect claims leakage.


🌟 Key Features

  • MOH MyPriMe Integration: Connects to the Malaysian Ministry of Health drug database (https://pharmacy.moh.gov.my/en/apps/drug-pricedatabase) for benchmark procurement and Recommended Retail Prices (RRP).
  • Asynchronous Scraper & Local Cache: Built with httpx and BeautifulSoup4, scraping and caching records in a persistent SQLite database.
  • Fuzzy Search Engine: Powered by rapidfuzz to tolerate common misspelling variants (e.g., nexum $\rightarrow$ Nexium, paracetemol $\rightarrow$ Paracetamol).
  • B2B Claims Auditing Tools:
    • search_drug_price: Lookup benchmark prices and dosages.
    • audit_billed_medication: Audit single item billings against MOH RRP with customizable markup thresholds.
    • batch_audit_invoice: Audit entire hospital medication invoices with consolidated claims leakage metrics.
  • Dual Transport (STDIO & SSE): Configurable transport via environment variable (MCP_TRANSPORT=stdio or MCP_TRANSPORT=sse).
  • Production-Ready Docker: Hardened multi-stage Docker build, non-root user execution (appuser), and persistent volume mounting.

📂 Project Architecture

.
├── Dockerfile # Multi-stage production build (python:3.11-slim, non-root user)
├── docker-compose.yml # Deployment compose file with named volumes & healthchecks
├── entrypoint.sh # Container entrypoint with automatic seed checking
├── database.py # SQLite schema, connection management & rapidfuzz matching
├── seed_mock_data.py # Seeds 25 realistic Malaysian private hospital medications
├── scraper.py # Asynchronous MOH MyPriMe web scraper
├── server.py # FastMCP server exposing auditing tools (STDIO & SSE)
├── requirements.txt # Python dependency manifest
└── README.md # Complete setup, configuration & integration guide

🛠️ MCP Tools Overview

1. search_drug_price(query: str) -> str

Searches the MOH MyPriMe price database using fuzzy string matching across generic names, brand names, and strengths.

  • Example query: "nexum", "Augmentin", "Pantoprazole 40mg".

2. audit_billed_medication(drug_name: str, quantity: int, total_billed_rm: float, custom_markup_threshold_pct: float = 30.0) -> dict

Evaluates a billed medication against MOH RRP.

  • Calculates billed unit price vs. MOH RRP.
  • Computes markup %: $$\text{Markup %} = \frac{\text{Billed Unit Price} - \text{MOH RRP}}{\text{MOH RRP}} \times 100$$
  • Flags claims exceeding standard Third-Party Administrator (TPA) thresholds (e.g. $>30%$) and computes estimated claims leakage.

3. batch_audit_invoice(items: list[dict], custom_markup_threshold_pct: float = 30.0) -> dict

Processes multi-line pharmaceutical invoices, providing:

  • Total items audited & flagged item count.
  • Total billed amount vs MOH benchmark RRP.
  • Net claims leakage in Malaysian Ringgit (RM).
  • Line-item breakdown.

🚀 Getting Started with Docker

  1. Start the MCP Server in SSE Mode:

    $docker compose up -d --build
  2. Verify Server Health & Logs:

    $docker compose logs -f

    The server will start at http://localhost:8000/sse.

  3. Trigger Scraper to Refresh Live MOH Data (Optional):

    $docker compose exec moh-myprime-mcp python3 scraper.py

Option B: Build and Run with Docker CLI

1. Build the Docker Image

$docker build -t moh-myprime-mcp:latest .

2. Run in STDIO Mode (for CLI integration / Claude Desktop)

docker run -i --rm \
-v moh_data:/app/data \
-e MCP_TRANSPORT=stdio \
moh-myprime-mcp:latest

3. Run in SSE Mode (for remote agents, API gateways, or webhooks)

docker run -d --name moh-mcp \
-p 8000:8000 \
-v moh_data:/app/data \
-e MCP_TRANSPORT=sse \
moh-myprime-mcp:latest

🔌 Connecting to AI Clients

1. Claude Desktop (STDIO Mode)

Add the following to your claude_desktop_config.json:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json
{
"mcpServers": {
"moh-myprime-auditor": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-v",
"moh_data:/app/data",
"-e",
"MCP_TRANSPORT=stdio",
"moh-myprime-mcp:latest"
]
}
}
}

2. Cursor / Windsurf / Remote Agents (SSE Mode)

When running the container via docker compose up -d:

  • Transport: sse
  • Server URL: http://localhost:8000/sse

In your MCP configuration:

{
"mcpServers": {
"moh-myprime-auditor": {
"url": "http://localhost:8000/sse"
}
}
}

3. API Gateway / Custom Agent Integration (Python Example)

import asyncio
from mcp.client.session import ClientSession
from mcp.client.sse import sse_client
async def run_audit():
async with sse_client("http://localhost:8000/sse") as (read, write):
async with ClientSession(read, write) as session:
await session.initialize()
# Audit a hospital bill for Nexium
result = await session.call_tool(
"audit_billed_medication",
arguments={
"drug_name": "nexum 40mg",
"quantity": 14,
"total_billed_rm": 180.0
}
)
print(result)
asyncio.run(run_audit())

📊 Seeded Benchmark Dataset

On first startup, the database is pre-seeded with 25 common Malaysian private hospital medications, including:

  • Pantoprazole 40mg (Controloc)
  • Atorvastatin 20mg (Lipitor)
  • Amoxicillin / Clavulanic Acid 625mg (Augmentin)
  • Ceftriaxone 1g IV (Rocephin)
  • Metformin 500mg (Glucophage)
  • Celecoxib 200mg (Celebrex)
  • Omeprazole 20mg (Losec)
  • Esomeprazole 40mg (Nexium)
  • Paracetamol 500mg (Panadol ActiFast)
  • Amlodipine 5mg (Norvasc)
  • Rosuvastatin 10mg (Crestor)
  • Enoxaparin 4000 IU (Clexane)
  • ...and more.