dse-mcp
It is an MCP server that lets an AI agent access Dhaka Stock Exchange data and run a disciplined buy/sell analysis workflow.
Get live/closed market status, session times, and Dhaka time.
Fetch market summaries and index history (DSEX/DS30/DSES).
See top gainers/losers, most active, turnover leaders, and sector performance.
Search instruments by symbol/name and pull quotes, price history, company profiles, fundamentals, and P/E ratios.
Read live order-book depth and company/market news/disclosures.
Compute technical indicators (SMA50/200, RSI, MACD, Bollinger) and get rule-based technical summaries.
Screen stocks by sector, P/E, price, and volume.
Use the bundled dse-analysis skill to guide a full market-context → fundamentals → technicals → news → verdict workflow.
Click on "Deploy 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., "@dse-mcp Show me today's top gainers on the DSE."
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.
dse-mcp
A production-grade Model Context Protocol (MCP) server for the Dhaka Stock
Exchange (DSE) — live quotes, price history, fundamentals, order-book depth,
news, technical indicators, screening — plus a bundled dse-analysis skill
that teaches your agent a disciplined buy/sell workflow on top of those tools.
Data is scraped from dsebd.org (DSE's official site) with
all of its production quirks handled: incomplete TLS chains, -- placeholders,
comma-grouped numbers, invisible layout tables, market-hours-aware caching, and a
mirror-domain fallback. Informational only — not investment advice. Not
affiliated with DSE.
Install
Requires Python 3.12+ (or just uv/pipx, which manage Python for you).
# Register with Claude Code (recommended)
claude mcp add dse -s user -- uvx dse-mcpClaude Desktop (claude_desktop_config.json):
{
"mcpServers": {
"dse": { "command": "uvx", "args": ["dse-mcp"] }
}
}Cursor (~/.cursor/mcp.json): same JSON shape as Claude Desktop.
pipx:
pipx install dse-mcp
# then register with the command "dse-mcp"Docker:
docker run -i --rm ghcr.io/ofsazib/dse-mcpRelated MCP server: Stock SDK MCP Server
The dse-analysis skill
The repo ships an agent skill that turns these tools into a repeatable buy/sell analysis workflow (market context → fundamentals → technicals → news → verdict with confidence + risks):
# from a git clone of this repo
./scripts/install_skill.sh # installs to ~/.claude, ~/.agents, ~/.zcode
./scripts/install_skill.sh --dir ~/x # add a custom skills directory
./scripts/install_skill.sh --uninstall # remove from all configured directoriesOr copy skills/dse-analysis/ into your client's skills directory manually.
Removing everything
claude mcp remove dse # unregister the MCP server (add -s user if needed)
./scripts/install_skill.sh --uninstall # remove the skill from all skill directories
uv cache clean dse-mcp # drop uvx's cached build of the packageTools (16)
Every response carries market_status (live/closed), data_freshness
(live/snapshot/stale), and data_as_of — so closed-market data is never mistaken
for live prices.
Market
Tool | Description |
| Live/closed, session hours, Dhaka time, next session |
| DSEX/DS30/DSES + changes, totals for the latest session |
| Daily index history (rolling one-year archive) |
|
|
| Advancing/declining + avg change per sector |
Stock
Tool | Description |
| Fuzzy search over 636 bundled instruments (22 sectors) |
| LTP, day range, close, change, trades, value, volume |
| Day-end OHLCV, oldest-first |
| Capital structure, listing year, 52w range, EPS block |
| Analysis-ready: EPS, P/E, dividends, reserves, 52w |
| Live bid/ask levels + session stats |
| Company or market-wide news/disclosures |
| P/E table (interim/audited/trailing) for all instruments |
Analysis & screening
Tool | Description |
| SMA50/200, RSI(14), MACD, Bollinger |
| Trend, support/resistance, outlook + reasons |
| Filter the live board |
Trading-hours aware caching
Market live (Sun–Thu 10:00–14:50 Asia/Dhaka): data cached 30s (depth is always fetched fresh).
Market closed: the last session's snapshot is cached ~1h and persisted to
~/.cache/dse-mcp/, so a restart still serves the last session (labeledsnapshot).DSE unreachable: the persisted snapshot is served labeled
stale.
Configuration (optional)
All via environment variables with the DSE_MCP_ prefix — see
.env.example. Useful ones:
Variable | Default | Purpose |
|
| Outbound requests/second (token bucket) |
|
| Seconds, while the market is live |
|
| Snapshot persistence |
|
| Logs go to stderr (never stdout — MCP) |
Troubleshooting
[SSL: CERTIFICATE_VERIFY_FAILED]— dsebd.org serves an incomplete TLS chain. dse-mcp uses the OS trust store (truststore), which handles it; do not replace it withverify=False.Empty depth / quotes look frozen — the market is closed (or a holiday). Check
market_statusand the response'sdata_as_of.DGEN: null— the DGEN index is retired from DSE's live pages; null is the honest value.
Development
git clone https://github.com/ofsazib/dse-mcp && cd dse-mcp
uv sync # Python 3.12 via uv
uv run pytest # 44 offline tests (recorded fixtures)
uv run ruff check .
uv run dse-mcp # run the server locally
npx @modelcontextprotocol/inspector uv run dse-mcp # visual debuggingRe-record fixtures when dsebd.org markup changes: uv run python scripts/record_fixtures.py.
Rebuild the instrument bundle: uv run python scripts/build_instruments.py.
See AGENTS.md for architecture and CONTRIBUTING.md
to contribute.
Legal
Data source: dsebd.org (Dhaka Stock Exchange). This project is an independent, unaffiliated open-source client; data remains the property of DSE.
Nothing here is investment advice. DSE securities can be illiquid and subject to circuit breakers; verify everything against primary sources before acting.
License
MIT © Omar Faruk Sazib
Available Tools
16 toolscompute_indicatorsCompute IndicatorsA
Compute technical indicators for a symbol over the last year of day-end candles. Values are null when history is too short (e.g. recent IPOs).
Inputs: symbol (required), macd, rsi_14, sma_50, +2 more. Returns: object
get_company_profileGet Company ProfileB
Company profile from displayCompany: capital structure, listing year, market lot, 52-week range, latest dividend status, EPS block.
Inputs: symbol (required). Returns: object
get_fundamentalsGet FundamentalsB
Analysis-ready fundamentals: EPS, P/E (interim/audited/trailing), dividend yield + latest dividend, reserves, market cap, 52-week range.
Inputs: symbol (required). Returns: object
get_index_historyGet Index HistoryA
Daily index history (DSEX, DS30, totals) for the last N days (max ~365; DSE keeps a rolling one-year archive).
Inputs: days. Returns: object
get_market_depthGet Market DepthB
Live order book: best bid/ask levels with volumes, plus session price statistics. Empty sides are normal outside trading hours.
Inputs: symbol (required). Returns: object
get_newsGet NewsA
Company or market-wide news/disclosures. Omit symbol for market-wide (inst=All); returns newest items first with titles, bodies, post dates.
Inputs: days, limit, symbol. Returns: object
get_pe_ratiosGet Pe RatiosB
P/E table for all instruments (interim basic/diluted, audited, trailing).
Inputs: no named parameters. Returns: object
get_price_historyGet Price HistoryA
Day-end OHLCV candles, oldest-first. Give ISO start/end, or just days (default 90; DSE keeps a rolling one-year archive).
Inputs: symbol (required), end, days, start. Returns: object
get_quoteGet QuoteA
Latest quote for one instrument: LTP, day range, close, YCP, change, trades, value, volume. Untraded instruments carry traded=false.
Inputs: symbol (required). Returns: object
market_statusMarket StatusA
Current DSE market state: live or closed, session hours, Dhaka local time.
Inputs: no named parameters. Returns: object
market_summaryMarket SummaryA
Latest market snapshot: DSEX/DS30 indices + changes, session totals, and DSES from the 30-day market information table.
Inputs: no named parameters. Returns: object
screen_stocksScreen StocksA
Filter the live board: sector (case-insensitive substring), max P/E (interim basic, falls back to trailing), price range, minimum volume. Untraded instruments are excluded. Sorted by traded value (turnover).
Inputs: limit, pe_max, sector, price_max, +2 more. Returns: object
search_symbolsSearch SymbolsA
Find DSE instruments by trading code or company name (case-insensitive).
Inputs: query (required), limit. Returns: object
sector_performanceSector PerformanceA
Aggregate live-quote performance per sector: advancing/declining counts and average change percent, sorted best-to-worst.
Inputs: no named parameters. Returns: object
technical_summaryTechnical SummaryA
Rule-based technical read: trend (SMA50/200 cross), RSI zone, MACD direction, Bollinger position, support/resistance, volume context, and a plain-language outlook with reasons. Informational only.
Inputs: symbol (required). Returns: object
top_moversTop MoversA
Top movers by category: gainers | losers | most_active | turnover.
Gain/loss lists reflect the +-10% circuit breaker; turnover leaders are computed from live quotes (untraded instruments excluded).
Inputs: category. Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 16 tools
Each tool targets a distinct data aspect (quotes, history, fundamentals, news, technicals), so most boundaries are clear. However, get_company_profile, get_fundamentals, and get_pe_ratios share overlapping metrics like EPS and P/E, which could cause confusion if an agent relies on descriptions alone.
The naming pattern is mostly get_ for retrievals and noun phrases for snapshots (market_summary, top_movers), which is readable and predictable. Minor deviations like search_symbols versus get_index_history and compute_indicators versus technical_summary keep it from being fully uniform.
With 16 tools, the server is on the upper end but still well-scoped for a stock exchange data platform. Each tool earns its place by covering a meaningful query type—pricing, fundamentals, news, technicals—without unnecessary fragmentation or duplication.
The surface covers the core domain well: market state, indices, quotes, history, fundamentals, news, screening, and technical analysis. Minor omissions like a direct list-all-instruments endpoint or corporate actions beyond dividends are workable through search_symbols and screen_stocks, so no severe dead ends exist.
Maintenance
Related MCP Connectors
Quant intelligence over MCP: backtest, signals, screens, scores & portfolios for US & TSX stocks.
A Model Context Protocol server exposing real-time and historical Colombo Stock Exchange (CSE) data to AI agents and LLM applications. Provides quotes and OHLCV price history, full financial statements (income, balance sheet, cash flow), pre-computed technicals (moving averages, RS ratings, volume signals), macroeconomic indicators, corporate actions, and rule-based screening across CSE stocks and sector indices, everything needed to build CSE-aware trading assistants, research tools, and market-analysis agents. This is the official MCP server of www.ceyloncharts.com
Financial data and research MCP for US/CN/JP equities: filings, statements, ownership, signals.
Research-only MCP server: your AI as a quant research desk. 90 tools, no trades, no brokers.
Related MCP Servers
- AlicenseCqualityDmaintenanceEnables querying real-time and historical financial market data for stocks, options, forex, and crypto, including quotes, trades, technical indicators, and reference data through a set of MCP tools.713MIT
- AlicenseNot gradedqualityAmaintenanceEnables AI assistants to access real-time and historical market data for A-shares, Hong Kong, US stocks, funds, futures, and options, calculate technical indicators, screen stocks, and perform composite market analysis through MCP tools, prompts, skills, and resources.153 npmISC
- AlicenseNot gradedqualityAmaintenanceEnables AI assistants to access real-time and historical market data across A-share, Hong Kong, and US stocks, funds, futures, and options, plus technical indicators, sector data, screeners, and composite analysis tools. It also provides MCP prompts, resources, and ready-to-use skills for stock analysis, market overviews, comparisons, and monitoring.153 npmISC
- AlicenseNot gradedqualityAmaintenanceEnables AI assistants to retrieve real-time and historical market data across A-shares, Hong Kong, US stocks, funds, futures, and options, calculate technical indicators, and perform stock screening, comparison, and market or sector analysis through MCP tools, prompts, resources, and skills.153 npmISC