psx-mcp-server
Provides live Pakistan Stock Exchange data including quotes, intraday and end-of-day history, indices, company fundamentals, dividends, and announcements via the Model Context Protocol, with no API key required.
README
psx-mcp-server
A Model Context Protocol server that gives Claude and other MCP agents live Pakistan Stock Exchange data — quotes, intraday and end-of-day history, indices (KSE-100 and 17 others), company fundamentals, dividends, and announcements — sourced from the public PSX Data Portal. No API key required.
Quick start
The server runs via uv — uvx fetches and runs it in one step,
so there is nothing to install manually.
Claude Code:
claude mcp add psx -- uvx psx-mcp-server
Claude Desktop — add to claude_desktop_config.json
(macOS: ~/Library/Application Support/Claude/, Windows: %APPDATA%\Claude\):
{
"mcpServers": {
"psx": {
"command": "uvx",
"args": ["psx-mcp-server"]
}
}
}
Any MCP client: run uvx psx-mcp-server (stdio transport). Requires uv
(install guide).
Example
You: Which PSX stocks gained the most today, and what's HBL trading at?
The agent calls get_market_snapshot and get_quote, and answers:
TOP 5 GAINERS:
TCORPR2 +22.62% Rs.5.42
PINL +10.52% Rs.10.51
HICL +10.05% Rs.11.50
TSPL +10.02% Rs.18.12
CLVL +10.02% Rs.22.41
breadth: 296 advancers / 180 decliners
HBL: Habib Bank Limited | current Rs.318.15 | P/E 7.43
KSE100: 187,454.69 (+1.12%)
Tools
| Tool | Parameters | Returns |
|---|---|---|
search_symbols |
query, sector?, limit=20 |
Matching tickers (exact matches first). Use first if unsure of a ticker. |
get_quote |
symbol |
Current price, LDCP, OHL, change %, volume, bid/ask, 52-week range, P/E (PKR). |
get_intraday |
symbol, interval="5min", limit=50 |
Intraday OHLCV bars (or raw ticks) for the latest session, PKT times. |
get_eod_history |
symbol, start_date?, end_date?, limit=260 |
Daily open/close/volume (~5 yrs). Works for indices. No high/low. |
get_ohlc_history |
symbol, month, year |
Full daily OHLCV for one month — the only free source of daily high/low. |
get_market_snapshot |
category="gainers", limit=15, sector? |
Top movers (gainers/losers/volume) plus market breadth. |
get_indices |
— | All ~18 PSX indices with change %. |
get_company_info |
symbol |
Business description, sector, market cap, shares, free float, P/E. |
get_dividends |
symbol, limit=10 |
Payout history (cash/bonus/rights) with book-closure dates. |
get_announcements |
symbol, limit=10 |
Recent corporate announcements with document (PDF) links. |
Resources: psx://symbols (full ticker directory), psx://sectors (sector names),
psx://indices (current index values).
Prompts: analyze_stock(symbol) (single-stock research brief),
market_overview() (today's market wrap).
Notes
- Prices are in PKR; timestamps are Pakistan Standard Time (UTC+5, no DST).
- PSX trades Monday–Friday, ~09:30–15:30 PKT. Outside those hours, quotes reflect the last session and intraday data may be empty.
- Responses are cached briefly (30 s intraday … 24 h for the symbol directory) to be polite to
the portal. Override the request identity with the
PSX_MCP_USER_AGENTenvironment variable.
Development
git clone https://github.com/ahmedraza-96/psx-mcp-server
cd psx-mcp-server
uv sync
uv run pytest # unit tests (mocked, offline)
uv run ruff check . && uv run ruff format --check .
# Live tests hit the real portal — run during PKT market hours:
uv run pytest -m live --override-ini "addopts="
# Re-record test fixtures if PSX changes its markup:
uv run python scripts/record_fixtures.py
Architecture: parsers/ are pure functions (raw response in, dataclasses out) tested against
committed fixtures in tests/fixtures/; client.py owns all HTTP I/O (caching, retries, error
mapping); tools.py composes the two into MCP tools. See
CHANGELOG.md for release history.
Disclaimer
This is an unofficial project and is not affiliated with or endorsed by the Pakistan Stock
Exchange. Data comes from the public PSX Data Portal (dps.psx.com.pk) and may be delayed or
inaccurate. For licensed or commercial market data, contact marketdatarequest@psx.com.pk.
Nothing here is investment advice.
License
MIT © Ahmed Raza
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。