Upstox Mcp Server

Created By
ravikant19183 months ago
A Model Context Protocol (MCP) server for the Upstox Trading API that allows AI agents to access Indian stock market data, perform technical analysis, and view account information in a strictly read-only mode.
Overview

Upstox MCP Server 📈

A Model Context Protocol (MCP) server that integrates with the Upstox Trading API, enabling AI agents to securely access Indian stock market data, perform technical analysis, and view account information in read-only mode.


🚀 Features

📊 Market Data

  • Live quotes (LTP, OHLC, volume)
  • Intraday candles (1m, 5m, 15m, 30m)
  • Historical candle data

📈 Technical Analysis

  • RSI, EMA, SMA, MACD, VWAP
  • Candlestick pattern detection
  • Trend context (Bullish / Bearish / Sideways)
  • Support & resistance levels

👤 Account (Read-Only)

  • Profile details
  • Funds & margin summary
  • Holdings
  • Open positions

🤖 MCP Native

  • Designed for AI agents
  • Tool-first architecture
  • Supports Claude Desktop, Cursor, and custom agents

⚠️ Safety Notice

This MCP server is STRICTLY READ-ONLY
❌ No order placement
❌ No order modification
❌ No trading actions

Trading endpoints are intentionally excluded for safety.


📦 Installation

1️⃣ Clone Repository

git clone https://github.com/your-username/upstox-mcp.git
cd upstox-mcp

2️⃣ Install Dependencies

pip install -e .

🔐 Configuration

Create a .env file in the project root:

UPSTOX_ACCESS_TOKEN=your_access_token_here

The access token must be generated using Upstox OAuth and should have read-only scopes.


▶️ Running the Server

Once installed, use the upstox-mcp command to start the server.

Option A — Standard IO (for Claude Desktop)

Default mode for local agent usage.

upstox-mcp

Option B — HTTP (Streamable)

Recommended for Cursor or remote MCP clients.

upstox-mcp --transport http

Option C — Deployment via Docker

Run the server in a containerized environment.

  1. Using Docker Compose (Recommended):

    docker-compose up -d
    
  2. Using Docker CLI:

    docker build -t upstox-mcp .
    docker run -d -p 8000:8000 --env-file .env upstox-mcp
    

Server will be available at: http://localhost:8000/mcp


🔌 MCP Client Configuration

Claude Desktop

Config path: ~/Library/Application Support/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "upstox": {
      "command": "upstox-mcp",
      "env": {
        "UPSTOX_ACCESS_TOKEN": "your_access_token_here"
      }
    }
  }
}

Note: Ensure the directory containing upstox-mcp is in your PATH.

Cursor (HTTP)

Open Cursor Settings → Features → MCP. Add a new server:

  • Name: Upstox
  • Type: http
  • URL: http://localhost:8000/mcp

🧠 Example Prompts (AI Agent)

Market Data

  • "What's the current price of RELIANCE?"
  • "Show 1-minute candles for INFOSYS"

Technical Analysis

  • "Run RSI and EMA-20 analysis on TATAMOTORS"
  • "Is SBIN trending bullish or bearish today?"

Account

  • "Show my available margin in Upstox"
  • "List my current holdings"
  • "What are my open positions and P&L?"

🧰 Available Tools

Tool NameDescription
get_live_quoteLive price, OHLC, volume
get_intraday_candlesIntraday OHLCV data
get_historical_candlesHistorical market data
get_technical_analysisRSI, EMA, MACD, trend, S/R
get_account_summaryFunds + overview
get_holdings_listAll equity holdings
get_positions_listActive positions

🏗️ Architecture

AI Agent (Claude / Cursor) ↓ MCP ↓ FastMCP Server ↓ Upstox API (Read-Only)


📄 License

MIT License

🙌 Credits

  • FastMCP —MCP framework
  • Upstox — Trading & market data API
  • Pandas-TA — Technical indicators

📬 Disclaimer

This project is not affiliated with Upstox. Use at your own risk. Ensure compliance with Upstox API terms.

Server Config

{
  "mcpServers": {
    "Upstox-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-remote",
        "https://mcp-server-upstox.onrender.com/mcp"
      ],
      "env": {
        "UPSTOX_API_KEY": "",
        "UPSTOX_API_SECRET": "",
        "UPSTOX_ACCESS_TOKEN": ""
      }
    }
  }
}
Project Info
Created At
3 months ago
Updated At
3 months ago
Author Name
ravikant1918
Star
-
Language
-
License
-
Category

Recommend Servers

View All
奇门遁甲
@colorwlof

