Skip to main content
Glama
iran-bourse-mcp

iran-bourse-mcp

by msmahdinejad

CI License: MIT Python 3.10+ MCP SDK 1.x and 2.x Tools Stars M8ven Score

Website · Install · Benchmarks · Tools · Screener · Real examples · Data notes · راهنمای فارسی · فارسی

An open-source MCP server that gives any AI agent complete, clean Tehran Stock Exchange (TSETMC / بورس تهران و فرابورس) and Codal data: a stock screener with its own filter language, quotes, order book and queues, tick-by-tick trades, real-vs-legal money flow, options and futures, index history, funds, major shareholders, filings and more. Units are explicit, derived numbers are labelled, and nothing can place an order.

Unofficial. Not affiliated with TSETMC, the Tehran Stock Exchange, Fara Bourse or Codal. Information only, not investment advice.

Watch the 2-minute launch film

▶ Watch the 2-minute film · Download MP4 (22.4 MB) · Vertical 9:16, Full HD and 4K

▶ 15-second tour (MP4) · GIF for sharing

Why it exists

An agent with a web browser cannot really read the Iranian market. We tested it:

  • The site is an empty shell. Fetching a symbol page from tsetmc.com returns a title and nothing else. Codal's report list comes back as unrendered {{template}} placeholders.

  • The hidden JSON API speaks in codes and has traps. Fields like qTotTran5J, pMeDem, zOrdMeOf; the exchange's own priceChange was 0.0 for a stock that rose 120 rial; order-book history is a delta feed; shareholder rows come back twice.

  • A day of ticks is 3 MB of JSON. Nobody should paste that into a context window.

iran-bourse-mcp finds the data, fixes the traps, reassembles what is fragmented, summarises what is huge and labels everything it infers.

Related MCP server: codal-mcp

Install

