Skip to main content
Glama
piyush-lingwal

CareSakhi MCP Server

README.md
# CareSakhi MCP Server

An MCP (Model Context Protocol) server that connects **CareSakhi Partner App's** Supabase backend to **Claude Desktop**. Manage orders, products, stock, users, and EcoCoins through natural conversation.

## Quick Start

### 1. Install dependencies

```bash
cd caresakhi-mcp-server
npm install
```

### 2. Build

```bash
npm run build
```

### 3. Configure Claude Desktop

Add this to your `claude_desktop_config.json`:
- **MSIX install (your setup):** `C:\Users\DELL\AppData\Local\Packages\Claude_pzs8sxrjxfjjc\LocalCache\Roaming\Claude\claude_desktop_config.json`
- **Standard install:** `%APPDATA%\Claude\claude_desktop_config.json`

```json
{
  "mcpServers": {
    "caresakhi": {
      "command": "node",
      "args": ["<PATH_TO>/caresakhi-mcp-server/dist/index.js"],
      "env": {
        "SUPABASE_URL": "https://your-project-ref.supabase.co",
        "SUPABASE_SERVICE_ROLE_KEY": "<your-service-role-key>"
      }
    }
  }
}
```

> ⚠️ **Get your service role key** from the [Supabase Dashboard](https://supabase.com/dashboard) → Your Project → Settings → API → `service_role` key.

### 4. Restart Claude Desktop

Close and reopen Claude Desktop. You should see "caresakhi" in the MCP tools list.

---

## Available Tools (16)

### Orders
| Tool | Description |
|---|---|
| `get_orders` | List orders with status, date, and user filters |
| `get_order_details` | Full order info with items and timeline |
| `update_order_status` | Accept/reject/advance orders |
| `create_order` | Place a new order |

### Products
| Tool | Description |
|---|---|
| `search_products` | Search catalog by name, category, price, tags |
| `get_product_details` | Full product information |

### Stock
| Tool | Description |
|---|---|
| `get_stock_levels` | Distributor inventory with low-stock filter |
| `update_stock` | Update stock quantity |

### Notifications
| Tool | Description |
|---|---|
| `get_notifications` | View notifications with type/read filters |
| `mark_notification_read` | Mark single or all as read |

### Users
| Tool | Description |
|---|---|
| `get_user_profile` | Lookup by ID, phone, or partner ID |
| `list_users` | List users by role/KYC status |
| `get_pharmacy_links` | Distributor's linked pharmacies |
| `link_pharmacy` | Link pharmacy via coupon code |

### EcoCoins
| Tool | Description |
|---|---|
| `get_eco_balance` | Balance and transaction history |
| `get_analytics` | Dashboard stats (orders, revenue, users) |

## Resources (3)

| URI | Description |
|---|---|
| `caresakhi://schema` | Database schema overview |
| `caresakhi://products/catalog` | Full product catalog |
| `caresakhi://stats/overview` | System statistics |

---

## Example Conversations

```
You: Show me all pending orders
Claude: [calls get_orders] → Lists orders with status, amount, pharmacy info

You: Accept order ORD-2026-0039 with note "Will ship today"
Claude: [calls update_order_status] → Order updated ✅

You: How many orders this week?
Claude: [calls get_analytics] → Weekly summary with charts

You: Find organic pads under ₹200
Claude: [calls search_products] → Product list with prices and stock
```