TSETMC Tehran Stock Exchange

io.github.sepehr071由 GitHub 帳號 sepehr071 發布v0.2.0更新於 Nov 8, 2026

Unofficial read-only Tehran Stock Exchange (TSETMC): quotes, movers, order book, history, indices.

發布方自己的服務:Exchange.news — Crypto offers, campaigns and news

已驗證STDIO僅桌面金融資料與分析

概覽

AI 產生的概覽

非官方唯讀 MCP 伺服器,讓助理查詢德黑蘭證券交易所與伊朗法拉交易所的報價、漲跌排行、委託簿、歷史行情與指數。

可以做什麼
  • 依波斯語代號或名稱搜尋股票、基金、增資認購權與債券
  • 讀取單一標的報價:最新成交、收盤價、當日區間、成交量、成交值、價格限制與市值
  • 依漲幅、跌幅、成交量、成交值或成交筆數排出市場漲跌排行,並標示漲跌停
  • 讀取某標的買賣各五檔最佳價位
  • 取得個股日線歷史與指數歷史,並掃描總指數、等權指數與產業指數
  • 逐日比較自然人(個人)與法人(機構)的買賣資金流向
適用情境
適用於詢問德黑蘭證券交易所或法拉交易所的價格、漲跌排行、產業指數、委託簿,以及個人與法人資金流向的情境。不適用於下單交易、基本面或 Codal 公告、選擇權期貨或其他交易所。
執行需求
透過 uvx(或 pip install)以 stdio 在本機執行,需要 uv 與 Python 3.10 以上。不需帳號或 API 金鑰。需要能連線 tsetmc.com 的網路;可選環境變數 TSETMC_MCP_PROXY 用來設定 HTTP 代理(或逗號分隔的清單),系統代理設定會被忽略。
安裝前請注意
唯讀:無法登入、交易或下單,回傳內容不構成投資建議。請求送往 tsetmc.com 這個未公開文件的第三方端點,端點可能變動,也可能以 HTTP 403 封鎖部分網路,必要時需使用伊朗出口代理。價格為未還原的里亞爾數值,資料可能延遲。速率限制不明,應控制請求頻率。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 TSETMC Tehran Stock Exchange,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

[tsetmc-mcp: unofficial TSETMC MCP server for Claude, Cursor and Copilot]

tsetmc-mcp: Tehran Stock Exchange MCP server for AI agents

Let your AI agent read the Tehran Stock Exchange (بورس تهران).
An unofficial, read-only MCP server for TSETMC, the data portal of the Tehran Stock Exchange and Iran Fara Bourse:
quotes, top movers, order book, daily history, real vs legal trading and market indices, from Claude, Cursor or Copilot.

[PyPI] [Python] [CI] [MCP Registry] [License: MIT] [mcpfarsi]

[Install in VS Code]

For AI agents · Quick start · What it can do · Tools · FAQ · فارسی


For AI agents

  • What: unofficial MCP server (model context protocol) for tsetmc.com, the Tehran Stock Exchange and Iran Fara Bourse market data. Symbol search takes Persian names (Arabic ي/ك are accepted).
  • Install: uvx tsetmc-mcp or claude mcp add tsetmc -- uvx tsetmc-mcp. Transport: stdio. Needs uv (Python 3.10+).
  • Auth: none, no API key or account. Optional TSETMC_MCP_PROXY (HTTP proxy URL, or a comma-separated list); system proxy settings are ignored.
  • Access: read-only. It cannot log in, trade or place orders, so no confirmation is needed before calling any tool.
  • Tools: 8, all prefixed ts_. Typical sequence: ts_indices -> ts_market_movers -> ts_get_quote -> ts_price_history. If you only have a name, call ts_search_symbols first and pass its symbol or ins_code to the other tools.
  • Use when: the user asks about Tehran Stock Exchange or Fara Bourse prices, movers, sector indices, order book or real vs legal money flow.
  • Do not use when: the user wants to trade, needs fundamentals or Codal filings, or asks about other exchanges.
  • Output: compact JSON. Prices in Rial (Toman = Rial / 10), volumes in shares, dates Gregorian (YYYY-MM-DD).
  • Network: tsetmc.com answers only some networks. On HTTP 403, try an Iranian connection or set TSETMC_MCP_PROXY.
  • Machine-readable: server.json and the iran-mcp catalog.

Why

TSETMC is the place Iranian traders look at, but it is a heavy web page built for human eyes. Asking "which sectors are up today, which stocks hit the daily limit, and are individual investors buying or selling Foolad?" means opening several screens. With tsetmc-mcp an agent answers it in a few calls and returns a short summary instead of tables of raw numbers.

You: How is the market today, and what are the biggest gainers?

Agent: calls ts_indices(limit=5) -> ts_market_movers(market="bourse", sort_by="gain", limit=5)

