tsetmc-mcp
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@tsetmc-mcpshow me the order book for خودرو"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
tsetmc-mcp
A local MCP server that gives Claude Code (and any MCP client) live Tehran Stock Exchange (TSETMC) market data — quotes, order-book queues (صف), حقیقی/حقوقی money-flow, market screens, price history, and custom filters you describe in plain language. Ask Claude about the بازار and it pulls the data for you.
It reads public data straight from tsetmc.com. It is not affiliated with TSETMC,
needs no API key, and is read-only.
⚠️ One hard requirement: run it on an Iranian IP
tsetmc.com serves its data API to Iranian IPs and blocks most foreign / VPN
addresses. Run this on a machine in Iran, and make sure the process is not routed
through a foreign VPN. From inside Iran it just works — no proxy needed. Outside Iran it
is not supported (you would need your own in-Iran relay).
The Tehran session is Saturday–Wednesday, 09:00–12:30 (Asia/Tehran). Outside those hours the market is closed: live prices read as empty and money-flow/صف filters return nothing until the session opens. That's expected, not a bug.
Related MCP server: Financial Datasets MCP Server
Features
Tool | What it does |
| نماد (Persian) → instrument code |
| live price, %change, volume/value, EPS/PE |
| 5-level صف خرید/فروش (bid/ask) |
| حقیقی/حقوقی buy/sell + net institutional |
| filtered/sorted whole-market view (never dumps ~700 rows) |
| top gainers/losers, most active, market breadth |
| TEDPIX + equal-weight index at a glance |
| daily OHLCV; large pulls → CSV file |
| is the Tehran market open now |
| field / units reference |
| run a custom filter (describe it, or paste a TSETMC filter) |
| run a saved filter or a built-in preset by name |
| filter variables, operators, presets |
Prices are in Rial. Every response is stamped with freshness (market_open,
staleness_seconds, upstream_reachable) so the model never treats stale data as live.
Prerequisites
A machine in Iran (see above), not on a foreign VPN.
Python ≥ 3.11 (the
uvinstaller can provision it for you).uv— install withcurl -LsSf https://astral.sh/uv/install.sh | shThe Claude Code CLI (
claude), or any MCP client.
Get the code & install
git clone https://github.com/solitraderbusiness/tsetmc-mcp
cd tsetmc-mcp
uv sync # creates .venv and installs everythingStep 1 — verify it can reach TSETMC (run this in Iran)
uv run tsetmc-mcp-selfcheckRead the result:
mostly ✅ → you're good, continue.
all 🚫 BLOCKED → you're on a non-Iranian IP. Turn off any foreign VPN and re-run.
✅ but
WARN calendar trading_day=False/0 traded→ fine, the market is just closed. Reachability is proven; continue.
Step 2 — register it with Claude Code
Run this from inside the clone so the absolute path is filled in for you:
claude mcp add tsetmc -- uv run --directory "$(pwd)" tsetmc-mcpThe
--directorymust be an absolute path. A relative or~path is the #1 cause of a server that registers "successfully" but then shows disconnected.
Alternative — one line, no clone (once the repo is public; you can't run the Iran-IP selfcheck first this way):
claude mcp add tsetmc -- uvx --from 'git+https://github.com/solitraderbusiness/tsetmc-mcp@v0.1.0' tsetmc-mcpVerify it worked
Restart Claude Code and run /mcp — you should see tsetmc connected. Ask Claude
"is the Tehran market open?" — a stamped market_status reply confirms it's live.
Usage — just talk to Claude
Ask in plain Persian or English; Claude picks the right tool:
«قیمت فولاد چنده؟» / "what's فولاد trading at?"
«صف خرید خودرو چطوره؟» / "show خودرو's order book"
«امروز کدوم نمادها +۳٪ با حجم بالان؟» / "stocks up >3% on high volume"
«بیشترین رشد امروز» / "top gainers now"
«حقیقی/حقوقی شستا؟» / "smart-money on شستا"
«شاخص کل چنده؟» / "where's TEDPIX?"
«تاریخچه ۶ ماه فولاد» / "pull فولاد's price history" (large pulls saved to CSV)
Custom filters — describe it, Claude writes it, runs it
TSETMC's "دیدهبان فیلتر" lets you write filter scripts. This does the same, but you just describe what you want:
«سهمهایی که پول حقیقی واردشون میشه و مثبتان» → Claude writes
net_individual > 0 and change_pct > 0, runs it, lists the matches.
Paste a real TSETMC filter and it runs as-is:
(ct).Buy_I_Volume-(ct).Sell_I_Volume>0 && (plp)>0Say "save this as my-flow" → later "run my-flow".
Built-in presets:
buyer_power_2x(پول داغ),code_to_code(کد به کد),institutional_accumulation,volume_spike,buy_queue/sell_queue(صف), …Safety: filters are parsed, never executed as code — no filter string can run code or touch your system.
Not in v1: 30-day-average / RSI history terms and market-cap/sector (Claude will say so and suggest an alternative). Filters are most useful during market hours.
How it works
A background poller pulls the whole market from TSETMC every few seconds during the
Tehran session and keeps it in memory. Every tool answers from that snapshot, so asking
Claude a question never hammers TSETMC (which would get you rate-limited / IP-blocked).
Order books and history are fetched per-symbol on demand. Full architecture:
docs/design.md; endpoint reference: docs/endpoints.md.
Configuration
Everything has a safe default; override via env vars (see .env.example) —
poll interval, request rate, market hours, output limits, data dir. Extra market holidays:
put one YYYY-MM-DD per line in ~/.tsetmc-mcp/holidays.txt (weekends Thu/Fri are already
handled). Pass env to the server via claude mcp add --env KEY=value ….
Optional: the 5j9/tsetmc accelerator
The default raw backend needs no extra packages. On Python ≥ 3.13 you can opt into
the actively-maintained 5j9/tsetmc library as an
alternate backend behind the same interface:
uv pip install "tsetmc>=3.0"
TSETMC_SOURCE=library uv run tsetmc-mcpTroubleshooting
Symptom | Cause / fix |
self-check is all 🚫 | non-Iranian IP — turn off any foreign VPN |
|
|
empty market_watch / screen | outside the Sat–Wed 09:00–12:30 session (market closed) |
self-check | it's Thursday/Friday (Tehran weekend) or a holiday — not an error |
| needs Python ≥ 3.13 + |
Update / uninstall
git -C tsetmc-mcp pull && uv sync # update
claude mcp remove tsetmc # unregister
# delete the clone and ~/.tsetmc-mcp/ to remove all local stateDevelop
uv run pytest # 107 offline tests (no network needed)
uv run ruff check . && uv run ruff format --check .
uv run mcp dev src/tsetmc_mcp/server.py # click-test tools in the MCP InspectorContributions welcome — see CONTRIBUTING.md. Security reports:
SECURITY.md. Your requests go directly from your machine to tsetmc.com;
this tool sends nothing anywhere else.
License
MIT. The optional library extra pulls 5j9/tsetmc (GPL-3.0); it is not
vendored or bundled here — it's only an optional dependency specifier that pip fetches
from PyPI if you opt in, so it places no copyleft obligation on this MIT distribution.
(Don't bake an installed tsetmc into a distributed Docker image / single-file binary, or
that bundle becomes a GPL combined work.)
Disclaimer
This project is an independent, open-source client. It is NOT affiliated with, endorsed by, or connected to the Tehran Securities Exchange Technology Management Co. (TSETMC), the Tehran Stock Exchange, or any regulatory body.
It reads PUBLICLY available market data from tsetmc.com through the same undocumented endpoints the website itself uses. All requests are READ-ONLY. It accesses no authenticated, paywalled, or non-public resource and circumvents no access control.
It is provided for personal, educational, and research use, and is rate-limited by design; please use it responsibly and do not send abusive request volumes. You are responsible for how you use it and for complying with any applicable terms of use and local laws.
The data is provided "AS IS", without any warranty of accuracy, completeness, or timeliness, and may be delayed or incorrect. Nothing here is financial or investment advice. The authors accept no liability for any loss arising from use of this software or the data it retrieves.
سلب مسئولیت
این ابزار یک کلاینت متنباز و مستقل است و هیچ وابستگی، تأییدیه یا ارتباطی با شرکت مدیریت فناوری بورس تهران (TSETMC)، بورس اوراق بهادار تهران یا هیچ نهاد ناظری ندارد.
این کتابخانه صرفاً دادههای عمومی و در دسترسِ همگان را از tsetmc.com و از همان مسیرهایی که خودِ وبسایت استفاده میکند، بهصورت فقط-خواندنی دریافت میکند؛ به هیچ منبع احرازهویتشده، پولی یا غیرعمومی دسترسی ندارد و هیچ سازوکار امنیتی را دور نمیزند.
این ابزار برای استفادهٔ شخصی، آموزشی و پژوهشی ارائه شده و بهصورت پیشفرض دارای محدودیت نرخ درخواست است؛ لطفاً مسئولانه استفاده کنید. دادهها «همانگونه که هست» و بدون هیچ تضمینی نسبت به صحت یا بهروزبودن ارائه میشوند و ممکن است نادرست باشند. هیچیک از موارد ارائهشده توصیهٔ مالی نیست و مسئولیت هرگونه استفاده بر عهدهٔ کاربر است.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/solitraderbusiness/tsetmc-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server