Metadata-Version: 2.4
Name: jyotishyamitra-mcp
Version: 0.1.0
Summary: MCP server for the JyotishyaMitra astrology engine — personalized, multi-system readings inside your coding agent.
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: mcp>=1.2
Requires-Dist: httpx>=0.27

# JyotishyaMitra MCP / Engine Gateway

Two pieces:
- **Gateway** (`config.py`, `store.py`, `auth.py`, `plans.py`, `main.py`, `admin.py`) — a service that runs on **your** server. Authenticates API keys, mints backend tokens, proxies to ProfileAPI, meters usage. Never exposes raw charts.
- **MCP server** (`mcp_server.py`, packaged via `pyproject.toml`) — runs on the **developer's** machine, inside their coding agent. Thin client that calls the gateway.

A developer pays (Razorpay link) → you issue them an API key → they paste it into their agent's MCP config → their agent gets personalized, multi-system astrology readings from your engine.

---

## Ops — running it (you)

### Deploy the gateway
```bash
bash gateway/deploy.sh
```
This copies the code to the box, installs deps, writes `gateway.env` (pulling `SECRET_KEY` from ProfileAPI so tokens validate), installs the systemd service, and health-checks `http://127.0.0.1:8020/health`.

### Make it public (one-time)
1. Add a DNS **A record** for a subdomain (e.g. `mcp.astroraksa.com`) → this box's IP.
2. Edit `nginx-jm-gateway.conf`, set your subdomain, install it:
   ```bash
   sudo cp nginx-jm-gateway.conf /etc/nginx/sites-available/jm-gateway
   sudo ln -s /etc/nginx/sites-available/jm-gateway /etc/nginx/sites-enabled/
   sudo certbot --nginx -d mcp.astroraksa.com
   sudo systemctl reload nginx
   ```

### Issue a key when someone pays (manual launch flow)
```
dev pays your Razorpay link  →  you see it in the Razorpay dashboard
  →  on the box:  /home/ubuntu/venv/bin/python admin.py create-org "Dev Name" --plan pro
  →  send them the printed API key + the config snippet below
```
The key is shown **once** (only its hash is stored).

### Tiers (`plans.py`)
- `free` — data tools only, daily cap. `pro` — adds the LLM-backed `ask` tool. `b2b` — high limits.

---

## Developer setup (what you send a paying dev)

### 1. Install
```bash
pip install jyotishyamitra-mcp     # or: uvx jyotishyamitra-mcp
```

### 2. Add to your coding agent's MCP config
```json
{
  "mcpServers": {
    "jyotishyamitra": {
      "command": "jyotishyamitra-mcp",
      "env": {
        "JM_GATEWAY_URL": "https://mcp.astroraksa.com",
        "JM_API_KEY": "jm_xxx_your_key"
      }
    }
  }
}
```

### 3. Register your birth details once, then use it
Ask your agent to call `register` (birth date, time, place), then `daily_factors`, `life_blueprint`, `timing_windows`, `calibrate`, or `ask`.

**Tools:** `register`, `life_blueprint`, `daily_factors`, `timing_windows`, `calibrate` (free tier) · `ask` (paid).

---

## Payment (manual, no code)
Use a **Razorpay Payment Link** from the dashboard. On payment, issue the key with `admin.py`. Automate later with a webhook (`payment.captured` → issue key) only when volume justifies it.