# 小奇智算 API 能力 | Xiaoqi Intelligent Calculation API Skill GET APIKEY:https://www.xiaoqizhisuan.cn/account.html GET HELP: https://www.xiaoqizhisuan.cn/help.html en: Official Xiaoqi Intelligent Calculation API for BaZi and Qi Men Dun Jia. This service requires XIAOQIZHISUAN_API_KEY credential for authentication. zh: 小奇智算官方API,提供八字、奇门遁甲测算服务,需配置XIAOQIZHISUAN_API_KEY密钥鉴权。 提供专业的奇门遁甲排盘与解盘服务,支持7个MCP工具: # 可用工具 | Available Tools ### 1. bazi_dayun - 八字大运查询 | BaZi Great Fortune Query ``` 价格 | Price: ¥0.2 / time / 次 参数 | Parameters: year (integer, 必填) 出生年(公历) month (integer, 必填) 出生月 day (integer, 必填) 出生日 hour (integer, 必填) 出生时(0-23) xingbie (string, 必填) 性别("男" / "女") 返回 | Return: success, cost, balance, bazi, dayun, error ``` 实测结果 | real test: https://www.xiaoqizhisuan.cn/examples/example_1_bazi_dayun.html ### 2. qimen_paipan - 奇门排盘(JSON 数据)| Qi Men Chart Generation (JSON Data) ``` 价格 | Price: ¥0.5 / time / 次 参数 | Parameters: year (integer, 必填) 年 month (integer, 必填) 月 day (integer, 必填) 日 hour (integer, 必填) 时(0-23) minute (integer, 选填, 默认0) 分 number (integer, 选填, 默认1) 排盘方法(1=拆补法, 2=置润法) 返回 | Return: success, cost, balance, 数据, error ``` 实测结果 | real test: https://www.xiaoqizhisuan.cn/examples/example_2_qimen_paipan.html ### 3. qimen_paipan_image - 奇门排盘+HTML网页图 | Qi Men Chart Generation + HTML Webpage Chart ``` 参数 | Parameters: year (integer, 必填) 年 month (integer, 必填) 月 day (integer, 必填) 日 hour (integer, 必填) 时(0-23) minute (integer, 选填, 默认0) number (integer, 选填, 默认1) 返回 | Return: success, cost, balance, 数据, html_url, error ``` 实测结果 | real test: https://www.xiaoqizhisuan.cn/examples/example_3_qimen_paipan_image.html ### 4. qimen_jiepan - 即时盘解析准备 | Immediate Chart Analysis Preparation ``` 价格 | Price: ¥1.0 / time / 次 参数 | Parameters: year, month, day, hour (integer, 必填) 起盘时间 minute (integer, 选填, 默认0) number (integer, 选填, 默认1) question (string, 必填) 返回 | Return: success, cost, balance, html_url, system_prompt, user_prompt, error ``` 实测结果 | real test: https://www.xiaoqizhisuan.cn/examples/example_4_qimen_jiepan.html ### 5. qimen_jiepan_lifetime - 终身盘解析准备 | Lifetime Chart Analysis Preparation ``` 价格 | Price: ¥1.2 / time / 次 参数 | Parameters: year, month, day, hour (integer, 必填) xingbie (string, 必填) 性别("男"/"女") minute (integer, 选填, 默认0) number (integer, 选填, 默认1) question (string, 必填) 返回 | Return: success, cost, balance, bazi, dayun, html_url, system_prompt, user_prompt, error ``` 实测结果 | real test: https://www.xiaoqizhisuan.cn/examples/example_5_qimen_jiepan_lifetime.html ### 6. qimen_full - 即时局完整解盘 | Complete Immediate Chart Interpretation ``` 价格 | Price: ¥1.5 / time / 次 参数 | Parameters: year, month, day, hour (integer, 必填) minute (integer, 选填, 默认0) number (integer, 选填, 默认1) question (string, 必填) 返回 | Return: success, cost, balance, html_url, system_prompt, user_prompt, jiepan_result, error ``` 实测结果 | real test: https://www.xiaoqizhisuan.cn/examples/example_6_qimen_full.html ### 7. qimen_full_lifetime - 终身局完整解盘 | Complete Lifetime Chart Interpretation ``` 价格 | Price: ¥2.0 / time / 次 参数 | Parameters: year, month, day, hour (integer, 必填) xingbie (string, 必填) 性别("男"/"女") minute (integer, 选填, 默认0) number (integer, 选填, 默认1) question (string, 必填) 返回 | Return: success, cost, balance, bazi, dayun, html_url, system_prompt, user_prompt, jiepan_result, error ``` 实测结果 | real test: https://www.xiaoqizhisuan.cn/examples/example_7_qimen_full_lifetime.html 🔗 https://www.xiaoqizhisuan.cn/mcp

2 days ago
Wiza

16 hours ago