MCP for IDX Stock Data: Connect Your AI Agent to MesinSaham.id Market Data
MCP (Model Context Protocol) is a standard way for AI agents to call tools and data from outside the conversation. With the MesinSaham.id MCP, Claude, Codex, Gemini or any other MCP-capable agent can pull prices, fundamentals and broker data on its own, then analyze them in the same conversation.
What your AI agent can do
There is no copying numbers from one screen to another. Just ask, and the agent picks the right tool, calls it, and explains the result. A few example questions:
- "Compare BBCA's PER, PBV and ROE with BBRI."
- "Which broker had the largest net buy in ANTM last week?"
- "Which foreign broker net bought the most yesterday?"
- "Compare the order book imbalance of BBCA and BBRI."
- "How was ANTM’s order flow (OFI) hour by hour today?"
- "Show the IHSG and foreign flow for the last 30 days."
- "What is TLKM's 10-year history of net income and dividends?"
- "Which stocks are on today's signal benchmark candidate list?"
How to connect
- Make sure your Lifetime plan is active. MCP access is for this plan only.
- Open the MCP tab in the app and create a personal token (give it a label so you can recognize it).
- Add an MCP server in your agent using the address
https://api.mesinsaham.id/mcpand the headerAuthorization: Bearer msm_….
Example for Claude Code:
claude mcp add --transport http mesinsaham https://api.mesinsaham.id/mcp \ --header "Authorization: Bearer msm_<TOKEN>"
Other agents that support MCP over HTTP use the same address and header. The configuration file format differs between apps, so adapt it to your agent's version.
The 19 available tools
Every tool only reads market data. Stock codes are case-insensitive. Agents should start with get_data_coverage or list_symbols. Click a tool to see its parameters and what it returns.
get_data_coverageWhat data is available
Date range and number of stocks in every dataset. Check this first so the agent knows what exists.
No parameters.
Response: Per dataset (daily prices, broker trades, daily broker totals, intraday broker flow, fundamental history, fundamentals, active stocks): start date, end date and the number of days or stocks. For fundamentals: the last fetch time and the number of stocks.
list_symbolsList of active stocks
Search active stocks by part of the code or name.
| Parameter | Type | Description |
|---|---|---|
| query | text, optional | Part of a stock code or name (max 40 characters). |
| limit | number, optional | Maximum rows. Default 50, max 100. |
Response: Per stock: symbol, name, exchange, price_first_date, price_last_date. Sorted by code.
get_daily_pricesDaily prices for one stock
Daily price history of one stock.
| Parameter | Type | Description |
|---|---|---|
| symbol | text, required | Stock code, e.g. BBCA. |
| from, to | YYYY-MM-DD, optional | Date range. If empty: the last 180 days up to today (WIB). |
| limit | number, optional | Default 120, max 300. |
Response: Per day: date, open, high, low, close, volume, value, frequency, foreignbuy, foreignsell, foreignflow, dividend, shareoutstanding. Ascending by date.
get_ihsgDaily IHSG
The daily composite index with foreign flow.
| Parameter | Type | Description |
|---|---|---|
| from, to | YYYY-MM-DD, optional | Date range. If empty: the last 180 days. |
| limit | number, optional | Default 120, max 300. |
Response: Per day: date, open, high, low, close, volume, value, foreignbuy, foreignsell, foreignflow. Ascending by date.
list_sectorsSector list
The 11 IDX-IC sectors with the official IDX sector index code (e.g. IDXENERGY), member count, and the latest index close.
No parameters.
Response: Per sector: sector (index code), name_id, name_en, price_first_date, price_last_date, anggota, close_terakhir.
get_sector_indexDaily sector index
Daily official IDX sector index for one sector, since 3 May 2021. Can add SMA columns computed from close.
| Parameter | Type | Description |
|---|---|---|
| sector | text, required | Sector index code, e.g. IDXENERGY (see list_sectors). |
| from, to | YYYY-MM-DD, optional | Date range. Default: full history up to today. |
| limit | number, optional | Default 150, max 400. |
| ma | text, optional | Comma-separated SMA periods, up to 3 values between 2 and 250, e.g. "50,150". Adds sma50, sma150, ... columns. |
Response: Per day: date, open, high, low, close, volume, value, foreignbuy, foreignsell, foreignflow (cumulative), plus SMA columns if requested (null until enough data). Ascending by date.
get_sector_membersSector members
Stocks in one sector under the 11-sector IDX-IC classification.
| Parameter | Type | Description |
|---|---|---|
| sector | text, required | Sector index code, e.g. IDXENERGY. |
Response: Per stock: symbol, name.
get_cash_flowCash and cash flow
Cash, debt, operating/investing/financing cash flow, capex, free cash flow, EBITDA, working capital, total assets/liabilities/equity of one stock (IDR). History starts 2026-11-09.
| Parameter | Type | Description |
|---|---|---|
| symbol | text, required | Stock code, e.g. BBCA. |
| limit | number | Max rows (default 12, max 40). |
Response: Per snapshot: cash, debt, TTM CFO/CFI/CFF, capex, FCF, EBITDA, working capital, assets, liabilities, equity.
rank_cashCash reserve ranking
Ranks stocks by latest-quarter cash, largest first by default. Financials are excluded unless include_finance=true.
| Parameter | Type | Description |
|---|---|---|
| limit | number | Max rows (default 20, max 100). |
| order | desc | asc | desc = largest first. |
| sector | text | Sector code, e.g. IDXENERGY. |
| include_finance | boolean | Include banks/insurers. |
| min_cash | number | Minimum cash (IDR). |
Response: Per stock: cash, total debt, net debt, total liabilities, cash/total liabilities.
compare_cash_liabilitiesCash vs liabilities
Compares cash with current liabilities (derived: working capital / (current ratio - 1)) and then with total liabilities.
| Parameter | Type | Description |
|---|---|---|
| limit | number | Max rows (default 20, max 100). |
| sort_by | text | cash | cash_to_current | cash_to_total. |
| order | desc | asc | Sort direction. |
| sector | text | Sector code. |
| include_finance | boolean | Include banks/insurers. |
| min_cash | number | Minimum cash (IDR). |
Response: Per stock: cash, current liabilities (derived), cash/current liabilities, total liabilities, cash/total liabilities.
rank_altman_zAltman Z-Score ranking
Ranks stocks by the Altman Z-Score published by the data source, highest first by default. Financials are excluded unless include_finance=true.
| Parameter | Type | Description |
|---|---|---|
| limit | number | Max rows (default 20, max 100). |
| order | desc | asc | desc = highest first. |
| sector | text | Sector code. |
| include_finance | boolean | Include banks/insurers. |
| min_z | number | Minimum Altman Z. |
Response: Per stock: altman_z, zone (safe/grey/distress), piotroski, DER, current ratio.
rank_cashflow_growthCash flow growth ranking
Ranks stocks by growth of free cash flow or operating cash flow on a TTM (4-quarter) basis from quarterly financial statements since 2008: YoY, 3- and 5-year CAGR, consistency. Includes P/E, P/B, EV/EBITDA, dividend yield. Financials excluded unless include_finance=true.
| Parameter | Type | Description |
|---|---|---|
| metric | fcf | cfo | Default fcf. |
| sort_by | text | cagr_3t (default) | cagr_5t | yoy_ttm | yoy_kuartal | konsistensi. |
| order | desc | asc | Sort direction. |
| limit | number | Default 20, max 100. |
| sector | text | Sector code. |
| include_finance | boolean | Include banks/insurers. |
| require_positive | boolean | Positive TTM only (default true). |
| min_cagr_3t | number | Minimum 3-year CAGR, 0.1 = 10%. |
Response: Per stock: mata_uang (reporting currency), kuartal_terakhir, ttm, yoy_ttm, yoy_kuartal, cagr_3t, cagr_5t, tahun_naik_dari_4, tahun_positif_dari_5, per_ttm, pbv, ev_ebitda, dividend_yield. Percentages are fractions.
get_cashflow_historyQuarterly cash flow history
Quarterly cash flow of one stock since 2008 from financial statements: CFO, CFI, CFF, capex, FCF (= CFO + capex). Per quarter, in the company reporting currency.
| Parameter | Type | Description |
|---|---|---|
| symbol | text, required | Stock code, e.g. BBCA. |
| from_year | number | Start year. |
| limit | number | Default 20, max 80. |
Response: Per quarter: year, quarter, cfo, cfi, cff, capex, fcf; mata_uang in extras.
scan_sector_trendSector trend scan
Scans all 11 sectors in one call: close versus SMA and SMA slope. Built for daily alerts such as "sector above its MA150 with the MA sloping up".
| Parameter | Type | Description |
|---|---|---|
| ma | number, optional | SMA period, 5 to 250. Default 150. |
| slope_days | number, optional | Trading days used for the SMA slope, 1 to 60. Default 20. |
Response: Per sector: sector, nama, tanggal, close, sma, pct_vs_sma, sma_slope_pct (percent change of the SMA now versus slope_days ago), di_atas_sma, sma_naik, memenuhi (above the SMA and SMA rising). Plus the list of sectors that qualify.
get_fundamentalsLatest financial ratios
The latest financial ratios of one stock as published by the data source.
| Parameter | Type | Description |
|---|---|---|
| symbol | text, required | Stock code. |
Response: One row: per_ttm, per_annualised, per_forward, ihsg_per_median, pbv, psr, peg, ev_ebitda, earnings_yield, dividend_yield, payout_ratio, eps_ttm, bvps, roe, roa, roic, npm, gpm, opm, der, current_ratio, interest_coverage, altman_z, piotroski, rev_growth_yoy, ni_growth_yoy, net_income_ttm, revenue_ttm, market_cap_rank, fetched_at.
get_fundamental_historyFinancial statement history
Up to 10 years of financial statements for one stock: quarterly, annual and TTM.
| Parameter | Type | Description |
|---|---|---|
| symbol | text, required | Stock code. |
| item | choice, optional | Net Income, EPS or Revenue. Empty means all. |
| from_year | number, optional | Start year (2000 to 2100). |
| limit | number, optional | Default 200, max 400. |
Response: Statement rows: item, year, period (Q1 to Q4, ANNUALISED, TTM), value, value_text. Plus an annual list: year, dividend, payout_ratio, dividend_yield.
get_dividend_historyDividend history
Dividends of one stock, newest first.
| Parameter | Type | Description |
|---|---|---|
| symbol | text, required | Stock code. |
| limit | number, optional | Default 40, max 100. |
Response: Per dividend: period_year, ex_date, payment_date, dividend (amount per share).
get_broker_dailyTotal broker activity per day
Total activity of all brokers in one stock, per day.
| Parameter | Type | Description |
|---|---|---|
| symbol | text, required | Stock code. |
| from, to | YYYY-MM-DD, optional | Date range. If empty: the last 180 days. |
| limit | number, optional | Default 60, max 200. |
Response: Per day: date, buy_lot, sell_lot, buy_value, sell_value, buy_freq, sell_freq, net_value, net_lot. Ascending by date.
get_broker_tradesPer-broker activity on one date
Each broker's activity in one stock on one date.
| Parameter | Type | Description |
|---|---|---|
| symbol | text, required | Stock code. |
| date | YYYY-MM-DD, required | Trading date. |
| broker_code | text, optional | Filter to one broker code. |
| limit | number, optional | Default 100, max 200. |
Response: Per broker: broker_code, broker_type, buy_value, buy_lot, buy_avg, buy_freq, sell_value, sell_lot, sell_avg, sell_freq, net_value, net_lot. Sorted by largest net_value.
get_intraday_flowActivity per price level
One day of transactions for one stock, broken down by price level.
| Parameter | Type | Description |
|---|---|---|
| symbol | text, required | Stock code. |
| date | YYYY-MM-DD, required | Trading date. |
| limit | number, optional | Default 300, max 400. |
Response: Per row: time, price, buy_lot, sell_lot, buy_value, sell_value, buy_freq, sell_freq. Sorted by time.
list_brokersBroker list
All active brokers.
No parameters.
Response: Per broker: code, name, broker_group, investor_type. Sorted by code.
get_benchmark"Cheap & healthy" signal benchmark
The LQ45-proxy benchmark record. Daily snapshots are locked with a chained hash before outcomes are known. Not a trading recommendation.
| Parameter | Type | Description |
|---|---|---|
| snapshots | number, optional | Number of latest snapshots (1 to 30). Default 3. |
| symbol | text, optional | Filter to one stock code. |
Response: rule (the rules), summary (results: win rate and averages), daily_series (last 60 days), and snapshots with candidates, each with a staged buy plan (support levels), target, stop, status, average price and outcome.
get_orderbookOrder book for one stock
The 10-level bid and offer ladder from one daily sweep, with calculated metrics (imbalance, spread, microprice, depth, price impact). A point-in-time snapshot, not individual order flow. The official sweep runs at 15:00 WIB for tradeable stocks, available since 9 Nov 2026.
| Parameter | Type | Description |
|---|---|---|
| symbol | text, required | Stock code. |
| date | YYYY-MM-DD, optional | Sweep date. Default: latest. |
| slot | text, optional | EOD (default, the 15:00 WIB sweep) or AM (a morning sample on 9 Nov 2026). |
Response: sweep date and time, price, traded value; imbalance obi1/obi3/obi5/obi10 (positive = thicker bid); spread_ticks and spread_bps; micro_bps; depth dbid/doff within ±0.5/1/2% of mid (shares); the largest bid and offer walls; impact_buy/sell_100m and _1b (bps versus mid, null = 10 levels not enough); the ara and arb limits; and bid[] and offer[] (price, shares, queue).
scan_orderbookOrder book screener across all stocks
Ranks all stocks in one daily sweep by imbalance, spread, price impact, depth, microprice or traded value, with filters for minimum value, maximum spread and imbalance range.
| Parameter | Type | Description |
|---|---|---|
| sort | text, optional | obi1, obi3, obi5, obi10, obq10, spread_bps, spread_ticks, micro_bps, dbid_1, doff_1, dbid_2, doff_2, impact_buy_100m, impact_sell_100m, impact_buy_1b, impact_sell_1b, value, frequency, change_pct, or fnet. Default obi5. |
| dir | asc/desc, optional | Sort direction. Default desc. |
| min_value | number, optional | Minimum traded value that day (rupiah). |
| max_spread_bps | number, optional | Maximum spread (bps). |
| min_obi5 / max_obi5 | number -1 to 1, optional | Level-5 imbalance range. |
| limit | number, optional | Default 30, max 100. |
| date / slot | optional | As in get_orderbook. |
Response: Per stock: symbol, last, value, spread_bps, obi1/obi3/obi5/obi10, micro_bps, depth and price impact. Plus the date, slot, sort key and direction.
get_broker_flow_tickNet buy/sell per broker (ticks)
Net buy and net sell per broker code for one stock on one day, calculated from every tick after broker codes are revealed. Coverage: the 150 most liquid stocks, recorded at 17:00 WIB since 9 Nov 2026.
| Parameter | Type | Description |
|---|---|---|
| symbol | text, required | Stock code. |
| date | YYYY-MM-DD, optional | Default: the latest recorded day. |
| limit | number, optional | Brokers per list. Default 15, max 50. |
Response: date, trade count and time range, price range, nilai_total_rp, net_asing_rp (foreign net), net_lokal_rp (local net), jumlah_broker, porsi_top5_beli_pct; the net_beli and net_jual lists (broker, type foreign/local/government, buy and sell in lots and rupiah, net, average prices); and terbesar_beli. Rupiah value = lots x 100 x price.
scan_broker_flow_tickBroker screener across stocks
Stocks with the largest net buy or net sell from foreign brokers, local brokers, all brokers, or one specific broker code (e.g. KZ), on one day.
| Parameter | Type | Description |
|---|---|---|
| date | YYYY-MM-DD, optional | Default: the latest recorded day. |
| group | asing/lokal, optional | Broker group (foreign/local). Empty = all brokers. |
| broker | text, optional | One broker code; overrides group. |
| sort | net_buy/net_sell, optional | Default net_buy. |
| min_value | number, optional | Minimum stock traded value (rupiah). |
| limit | number, optional | Default 30, max 150. |
Response: Per stock: symbol, nilai_total_rp, beli_rp, jual_rp, net_rp, net_pct_nilai. Plus the date, group and number of recorded stocks.
get_order_flow_intradayOrder flow per interval
One stock’s order flow per 5, 15, 30 or 60-minute interval: OHLC, value, trades initiated by buyers and by sellers, OFI (order flow imbalance) and foreign net. Calculated from the action column of every trade.
| Parameter | Type | Description |
|---|---|---|
| symbol | text, required | Stock code. |
| date | YYYY-MM-DD, optional | Default: the latest recorded day. |
| interval | number, optional | 5, 15, 30 or 60 (minutes). Default 15. |
Response: Per interval: mulai (start), buka, tinggi, rendah, tutup (OHLC), transaksi, lot, nilai_rp, beli_agresif_rp, jual_agresif_rp, ofi_rp, ofi_pct, net_asing_rp. Plus total OFI, total foreign net and total value.
get_large_tradesLarge trades
One stock’s large trades on one day, sorted by value, with the buyer and seller broker codes and types.
| Parameter | Type | Description |
|---|---|---|
| symbol | text, required | Stock code. |
| date | YYYY-MM-DD, optional | Default: the latest recorded day. |
| min_value | number, optional | Minimum value (rupiah). Default 1,000,000,000. |
| limit | number, optional | Default 30, max 100. |
Response: Per trade: jam (time), aksi (buy/sell, the initiating side), harga, lot, nilai_rp, pembeli, jenis_pembeli, penjual, jenis_penjual, papan (board), no_order_beli, no_order_jual.
get_tick_coverageOrder flow data coverage
The tick data days available and the order book sweeps completed. Call it first before asking about a specific date.
No parameters.
Response: tick_harian (date, number of stocks, number of trades), order_book (snapshot count and sweep list), and a coverage note.
What data it reaches
- Daily prices per stock and the IHSG, including foreign flow.
- Broker activity: totals per day, per broker on a given date, and per intraday price level.
- Latest financial ratios and up to 10 years of financial statements, plus dividend history.
- The "cheap & healthy" signal benchmark record (LQ45 proxy).
- Order flow: the daily order book (10-level bid and offer, imbalance, price impact) and tick-by-tick trades with buyer and seller broker codes, including foreign/local net and OFI. The order book is swept at 15:00 WIB for tradeable stocks; ticks are recorded at 17:00 WIB for the 150 most liquid stocks. History starts on 9 Nov 2026 and cannot be backfilled; coverage is visible through
get_tick_coverage. Full explanation: Order Flow. - The list of active stocks and the broker list.
The agent can see the current date range of each dataset with the get_data_coverage tool.
Security and limits
- Read-only. No tool places orders, opens positions or transacts in any way.
- No personal account data. Only market data is available.
- Lifetime only. The plan status is checked on every request.
- Personal tokens start with
msm_, are created per user, and can be revoked at any time from the MCP tab. - There is a daily limit on tool calls per user, reset at 00:00 WIB. The limit and today's usage are shown in the MCP tab.
- Inputs are validated (stock codes and dates), and the number of rows per tool is capped.
- The server reads the database through an account that only has read access to market-data tables.
- The order flow tools read data from a recorder on a separate computer. If the recorder is offline, the tool returns a clear message and the data is not lost. The metrics in these tools (imbalance, price impact, OFI, broker net) are calculated from order book and trade data.
Frequently asked questions
What is MCP?
Model Context Protocol, an open standard that lets AI agents use external tools and data sources. Here, the tool is MesinSaham.id market data.
Who can use the MesinSaham.id MCP?
Active Lifetime plan users. The token is created in the MCP tab inside the app.
Can an AI agent buy or sell stocks through MCP?
No. Every tool only reads market data. No orders, positions or personal account data are reachable.
Is there a usage limit?
Yes, there is a daily limit on tool calls per user (WIB day), and the exact number is shown in the MCP tab.