psxdata-mcp is a Model Context Protocol (MCP) server that gives AI assistants Pakistan Stock Exchange data. It runs on your machine in Docker, is built on the psxdata Python SDK, and works with any MCP client: Claude Code, Claude Desktop, Cursor, VS Code, Windsurf, Codex, Gemini CLI and others.
Ask questions in plain language and the assistant does the rest:
- “How has OGDC done against the KSE-100 constituents this year?”
- “Which cement stocks have a P/E under 6?”
- “Write me a market wrap for today.”
How it works
1
The assistant loads data
It calls a
load_* tool, for example load_prices(["OGDC", "PPL"]) or load_index("KSE100"). The server fetches the data from PSX through the psxdata SDK and writes it to a table in a private, in-memory DuckDB database.2
The assistant queries it with SQL
It answers your question with
query(sql): returns, averages, rankings and joins all run in DuckDB, and only the result (at most 200 rows) comes back to the model.3
Everything resets at the end of the session
Loaded tables live in memory and disappear when the assistant session ends. Historical prices are cached on disk in a Docker volume, so the next session loads them without downloading again.
What’s available
See the tools reference for every tool and its limits, and skills for the ready-made analysis workflows (tearsheet, screen, compare, market wrap) that ship with the server.
Requirements
- Docker (Docker Desktop on macOS and Windows). The image is
mtauha/psxdata-mcpon Docker Hub. - An MCP client. Setup instructions for the common ones are in Local setup.
Good to know
- Prices are in PKR and not adjusted for splits, bonus issues or dividends. A bonus issue shows up as a sudden price drop. The bundled playbook tells the assistant how to handle this.
- Live data is a 15-minute snapshot. The screener, sector summary and quotes refresh every 15 minutes. Historical prices are cached in the
psxdata-cacheDocker volume and downloaded once per symbol. - Data is scraped from the public PSX website. It isn’t an official feed, and the server tells the assistant to treat table contents as data, never as instructions.
- Queries are sandboxed. DuckDB runs in memory with file and network access disabled, a 1 GB memory limit, 2 threads and a 30-second timeout per query. The assistant can create its own views and tables but can’t read or write files on your machine.
- No API key, no account. The server talks to PSX directly from your machine, so the REST API rate limit doesn’t apply.
Set it up
Install the server and connect it to your assistant in a couple of minutes.