It reads the total index, the market state and the strongest sector indices, then lists the top gainers with their last price, change and whether they are stuck at the upper price limit.

Every reply is trimmed to stay under about 15 KB, so it does not flood the agent's context.

What it can do

  • Look up any share, fund, rights issue or bond on the Tehran Stock Exchange or Iran Fara Bourse by ticker or name
  • Quote one instrument: last trade, closing price, daily range, volume, trades, value, allowed price range, week and year range, shares outstanding and market cap
  • Rank movers of Bourse, Fara Bourse, rights or bonds by gain, loss, volume, value or trade count, with a flag for prices at the daily limit
  • Read the order book: best five bid and ask levels with price, volume and order count, including buy and sell queues
  • Pull daily history: open, high, low, close, volume, trades and value for up to 50 trading days
  • Track real vs legal trading (حقیقی و حقوقی): buy and sell volume, value and counts per day, plus net individual volume
  • Scan indices: the total index, equal-weight index, market state and every sector index, and up to 100 days of any index's history
  • Read-only by design: no login, no orders

Example prompts:

  • "Which TSE sectors are leading today?"
  • "Top 10 Fara Bourse stocks by traded value."
  • "Show the order book for فولاد."
  • "Last 20 trading days of وبملت, and did individual investors buy or sell over the last 3 days?"
  • "How has the total index moved over the last 30 days?"
  • شاخص کل امروز چقدر تغییر کرده و کدام صنعت‌ها بیشترین رشد را داشتند؟
  • ورود و خروج پول حقیقی فولاد در سه روز اخیر چطور بوده؟
  • بیشترین حجم معاملات امروز فرابورس مربوط به کدام نمادهاست؟

Quick start

You need uv. No API key or account.

Claude Code
bash
claude mcp add tsetmc -- uvx tsetmc-mcp
Claude Desktop

Settings → Developer → Edit Config, then add:

json
{  "mcpServers": {    "tsetmc": { "command": "uvx", "args": ["tsetmc-mcp"] }  }}
Cursor

Add the Claude Desktop block above to ~/.cursor/mcp.json (or .cursor/mcp.json in a project).

VS Code (Copilot agent mode)

Click Install in VS Code above, or add to .vscode/mcp.json:

json
{  "servers": {    "tsetmc": { "type": "stdio", "command": "uvx", "args": ["tsetmc-mcp"] }  }}
Codex CLI
bash
codex mcp add tsetmc -- uvx tsetmc-mcp

Or in ~/.codex/config.toml:

toml
[mcp_servers.tsetmc]command = "uvx"args = ["tsetmc-mcp"]
Gemini CLI

Add to ~/.gemini/settings.json:

json
{  "mcpServers": {    "tsetmc": { "command": "uvx", "args": ["tsetmc-mcp"] }  }}
Windsurf

Add the Claude Desktop block to ~/.codeium/windsurf/mcp_config.json.

Anything else

It is a standard stdio MCP server: run uvx tsetmc-mcp, or pip install tsetmc-mcp and run tsetmc-mcp.

Tools

Pass a ticker (فولاد), an exact name, or a numeric ins_code as symbol. Index tools take an index name such as شاخص کل.

ToolWhat it does
ts_search_symbolsFind Tehran Stock Exchange instruments (shares, funds, rights, bonds) by ticker or name
ts_get_quoteLatest price, daily range, volume and key facts of one instrument on the Tehran Stock Exchange
ts_market_moversTop traded instruments of a market today, ranked by gain, loss, volume, value or trade count
ts_order_bookBest five bid and ask levels (price, volume, order count) of one instrument
ts_price_historyDaily open, high, low, close, volume, trades and value of one instrument for its latest trading days, newest first
ts_real_legalBuy and sell volume, value and buyer/seller counts split by real (individual) and legal (institutional) traders per day
ts_indicesTSE total index, market state and trading totals, plus every sector and market index with its change
ts_index_historyDaily close, high, low and percent change of a TSE index (total, equal-weight, sector...), newest first

All 8 tools are annotated readOnlyHint: true.

How it works

text
  AI agent  (Claude, Cursor, Copilot, ...)      │      │  MCP over stdio      ▼  tsetmc-mcp  (runs on your machine)      │      │  HTTPS      └──────▶  cdn.tsetmc.com   quotes, market watch, order book, indices

tsetmc-mcp runs locally and calls the same endpoints the tsetmc.com site uses. It has no hosted server in between and no API key. The TSETMC API is undocumented and blocks plain HTTP clients, so requests go out through a Chrome-impersonating client. It sends at most 2 requests at a time with a little jitter, keeps answers for 15 seconds, retries a failed GET up to twice, and only talks to cdn.tsetmc.com. It only reads.

