Skip to main content
Glama

IDX Market MCP (idx-market-mcp)

Python FastMCP License: MIT Market

Institutional-grade Model Context Protocol (MCP) server for Indonesian Stock Exchange (IDX) equities.

idx-market-mcp bridges AI agents (Claude Desktop, Cursor, Hermes Agent) to the Indonesian capital markets. It combines public market telemetry, real-time Level 2 orderbook depth, institutional bandarmology (broker accumulation/distribution), automated chart pattern recognition, and quantitative risk budgeting into a single, token-efficient Python server.


🌟 Key Capabilities

  1. Unified Multi-Action Gateway (idx_stockbit):

    • Access orderbook depth, broker summaries, audited financials, corporate action dividends, and insider disclosures through a single tool schema (~150 input tokens), eliminating tool-definition bloat across conversation turns.

  2. Institutional Bandarmology:

    • Real-time foreign net flows and broker summary breakdown (Top-1, Top-3, Top-5 broker accumulation/distribution status).

  3. Full Level 2 Orderbook Depth:

    • 10 Bid & 10 Ask depth ladder with lot volume and institutional support/resistance wall detection.

  4. Algorithmic Chart Pattern Recognition:

    • Mathematical detection of local extrema (scipy.signal.argrelextrema) and trendline regression to identify triangles, channels, and coils, complete with Bulkowski breakout probabilities and auto-generated candlestick charts (mplfinance).

  5. Defensive Financial Sanitization:

    • Automatic currency mismatch normalization for USD-reporting issuers (KRAS, AMMN, MEDC, ADRO), thin-equity ROE clamping, and solvency violation locks ($\text{DER} > 1.5\times$).

  6. Quantitative Risk Budgeting & Two-Tranche Orders:

    • Anti-cluster sector concentration ceilings (max 50% per sector) and mathematical 2-tranche limit order calculators ready for retail broker execution (e.g. Ajaib, Stockbit).


Related MCP server: Baguskto Saham

šŸ—ļø Architecture

ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”
│                   AI Agent / Client                    │
│      (Claude Desktop, Cursor, Hermes Agent, LLM)       │
ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¬ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜
                            │ Model Context Protocol (JSON-RPC / stdio)
ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā–¼ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”
│                    idx-market-mcp                      │
│                                                        │
│  ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”   ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā” │
│  │ Unified Gateway       │   │ Quantitative Guards   │ │
│  │ (idx_stockbit)        │   │ (Sanitize/Sector/Lot) │ │
│  ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¬ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜   ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¬ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜ │
│              │                           │             │
│  ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā–¼ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”   ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā–¼ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā” │
│  │ Pattern Recognition   │   │ Free Quote Fallback   │ │
│  │ (scipy + mplfinance)  │   │ (Yahoo Finance .JK)   │ │
│  ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜   ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜ │
ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¬ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¬ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜
               │ Session Bearer Token      │ Public OHLCV
ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā–¼ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”   ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā–¼ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”
│    Stockbit Exodus API   │   │   Yahoo Finance Charts  │
│ (Orderbook L2 / Bandar)  │   │      (.JK Tickers)      │
ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜   ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜

šŸ› ļø Tool Catalog (11 Active Tools)

Tool Name

Type

Description

idx_stockbit

Gateway

Single unified action tool: orderbook, bandarmology, keystats, dividends, insider.

idx_get_orderbook

Market L2

10-level Bid & Ask ladder, total queue lots, ARA/ARB thresholds.

idx_get_bandarmology

Flow

Broker summary, institutional flow in IDR, Top 1/3/5 broker actions.

idx_get_keystats

Fundamental

Audited IDR balance sheet, Piotroski F-Score (1-9), DER, ROE, CFO, DPR.

idx_get_dividends

Corp Action

Historical and upcoming dividend calendar (cum, ex, payment dates, IDR value).

idx_get_insider_activity

Corporate

Major shareholder and director/commissioner transaction disclosures.

idx_analyze_chart_pattern

Technical

Algorithmic pattern detection, regression slopes, and annotated PNG chart rendering.

idx_get_market_quote

Price Feed

Real-time quote, intraday range, volume in shares and lots.

