CSE MCP Server
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 Serverwhat's the current stock price of John Keells Holdings?"
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.
CSE MCP Server
A Model Context Protocol (MCP) server that provides real-time stock market data from the Colombo Stock Exchange (CSE). This server enables AI assistants to search for companies and retrieve current stock prices from the Sri Lankan stock market.
Features
Company Search: Search for CSE-listed companies by name or symbol with fuzzy matching
Real-time Stock Data: Get current price, change, and percentage change for any CSE ticker
Fuzzy Matching: Find companies even with typos or partial names
308 Companies: Complete database of all CSE-listed companies
Related MCP server: StockQuotes MCP
Installation with MCP Clients
Claude Desktop / Claude Code
Using Claude CLI (Recommended)
claude mcp add cse-mcp -- npx cse-mcpManual Configuration
Alternatively, add to your Claude configuration (~/Library/Application Support/Claude/claude_desktop_config.json on Mac):
{
"mcpServers": {
"cse": {
"command": "npx",
"args": ["cse-mcp"]
}
}
}Other MCP Clients
Use the following command configuration:
Command:
npxArguments:
["cse-mcp"]
Available Tools
1. search_company
Search for companies listed on the Colombo Stock Exchange.
Input:
query(string): Company name or symbol to search
Features:
Returns top 3 matches using fuzzy search
Searches both symbol and company name
Handles typos and partial matches
Example:
{
"query": "john keells"
}Response:
{
"query": "john keells",
"count": 3,
"companies": [
{
"id": 297,
"symbol": "JKH.N0000",
"name": "JOHN KEELLS HOLDINGS PLC"
},
{
"id": 596,
"symbol": "JKL.N0000",
"name": "JOHN KEELLS HOTELS PLC"
},
{
"id": 556,
"symbol": "JKPL.N0000",
"name": "JOHN KEELLS PLC"
}
],
"note": "Top 3 matches using fuzzy search"
}2. get_stock_data
Get real-time stock price data for a specific ticker symbol.
Input:
symbol(string): Exact ticker symbol (e.g., "JKH.N0000")
Features:
Validates symbol against company database
Fetches real-time data from CSE API
Returns price in Sri Lankan Rupees (Rs.)
Example:
{
"symbol": "JKH.N0000"
}Response:
{
"symbol": "JKH.N0000",
"companyName": "JOHN KEELLS HOLDINGS PLC",
"price": "Rs. 22.20",
"change": "-0.10",
"changePercentage": "-0.45%",
"lastUpdated": "2024-12-17T10:30:00.000Z"
}Development
Prerequisites
Node.js 16 or higher
npm or yarn
Building from Source
# Clone the repository
git clone https://github.com/Shaveen12/cse-mcp.git
cd cse-mcp
# Install dependencies
npm install
# Build TypeScript
npm run build
# Run in development mode (watches for changes)
npm run dev
# Test locally with MCP Inspector
npx @modelcontextprotocol/inspector node dist/index.jsProject Structure
cse-mcp/
├── src/
│ └── index.ts # Main server implementation
├── bin/
│ └── cse-mcp.js # CLI entry point
├── dist/ # Compiled JavaScript (generated)
├── cse_companies.csv # Company database
├── package.json
├── tsconfig.json
└── README.mdAPI Rate Limits
The CSE API has the following considerations:
No authentication required
Reasonable rate limiting is recommended
Timeout set to 10 seconds per request
Data Source
Company data and real-time prices are sourced from the Colombo Stock Exchange.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Fork the repository
Create your feature branch (
git checkout -b feature/AmazingFeature)Commit your changes (
git commit -m 'Add some AmazingFeature')Push to the branch (
git push origin feature/AmazingFeature)Open a Pull Request
License
This project is licensed under the ISC License - see the package.json file for details.
Disclaimer
This tool is for informational purposes only. Stock market data may be delayed. Always verify data with official sources before making investment decisions.
Support
For issues, questions, or suggestions, please open an issue on GitHub.
Acknowledgments
Colombo Stock Exchange for providing the data API
Model Context Protocol for the MCP SDK
Available Tools
7 toolsget_detailed_company_infoGet Detailed Company InfoA
Get comprehensive company information including 52-week high/low, YTD metrics, market cap, and beta values. Use search_company first to find the correct symbol.
Inputs: symbol (required).
get_market_summaryGet Market SummaryA
Get the overall market summary including total trade volume, share volume, and trade date.
Inputs: no named parameters.
get_most_active_stocksGet Most Active StocksA
Get the top 10 most actively traded stocks by volume in the CSE for the current trading day.
Inputs: no named parameters.
get_stock_dataGet Stock DataA
Get real-time stock price data for a specific CSE ticker symbol. Use search_company first to find the correct symbol.
Inputs: symbol (required).
get_top_gainersGet Top GainersA
Get the top 10 gaining stocks in the CSE for the current trading day.
Inputs: no named parameters.
get_top_losersGet Top LosersA
Get the top 10 losing stocks in the CSE for the current trading day.
Inputs: no named parameters.
search_companySearch CompanyA
Search for Colombo Stock Exchange companies by name or symbol. Uses fuzzy matching to return the 3 closest matches.
Inputs: query (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
TDQS
Scored across 7 tools
Tools are mostly distinct: search_company finds symbols, get_stock_data provides real-time price, get_detailed_company_info gives comprehensive data, and the remaining four cover market overviews. There is a slight overlap between get_stock_data and get_detailed_company_info (both include price data), but descriptions clarify the difference.
All tool names follow a consistent 'get_' prefix with descriptive snake_case noun phrases (e.g., get_detailed_company_info, get_most_active_stocks). No mixing of conventions or vague verbs.
7 tools is well-scoped for a stock exchange MCP server. It provides a focused set covering search, individual stock data, company info, and market summaries without being overly numerous or sparse.
The tool set covers basic read operations (search, price, details, market summary, top movers) but lacks historical data, time series, or order book information. While functional for common queries, there are notable gaps for more advanced analysis.
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
Fetch current stock prices and key data for symbols across global markets. Look up companies like…
Live stock quotes, a stock screener, crypto prices and FX rates as agent tools.
Look up the latest stock prices by ticker symbol across global markets. Get current price and esse…
Related MCP Servers
- 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.752 npm3ISC
- AlicenseNot gradedqualityCmaintenanceProvides real-time stock quotes, historical data, and stock search via Yahoo Finance, enabling AI assistants to access and analyze financial market data.17 npm19MIT
- 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-
- FlicenseAqualityDmaintenanceEnables real-time and historical Indian stock market data retrieval, including prices, news, recommendations, and top gainers/losers.11-