Good to know

  • Prices are in Rial, as TSETMC quotes them. Divide by 10 for Toman. Volumes are in shares.
  • Prices are not adjusted for capital increases or dividends, so long histories can show jumps.
  • last vs close: last is the last trade, close the closing (volume-weighted) price; change_pct compares last with yesterday's close.
  • Trading hours: the market trades Saturday to Wednesday, in the morning. Outside those hours the order book is empty and other tools show the last session.
  • Network: tsetmc.com blocks some networks with HTTP 403. It worked from an Iranian line; a foreign exit may or may not be accepted. If you get 403, set TSETMC_MCP_PROXY to an HTTP proxy with an Iranian exit. System proxy variables are ignored on purpose.
  • Reply caps: ts_market_movers returns at most 30 rows, ts_price_history 50 days, ts_index_history 100 days, ts_real_legal 10 days, ts_indices 60 indices.
  • ts_real_legal makes one upstream call per day, so ask for few days. Days with no data are listed under unavailable_dates.
  • Movers cover four markets: bourse, farabourse, rights and bonds. Only instruments that traded today are ranked.
  • Names: Arabic ي/ك and Persian ی/ک both match, and answers use the Persian forms. An ambiguous name returns an error listing candidates; pass the exact ticker or ins_code.
  • What it does not do: no trading or orders, no company fundamentals or Codal filings, no options or futures movers, no adjusted prices, no Jalali dates. Rate limits of TSETMC are unknown, so keep requests reasonable.

FAQ

Is there a TSETMC API or Tehran Stock Exchange MCP server?

TSETMC has no documented public API. tsetmc-mcp is an unofficial MCP server with 8 read-only tools that calls the same endpoints the tsetmc.com web app uses and returns compact JSON for AI agents.

Does it cover Fara Bourse (فرابورس) too?

Yes. ts_market_movers accepts market="farabourse", and ts_search_symbols finds Fara Bourse instruments; each match shows its market.

How do I use it with Claude, Cursor or Copilot?

Add the server with claude mcp add tsetmc -- uvx tsetmc-mcp, or use the matching config in Quick start, then ask in plain language, in Persian or English.

Are prices in Rial or Toman?

Rial. Every tool reports unit: "rial" where it returns prices. Divide by 10 for Toman.

Why is the order book empty?

The order book is only open while the market is. TSETMC trades Saturday to Wednesday mornings; after the close, or for an instrument that did not trade today, ts_order_book returns no levels and a note.

I get HTTP 403. What now?

tsetmc.com blocks some networks. Try from an Iranian connection, or set TSETMC_MCP_PROXY to an HTTP proxy with an Iranian exit. Plain curl is always refused because the site checks the TLS fingerprint; the server handles that itself.

Can it place orders or give investment advice?

No. It has no login and no trading calls, it only reads public market data. Nothing it returns is financial advice.

Is the data real time?

It is what TSETMC serves, kept for up to 15 seconds in a local cache, and it may be delayed. Check the date and time fields in a quote for the moment of the last trade.

How do I debug what the agent sees?
bash
npx @modelcontextprotocol/inspector uvx tsetmc-mcp

Configuration

VariableDefaultMeaning
TSETMC_MCP_PROXYunsetOptional HTTP proxy URL for tsetmc.com requests; system proxy settings are ignored. A comma-separated list is used one at a time: the next proxy takes over when one is blocked or cannot connect

فارسی: سرور MCP بورس تهران (TSETMC)

tsetmc-mcp یک سرور MCP غیررسمی و فقط‌خواندنی برای سامانه TSETMC (مدیریت فناوری بورس تهران) است. این سرور به دستیار هوش مصنوعی شما (Claude، Cursor، Copilot و ...) اجازه می‌دهد قیمت نماد، شاخص کل، دفتر سفارش و آمار معاملات بورس تهران و فرابورس را بخواند.

چه کارهایی می‌کند

  • جستجوی نماد سهام، صندوق، حق تقدم و اوراق (با نام یا نماد فارسی؛ «ي» و «ك» عربی هم پذیرفته می‌شود).
  • قیمت لحظه‌ای نماد: آخرین معامله، قیمت پایانی، بازه روز، حجم، ارزش، بازه مجاز قیمت و ارزش بازار.
  • پرمعامله‌ها و بیشترین رشد و افت در بورس، فرابورس، حق تقدم و اوراق، با نشانه صف خرید یا فروش (قیمت در سقف یا کف مجاز).
  • دفتر سفارش با ۵ سطح بهترین خرید و فروش.
  • تاریخچه روزانه قیمت تا ۵۰ روز معاملاتی (قیمت‌ها تعدیل نشده‌اند).
  • حقیقی و حقوقی: حجم و ارزش خرید و فروش و تعداد خریدار و فروشنده به تفکیک حقیقی و حقوقی، تا ۱۰ روز.
  • شاخص‌ها: شاخص کل، شاخص هم‌وزن، وضعیت بازار و شاخص همه صنعت‌ها، و تاریخچه تا ۱۰۰ روز.