Works with every MCP client, and with agents that have none. You need uv (powershell -c "irm https://astral.sh/uv/install.ps1 | iex" or curl -LsSf https://astral.sh/uv/install.sh | sh) and a machine in Iran (why).

# 1. check that TSETMC and Codal are reachable from here
uvx iran-bourse-mcp doctor

# 2. print the exact steps for your agent, or let the tool edit the config for you
uvx iran-bourse-mcp config cursor
uvx iran-bourse-mcp install cursor

The server entry is always the same: command uvx, args ["iran-bourse-mcp"], stdio transport. One-click install buttons for Cursor, VS Code and Goose are on the website. An AI agent can set it up from docs/llms-install.md.

Claude Code

claude mcp add iran-bourse -- uvx iran-bourse-mcp

Add --scope user to make it available in every project.

Claude Desktop

Add to the config file (Windows: %APPDATA%/Claude/claude_desktop_config.json; macOS: ~/Library/Application Support/Claude/claude_desktop_config.json; Linux: ~/.config/Claude/claude_desktop_config.json):

{
  "mcpServers": {
    "iran-bourse": {
      "command": "uvx",
      "args": [
        "iran-bourse-mcp"
      ]
    }
  }
}

Or automatically (makes a backup first): iran-bourse-mcp install claude-desktop

Restart Claude Desktop after editing the file.

OpenAI Codex CLI

codex mcp add iran-bourse -- uvx iran-bourse-mcp

or in ~/.codex/config.toml:

[mcp_servers.iran-bourse]
command = "uvx"
args = ["iran-bourse-mcp"]

uvx --version must work in the shell that starts Codex. For scripted codex exec runs use the config.toml form (required = true), or uv tool install the package so the server starts in about a second.

Gemini CLI

Add to ~/.gemini/settings.json:

{
  "mcpServers": {
    "iran-bourse": {
      "command": "uvx",
      "args": [
        "iran-bourse-mcp"
      ]
    }
  }
}

Or automatically (makes a backup first): iran-bourse-mcp install gemini-cli

Cursor

Add to ~/.cursor/mcp.json:

{
  "mcpServers": {
    "iran-bourse": {
      "command": "uvx",
      "args": [
        "iran-bourse-mcp"
      ]
    }
  }
}

Or automatically (makes a backup first): iran-bourse-mcp install cursor

Restart Cursor after editing. A one-click install link is available (see config cursor).

VS Code (GitHub Copilot)

Add to .vscode/mcp.json:

{
  "servers": {
    "iran-bourse": {
      "type": "stdio",
      "command": "uvx",
      "args": [
        "iran-bourse-mcp"
      ]
    }
  }
}

Project-level file. Top-level key is servers, not mcpServers.

Windsurf

Add to ~/.codeium/windsurf/mcp_config.json:

{
  "mcpServers": {
    "iran-bourse": {
      "command": "uvx",
      "args": [
        "iran-bourse-mcp"
      ]
    }
  }
}

Or automatically (makes a backup first): iran-bourse-mcp install windsurf

Newer releases may relocate the file; open it from Cascade's MCP panel if this path is missing.

Cline

Add this entry in the client's MCP settings:

{
  "mcpServers": {
    "iran-bourse": {
      "command": "uvx",
      "args": [
        "iran-bourse-mcp"
      ]
    }
  }
}

Open the MCP Servers panel, choose Configure MCP Servers, and paste the entry into the JSON it opens.

Roo Code

Add to .roo/mcp.json:

{
  "mcpServers": {
    "iran-bourse": {
      "command": "uvx",
      "args": [
        "iran-bourse-mcp"
      ]
    }
  }
}

Project file shown; the global file is opened from the MCP settings view.

Kiro

Add to ~/.kiro/settings/mcp.json:

{
  "mcpServers": {
    "iran-bourse": {
      "command": "uvx",
      "args": [
        "iran-bourse-mcp"
      ]
    }
  }
}

Or automatically (makes a backup first): iran-bourse-mcp install kiro

Qwen Code

Add to ~/.qwen/settings.json:

{
  "mcpServers": {
    "iran-bourse": {
      "command": "uvx",
      "args": [
        "iran-bourse-mcp"
      ]
    }
  }
}

Or automatically (makes a backup first): iran-bourse-mcp install qwen-code

JetBrains AI Assistant

Add this entry in the client's MCP settings:

{
  "mcpServers": {
    "iran-bourse": {
      "command": "uvx",
      "args": [
        "iran-bourse-mcp"
      ]
    }
  }
}

Settings > Tools > AI Assistant > Model Context Protocol (MCP) > Add, then paste the JSON.

Zed

Add to ~/.config/zed/settings.json:

{
  "context_servers": {
    "iran-bourse": {
      "command": "uvx",
      "args": [
        "iran-bourse-mcp"
      ]
    }
  }
}

Older Zed versions expect command as an object: {"path": ..., "args": [...]}.

OpenCode

Add to ~/.config/opencode/opencode.json:

{
  "mcp": {
    "iran-bourse": {
      "type": "local",
      "command": [
        "uvx",
        "iran-bourse-mcp"
      ],
      "enabled": true
    }
  }
}

OpenCode uses command as one array and type: local.

Goose

uvx iran-bourse-mcp

Paste that into goose configure > Add Extension > Command-line Extension, or open the one-click link on the website.

Or run goose configure > Add Extension > Command-line Extension and enter the command below.

Amp

Add to ~/.config/amp/settings.json:

{
  "amp.mcpServers": {
    "iran-bourse": {
      "command": "uvx",
      "args": [
        "iran-bourse-mcp"
      ]
    }
  }
}

Python agent frameworks and plain shell

OpenAI Agents SDK

from agents import Agent
from agents.mcp import MCPServerStdio

async with MCPServerStdio(params={"command": "uvx", "args": ["iran-bourse-mcp"]}) as bourse:
    agent = Agent(name="Analyst", instructions="Answer with exchange data.", mcp_servers=[bourse])

LangChain

from langchain_mcp_adapters.client import MultiServerMCPClient

client = MultiServerMCPClient({
    "iran-bourse": {"transport": "stdio", "command": "uvx", "args": ["iran-bourse-mcp"]}
})
tools = await client.get_tools()

Claude Agent SDK

from claude_agent_sdk import ClaudeAgentOptions

options = ClaudeAgentOptions(mcp_servers={"iran-bourse": {"command": "uvx", "args": ["iran-bourse-mcp"]}})

No MCP support? Use the shell

# Any agent that can run commands can use every tool:
uvx iran-bourse-mcp tools
uvx iran-bourse-mcp call quote symbol=فولاد --compact
uvx iran-bourse-mcp call top_movers kind=buy_queue limit=5 --compact

What you can ask

«وضعیت فولاد رو کامل بررسی کن: صف، ورود پول حقیقی، سهامداران عمده و آخرین اطلاعیه‌های کدال» «امروز کدوم سهم‌ها صف خرید قوی دارن و پول حقیقی وارد شده؟» «ریز معاملات فولاد دیروز رو خلاصه کن و بزرگ‌ترین معامله‌ها رو نشون بده» «صف خرید خودرو از چه ساعتی شکل گرفت و چقدر بزرگ شد؟» «سهامدار عمده شستا چه سهم‌های دیگه‌ای داره؟» «سهم‌هایی رو پیدا کن که امروز حجمشون بیش از دو برابر میانگین ۲۰ روز بوده، دیروز بیش از ۱٪ رشد کرده و امروز هم مثبته» ← اسکرینر «زنجیره اختیار معامله اهرم رو با نزدیک‌ترین سررسید بده» · «تاریخچه شاخص کل از اول مهر» · «افزایش سرمایه‌های هفته آینده کدوم نمادهاست؟»

The stock screener

screen_stocks is the filter box of tsetmc.com, written by your agent. Describe what you want; the agent writes a short condition and gets back only the stocks that pass it, with the evidence for each hit. It reads today's live values, up to 60 past trading days (adjusted for capital increases), real-vs-legal flow and a five-level order book for every instrument of the exchange's own market watch (about 3,700, including funds, bonds, options and futures).

You:    stocks trading over twice their 20-day average volume, up more than 1% yesterday, positive today, over 5 billion rial
Agent:  screen_stocks(filter="volume > 2 * avg(volume, 20) and close_pct[1] > 1 and close_pct > 0 and value > 5B")
        35 of 625 stocks match, 3.6 s: انتخاب (9.4x volume, +2.97% yesterday, +2.85% today), پکرمان, کرماشا, خراسان ...

The language is a safe expression grammar (parsed with ast, never eval), accepts the field names and JavaScript spellings of the exchange's own filter (pl, pc, tvol, tmax, pd1, ct.Buy_I_Volume, ===), ships 15 ready-made presets (volume_surge, smart_money, breakout_20d, buy_queue ...) and reports mistakes with suggestions. Checked against an independent re-implementation straight from raw exchange data: identical results on three different screens. Guide and every field: docs/SCREENER.md.

Coverage

Data

Tools

Market state, indices, industry indices

market_status market_overview indices industry_summary index_contributors

Whole-market tables (~3,700 instruments: shares, funds, bonds, options, futures)

market_watch top_movers (gainers, losers, buy/sell queues live or at the close of a past day, real-money inflow/outflow, buyer power) market_snapshot

Stock screener (filter language, history, presets)

screen_stocks screener_reference

Index history, members and their effect

index_history (daily since 2008, or today's 5-minute path) index_constituents

Options and futures

option_chain (calls and puts by strike and expiry, moneyness, intrinsic value, open interest, covered-call returns, expiry by Jalali month) futures_market (basis)

The exchange's own best-of lists (برترین‌ها)

top_lists (69 lists: blocks, rights, ETFs, queues, options ...)

Corporate-action calendar

capital_calendar (upcoming capital increases, price adjustments)

Halts and supervision

trading_status (suspended, under caution, state changes, one symbol's history)

One-call symbol dossier

symbol_overview

Price, limits, VWAP, P/E, market cap

quote price_history (optionally back-adjusted) symbol_statistics corporate_actions

Technical indicators (computed from adjusted daily prices)

technical_indicators (SMA, EMA, RSI, MACD, Bollinger, ATR, stochastic, OBV, 52-week range, support/resistance, plain-language summary)

Order book and queues (صف خرید/فروش)

order_book order_book_history (rebuilt from every event, with queue episodes)

Tick-by-tick trades (ریز معاملات)

trades (filterable) trade_summary (bars, VWAP, biggest trades, price levels, pressure estimate, coverage check)

Real vs legal investors (حقیقی/حقوقی)

real_legal_flow (per-capita, buyer power, net flow, daily history)

Shareholders (سهامداران عمده)

shareholders shareholder_history (also one holder's position over time) shareholder_portfolio market_holder_moves

Commodity and energy exchanges

commodity_market (IME physical trades by contract, roll-ups, dollar rate) energy_market (Iran Energy Exchange: trades, announced offers, one auction's order levels)

Funds

fund_ranking (579 funds: NAV, returns, size, portfolio mix) etf_nav (premium/discount to issue and redemption NAV)

Fundamentals (read from Codal)

fundamentals (EPS, P/E, P/S, P/B on trailing twelve months, margins, ROE, leverage, recent sales) financial_statements (income statement, balance sheet, cash flow, ratios) monthly_activity (monthly sales by product)

Codal

codal_filings (links to page, PDF, Excel) codal_letter (any letter's tables or text) codal_company

Supervisor notices

supervisor_messages

Vocabulary

glossary (Persian ↔ English market terms)

Also four prompts (analyze_symbol, daily_market_report, smart_money_scan, find_stocks) and a glossary resource. Full parameters: docs/TOOLS.md.

Benchmarks

Measured against the live exchange, not claimed. The raw route is the best case for an agent that already knows the hidden endpoints. Scripts, ground truth and raw results live in benchmarks/ and can be re-run.

Task

Raw route

iran-bourse-mcp

Tokens saved

Live quote with correct % change

3 req · 0.4s · 6,225 tok

1 call · 0.5s · 337 tok

18x

Order book with queue detection

3 req · 0.3s · 6,298 tok

1 call · 0.6s · 388 tok

16x

One day of ticks: VWAP, biggest trades, bars

3 req · 0.7s · 2,142,302 tok

1 call · 1.1s · 3,380 tok

634x

Real vs legal money flow, 10 days

12 req · 0.9s · 612,009 tok

1 call · 1.2s · 1,332 tok

460x

Major shareholders

3 req · 0.4s · 7,018 tok

1 call · 0.7s · 686 tok

10x

Market-wide ranking of buy queues

222 req · 15.0s · 695,971 tok

1 call · 9.4s · 1,241 tok

561x

Latest 5 Codal filings with links

1 req · 1.6s · 6,489 tok

1 call · 1.6s · 1,539 tok

4x

One year of daily prices, adjusted

2 req · 0.4s · 610,549 tok

1 call · 0.8s · 19,517 tok

31x

Screen the market: volume > 2x 20-day average, up yesterday and today

22 req · 5.8s · 7,437,128 tok

1 call · 3.9s · 723 tok

10,286x

Data-plane benchmark, 2026-11-04 15:51:55 UTC. Tokens are a tiktoken o200k_base proxy; the ratios matter more than the absolute numbers. A single-endpoint task takes about as long either way; the server wins where the raw route needs many sequential requests, and on tokens everywhere.

Traps in the raw data (each found on the live endpoints and handled by the server):

Trap

Naive reading

Correct

The exchange's own priceChange field in GetClosingPriceInfo

0.0

120.0

Counting holders / summing percent from the dated shareholder endpoint

{"holders": 24, "percent_sum": 92.97}

{"holders": 12, "percent_sum": 46.48}

Reading real-buyer count with the key used by the live endpoint (buy_CountI) on history rows

null

3790.0

Calling every limit-up stock without visible sell orders a buy queue, using the gateway's market watch alone

85

83

Matching the company name the user types (Persian letters) against the exchange's text (Arabic letters)

false

true

Agent trials (one LLM agent model, identical in every arm, 2026-11-04; 6 tasks, graded against independent ground truth):

Agent

Accuracy

Net tokens (mean/task)

Time (mean/task)

Tool calls

Answered

Browser-only agent (page fetch)

21%

100,054

190s

9.2

4/6

Shell agent (curl/python + web, no MCP)

94%

17,129

83s

6.8

6/6

Agent + iran-bourse-mcp

100%

11,512

36s

3.0

6/6

Six tasks, one model, runs per task: 1 (2 for T2 and T6 in the shell and MCP arms). The shell agent used its own knowledge of the exchange's endpoints. On T4 it classified a fixed-price symbol (فولاد3) as an ordinary share, a different but defensible reading of 'ordinary shares'; queue sizes also drift by tens of percent within minutes after the close, so T4 is graded on the ranking only.

Verified, not assumed

  • Ticks are complete. For فولاد the 6,819 ticks of 3 Nov and the 15,643 ticks of 2 Nov matched the exchange's own daily totals at 100.0% of volume and trade count. trade_summary reports this coverage on every call so you do not have to trust us. (A community reference claimed a 36-38% shortfall; we could not reproduce that.)

  • Price limits and queues come from the day's actual allowed price range, not a guess, and queue rankings are confirmed against the real order book.

  • Derived numbers are labelled. Anything the exchange does not publish (tick-rule pressure, adjusted prices, same-day value of real money flow) sits under an estimate/estimated key.

  • Tested. Offline tests on recorded real fixtures (CI: Python 3.10 to 3.13 on both MCP SDK generations), a live smoke test of every tool (scripts/smoke_live.py) and an end-to-end stdio test (scripts/e2e_stdio.py).

Architecture

Pure transformation logic (shape.py) is separated from I/O so every number can be tested offline. Details: docs/ARCHITECTURE.md (فارسی).

The Iranian IP requirement

TSETMC and Codal are built for Iranian users. Their servers often reject foreign or VPN addresses. So:

  • Run the server on a machine in Iran, not behind a foreign VPN, or

  • point it at an in-Iran proxy: IRAN_BOURSE_PROXY=http://host:port, or

  • run it on an Iranian server and connect remotely over HTTP (use an SSH tunnel or a reverse proxy with authentication; the server has no auth of its own):

iran-bourse-mcp serve --transport streamable-http --host 127.0.0.1 --port 8000

iran-bourse-mcp doctor tells you which sources are reachable. A Dockerfile is included (docker build -t iran-bourse-mcp . && docker run -i --rm iran-bourse-mcp); images are pushed to ghcr.io on tagged releases.

Configuration

Variable

Purpose

Default

IRAN_BOURSE_PROXY

HTTP(S) proxy for all requests

none (system proxy variables are honoured)

IRAN_BOURSE_TIMEOUT

Request timeout, seconds

45

IRAN_BOURSE_SOURCE

Package source used in generated install snippets (pypi once published)

the GitHub repository

IRAN_BOURSE_CDN_URL

Override the TSETMC API base

https://cdn.tsetmc.com/api

IRAN_BOURSE_WEBGW_URL

Override the TSE gateway base

https://webgw.tse.ir

IRAN_BOURSE_CODAL_URL

Override the Codal search API

https://search.codal.ir/api/search/v2/q

Good to know

  • Prices and values are in Rial (1 Toman = 10 Rial). Dates accept Gregorian (2026-11-03) or Jalali (1405/08/12, Persian digits fine).

  • Persian/Arabic letter variants are interchangeable on input (کگل = كگل) and normalised on output.

  • The market trades Saturday-Wednesday 09:00-12:30 Tehran time, except on official public holidays. market_status knows the 1405 holiday calendar (holiday, next_session, upcoming_holidays); for years not yet in the table only the fixed Solar Hijri holidays are known. The exchange also closes on some days without a holiday; market_status flags it when the exchange's own data disagrees with the calendar. Outside the session you get the last session's data.

  • Order-book history for the current trading day may be partial. TSETMC publishes the full intraday book history only after the day ends. order_book_history tells you when it is cut short (events_span, warning). Use order_book for the live book.

  • The unofficial endpoints can change without notice. Every quirk we found is in docs/DATA_SOURCES.md (فارسی).

  • Requests are cached briefly (seconds for live data, hours for history) and limited to 6 in flight. Please be gentle: this is somebody else's server.

Troubleshooting

Symptom

Fix

spawn uvx ENOENT or "command not found" in the client

GUI clients (Claude Desktop, Cursor) may not see your shell PATH. Put the absolute path in command (where uvx on Windows, which uvx elsewhere).

First start takes ~10 seconds

uvx downloads and caches the dependencies once. Later starts are instant. Pin it with uv tool install iran-bourse-mcp and use the iran-bourse-mcp command directly.

HTTP 403 or "Could not reach"

The Iranian IP requirement above. Run iran-bourse-mcp doctor to see which host fails.

"The exchange server answered HTTP 502/503"

TSETMC is overloaded. The server already retried; try again in a few seconds.

Empty or old live data

The market is closed (Saturday-Wednesday 09:00-12:30 Tehran time); you get the last session.

Persian text looks reversed in a terminal

Terminal bidi rendering, not a data problem. The JSON is correct.

Safety

All tools are read-only (readOnlyHint). There is deliberately no order placement, no login and no credential handling.

Development

uv sync
uv run pytest                           # offline, a few seconds
uv run ruff check .
uv run python scripts/smoke_live.py     # needs access to TSETMC
uv run python scripts/e2e_stdio.py      # real MCP handshake against live data
uv run python benchmarks/data_plane.py  # re-measure tokens, requests, time

See CONTRIBUTING.md, AGENTS.md and docs/ARCHITECTURE.md.

Roadmap

  • Holiday table for Jalali year 1406 (once the official calendar is final)

  • Published PyPI release (uvx iran-bourse-mcp)

Citing

See CITATION.cff. Licensed under MIT. Market data belongs to its respective owners; check the exchange's terms before redistributing it.

Available Tools

45 tools
capital_calendarA
Read-onlyIdempotent

Market-wide corporate-action calendar (افزایش سرمایه و تعدیل قیمت), sorted by date: capital increases with the old and new share count, added shares and increase %, and price adjustments (reference-price cuts around dividends and rights) with the adjustment factor, for the days after today, the days up to today, or both. Forward visibility is short: the exchange lists a share-count change only a few days before it takes effect, and price adjustments only after the fact. Not in this feed: dividend per share, ex-dividend and AGM dates, rights exercise price; they are in Codal letters (use codal_filings).

Inputs: days, flow, kind, limit, +1 more.

codal_companyB
Read-onlyIdempotent

Issuer profile from Codal: CEO, ISIC, address, activity description (اطلاعات ناشر).

Inputs: symbol (required).

codal_filingsB
Read-onlyIdempotent

Search Codal disclosures (کدال): title, publish time, tracing number and links to the page, PDF, Excel and attachments.

Inputs: page, limit, symbol, to_date, +4 more.

codal_letterA
Read-onlyIdempotent

Read the CONTENT of any Codal letter (متن و جدول‌های اطلاعیه کدال): financial statements, monthly activity reports, meeting decisions (DPS, capital increases), explanations and notices. Structured reports come back as tables (columns from the report's own headers, numbers parsed, usually million rial: see unit_note), one sheet per call, with the other sheets listed in 'sheets'; a statement sheet also gets 'key_items' (revenue, profits, EPS, assets, equity, cash flows...) and a monthly report a 'monthly_summary' (month and year-to-date sales, by product). Plain letters come back as text. For the usual questions prefer financial_statements, monthly_activity or fundamentals, which find and read the right letters for you.

Inputs: tracing_no (required), sheet.

commodity_marketA
Read-onlyIdempotent

Iran Mercantile Exchange physical market (بورس کالای ایران: steel, copper, aluminium, zinc, cement, petrochemicals, oil products, bitumen, agricultural goods), straight from ime.co.ir. view='trades' lists a session's offers and contracts: product, producer, hall (تالار), contract type (cash نقدی, forward سلف, credit نسیه; matching مچینگ), delivery date, offered / demand / traded tons, weighted-average closing price with low, high and base price in RIAL PER KILOGRAM, and value in RIAL, with totals by hall and contract type and the top products by value. view='summary' gives IME's roll-ups: value and traded / offered tons per ring, traded value per market (physical, futures, options, financial, certificates), one row per session and IME's dollar rate. Units are in the key names (volume_tons, price_rial_per_kg, value_rial). Without a date the latest session is used; IME trades Saturday to Wednesday, so Thursday and Friday are empty. The trades list leaves out the sub-market and is smaller than the summary: never add them. The exchange-traded boards (gold and saffron certificates, standard forwards, commodity funds, futures) are in top_lists (commodity group) and market_watch (security_type='commodity').

Inputs: date, view, group, limit, +4 more.

corporate_actionsA
Read-onlyIdempotent

Capital increases and price adjustments (افزایش سرمایه، تعدیل قیمت) with dates and factors.

Inputs: symbol (required).

energy_marketA
Read-onlyIdempotent

Iran Energy Exchange (بورس انرژی ایران, IRENEX): physical auctions (liquefied gas, solvents, CSO, hexane, liquid nitrogen and other oil, gas and petrochemical products; domestic and international rings) and the electricity market (standard, free and green power contracts), from the exchange's own site (iee.ir). view='trades' gives each auction's result: product, supplier, ring and destination, contract type, offered / demand / traded volume, base and average price and the exchange's value in RIAL; view='offers' the announced auctions; view='auction' one auction's terms, price units, buy and sell order levels and trades; view='overview' whether the market is open and today's traded value. Units differ by product and are spelled out per row: tonne auctions in rial are priced per KILOGRAM, dollar auctions per TONNE, premium auctions as a premium on a reference price, electricity in kW of capacity over the delivery period with kwh the energy and the price per kWh (see price_basis and totals.volume_by_unit; volumes of different units are never added). Without a date the latest session is used; the exchange trades Saturday to Wednesday. The traded boards (electricity forwards and base-load contracts, capacity and energy-saving certificates, energy futures) are in top_lists (energy group).

Inputs: date, view, limit, market, +5 more.

etf_navC
Read-onlyIdempotent

Fund/ETF issue and redemption NAV vs market price: premium/discount (صدور و ابطال).

Inputs: symbol (required).

financial_statementsA
Read-onlyIdempotent

A company's financial statements from Codal (صورت‌های مالی): income statement, balance sheet and cash flow, each as key items for this period, the same period last year and the last full year (revenue, cost of revenue, gross/operating/net profit, EPS, total assets, equity, debt, cash, operating cash flow, capex, dividends paid...), plus margins, growth, ROE/ROA on trailing twelve months, current ratio and leverage. Banks (loans, customer deposits, loan interest, fee income, loans-to-deposits) and insurers (premiums, claims, technical reserves, loss ratio) are read in their own templates. Amendments and audited re-issues replace earlier versions. Amounts in million rial, EPS in rial. For the full tables of a letter use codal_letter.

Inputs: symbol (required), period, history, consolidated.

fundamentalsA
Read-onlyIdempotent

One-call fundamental picture of a company (تحلیل بنیادی): price and market cap, the exchange's EPS and P/E, the latest Codal statements (revenue, net profit, EPS, equity), margins, growth, ROE/ROA, liquidity and leverage, valuation computed on trailing twelve months (EPS, P/E, P/S, P/B, marked estimated), and the last three months of sales from the monthly reports.

Inputs: symbol (required).

fund_rankingA
Read-onlyIdempotent

Ranking and screening of the investment-fund registry (صندوق‌های سرمایه‌گذاری): about 580 funds of 15 types, not only the exchange-traded ones, with net assets, units, redemption/issue/statistical NAV (ابطال، صدور، آماری), returns over 1 day to 1 year and since inception, portfolio mix (stock/bond/deposit), manager and NAV date. Sort by any return or size, filter by type and minimum net assets. Returns are percent as published, null where the fund is too young. The registry has no ticker: find the traded unit with search_symbol on the fund's name, then etf_nav for its NAV premium. Market-maker and very young funds show extreme returns, so filter them for a fair ranking.

Inputs: limit, detail, sort_by, fund_type, +2 more.

futures_marketB
Read-onlyIdempotent

Futures (آتی) of the Tehran derivatives market (about 16 contracts): last and close price, bid/ask, volume, value, open interest, expiry and days left, plus the basis against the underlying - absolute, percent and an annualised estimate (formula in the notes). Contracts that did not trade today show no price and no basis.

Inputs: limit, sort_by, descending, underlying.

glossaryB
Read-onlyIdempotent

Explain Iranian market terms (صف خرید، سرانه خرید، حقیقی/حقوقی، دامنه نوسان …) so answers use them correctly.

Inputs: term.

index_constituentsA
Read-onlyIdempotent

Member stocks of an index (سهام شاخص) with close, change %, volume, value and each stock's effect in index points on the total index (تاثیر در شاخص, from the exchange), plus totals: members, advancers/decliners, traded value, sum of effects. The exchange publishes no index weights, so market-cap share is only a derived proxy (sort_by market_cap). Effects are for the latest session and are left out, with a note, when the exchange's table does not add up to the index move; for a sector index they are the effect on the total index, not on the sector index.

Inputs: index (required), limit, sort_by, descending.

index_contributorsB
Read-onlyIdempotent

Stocks pushing the total index up or down the most, in index points (بیشترین تاثیر بر شاخص).

Inputs: limit.

index_historyA
Read-onlyIdempotent

History of any index (تاریخچه شاخص) in index points, not rial: the total index (شاخص کل) back to 2008, equal-weight, free-float, any industry index such as فلزات or بانک, and the Fara Bourse indices. Rows ascending with close, low, high and daily change %, plus a summary of the whole requested range: change %, highest and lowest close with dates, maximum drawdown, up/down days and a volatility estimate. Days the market was closed are flagged flat and kept out of the statistics. With intraday=true: today's 5-minute path with day high/low and the previous close.

Inputs: index (required), limit, to_date, intraday, +2 more.

indicesB
Read-onlyIdempotent

All indices: total, equal-weight, free-float and every industry index with change % (شاخص‌ها و شاخص صنایع).

Inputs: market, only_headline.

industry_summaryB
Read-onlyIdempotent

Per-industry breakdown: traded value, average and cap-weighted change, index effect, queue counts (گروه‌های صنعتی).

Inputs: limit, market.

market_holder_movesA
Read-onlyIdempotent

Large holders whose positions changed most over the last 5 reported days, market-wide (تغییرات سهامداران عمده).

Inputs: limit.

market_overviewC
Read-onlyIdempotent

Index value, equal-weight index, total value/volume/trades and market cap for the market (نمای کلی بازار).

Inputs: market.

market_snapshotB
Read-onlyIdempotent

End-of-day table for every instrument on a past date; ordinary stocks unless security_type says otherwise (تاریخچه کل بازار در یک روز).

Inputs: date (required), limit, sort_by, security_type.

market_statusA
Read-onlyIdempotent

Is the Tehran market open right now, and when does it open next? Tehran time, today's status (open, before_open, after_close, weekend or holiday), the public holiday if any, next_session (skipping weekends and holidays), the next upcoming_holidays, the bourse state and totals (وضعیت بازار). Holidays come from the official calendar of 1405; days the exchange closes without notice are flagged in calendar_check when its own data disagrees.

Inputs: no named parameters.

market_watchA
Read-onlyIdempotent

Whole-market table (دیده‌بان بازار) of the exchange's own feed: about 3,700 instruments (shares, base market, funds, bonds, options, futures, rights, commodities) on Bourse and Fara Bourse, filtered, sorted and paged in one call. To find instruments by conditions use screen_stocks.

Inputs: board, limit, detail, market, +6 more.

monthly_activityA
Read-onlyIdempotent

A company's monthly activity reports from Codal (گزارش فعالیت ماهانه، ن-۳۰): sales of each month and year to date, growth on the same span last year, month-on-month change, and for the newest month each product's production, sales quantity, rate and amount (domestic, export and services). Banks give operating income, loans and deposits at the month end and net interest; insurers premiums and claims; investment companies operating income and their portfolio. Amended reports replace the originals. Amounts in million rial.

Inputs: symbol (required), months, products.

option_chainA
Read-onlyIdempotent

Option chain (اختیار معامله) of the Tehran derivatives market: for an underlying ('اهرم', 'شستا', 'وبملت' ...) and expiry, every strike with its call (خرید) and put (فروش) leg - last/close price, bid/ask, volume, value, open interest, change % - plus derived (computed, not published) moneyness ITM/OTM, intrinsic and time value, break-even, bid-ask spread, put/call ratios, top open-interest strikes and an estimated max pain, and on every call the covered-call figures (net cost, return if called or unchanged, annualized, downside protection). For «کاورد کال برج ۹» pass expiry=9. Omit underlying to list the underlyings that have options. Prices are rial per underlying unit, one contract = contract_size units; legs with no trade today show no price; open interest is the clearing house's daily figure.

Inputs: limit, expiry, market, sort_by, +6 more.

order_bookA
Read-onlyIdempotent

Five-level order book (عمق بازار) with order counts, imbalance and buy/sell queue (صف) detection.

Inputs: symbol (required).

order_book_historyA
Read-onlyIdempotent

Intraday order-book evolution rebuilt from every event: sampled depth plus buy/sell queue episodes with peak sizes (تاریخچه صف خرید و فروش).

Inputs: symbol (required), date, to_time, from_time, +1 more.

price_historyA
Read-onlyIdempotent

OHLCV price history since listing (تاریخچه قیمت), daily or aggregated to weekly/monthly/yearly bars, optionally back-adjusted for capital increases and dividends. For long ranges prefer granularity='monthly' or 'yearly' over thousands of daily rows.

Inputs: symbol (required), limit, to_date, adjusted, +2 more.

quoteA
Read-onlyIdempotent

Live/last quote with correct change %, volume, value, VWAP, price limits, ranges, P/E and market cap (قیمت لحظه‌ای).

Inputs: symbol (required).

screener_referenceA
Read-onlyIdempotent

Fields, functions, ready-made presets and examples for screen_stocks filters. Call it when a filter is rejected or you need a field name.

Inputs: topic.

screen_stocksA
Read-onlyIdempotent

Stock screener (فیلتر نویسی): the filter box of tsetmc.com driven by an expression. Returns only the stocks that pass your condition right now, using today's live values plus up to 60 past trading days (close[1], avg(volume, 20), count(close_pct > 0, 3)) and real/legal money flow, in one call with a validated, safe expression (nothing is executed).

Inputs: sort, limit, filter, market, +7 more.

search_symbolA
Read-onlyIdempotent

Find instruments by symbol or name fragment; returns symbol, name, market, board, insCode (جستجوی نماد).

Inputs: query (required), limit.

shareholder_historyA
Read-onlyIdempotent

Dated major-holder snapshots for a symbol with computed changes between snapshots; or, with holder=..., one major holder's position over time and the days it bought or sold (تاریخچه سهامدار عمده).

Inputs: symbol (required), date, days, holder.

shareholder_portfolioC
Read-onlyIdempotent

Everything else that major holder owns across the market (پرتفوی سهامدار).

Inputs: holder_id (required).

shareholdersA
Read-onlyIdempotent

Major shareholders (سهامداران عمده) with shares, percent and the holder_id for deeper lookups.

Inputs: symbol (required).

supervisor_messagesB
Read-onlyIdempotent

Exchange supervisor notices (پیام ناظر): trading restrictions, clarifications, halts.

Inputs: limit, market, symbol, full_text.

symbol_overviewA
Read-onlyIdempotent

One-call dossier for a symbol: identity, quote, order book, real/legal flow, top shareholders, latest Codal filings and supervisor notices. Start here.

Inputs: symbol (required).

symbol_statisticsA
Read-onlyIdempotent

Exchange-computed averages and stats for the symbol (e.g. average traded value over 3 months).

Inputs: symbol (required).

technical_indicatorsA
Read-onlyIdempotent

Technical analysis indicators of one symbol (اندیکاتورهای تکنیکال) from its daily prices: SMA 20/50/200, EMA 12/26, RSI 14 (Wilder), MACD 12/26/9 with signal and histogram, Bollinger 20/2 with %B and bandwidth, ATR 14, stochastic 14/3, OBV trend, volume vs its 20-session average, distance from the 52-week high and low, support and resistance from recent swing lows and highs, recent crosses (MACD/signal, SMA50/SMA200) and a plain-language summary ("RSI 72: overbought", "price above SMA50 and SMA200"). Computed by this server from the exchange's adjusted daily closing prices, not published by the exchange.

Inputs: symbol (required), days, adjusted.

top_listsA
Read-onlyIdempotent

The exchange's own best-of tables («برترین‌ها» of tsetmc.com): most trades, biggest traded value or volume, price gainers and losers, last price above or below the close, block trades (معاملات عمده), closing-price-only TAL trades, rights (حق تقدم), ETFs, options and futures by volume or open interest, debt papers, energy and commodity markets, the largest buy and sell queues (برترین تقاضا و عرضه), market-value gainers and losers and industries by traded value, for the Bourse, the Fara Bourse and their sub-markets. Rows keep the exchange's own ranking with stable keys (symbol, close, close_pct, last, trades, volume, value ...; rial). Call it first with list_name='catalogue' to see all lists and the flows each one supports.

Inputs: flow, limit, list_name.

top_moversA
Read-onlyIdempotent

Ranked lists of the live session: top gainers/losers, most traded, buy/sell queues (صف خرید/فروش, confirmed against each symbol's real order book; about 10 s on a strong day), real-person money inflow/outflow (ورود/خروج پول حقیقی), buyer power. With date (queues only): the queues at the close of a past session, found from that day's end-of-day table and confirmed against each candidate's order-book history, with queue size at the close and since when it held (can take 20-40 s on a strong day; repeated calls are fast). Before 09:00 Tehran time the live lists are empty because the exchange resets the day's data: read note, and pass date= for queues.

Inputs: date, kind, limit, market, +1 more.

tradesA
Read-onlyIdempotent

Raw tick-by-tick trades (ریز معاملات) with time, price, volume, value. Filter by time and size; prefer trade_summary for analysis.

Inputs: symbol (required), date, limit, to_time, +3 more.

trade_summaryA
Read-onlyIdempotent

Aggregate a day's ticks: intraday bars, VWAP, biggest trades, volume by price level, tick-rule pressure estimate, and a completeness check against official totals.

Inputs: symbol (required), date, to_time, from_time, +1 more.

trading_statusA
Read-onlyIdempotent

Which symbols are halted or flagged. 'suspended' lists symbols whose trading is suspended (تعلیق شده) with the exchange's reasons; 'supervision' lists symbols that still trade but are in the suspension process (مشمول فرآیند تعلیق) or under caution (معامله تحت احتیاط); 'state_changes' is the market-wide log of order-entry states (مجاز, ممنوع, محفوظ, متوقف), decoded into what each means; 'symbol_history' gives one symbol's state history with its current supervision status and since when. Reasons are plain Persian lines.

Inputs: kind, limit, market, symbol.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.2/5.0

    Scored across 45 tools

    Disambiguation3/5

    The set has many adjacent views: market_watch vs market_snapshot vs screen_stocks vs top_lists, quote vs symbol_overview vs fundamentals, and codal_letter vs financial_statements/monthly_activity. Descriptions often explicitly steer selection, which keeps ambiguity manageable, but an agent still faces several plausible entry points for common questions.

    Naming Consistency4/5

    All names use snake_case and cluster into coherent prefixes such as market_, index_, shareholder_, and codal_, making them readable and predictable. The convention is mostly noun-phrase/resource-based with a few verb-led exceptions like search_symbol and screen_stocks, so it is not perfectly uniform.

    Tool Count2/5

    45 tools is far above the comfortable 3-15 range and creates a large selection surface, even though the domain genuinely spans equities, derivatives, Codal, commodity, energy, and funds. Several tools could be combined or tiered behind higher-level entry points.

    Completeness4/5

    Coverage is unusually broad: market status, indices, quotes, order books, trades, fundamentals, Codal, options, futures, commodity, energy, screening, shareholders, and corporate actions. Minor gaps such as DPS/ex-dividend dates are explicitly routed to Codal, so agents have workarounds rather than dead ends.

    Maintenance

    ActivityNo data
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      B
      maintenance
      Enables AI agents to read Tehran Stock Exchange and Iran Fara Bourse market data—quotes, top movers, order books, price history, sector indices, and real vs legal trading—through read-only tools. Requires no API key, returning compact JSON in Rial directly to Claude, Cursor, or Copilot.
      8
      348 PyPI
      10
      PolyForm Noncommercial 1.0.0
    • A
      license
      A
      quality
      B
      maintenance
      Enables AI agents to search and read Iranian listed companies’ Codal disclosures, including financial statements, EPS and monthly activity reports as tables, meeting decisions, and PDF/Excel links, plus company and fiscal-year lookups.
      5
      383 PyPI
      11
      PolyForm Noncommercial 1.0.0
    • A
      license
      A
      quality
      B
      maintenance
      Enables AI agents to search, rank, and compare Iranian mutual funds and ETFs; inspect NAV, returns, size, flows, investors, and managers; and retrieve Tehran and Farabourse market overviews, indices, stock quotes, and industry data read-only without an API key.
      11
      181 PyPI
      PolyForm Noncommercial 1.0.0
    • A
      license
      A
      quality
      B
      maintenance
      Gives AI agents read-only access to the public trade and supply data of the Iran Mercantile Exchange, covering commodity trades, upcoming supply offers, daily price series, market totals, options, certificates, rankings, news and weekly reports. Requires no API key or account, and works in Claude, Cursor, Copilot and any other MCP client.
      14
      280 PyPI
      PolyForm Noncommercial 1.0.0