Sectors MCP Server
A Model Context Protocol (MCP) server that provides financial market data and analysis tools, with a focus on stock market sectors, indices, and company data. This server offers a comprehensive set of tools for accessing and analyzing financial market information.
Features
- Market Indices Data: Access to various stock market indices and their historical data
- Company Information: Detailed company reports, financials, and performance metrics
- Sector & Industry Analysis: Tools for analyzing companies by sector, subsector, and industry
- SGX (Singapore Exchange) Data: Specialized tools for Singapore Exchange listed companies
- Market Analysis: Tools for identifying top movers, most traded stocks, and growth companies
- Financial Reporting: Access to quarterly financials and reporting dates
Installation
- Ensure you have Node.js (v14 or later) and npm installed
- Clone this repository
- Install dependencies:
npm install
- Build the project:
npm run build
Configuration
Create a .env file in the root directory with the following variables:
SECTORS_API_BASE=your_api_base_url
SECTORS_API_KEY=your_api_key
Available Tools
Market Indices
fetch-index: Fetch data for a specific market indexfetch-index-daily: Get daily transaction data for an indexfetch-idx-market-cap: Retrieve historical market capitalization data
Company Data
fetch-company-report: Get detailed company reportsfetch-company-segments: Access company segment datafetch-listing-performance: View listing performance metricsfetch-quarterly-financials: Access quarterly financial statementsfetch-quarterly-financial-dates: Get reporting dates for financialsfetch-sgx-company-report: Specialized reports for SGX-listed companies
Sector & Industry Analysis
get-subsectors: List all available subsectorsfetch-subindustries: Get subindustry datafetch-industries: Access industry informationfetch-companies-by-subsector: Find companies by subsectorfetch-companies-by-subindustry: Find companies by subindustryfetch-companies-by-index: Get companies listed in a specific indexfetch-sgx-companies-by-sector: Find SGX-listed companies by sector
Market Analysis
fetch-top-companies: Get top companies by various metricsfetch-top-company-movers: Identify top gaining and losing stocksfetch-top-growth-companies: Find companies with highest growth metricsfetch-most-traded-stocks: Get most actively traded stocks
Usage
Running the Server
node build/index.js
Using with MCP Client
The server implements the Model Context Protocol, allowing it to be used with any MCP-compatible client. Example usage with an MCP client:
// Example client code
const client = new McpClient({
transport: new StdioTransport({
command: "node",
args: ["build/index.js"],
}),
});
// Connect to the server
await client.connect();
// Use available tools
const result = await client.callTool("fetch-company-report", {
ticker: "BBCA",
sections: "overview,financials",
});
Development
Project Structure
src/- Source codetools/- Individual tool implementationstypes/- TypeScript type definitionsutils/- Utility functionsconfig.ts- Configuration settingsindex.ts- Main server entry point
build/- Compiled JavaScript outputtsconfig.json- TypeScript configuration
Adding New Tools
- Create a new file in
src/tools/for your tool - Implement the tool following the pattern of existing tools
- Register the tool in
src/tools/registerTools.ts - Rebuild the project
Dependencies
@modelcontextprotocol/sdk: MCP server implementationzod: Schema validationtypescript: TypeScript compiler@types/node: TypeScript definitions for Node.js
Contributing
Contributions are welcome! Please open an issue or submit a pull request.