Upstox Market Data MCP Server
by najeebccj
README.md
# Upstox Market Data MCP Server
A small MCP server that gives ChatGPT (or Claude) live access to Upstox option chain / OI data,
market quotes, and option contracts — read-only, using your Upstox **Analytics Token**.
## Tools exposed
- `get_option_chain` — raw option chain (OI, volume, LTP, IV per strike)
- `get_option_chain_analysis` — computed PCR, max-pain strike, support/resistance from OI, strikes near spot
- `get_option_contracts` — list contracts/expiries for an underlying
- `get_market_quote` — live LTP/OHLC/volume for one or more instrument keys
## 1. Get your credentials
1. In Upstox → **Apps → My Apps → Analytics** tab → **Generate Token**. Copy it.
(This is your `UPSTOX_ANALYTICS_TOKEN` — valid 1 year, read-only, no daily re-login.)
2. Invent a password for `MCP_SHARED_SECRET` — anything long and random. This is NOT your Upstox
token; it's a separate secret that protects this server from strangers on the internet, since
it will be running on a public URL.
## 2. Deploy (Render, free tier)
1. Push this folder to a GitHub repo (or use Render's "Deploy from folder" if available).
2. On [render.com](https://render.com) → **New → Web Service** → connect your repo.
3. Runtime: Node. Build command: `npm install`. Start command: `npm start`.
4. Under **Environment**, add:
- `UPSTOX_ANALYTICS_TOKEN` = (your token from step 1)
- `MCP_SHARED_SECRET` = (your invented password from step 1)
5. Deploy. Render will give you a URL like `https://your-app-name.onrender.com`.
6. Your MCP endpoint is: `https://your-app-name.onrender.com/mcp`
## 3. Connect it in ChatGPT
1. Settings → Apps (or Plugins) → MCPs → **Add server**.
2. Type: **Streamable HTTP**.
3. URL: `https://your-app-name.onrender.com/mcp`
4. Under headers (or "Bearer token"), set: `Authorization: Bearer <your MCP_SHARED_SECRET>`
(some ChatGPT UIs have a dedicated "Bearer token" field — put the secret there instead)
5. Save. It should scan and list the 4 tools above.
## Notes
- This uses your Analytics Token, which is **read-only** — it cannot place, modify, or cancel orders.
- Free Render tiers spin down when idle; the first call after inactivity may take ~30-60s to wake up.
- PCR, max-pain, and OI buildup are positioning heuristics, not statistical probabilities — treat
them as one input alongside your existing indicators (EMA/VWAP/SuperTrend/RSI etc.), not a standalone signal.
This server cannot be deployed
Maintenance
ActivitySlowing
ResponsivenessNo issues