
PSX MCP
io.github.revolutionarybukhari由 GitHub 帳號 revolutionarybukhari 發布v0.1.1更新於 Oct 27, 2026
Pakistan Stock Exchange in plain English — quotes, dividends, announcements, and indices.
概覽
唯讀的 MCP 伺服器,讓助理用自然語言查詢巴基斯坦證券交易所的報價、股利、公告與指數。
- 可以做什麼
- 查詢個股目前價格快照,並依公司名稱模糊比對股票代號
- 列出即將發放的股利與推算的買進截止日,查看歷年配息,並依最低配息比例篩選股票
- 取得近期公司公告與文件,附 PDF 連結
- 讀取 KSE100、KSE30、KMI30、ALLSHR、PSXDIV20 等指數點位,並判斷市場目前是否開市
- 提供市場狀態、指數、即將發放股利等唯讀資源,以及股利交易分析、持股檢視、機會篩選等範本化提示
- 適用情境
- 適合巴基斯坦市場研究:查看報價、依 T+2 買進截止日規劃股利交易、檢視持股組合,或彙整某公司近期公告。
- 執行需求
- 以本機 Python 套件形式執行(需 Python 3.10 以上),可從 PyPI 或使用 uv 安裝;不需要 API 金鑰或驗證。需要連線至公開的 PSX 資料入口網站(以擷取網頁方式取得資料)。也可啟動為本機 HTTP 伺服器供共用。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 PSX MCP,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
psx-mcp
[CI] [PyPI] [Python] [License] [MCP]
mcp-name: io.github.revolutionarybukhari/psx-mcp
Talk to the Pakistan Stock Exchange in plain English.
psx-mcp is a Model Context Protocol server that exposes PSX market data — quotes, dividends, announcements, indices — as tools any MCP-compatible AI client can call. Connect it to Claude Desktop, Cursor, ChatGPT, or your own agent, and ask questions like:
"What are the upcoming dividends on PSX with payouts above 100%?"
"Should I buy MEBL today to collect the dividend?"
"Pull recent announcements for OGDC and summarize anything material."
"How has FFC's dividend history looked over the past 5 years?"
The LLM picks the right tools automatically and answers in your language.
Why MCP?
Existing PSX tools are libraries — you import them, write code, get data. MCP servers are tools an LLM calls for you. You ask in English, the model invokes get_quote, get_upcoming_dividends, get_dividend_history, and synthesizes an answer. No Python required for the end user.
This is also the first PSX MCP server published. If you're building agents, financial copilots, or AI-augmented research workflows for Pakistani markets, this gives them eyes.
What's exposed
Tools (LLM-callable)
Resources (read-only context)
psx://market-statuspsx://indicespsx://upcoming-dividends
Prompts (templated workflows)
analyze_dividend_play(symbol)— full dividend-trade analysisportfolio_review(symbols)— review a holdings listfind_dividend_opportunities(min_payout_pct)— screener + per-name analysis
Install
Requires Python 3.10+.
Connect to Claude Desktop
Edit your Claude Desktop config:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json
Restart Claude Desktop. You should see the PSX tools listed in the connection icon. Try:
"What dividends are coming up this week on PSX?"
Connect to Cursor
Settings → MCP → add server:
Run as remote HTTP server
For shared/team use or hosted agents:
The server is then reachable at http://localhost:8000/mcp. Test it with the MCP Inspector:
Example prompts to try
Once connected:
How it works
Tools call the public PSX Data Portal, parse HTML with BeautifulSoup, normalize into structured JSON, and return to the LLM. No keys, no auth, no scraping headaches for the consumer.
Architecture notes
- Async everywhere. All scraper functions use
httpx.AsyncClientso MCP calls don't block. - Symbol cache. The full PSX symbol list is cached for 24h to make
search_symbolsfast. - Trading-day math. Buy-deadline calculation uses
BC_From − 2 trading days, skipping weekends and configurable holidays individend_calc.PSX_HOLIDAYS_2026. - No persistence. This server is stateless. State (alerts, watchlists) belongs in your client.
Pairs well with
This is one server in a wider PSX open-source toolkit:
psx-dividend-alert— proactive Telegram alerts for upcoming dividendspsx-cgt-calculator— Pakistan capital-gains-tax with FIFO lotspsx-zakat-calculator— zakat on stock holdings (zakatable assets method)psx-broker-statement-parser— normalize KTrade/AKD/JS Global PDFspsx-announcements-summarizer— LLM-powered summaries of every PSX filing
The MCP server makes all of these LLM-callable. Pair them and you have a complete conversational PSX research stack.
Limitations / honest notes
- PSX data is delayed ~5 minutes. Same as the public Data Portal.
- Scraping is fragile. If PSX changes their HTML, parsers will need updating. PRs welcome.
- No order placement. This is read-only. There's no path here that puts trades on the wire — by design.
- Holiday list is stub. Edit
PSX_HOLIDAYS_2026individend_calc.pyonce PSX publishes the annual calendar. Without it, the buy-deadline math correctly skips weekends but will be off during Eid/Independence Day weeks. - Personal use. PSX terms restrict commercial redistribution of market data without a license. Email
[email protected]if you need one.
Contributing
- Add a tool: write the function in
scraper.py, expose it inserver.pywith@mcp.tool(), add a docstring (the docstring becomes the LLM's tool description — make it clear). - Add a test: drop async tests in
tests/. The MCP SDK supports in-memory testing. - File issues for HTML parser breakage with the failing URL and a snippet.
License
MIT. See LICENSE.
來源:README.md,提交 4beac6c
工具
0版本歷史
1- v0.1.1最新Sep 16, 2026
評分
已滿足適用檢查項的 40%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分
請在儲存庫或註冊中心條目中宣告授權條款。