cse-mcp
This server gives AI apps read-only access to live Colombo Stock Exchange data and announcements via MCP.
Get a whole-market snapshot: open/closed status, ASPI and S&P SL20, turnover, volume, and trades.
View top gainers, losers, and most actively traded stocks.
Search and rank listed stocks by name/ticker, turnover, % change, market cap, volume, or symbol.
Get a single stock's profile, ranges, market cap, foreign holding, beta, and price history.
Analyze today's trades by price level with VWAP.
View sector indices and index history for ASPI, S&P SL20, or sectors.
Get daily market stats including foreign/local flow, market P/E, P/BV, and dividend yield.
Browse and filter CSE announcements, including financial statements with PDF links.
All tools are read-only; they cannot place trades or change anything.
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., "@cse-mcp give me today's CSE market wrap"
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.
You: How did banks do today vs the ASPI? Anything interesting from COMB?
Claude: *checks get_market_overview, get_sector_indices, get_stock, get_announcements*
The ASPI closed +2.75% at 22,123. Banks did even better (+3.7%).
COMB ended at LKR 225.25 (+4.3%) on 1.5M shares...cse-mcp is an MCP server. MCP is a standard "plug" that lets AI apps use tools. This one connects your AI to the public data behind cse.lk, so its answers use current prices, indices and announcements.
⚡ Install (pick your app)
Claude Desktop: one click, nothing else to install
Download
cse-mcp-<version>.mcpbfrom the latest release.Double-click it (or drag it into Claude Desktop) and click Install.
Ask: "How's the CSE today?" 🎉
Claude Desktop sets up Python and everything else for you.
Claude Code
claude mcp add cse -- uvx cse-mcpOr install it as a plugin, which adds a market-analyst skill too:
/plugin install cse-mcp --marketplace lxnid/cse-mcpCursor, VS Code, Windsurf, Claude Desktop (manual), and other MCP apps
Add this to the app's MCP config:
{
"mcpServers": {
"cse": { "command": "uvx", "args": ["cse-mcp"] }
}
}This needs uv, the fast Python package manager (brew install uv, or see the link for Windows). Python itself is downloaded automatically.
It's also listed in the official MCP Registry as io.github.lxnid/cse-mcp, so apps that browse the registry can find it.
claude.ai on the web or phone?
Not yet. Web and mobile apps can only reach servers hosted on the internet, and this one runs on your computer. You can host it yourself with uvx cse-mcp --http behind an HTTPS URL (see Development below), then add that URL as a custom connector.
Related MCP server: CSE MCP Server
🧰 What your AI can do with it
Tool | What it gives you |
| Market open/closed, ASPI & S&P SL20, today's turnover/volume/trades |
| Top gainers, losers or most active stocks today |
| Search all listed stocks by name/ticker and sort by turnover, % change, market cap… |
| Full profile of one stock: price, ranges (week → all-time), market cap, foreign holding, beta |
| Price history: today (15-min bars), 1w, 1m, 3m or 1y |
| Today's volume at each price level, plus VWAP |
| Every S&P/CSE sector index, best to worst |
| ASPI / S&P SL20 / any sector index over time |
| Foreign vs local buying (net foreign flow), market P/E, P/BV, dividend yield |
| Dividends, financial statements (PDF links), circulars, non-compliance notices… |
All tools are read-only. They can't place trades or change anything.
Things to ask:
"Give me a market wrap for today."
"Were foreigners net buyers or sellers today?"
"Show me the top 10 most active stocks and which sectors they're in."
"How has HNB done over the past year vs the Banks index?"
"Any new quarterly results out today? Summarise the ones from plantations."
"Where did most of JKH's volume trade today?"
💡 Tickers are forgiving:
jkh,JKHandJKH.N0000all work. Non-voting shares useX0000(e.g.JKH.X0000).
🧠 How it works
Your AI ──MCP──▶ cse-mcp (on your computer) ──HTTPS──▶ www.cse.lk/api/*
│
└─ tidies the JSON: readable names, rounded numbers,
Sri Lanka time, 15-min bars, PDF links, 30s cachesrc/cse_mcp/client.py: talks to cse.lk (timeouts, errors, a 30-second cache)src/cse_mcp/server.py: the MCP tools (one function each, easy to read)tests/: offline tests with fake API responses, plus an opt-in live test
Endpoint reference: the community CSE API documentation.
⚠️ Good to know
Unofficial. Not affiliated with or endorsed by the Colombo Stock Exchange. The cse.lk API is public but undocumented, so it can change without notice. If a tool breaks, open an issue.
Private. It collects nothing. Requests go straight from your computer to cse.lk. See PRIVACY.md.
Be gentle. Responses are cached for 30 seconds so cse.lk isn't spammed. Please keep it that way.
Not financial advice. Data can be delayed or wrong, and AIs can misread numbers. Double-check before you trade.
Prices are in LKR. Times are Sri Lanka time (UTC+05:30). Trading runs Mon–Fri, 09:30–14:30.
🛠️ Development
git clone https://github.com/lxnid/cse-mcp.git && cd cse-mcp
uv sync
uv run pytest # offline tests (fast, no internet)
uv run pytest -m live # hit the real cse.lk API
uv run cse-mcp --http # serve over HTTP at http://127.0.0.1:8000/mcp
uv run mcp dev src/cse_mcp/server.py # poke the tools in the MCP Inspector (needs Node.js)To run your local copy in Claude Desktop, use "command": "uv", "args": ["--directory", "/ABSOLUTE/PATH/TO/cse-mcp", "run", "cse-mcp"].
Ideas, bug reports and PRs are welcome. See CONTRIBUTING.md.
📄 License
MIT: use it, fork it, build on it.
Available Tools
10 toolsget_announcementsAnnouncementsARead-onlyIdempotent
Latest CSE announcements, newest first.
- corporate: dividends, rights issues, AGMs, board changes, XD/payment dates
- financial: quarterly/annual financial statements (with PDF links)
- non_compliance, new_listings, buy_in_board: regulatory notices
- circulars, directives: CSE/SEC rule circulars and directives
`query` filters by company name, ticker or text (e.g. "JKH", "dividend").Inputs: limit, query, category. Returns: object
get_index_historyIndex historyARead-onlyIdempotent
History of a market or sector index. index can be "ASPI", "S&P SL20",
a sector name/symbol from get_sector_indices (e.g. "Banks", "BNK") or its
numeric index_id. period: "today" (minute data), "1w", "1m", "3m", "1y".
Inputs: index, period, max_points. Returns: object
get_market_daily_summaryDaily market summaryBRead-onlyIdempotent
End-of-day style market statistics: turnover, foreign vs domestic buying and selling (net foreign flow), market cap, market P/E, P/BV and dividend yield, number of companies traded.
Inputs: no named parameters. Returns: object
get_market_overviewMarket overviewARead-onlyIdempotent
Snapshot of the whole market right now: open/closed status, the ASPI and S&P SL20 indices (value, change, day range) and today's turnover, volume and trades. Best first call for "how is the market doing?".
Inputs: no named parameters. Returns: object
get_price_historyStock price historyARead-onlyIdempotent
Price history for one stock. period: "today" (15-minute bars), "1w",
"1m", "3m" or "1y" (daily bars). Includes a start/end/change/high/low
summary. Long series are thinned to max_points rows (0 = no limit).
Inputs: symbol (required), period, max_points. Returns: object
get_sector_indicesSector indicesARead-onlyIdempotent
All CSE sector indices (S&P/CSE industry groups such as Banks, Energy,
Capital Goods) with today's value, change and activity, best performers first.
The index_id can be passed to get_index_history.
Inputs: no named parameters. Returns: object
get_stockStock profileARead-onlyIdempotent
Full live profile of one stock: price and change, today's range and
volume, week/month/YTD/52-week/all-time highs and lows, market cap,
foreign holding, beta. symbol like "JKH", "JKH.N0000" or "COMB.X0000".
Inputs: symbol (required). Returns: object
get_top_moversTop moversBRead-onlyIdempotent
Today's biggest gainers, biggest losers, or most actively traded stocks.
Inputs: kind, limit. Returns: object
get_trades_by_priceToday's trades by priceARead-onlyIdempotent
Today's trading in one stock broken down by price level: how many shares and trades went through at each price, plus the volume-weighted average price (VWAP). Useful for spotting where the real buying/selling happened.
Inputs: symbol (required). Returns: object
list_stocksSearch and rank stocksARead-onlyIdempotent
Search and rank every listed stock with today's prices.
Use `query` to find symbols by company name or ticker (e.g. "bank", "hayleys", "JKH").
Sort by turnover, change_pct (best first), market_cap, volume or symbol.
Set limit=0 to return every match.Inputs: limit, query, sort_by. Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 10 tools
Most tools target clearly different query shapes: market snapshot, stock profile, stock/index histories, price-level trades, and announcements. get_top_movers overlaps somewhat with list_stocks sorted by change/volume, and get_market_overview is related to get_market_daily_summary, but the descriptions give clear routing cues.
All tool names use consistent snake_case verb_noun naming, overwhelmingly get_* plus one appropriately named list_stocks. The convention is predictable and resource-oriented.
Ten tools is well-scoped for a CSE market-data server, with each tool covering a distinct view such as market overview, stock search, index history, or announcements. There is no obvious filler or missing basic surface.
The surface covers core market workflows: overview, movers, stock search, stock profiles, price and index history, trades by price, daily statistics, and announcements. Minor gaps remain around order-book/depth data and deeper company fundamentals, but agents can work around them.
Maintenance
Related MCP Connectors
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
Live stock quotes, a stock screener, crypto prices and FX rates as agent tools.
Hosted MCP server for Indian NSE/BSE stock research: 59 tools for quotes, financials and ratios, peers, shareholding and pledge, filings with extracted facts, screens, F&O and FII/DII context. Source and freshness on every answer; no buy/sell calls.
Live crypto + IDX stock market intelligence for AI agents — 19 tools, no API key.
Related MCP Servers
- AlicenseAqualityDmaintenanceProvides real-time stock market data and company search functionality for the Colombo Stock Exchange (CSE). It enables AI assistants to retrieve current prices, change percentages, and ticker information for Sri Lankan listed companies.716 npm13ISC
- AlicenseAqualityDmaintenanceA Model Context Protocol server for the Colombo Stock Exchange that enables users to search listed companies, fetch stock quotes, and retrieve real-time market snapshots. It provides a structured interface for AI tools to access CSE data, including top gainers, losers, and index summaries.757 npm3ISC
- FlicenseNot gradedqualityDmaintenanceEnables querying real-time and historical Colombo Stock Exchange data, including prices, sectors, top movers, and technical indicators like RSI and MACD, for AI-assisted market analysis.1-
- AlicenseNot gradedqualityCmaintenanceEnables AI assistants to research Indian stock markets by accessing NSE/BSE corporate filings with measured price reactions, fundamentals, a 108-metric screener, IPO pipeline, FPI flows, results calendar, and daily market briefings through MCP tools.2MIT