stock-market-mcp-server
v1.0.17
Published
Financial Datasets MCP Server for Stock Market API
Readme
Financial Datasets MCP Server
A Model Context Protocol (MCP) server implementation for the Financial Datasets API. This server allows language models to interact with stock market and cryptocurrency data through a standardized interface.
Features
- Query company information by ticker or CIK
- Retrieve historical stock prices and financial data
- Access company financial statements (income, balance sheet, cash flow)
- View financial metrics, ratios and press releases
- Get cryptocurrency price data and real-time snapshots
- Access financial prompts for company and crypto analysis
- Use templates for constructing financial data queries
- Seamless integration with Claude Desktop and other AI tools
Installation & Usage
Using npx (recommended)
The easiest way to use this package is through npx:
npx stock-market-mcp-server --api-key YOUR_API_KEYIf you don't provide an API key via the command line, you'll be prompted to enter one.
Additional options:
npx stock-market-mcp-server --helpUsing with Claude Desktop
To use with Claude Desktop:
- Open Claude Desktop
- Enable the Plugins feature
- In a terminal window, run:
npx stock-market-mcp-server --api-key YOUR_API_KEY - In Claude Desktop, click Add Plugin and connect to the MCP server
- Ask Claude to retrieve financial data about companies and crypto markets
Install from GitHub Packages
You can install the package from GitHub Packages with:
# Add this to your .npmrc file
@suhail-ak-s:registry=https://npm.pkg.github.com
# Then install the package
npm install @suhail-ak-s/stock-market-mcp-serverGlobal Installation
You can install the package globally using:
npm install -g stock-market-mcp-serverOr install directly from the GitHub repository:
npm install -g git+https://github.com/suhail-ak-s/stock-market.gitThen run:
stock-market-mcp-server --api-key YOUR_API_KEYThe API key will be stored securely for future use if you choose to save it.
Manual Installation
- Clone this repository
- Install dependencies:
npm install- Build the TypeScript code:
npm run build- Start the server:
node dist/index.js --api-key YOUR_API_KEYCommand Line Options
--api-key,-k(required): Your Financial Datasets API key--base-url,-u(optional): Custom API base URL (defaults to https://api.financialdatasets.ai)--debug,-d: Enable debug output--non-interactive,-n: Run in non-interactive mode (no prompt)--help,-h: Show help message
MCP Integration
This server implements the Model Context Protocol, allowing language models to:
- List available financial resources (stock & crypto tickers)
- Read company and cryptocurrency information
- Call tools to query financial data
- Access prompts for financial analysis
- Use templates for constructing queries
Tools
The server provides the following tools:
Stock Market Tools
get_company_facts: Get company facts including name, CIK, market cap, etc.get_stock_prices: Get historical stock prices for a companysearch_companies: Search for companies by name or industryget_company_news: Get news articles for a companyget_insider_trades: Get insider trades (buys and sells) for a companyget_stock_price_snapshot: Get real-time price snapshot for a tickerget_stock_prices_advanced: Get ranged price data with customizable intervalsget_sec_filings: Get a list of SEC filings for a company by ticker or CIK
Financial Data Tools
get_earnings_press_releases: Get company earnings press releasesget_financial_metrics: Get historical financial metrics for a companyget_insider_ownership: Get insider ownership for a companyget_institutional_ownership_by_ticker: Get institutional ownership by tickerget_institutional_ownership_by_investor: Get institutional ownership by investorget_institutional_investors: Get institutional investors for a companyget_sec_filing_items: Get SEC financial filing items in XBRL formatget_financial_metrics_snapshot: Get current financial metrics snapshotget_income_statements: Get company income statementsget_balance_sheets: Get company balance sheetsget_cash_flow_statements: Get company cash flow statementsget_all_financial_statements: Get all statements in a single callsearch_financials: Search for financial data across income statements, balance sheets, and cash flow statements using filters or retrieving specific line itemsget_segmented_revenues: Get detailed, segmented revenue data by product lines, business segments, and regions
Cryptocurrency Tools
get_crypto_prices: Get historical price data for a cryptocurrencyget_crypto_snapshot: Get the current price snapshot for a cryptocurrency
Prompts
The server provides the following analytical prompts:
analyze_company: Get a comprehensive analysis of a companymarket_overview: Get a market overview with key metrics and trendsanalyze_crypto: Get a comprehensive analysis of a cryptocurrencyanalyze_financial_statements: Get an analysis of company financial statements
Resource Templates
The server provides these templates for constructing financial data URIs:
company_profile: Template for viewing a company's profile (financial://company/{ticker})stock_prices: Template for viewing stock price history (financial://prices/{ticker}/{period})crypto_profile: Template for viewing cryptocurrency data (financial://crypto/{ticker})crypto_prices: Template for viewing cryptocurrency price history (financial://crypto/prices/{ticker}/{interval}/{interval_multiplier})earnings_press_releases: Template for viewing company earnings press releases (financial://earnings/{ticker}/press-releases)financial_metrics: Template for viewing company financial metrics (financial://metrics/{ticker}/{period})financial_statements: Template for viewing company financial statements (financial://financials/{ticker}/{statement_type}/{period})
Troubleshooting
If you encounter issues with the server:
Check the log files in your temporary directory:
/tmp/financial-mcp.log- Server logs/tmp/stock-market-debug.log- Debug logs
Run the diagnostics test:
npx -p stock-market-mcp-server stock-market-test --diagnosticsEnsure your API key is valid and has access to the Financial Datasets API
If using with Claude Desktop and having connection issues, try running in non-interactive mode:
npx stock-market-mcp-server --api-key YOUR_API_KEY --non-interactive
Development
For development, you can run the server directly using ts-node:
npm run dev -- --api-key YOUR_API_KEYEnvironment Variables
The server supports the following environment variables:
FINANCIAL_API_KEY: Your API key for the Financial Datasets APIFINANCIAL_API_BASE_URL: Custom API base URL (defaults to https://api.financialdatasets.ai)CLAUDE_API_KEY: Set by Claude Desktop for MCP context detection
Logging
The server logs all activity to temporary files:
/tmp/financial-mcp.log- Main server logs (Unix/macOS) or equivalent temporary directory on Windows/tmp/stock-market-debug.log- Debug logs for troubleshooting
Version History
- v1.0.14 - Fixed npm publishing issues and updated contributors section
- v1.0.12 - Fixed npm publishing and workflow issues
- v1.0.7 - Fixed ESM syntax issues in test script
- v1.0.6 - Enhanced npx compatibility and added diagnostics mode
- v1.0.5 - Improved Claude Desktop integration for MCP communication
- v1.0.4 - Initial public release
Note: Version numbers are automatically incremented by our GitHub Actions workflow on each successful merge to the main branch.
Contributors ✨
Thanks goes to these wonderful people (emoji key):
This project follows the all-contributors specification. Contributions of any kind are welcome!
License
This project is licensed under the MIT License - see the LICENSE file for details.
Copyright (c) 2025 Suhail AK. All rights reserved.