نکته‌ها

  • فقط خواندنی است: وارد حساب نمی‌شود و سفارش ثبت نمی‌کند. توصیه سرمایه‌گذاری نیست.
  • قیمت‌ها به ریال است؛ برای تومان تقسیم بر ۱۰ کنید. تاریخ‌ها میلادی هستند.
  • بازار شنبه تا چهارشنبه، صبح‌ها باز است؛ بعد از بسته شدن بازار دفتر سفارش خالی است.
  • اگر سایت خطای ۴۰۳ داد، از اینترنت ایران استفاده کنید یا متغیر TSETMC_MCP_PROXY را روی یک پراکسی HTTP با خروجی ایران بگذارید.
  • کلید API لازم نیست و روی سیستم خود شما اجرا می‌شود.

نصب (اول uv را نصب کنید). در Claude Code:

bash
claude mcp add tsetmc -- uvx tsetmc-mcp

در Claude Desktop، Cursor و بقیه برنامه‌ها همان تنظیم بخش Quick start را بگذارید.

نمونه پرسش‌ها

  • «شاخص کل امروز چقدر تغییر کرده و کدام صنعت‌ها جلوتر هستند؟»
  • «دفتر سفارش فولاد را نشان بده.»
  • «پرمعامله‌ترین نمادهای فرابورس امروز کدام‌اند؟»
  • «ورود و خروج پول حقیقی وبملت در ۵ روز اخیر چطور بوده؟»
  • «تاریخچه ۳۰ روزه شاخص کل را بده.»

Development

bash
git clone https://github.com/sepehr071/tsetmc-mcp && cd tsetmc-mcpuv syncuv run ruff check . && uv run ruff format --check .uv run python -m pytest -q          # offline unit testsuv run python -m pytest -m live -q  # calls tsetmc.comuv build

All tools live in src/tsetmc_mcp/markets.py; each is a typed async function with a docstring that tells the agent when to use it. Issues and PRs are welcome.

Releases: bump the version in pyproject.toml and server.json, then push a v* tag. GitHub Actions publishes to PyPI.

Related servers

Disclaimer

Unofficial and not affiliated with or endorsed by TSETMC or the Tehran Securities Exchange Technology Management Co. It is read-only and uses the endpoints of the tsetmc.com web app, which can change without notice. Data is informational and may be delayed. Nothing here is financial advice.

Author

[Sepehr Radmard: open-source MCP servers for the Iranian web. LinkedIn: linkedin.com/in/sepehr-radmard]

Built and maintained by Sepehr Radmard (سپهر رادمرد). Connect on LinkedIn or follow @sepehr071 on GitHub for more MCP servers for Iranian websites, all listed in iran-mcp. If this saves you time, a star on the repo helps other people find it.

License

MIT

來源:README.md,提交 9209e01

工具

8

ts_search_symbols

Search symbols

Find Tehran Stock Exchange instruments (shares, funds, rights, bonds) by ticker or name. Pass a result's `symbol` or `ins_code` to the other ts_ tools. Empty list: retry a shorter name.

輸入參數limitquery必填

ts_get_quote

Stock quote

Latest price, daily range, volume and key facts of one instrument on the Tehran Stock Exchange. Use ts_order_book for bids and asks, ts_price_history for earlier days.

輸入參數symbol必填

ts_market_movers

Market movers

Top traded instruments of a market today, ranked by gain, loss, volume, value or trade count. Only traded instruments. `limit_up`/`limit_down` = stuck at the daily limit. Pass a row's `symbol` to other ts_ tools.

輸入參數limitmarketsort_by

ts_order_book

Order book

Best five bid and ask levels (price, volume, order count) of one instrument. Empty outside trading hours. Ask price 0 = buy queue (no sellers), bid price 0 = sell queue.

輸入參數symbol必填

ts_price_history

Daily price history

Daily open, high, low, close, volume, trades and value of one instrument for its latest trading days, newest first. Prices are unadjusted for capital increases and dividends.

輸入參數dayssymbol必填

ts_indices

Market indices

TSE total index, market state and trading totals, plus every sector and market index with its change. Pass an index `name` to ts_index_history for past values.

輸入參數limitquery

ts_index_history

Index history

Daily close, high, low and percent change of a TSE index (total, equal-weight, sector...), newest first. Names: see ts_indices.

輸入參數daysindex

版本歷史

4
  1. v0.2.0最新Nov 7, 2026
  2. v0.1.3Nov 3, 2026
  3. v0.1.2Oct 23, 2026
  4. v0.1.1Oct 22, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分

其他 Exchange 整合