gbs-finance-mcp-server
v1.0.0
Published
MCP server for GBS Finance API integration - provides financial market data, quotes, and analysis tools
Downloads
8
Maintainers
Readme
GBS Finance MCP Server
A Model Context Protocol (MCP) server that provides comprehensive financial market data, quotes, historical prices, and analysis tools. This server integrates with the GBS Finance API to deliver real-time and historical financial data for stocks, ETFs, REITs, and other securities.
Features
15 Financial Data Tools
Core Quote & Market Data:
finance_get_quote- Get single security quote with dividend yieldsfinance_get_quotes- Batch quotes for multiple symbols
Historical & Performance Data:
finance_get_history- Historical OHLC prices (period/interval)finance_get_histories- Multi-symbol historical pricesfinance_get_performances- Performance metrics across periods (1mo/ytd/1y/5y)
Security-Type Specific:
finance_get_etf_data- ETF metrics with expense ratios and returnsfinance_get_stock_data- Stock data with dividend informationfinance_get_reit_data- REIT data with gearing ratios
Financial Analysis:
finance_get_financial_analysis- Growth metrics & ratio analysisfinance_get_financials_history- All historical financial statementsfinance_get_earnings_estimates- Forward earnings projections
Singapore-Specific:
finance_get_ssb_projection- Singapore Savings Bond rate projectionfinance_get_fund_returns- Fullerton fund performancefinance_get_exchange_rate- Currency conversion ratesfinance_get_dividend_stats- Comprehensive dividend analysis
Installation
Prerequisites
- Node.js 18 or higher
- pnpm (recommended) or npm
- Access to GBS Finance API (default: http://localhost:8000)
Setup
Clone or navigate to the project directory:
cd gbs-finance-mcpInstall dependencies:
pnpm installConfigure environment (optional):
cp .env.example .env # Edit .env to set FINANCE_API_URL if different from defaultBuild the project:
pnpm run build
Usage
Running the Server
The MCP server communicates via stdio (standard input/output):
node dist/index.jsConfiguration with MCP Clients
Claude Desktop
Add to your Claude Desktop configuration file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"gbs-finance": {
"command": "node",
"args": [
"/absolute/path/to/gbs-finance-mcp/dist/index.js"
],
"env": {
"FINANCE_API_URL": "http://localhost:8000"
}
}
}
}Other MCP Clients
Configure according to your client's documentation, using:
- Command:
node - Args:
["/path/to/dist/index.js"] - Transport: stdio
Tool Examples
Get a Single Quote
{
"name": "finance_get_quote",
"arguments": {
"symbol": "AAPL",
"response_format": "markdown"
}
}Get Historical Prices
{
"name": "finance_get_history",
"arguments": {
"symbol": "AAPL",
"period": "1y",
"interval": "1d",
"response_format": "json"
}
}Compare Multiple ETFs
{
"name": "finance_get_etf_data",
"arguments": {
"symbols": ["SPY", "VOO", "QQQ"],
"response_format": "markdown"
}
}Analyze Financial Performance
{
"name": "finance_get_financial_analysis",
"arguments": {
"symbol": "AAPL",
"response_format": "markdown"
}
}Get Singapore Savings Bond Projection
{
"name": "finance_get_ssb_projection",
"arguments": {
"response_format": "markdown"
}
}Response Formats
All tools support two output formats:
Markdown (default)
Human-readable format with headers, tables, and formatting:
# Quote: AAPL
**Price**: USD 150.25
**Change**: USD 2.50 (1.69%)
...JSON
Machine-readable structured data:
{
"symbol": "AAPL",
"regularMarketPrice": 150.25,
"regularMarketChange": 2.50,
...
}Specify format using the response_format parameter: "markdown" or "json".
Development
Project Structure
gbs-finance-mcp/
├── src/
│ ├── index.ts # Main MCP server + all tool implementations
│ ├── constants.ts # API URLs, limits, enums
│ ├── types.ts # TypeScript type definitions
│ ├── schemas/
│ │ └── finance.ts # Zod validation schemas
│ └── utils/
│ ├── api.ts # HTTP client wrapper
│ └── format.ts # Response formatters
├── dist/ # Built JavaScript files
├── package.json
├── tsconfig.json
└── README.mdDevelopment Commands
# Development with auto-reload
pnpm run dev
# Build TypeScript to JavaScript
pnpm run build
# Clean build artifacts
pnpm run clean
# Run the server
pnpm startCode Quality
- Strict TypeScript: Full type safety enabled
- Zod Validation: Runtime input validation for all tools
- Error Handling: Comprehensive error messages with actionable guidance
- Response Limits: 25,000 character limit with graceful truncation
- Tool Annotations: All tools annotated with readOnlyHint, destructiveHint, idempotentHint, openWorldHint
Architecture
MCP Server Design
This server follows MCP best practices:
- Agent-Centric Design: Tools enable complete workflows, not just API wrappers
- Optimized for Context: Dual format support (Markdown/JSON) for efficient LLM consumption
- Actionable Errors: Error messages guide next steps
- Natural Task Subdivision: Tool names reflect how humans think about tasks
- Read-Only Operations: All tools are non-destructive with readOnlyHint=true
API Integration
The server connects to the GBS Finance FastAPI backend which:
- Fetches data from Yahoo Finance (yahooquery)
- Caches responses for performance
- Provides SGX-specific dividend calculations
- Integrates with Temporal workflows for data updates
- Stores data in MySQL database
Troubleshooting
Server Won't Start
Error: Cannot connect to finance API
- Ensure the GBS Finance API is running at the configured URL
- Check
FINANCE_API_URLenvironment variable - Default is
http://localhost:8000
Error: Module not found
- Run
pnpm installto install dependencies - Run
pnpm run buildto compile TypeScript
Data Issues
Error: Resource not found (404)
- Verify the symbol is correct and exists in the database
- Check if the security has been imported into the finance system
- Some symbols may only have limited data available
Response Truncated:
- Use pagination parameters (limit/offset) to fetch data in chunks
- Add filters to reduce result set size
- Use JSON format for more efficient data representation
API Requirements
This MCP server requires the GBS Finance API to be running. See the main gbs-finance project for:
- API setup instructions
- Database migrations
- Temporal worker configuration
- Data population workflows
License
MIT
Contributing
This server is part of the GBS Finance project. For issues or contributions, please refer to the main project repository.
Support
For questions or issues:
- Check the troubleshooting section above
- Review the main GBS Finance project documentation
- Ensure all dependencies are installed and up to date
Note: This is a read-only MCP server. All tools perform non-destructive data retrieval operations only. No data modifications are possible through this interface.
