stock-market-mcp-server

stock-market-mcp-server

Enables LLMs to access stock market and cryptocurrency data through the Financial Datasets API, including financial statements, prices, metrics, and press releases.

Category
访问服务器

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_KEY

If 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 --help

Using with Claude Desktop

To use with Claude Desktop:

  1. Open Claude Desktop
  2. Enable the Plugins feature
  3. In a terminal window, run:
    npx stock-market-mcp-server --api-key YOUR_API_KEY
    
  4. In Claude Desktop, click Add Plugin and connect to the MCP server
  5. 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-server

Global Installation

You can install the package globally using:

npm install -g stock-market-mcp-server

Or install directly from the GitHub repository:

npm install -g git+https://github.com/suhail-ak-s/stock-market.git

Then run:

stock-market-mcp-server --api-key YOUR_API_KEY

The API key will be stored securely for future use if you choose to save it.

Manual Installation

  1. Clone this repository
  2. Install dependencies:
npm install
  1. Build the TypeScript code:
npm run build
  1. Start the server:
node dist/index.js --api-key YOUR_API_KEY

Command 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:

  1. List available financial resources (stock & crypto tickers)
  2. Read company and cryptocurrency information
  3. Call tools to query financial data
  4. Access prompts for financial analysis
  5. Use templates for constructing queries

Tools

The server provides the following tools:

Stock Market Tools

  1. get_company_facts: Get company facts including name, CIK, market cap, etc.
  2. get_stock_prices: Get historical stock prices for a company
  3. search_companies: Search for companies by name or industry
  4. get_company_news: Get news articles for a company
  5. get_insider_trades: Get insider trades (buys and sells) for a company
  6. get_stock_price_snapshot: Get real-time price snapshot for a ticker
  7. get_stock_prices_advanced: Get ranged price data with customizable intervals
  8. get_sec_filings: Get a list of SEC filings for a company by ticker or CIK

Financial Data Tools

  1. get_earnings_press_releases: Get company earnings press releases
  2. get_financial_metrics: Get historical financial metrics for a company
  3. get_insider_ownership: Get insider ownership for a company
  4. get_institutional_ownership_by_ticker: Get institutional ownership by ticker
  5. get_institutional_ownership_by_investor: Get institutional ownership by investor
  6. get_institutional_investors: Get institutional investors for a company
  7. get_sec_filing_items: Get SEC financial filing items in XBRL format
  8. get_financial_metrics_snapshot: Get current financial metrics snapshot
  9. get_income_statements: Get company income statements
  10. get_balance_sheets: Get company balance sheets
  11. get_cash_flow_statements: Get company cash flow statements
  12. get_all_financial_statements: Get all statements in a single call
  13. search_financials: Search for financial data across income statements, balance sheets, and cash flow statements using filters or retrieving specific line items
  14. get_segmented_revenues: Get detailed, segmented revenue data by product lines, business segments, and regions

Cryptocurrency Tools

  1. get_crypto_prices: Get historical price data for a cryptocurrency
  2. get_crypto_snapshot: Get the current price snapshot for a cryptocurrency

Prompts

The server provides the following analytical prompts:

  1. analyze_company: Get a comprehensive analysis of a company
  2. market_overview: Get a market overview with key metrics and trends
  3. analyze_crypto: Get a comprehensive analysis of a cryptocurrency
  4. analyze_financial_statements: Get an analysis of company financial statements

Resource Templates

The server provides these templates for constructing financial data URIs:

  1. company_profile: Template for viewing a company's profile (financial://company/{ticker})
  2. stock_prices: Template for viewing stock price history (financial://prices/{ticker}/{period})
  3. crypto_profile: Template for viewing cryptocurrency data (financial://crypto/{ticker})
  4. crypto_prices: Template for viewing cryptocurrency price history (financial://crypto/prices/{ticker}/{interval}/{interval_multiplier})
  5. earnings_press_releases: Template for viewing company earnings press releases (financial://earnings/{ticker}/press-releases)
  6. financial_metrics: Template for viewing company financial metrics (financial://metrics/{ticker}/{period})
  7. financial_statements: Template for viewing company financial statements (financial://financials/{ticker}/{statement_type}/{period})

Troubleshooting

If you encounter issues with the server:

  1. Check the log files in your temporary directory:

    • /tmp/financial-mcp.log - Server logs
    • /tmp/stock-market-debug.log - Debug logs
  2. Run the diagnostics test:

    npx -p stock-market-mcp-server stock-market-test --diagnostics
    
  3. Ensure your API key is valid and has access to the Financial Datasets API

  4. 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_KEY

Environment Variables

The server supports the following environment variables:

  • FINANCIAL_API_KEY: Your API key for the Financial Datasets API
  • FINANCIAL_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):

<table> <tbody> <tr> <td align="center" valign="top" width="14.28%"> <a href="https://github.com/suhail-ak-s"> <img src="https://avatars.githubusercontent.com/u/157091287?v=4" width="100px;" alt="Suhail AK"/> <br /> <sub><b>Suhail AK</b></sub> </a> <br /> <a href="#code-suhail" title="Code">💻</a> <a href="#design-suhail" title="Design">🎨</a> <a href="#doc-suhail" title="Documentation">📖</a> </td> </tr> </tbody> </table>

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.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选