PSX Market Data

MCP and HTTP · one key

Two doors, one key.

AI tools talk to the MCP endpoint. Everything else can use plain HTTP. The same key opens both, and both share the same limits.

For AI tools

MCP endpoint

Cursor, ChatGPT, and any client that speaks MCP.

http://127.0.0.1:8000/mcp

For programs

HTTP API

Scripts, notebooks, spreadsheets, and dashboards.

http://127.0.0.1:8000/v1
01

The headerOne line on every call.

Every call sends one header. The value is the word Bearer, one space, then your key.

Authorization: Bearer YOUR_KEY

Replace YOUR_KEY with the key from your account page. New here? Read the full steps first.

02

Call it from an AI toolMCP tools by name.

curl -X POST "http://127.0.0.1:8000/mcp" \
  -H "Authorization: Bearer YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"get_stock","arguments":{"symbol":"SYS"}}}'

Tools you can ask for by name:

ToolWhat it returns
get_stockProfile, last saved session, fundamentals, and payouts for one symbol. Add include “quote” or “technicals” for a live figure.
get_stock_historyDaily prices for a symbol, up to 2,000 rows and 3,650 days back.
get_stock_dividendsEvery saved payout for a symbol, newest first.
list_stocksThe saved symbol list with name, sector, and Shariah flag.
list_indices / get_indexThe 10 saved indices and their price history.
list_fundamental_metricsThe 42 metric codes with plain names, units, and definitions.
describe_archiveCounts of what is saved: symbols, prices, actions, fundamentals, indices.
get_market_overviewLive gainers, losers, sectors, forex, and gold rates.
get_news / get_stock_announcementsLive market news and company announcements.
get_market_sentiment / get_stock_scoreLive trending discussion and score rankings.
list_mutual_funds / get_mutual_fund / list_etfsLive fund and ETF data. These are not in the archive.
get_forex / get_crypto / get_commoditiesLive currency, crypto, and commodity figures.
03

Call it over plain HTTPSaved files only, never live.

curl -H "Authorization: Bearer YOUR_KEY" \
  "http://127.0.0.1:8000/v1/symbols/SYS/history?days=30"

/v1 reads the saved files only. It never fetches a live figure, so history answers stay fast and steady.

PathWhat it returns
GET /v1/symbolsPages of the symbol list. offset, limit up to 500.
GET /v1/symbols/{SYMBOL}Profile and row counts for one symbol.
GET /v1/symbols/{SYMBOL}/historyPrice rows. days 1–3650, limit up to 1000 (default 250), before=YYYY-MM-DD to page back.
GET /v1/symbols/{SYMBOL}/corporate-actionsAll saved payouts for the symbol.
GET /v1/symbols/{SYMBOL}/fundamentalsAll saved fundamental rows for the symbol.
GET /v1/indicesThe saved indices and their last session.
GET /v1/indices/{SYMBOL}/historySaved index prices, same paging as stock history.
GET /v1/metricsThe 42 fundamental codes with units and definitions.
GET /v1/archiveCounts of everything saved.
04

What every answer looks likeOne envelope everywhere.

{
  "ok": true,
  "partial": false,
  "origin": "archive",
  "asOf": "2026-11-14T12:00:00+00:00",
  "disclaimer": "Market data is provided as-is and is not investment advice.",
  "data": {}
}

origin is archive, live, or mixed. partial is true when a live figure failed and the saved figures still came back. asOf is when the server built the answer; the trading session is the date inside a price row.

05

Errors you can getWhy, and what to do.

CodeWhy, and what to do
400The query was bad — a symbol with a dot or space, or days out of range. Fix the query.
401The key is missing, revoked, or not yet known to the data server. Check the header format first.
404The symbol is not in the archive. Check the spelling against GET /v1/symbols.
429Over 5 calls in a minute, 100 in a day, or 1,000 in a month. Wait for the next minute, day, or month; the call did not read any data.
500Something failed on the server. Try again; if it keeps failing, the saved files are unaffected.

Free keys allow 5 calls a minute, 100 calls a day, and 1,000 calls a month across both doors. Symbols are 1–20 letters or digits, and lowercase works. See what is inside the archive and the disclaimer.

Ask your first question in the next five minutes.

Free to start. Upgrade only when you need more calls.