idx_sanitize_financials

Risk Guard

Normalizes USD reporting mismatches, thin-equity ROE distortions, and leverage traps.

idx_check_sector_concentration

Risk Guard

Enforces 50% single-sector portfolio ceiling (e.g. anti-cluster bank guard).

idx_calc_tranche_orders

Execution

Computes disciplined 2-tranche limit orders (Tranche 1 immediate + Tranche 2 reserve).


šŸš€ Quickstart

1. Installation

Clone and install dependencies via pip or uv:

git clone https://github.com/mpandudc/idx-market-mcp.git
cd idx-market-mcp

# Using uv (recommended)
uv venv
source .venv/bin/activate
uv pip install -e .

# Or using standard pip
pip install -e .

2. Authentication (Optional for Deep Data)

Basic market quotes, sector concentration checks, and chart pattern recognition work without credentials (using public feeds).

To unlock Level 2 Orderbook depth, Bandarmology, and audited Keystats, provide a Stockbit Bearer token via environment variable:

export STOCKBIT_BEARER_TOKEN="eyJhbGciOiJSUzI1NiIs..."

(Token can be obtained once from your browser DevTools Authorization: Bearer header on stockbit.com).


šŸ”Œ Client Configuration

Claude Desktop

Add to your claude_desktop_config.json:

{
  "mcpServers": {
    "idx-market": {
      "command": "python",
      "args": ["-m", "idx_market_data_mcp.server"],
      "env": {
        "STOCKBIT_BEARER_TOKEN": "YOUR_BEARER_TOKEN_HERE"
      }
    }
  }
}

Cursor

Add to .cursor/mcp.json:

{
  "mcpServers": {
    "idx-market": {
      "command": "python",
      "args": ["-m", "idx_market_data_mcp.server"],
      "env": {
        "STOCKBIT_BEARER_TOKEN": "YOUR_BEARER_TOKEN_HERE"
      }
    }
  }
}

Hermes Agent (~/.hermes/config.yaml)

mcp_servers:
  idx_market:
    command: /path/to/idx-market-mcp/.venv/bin/python
    args:
      - -m
      - idx_market_data_mcp.server
    enabled: true
    env:
      STOCKBIT_BEARER_TOKEN: "YOUR_BEARER_TOKEN_HERE"

šŸ“ˆ Example Prompts

  • "Cek orderbook dan bandarmology saham MYOR hari ini"

  • "Analisis chart pattern SMSM pada timeframe 1d dan render gambarnya"

  • "Hitung tiket limit order 2-tranche untuk alokasi Rp 12.000.000 di saham BBCA"

  • "Audit portofolio saya: apakah boleh menambah BBNI jika sudah memegang BBCA, BMRI, dan BBRI?"


āš–ļø Disclaimer

This software is developed strictly for educational, academic, and quantitative research purposes. It is not affiliated with, endorsed by, or sponsored by PT Bursa Efek Indonesia (IDX) or PT Stockbit Sekuritas Digital. Automated data access may be subject to the terms of service of upstream providers. Use responsibly on your own personal accounts.

šŸ“„ License

MIT License — Copyright (c) 2026 Muhammad Pandu Dwi Cahyo.

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    Provides real-time Indonesian stock market (IDX) data including prices, technical indicators, fundamental analysis, and trading signals optimized for the Indonesian market through the Model Context Protocol.
    7
    MIT
  • A
    license
    A
    quality
    D
    maintenance
    Enables access to Indonesian Stock Exchange (IDX) data with comprehensive historical data from 2019-2025 for 958 stocks, including real-time market overview, technical analysis, sector performance, and stock comparison capabilities.
    9
    20 npm
    42
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    Connects AI assistants to real-time Indian stock market data with 34 tools for search, screening, analysis, portfolio tracking, and market insights across all NSE and BSE stocks.
    93 npm
    80
    MIT
  • A
    license
    A
    quality
    C
    maintenance
    Enables AI assistants to access Indonesian stock market data, including real-time quotes, historical data from 2019, and technical analysis for 958 IDX-listed stocks.
    9
    20 npm
    MIT