Skip to main content
Glama
anish5256

Zerodha MCP Server

by anish5256

Zerodha MCP 서버

MCP(Model Context Protocol)를 통해 Zerodha 거래 계좌를 조회하세요. Claude Code, Claude Desktop, Cursor 및 기타 MCP 호환 AI 도구와 함께 작동합니다.

사용 가능한 도구

도구

설명

get_account_funds

사용 가능한 잔액 및 증거금

get_portfolio_holdings

장기 보유 주식(Demat)

get_open_positions

손익(P&L)을 포함한 당일/선물옵션(F&O) 포지션

get_todays_orders

오늘의 주문 내역

get_current_pnl

통합 손익(P&L) 요약

get_instrument_ltp

모든 종목의 최종 거래 가격(LTP)

get_instrument_ohlc

모든 종목의 OHLC 데이터

get_pnl_summary

기간별(최대 3개월) 과거 손익(P&L) 요약

get_pnl_heatmap

기간별(최대 3개월) 일일 손익(P&L) 분석

Related MCP server: Trade-MCP

설치

git clone https://github.com/anish5256/zerodha-mcp.git
cd zerodha-mcp
pip install -e .

구성

환경 변수

서버는 인증을 위해 다음 환경 변수가 필요합니다:

변수

설명

ZERODHA_USER_ID

Zerodha 클라이언트 ID (예: AB1234)

ZERODHA_PASSWORD

Zerodha 로그인 비밀번호

ZERODHA_TOTP_KEY

TOTP 비밀 키 (32자 base32 문자열)

TOTP 키 가져오기

TOTP 비밀 키는 Google Authenticator/Authy에서 2단계 인증(2FA)을 설정할 때 사용한 32자 코드입니다. 예: ABCD1234EFGH5678IJKL9012MNOP3456

저장해 둔 키가 없다면 Zerodha Console에서 2FA를 재설정하여 새 키를 받으세요.


플랫폼별 설정

Claude Code (CLI)

~/.mcp.json에 추가하세요:

{
  "mcpServers": {
    "zerodha": {
      "command": "python",
      "args": ["/path/to/zerodha-mcp/server.py"],
      "env": {
        "ZERODHA_USER_ID": "YOUR_USER_ID",
        "ZERODHA_PASSWORD": "YOUR_PASSWORD",
        "ZERODHA_TOTP_KEY": "YOUR_TOTP_SECRET"
      }
    }
  }
}

그런 다음 Claude Code를 재시작하세요.


Claude Desktop (macOS)

~/Library/Application Support/Claude/claude_desktop_config.json을 편집하세요:

{
  "mcpServers": {
    "zerodha": {
      "command": "python",
      "args": ["/path/to/zerodha-mcp/server.py"],
      "env": {
        "ZERODHA_USER_ID": "YOUR_USER_ID",
        "ZERODHA_PASSWORD": "YOUR_PASSWORD",
        "ZERODHA_TOTP_KEY": "YOUR_TOTP_SECRET"
      }
    }
  }
}

그런 다음 Claude Desktop을 재시작하세요.


Claude Desktop (Windows)

%APPDATA%\Claude\claude_desktop_config.json을 편집하세요:

{
  "mcpServers": {
    "zerodha": {
      "command": "python",
      "args": ["C:\\path\\to\\zerodha-mcp\\server.py"],
      "env": {
        "ZERODHA_USER_ID": "YOUR_USER_ID",
        "ZERODHA_PASSWORD": "YOUR_PASSWORD",
        "ZERODHA_TOTP_KEY": "YOUR_TOTP_SECRET"
      }
    }
  }
}

그런 다음 Claude Desktop을 재시작하세요.


Cursor

Cursor의 MCP 설정(Settings > MCP)에 추가하세요:

{
  "zerodha": {
    "command": "python",
    "args": ["/path/to/zerodha-mcp/server.py"],
    "env": {
      "ZERODHA_USER_ID": "YOUR_USER_ID",
      "ZERODHA_PASSWORD": "YOUR_PASSWORD",
      "ZERODHA_TOTP_KEY": "YOUR_TOTP_SECRET"
    }
  }
}

기타 MCP 클라이언트

MCP 호환 클라이언트의 경우 다음을 구성하세요:

  • 명령어: python

  • 인자: ["/path/to/zerodha-mcp/server.py"]

  • 환경 변수:

    • ZERODHA_USER_ID = 클라이언트 ID

    • ZERODHA_PASSWORD = 비밀번호

    • ZERODHA_TOTP_KEY = TOTP 비밀 키


사용 예시

설정이 완료되면 AI 어시스턴트에게 다음과 같이 물어보세요:

  • "현재 내 포트폴리오 가치는 얼마야?"

  • "내 오픈 포지션을 보여줘"

  • "오늘 내 손익(P&L)은 얼마야?"

  • "사용 가능한 자금이 얼마 있지?"

  • "RELIANCE의 LTP는 얼마야?"

  • "NIFTY 50의 OHLC 데이터를 가져와"

  • "2024년 내 선물옵션(F&O) 수익은 얼마였어?"

  • "지난달 일일 손익(P&L)을 보여줘"

보안 참고 사항

  • 자격 증명은 MCP 설정 파일에 로컬로 저장됩니다.

  • 자격 증명은 AI 모델로 전송되지 않으며 서버 측에서만 사용됩니다.

  • 토큰은 zerodha_enctoken.txtzerodha_console_token.txt(gitignored)에 로컬로 캐시됩니다.

  • 각 사용자는 자신의 컴퓨터에서 직접 자격 증명을 구성해야 합니다.

라이선스

MIT

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    quality
    D
    maintenance
    Enables AI assistants to interact with the Zerodha trading platform for placing stock orders, viewing portfolio holdings, and managing mutual fund investments. Provides secure OAuth authentication and real-time trading capabilities through Zerodha's official API.
    1
    -
  • F
    license
    Not graded
    quality
    C
    maintenance
    Enables trading automation through Zerodha Kite Connect API, allowing users to place buy/sell orders and fetch holdings via MCP tools accessible to Claude Desktop and other MCP-compatible clients.
    -
  • F
    license
    Not graded
    quality
    D
    maintenance
    Enables AI models to interact with the Zerodha trading platform for portfolio management, trading, and account operations through natural language.
    3
    -
  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables natural language management of Zerodha trading accounts, including placing orders, checking portfolio, and viewing positions through MCP integration.
    32
    Apache 2.0