Finance MCP Server
A Model Context Protocol (MCP) server written in Dart that provides financial data and analysis tools from SEC EDGAR.
This server exposes tools to fetch company information and financial statements, as well as prompts to guide LLMs in performing financial analysis.
Features
- Fetch Company Info: Get CIK, name, and tickers for a company.
- Fetch Financial Statements: Retrieve Balance Sheets, Income Statements, and Cash Flows (Annual/Quarterly) with up to 10 years of history.
- Fetch SEC Filings: Access 8-K, 10-K, and 10-Q filings for sentiment analysis.
- Financial Analysis Prompts: Built-in templates for comprehensive company analysis and stock comparisons.
- Multiple Transports: Supports both
stdio(default) andStreamableHTTP(SSE/Post) transports. - Modular Architecture: Clean separation of data, MCP protocol, and server logic.
- SEC Integration: Compliant with SEC EDGAR API requirements (User-Agent).
Tools
The server exposes the following tools:
get_company_info(ticker: string)- Retrieves metadata (CIK, name) for a given stock ticker.
get_financial_statements(ticker: string, period: string?, year: int?, years: int?)- Fetches comprehensive financial statements (Income, Balance Sheet, Cash Flow) with computed metrics (ROE, ROIC).
period:annual(default) orquarterly.year: Optional specific year to retrieve.years: Number of historical years to fetch (default: 5).
get_sec_filings(ticker: string, forms: string[]?, limit: int?, includeContent: bool?)- Retrieves SEC EDGAR filings lists and optionally full text content.
forms: List of form types (e.g.,['8-K', '10-K']).includeContent: If true, fetches the full text body of the filings (useful for sentiment analysis).
Prompts
The server provides structured prompts to help LLMs generate financial insights:
comprehensive_analysis- Generates a complete stock analysis covering financial health (profitability, balance sheet, cash flow), intrinsic value (DCF, P/E, ROE models), business quality (moat, management), sentiment (SEC filings, news), and an actionable investment thesis.
compare_stocks- Performs a side-by-side comparative analysis of multiple stocks across financial health, valuation, business quality, and sentiment.
Prerequisites
- Dart SDK (>=3.0.0)
Setup
Installation
-
Global installation (recommended for general use):
dart pub global activate finance_mcpOr for Dart 3.10+:
dart install finance_mcp -
Local installation (for development):
git clone https://github.com/leehack/finance-mcp.git cd finance_mcp dart pub get
Usage
Running the Server
Option 1: Stdio Transport (Default) Best for local use with Claude Desktop.
dart run bin/server.dart
Option 2: HTTP Transport Exposes an StreamableHTTPS endpoint for remote connections.
dart run bin/server.dart --transport http --port 3000
Running with Docker
- Build the image:
docker build -t finance-mcp .
Configuration (Claude Desktop & Other Clients)
1. Docker (Stdio) - Recommended
Run the server in a container managed by the client.
Add to mcp.json:
{
"mcpServers": {
"finance-docker": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"finance-mcp",
"--transport",
"stdio"
]
}
}
}
2. Docker (StreamableHTTP)
Run the server independently and connect via HTTP.
-
Start the container:
docker run -p 3000:3000 finance-mcp -
Add to
mcp.json:{ "mcpServers": { "finance-http": { "url": "http://localhost:3000/mcp" } } }
3. Local Dart (Development)
Run directly from source.
Add to mcp.json:
{
"mcpServers": {
"finance-local": {
"command": "dart",
"args": ["run", "/absolute/path/to/finance-mcp/bin/server.dart"]
}
}
}
4. Pub Global (Published Package)
If you installed via dart pub global activate finance_mcp:
Add to mcp.json:
{
"mcpServers": {
"finance-mcp": {
"command": "dart",
"args": ["pub", "global", "run", "finance_mcp"]
}
}
}
Note: Replace /absolute/path/to/finance-mcp with the actual path to your project.
Development
Running Tests
To run the full test suite (unit and integration tests):
dart test
Libraries
- data/constants/concept_mappings
- Concept mapping from standardized metrics to SEC XBRL tags.
- data/constants/constants
- Constants for financial data processing.
- data/data
- Data layer for the finance-mcp server.
- data/models/balance_sheet
- data/models/cash_flow_statement
- data/models/company_financials
- data/models/dcf_valuation
- data/models/financial_statements
- data/models/fiscal_period
- data/models/income_statement
- data/models/metric_history
- data/models/metric_value
- data/models/models
- Financial data models for SEC EDGAR data.
- data/models/sec_filing
- data/services/financial_data_service
- data/services/financial_parser
- Enhanced financial data parser.
- data/services/sec_client
- data/services/services
- Data services for financial data access and transformation.
- mcp/mcp
- MCP protocol components for the finance-mcp server.
- mcp/prompts/base_prompt
- Base class for MCP prompts with modular registration.
- mcp/prompts/compare_stocks_prompt
- Prompt for comparing multiple stocks using comprehensive analysis.
- mcp/prompts/comprehensive_analysis_prompt
- Comprehensive stock analysis prompt combining all analysis aspects.
- mcp/prompts/prompts
- MCP prompts for the finance-mcp server.
- mcp/resources/base_resource
- Base class for MCP resources with modular registration.
- mcp/resources/resources
- MCP resources for the finance-mcp server.
- mcp/server_config
- mcp/tools/base_tool
- Base class for MCP tools with dependency injection.
- mcp/tools/get_company_info
- mcp/tools/get_financial_statements
- mcp/tools/get_sec_filings
- mcp/tools/tools
- MCP tools for the finance-mcp server.