Skip to main content
Glama
Finance Tools MCP

Finance Tools MCP

by VoxLink-org

finance-tools-mcp:财务分析MCP服务器

https://github.com/VoxLink-org/finance-tools-mcp

概述

finance-tools-mcp是一个模型上下文协议 (MCP) 服务器,旨在为大型语言模型 (LLM) 提供全面的财务洞察和分析能力。它由investor-agent修改而来,可与各种数据源和分析库集成,提供一套用于详细财务研究和分析的工具。

Related MCP server: Trading MCP Server

提供的工具

服务器通过 MCP 公开各种工具,允许连接的客户端(如 LLM)访问特定的财务数据并执行分析:

  • 股票数据工具:

    • get_ticker_data :提供给定股票代码的综合报告,包括概述、新闻、关键指标、表现、日期、分析师建议以及升级/降级。

    • get_options :检索股票代码未平仓合约最高的期权数据,并提供日期范围、执行价格和期权类型(看涨/看跌)的过滤选项。

    • get_price_history :获取指定时期的历史价格数据摘要,包括 OHLCV 样本、技术指标、风险指标和其他定量分析。

    • get_financial_statements :获取股票行情的财务报表(收入、余额、现金流),可按季度或年度获取。

    • get_institutional_holders :列出股票代码的主要机构和共同基金持有人。

    • get_earnings_history :提供股票盈利历史,包括估值和意外情况。

    • get_insider_trades :检索股票代码的近期内幕交易活动。

    • get_ticker_news_tool :获取特定股票代码的最新雅虎财经新闻。

  • 恐惧与贪婪指数工具:

    • get_current_fng_tool :获取当前 CNN 恐惧与贪婪指数得分和评级。

    • get_historical_fng_tool :检索指定天数的历史 CNN 恐惧与贪婪指数数据。

    • analyze_fng_trend :分析特定时期内 CNN 恐惧与贪婪指数的趋势。

  • 计算工具:

    • calculate :使用 Python 的数学语法和 NumPy 计算数学表达式。

  • 宏观数据工具:

    • get_current_time :提供当前时间。

    • get_fred_series :检索特定 FRED 系列 ID 的数据。

    • search_fred_series :按关键字搜索热门的 FRED 系列。

    • cnbc_news_feed :从 CNBC、BBC 和 SCMP 获取最新的世界新闻。

时间序列数据处理与优化

该服务器利用yfinance检索股票的历史价格数据(OHLCV,即开盘价、最高价、最低价、收盘价、成交量)。这些原始数据经过大量处理和分析,以提供有价值的见解,并特别针对法学硕士 (LLM) 的使用进行了优化。

时间序列数据处理的关键方面包括:

  • **全面分析:**使用ta-lib-python等库分析数据,计算各种技术指标。此外,自定义函数可计算基本统计数据、风险指标,识别常见图表模式,并计算斐波那契回撤位。

  • **结构化摘要:**此分析的结果被编译成易于 LLM 解析和理解的结构化摘要格式( generate_time_series_digest_for_LLM ),其中包括统计数据、摘要、技术指标、风险指标、模式、斐波那契水平和数据样本等部分。

  • **LLM 的智能采样:**为了向 LLM 提供具有代表性的历史数据视图,且不至于使上下文窗口过载,我们采用了“智能采样”策略 ( get_latest_data_sample )。此方法以不同的分辨率对数据进行采样:

    • **高分辨率:**每天都包含最新的数据点。

    • **中等分辨率:**每周对中间数据点进行采样。

    • **低分辨率:**每月对旧数据点进行采样。这种混合方法可确保 LLM 接收有关近期价格走势的详细信息,同时仍掌握长期趋势的背景信息,所有这些都在可控的数据点数量范围内。

这种对时间序列数据的优化处理和呈现使 LLM 能够快速掌握关键趋势、指标和模式,从而促进更明智的财务分析。

示例报告

替代文本

先决条件

  • Python: 3.10 或更高版本

  • 软件包管理器: uv

安装

首先,如果尚未安装uv ,请安装它:

curl -LsSf https://astral.sh/uv/install.sh | sh

然后,您可以使用uvx运行finance-tools-mcp MCP 服务器:

uvx finance-tools-mcp

如果您想使用自己的 FRED API 密钥,可以将其设置为环境变量:

FRED_API_KEY=YOUR_API_KEY uvx finance-tools-mcp

您还可以使用服务器发送事件(SSE)传输运行服务器:

uvx finance-tools-mcp --transport sse

或者使用 FRED API 密钥和 SSE 传输:

FRED_API_KEY=YOUR_API_KEY uvx finance-tools-mcp --transport sse

与 MCP 客户端一起使用

要将finance-tools-mcp与 MCP 客户端(例如 Claude Desktop)集成,请将以下配置添加到claude_desktop_config.json中:

{
  "mcpServers": {
    "investor": {
        "command": "path/to/uvx/command/uvx",
        "args": ["finance-tools-mcp"],
    }
  }
}

调试

您可以利用 MCP 检查器来调试服务器:

npx @modelcontextprotocol/inspector uvx finance-tools-mcp

或者

npx @modelcontextprotocol/inspector uv --directory  ./ run finance-tools-mcp

对于日志监控,请检查以下目录:

  • macOS: ~/Library/Logs/Claude/mcp*.log

  • Windows: %APPDATA%\Claude\logs\mcp*.log

发展

对于本地开发和测试:

  1. 按照调试部分中的说明使用 MCP 检查器。

  2. 使用 Claude Desktop 进行以下配置测试:

{
  "mcpServers": {
    "investor": {
      "command": "path/to/uv/command/uv",
      "args": ["--directory", "path/to/finance-tools-mcp", "run", "finance-tools-mcp"],
    }
  }
}

执照

此 MCP 服务器采用 MIT 许可证。详情请参阅许可证文件。

示例

待办事项

  • [ ] 添加股票支撑位和阻力位

  • [x] 为股票添加斐波那契回撤位

  • [ ] 添加股票移动平均汇合水平

  • [ ] 添加选项模型进行预测

  • [ ] 使用财务表和其他功能添加预测模型

数据源

  • fintel.com

  • 投资网站

  • 雅虎

  • fred.stlouisfed.org

  • CNN、CNBC 和 Reddit

Available Tools

17 tools
analyze_fng_trendA
Analyze trends in CNN Fear & Greed Index over specified days.

Parameters:
    days (int): Number of days to analyze (limited by available data).

Returns:
    str: A string containing the analysis results, including latest value,
         average value, trend direction, and number of data points analyzed.

Inputs: days (required).

calculateB

Calculate the result of a mathematical expression. Support python math syntax and numpy. > calculate("2 * 3 + 4") {'result': 10} > calculate("sin(pi/2)") {'result': 1.0} > calculate("sqrt(16)") {'result': 4.0} > calculate("np.mean([1, 2, 3])") {'result': 2.0}

Inputs: expression (required).

cnbc_news_feedB

Get the latest breaking world news from CNBC, BBC, and SCMP. Useful to have an overview for the day. Include the Fed rate prediction from Fed watch and key macro indicators.

Inputs: no named parameters.

get_current_timeA

Get the current time in ISO 8601 format.

Inputs: no named parameters.

get_earnings_historyC

Get earnings history with estimates and surprises.

Inputs: ticker (required).

get_financial_statementsC

Get financial statements. Types: income, balance, cash. Frequency: quarterly, annual.

Inputs: ticker (required), frequency, statement_type.

get_fred_seriesB

Get a FRED series by its ID. However the data is not always the latest, so use with caution!!!

Inputs: series_id (required).

get_historical_fng_toolB
Get historical CNN Fear & Greed Index data for a specified number of days.

Parameters:
    days (int): Number of days of historical data to retrieve (limited by the API).

Returns:
    str: Historical Fear & Greed Index values for the specified period.

Inputs: days (required).

get_insider_tradesC

Get recent insider trading activity.

Inputs: ticker (required).

get_overall_sentiment_toolB
Get comprehensive market sentiment indicators including:
- CNN Fear & Greed Index (score and rating)
- Market RSI (Relative Strength Index)
- VIX (Volatility Index)

Returns:
    str: Formatted string containing all three indicators with their current values

Inputs: no named parameters.

get_price_historyA

Get historical price data digest for specified period. There're two kinds of response mode: 1. The period mode. It will generate a digest for LLM consumption. Usually get at least 3 months, 6 months or more. The response includes OCHLCV samples, Technical Indicators (by ta-lib) , Risk Metrics, and other quantitative analysis. 2. The start_date and end_date mode. Once the start_date (yyyy-mm-dd) and end_date (yyyy-mm-dd) are specified, it will generate a raw OCHLCV data in the slot. And no digest will be generated in this mode. Useful for checking the price history of a specific short date range.

Inputs: ticker (required), end_date, period, start_date.

get_ticker_dataB

Get comprehensive report for ticker: overview, news, metrics, sector / industry valuation, performance, dates, analyst recommendations, and upgrades/downgrades.

Inputs: ticker (required).

get_ticker_news_toolB

For getting yahoo financial news of a ticker. Useful for getting latest news, especially for doing deep research.

Inputs: ticker (required).

get_top25_holdersC

Get top 25 institutional holders and their changes for a given stock ticker.

Inputs: ticker (required).

search_fred_seriesC

Search for the most popular FRED series by keyword. Useful for finding key data by name. Like GDP, CPI, etc. However the data is not always the latest.

Inputs: query (required).

social_media_feedA

Get most discussed stocks and investments opinions from reddit. Useful to know what investors are talking about. keywords is optional. Set keywords to match the specific topic you are interested in, by 'OR' operator, e.g. ['tsla', 'tesla'], ['tesla', 'spacex'], ['AAPL', 'apple', 'tim cook', 'cook'] No keywords will return the most discussed stocks and investments.

Inputs: keywords.

super_option_toolB
Analyzes and summarizes option data for a given ticker.

This function retrieves option indicators and Greeks for the specified ticker,
generates a digest summarizing key metrics, and formats a table of key option
data including last trade date, strike, option type, open interest, volume,
and implied volatility.

Args:
    ticker: Stock ticker symbol.

Inputs: ticker (required).

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.2/5.0

    Scored across 17 tools

    Disambiguation3/5

    Most tools have distinct purposes, but there is some overlap that could cause confusion. For example, get_historical_fng_tool and analyze_fng_trend both deal with Fear & Greed Index data, and get_ticker_data includes news while get_ticker_news_tool is specifically for news. However, descriptions help clarify differences, such as analyze_fng_trend focusing on trend analysis versus get_historical_fng_tool for raw data retrieval.

    Naming Consistency4/5

    The naming follows a consistent snake_case pattern with a verb_noun structure for most tools, like get_price_history and search_fred_series. There are minor deviations, such as calculate being a single verb and cnbc_news_feed using a noun_verb_noun pattern, but overall, the naming is predictable and readable.

    Tool Count4/5

    With 17 tools, the count is slightly high but reasonable for a finance domain that covers diverse areas like market data, news, sentiment, and analysis. It provides comprehensive coverage without being overwhelmingly large, though it borders on the heavy side for typical MCP server scopes.

    Completeness4/5

    The tool set offers broad coverage for financial analysis, including data retrieval (e.g., price history, financial statements), sentiment indicators, news feeds, and specialized tools like options analysis. Minor gaps exist, such as no explicit tools for portfolio management or trading actions, but agents can work around this with the available tools for core financial workflows.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      D
      maintenance
      An MCP server that provides comprehensive access to real-time stock quotes, financial statements, analyst estimates, and technical indicators via the Financial Modeling Prep API. It enables users to conduct in-depth financial analysis and track market performance through specialized tools, resources, and prompt templates.
      26
      47 npm
      1
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      A comprehensive MCP server for stock analysis and trading insights, including stock screening, fundamental analysis, insider trading, options analysis, social media research, and news analysis.
      10
      75
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      Comprehensive MCP server for real-time stock, cryptocurrency, options, and fundamental analysis, including SEC filings and insider trading data.
      26
      9 npm
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      An advanced MCP server for real-time worldwide stock market data, technical indicators, financials, news, and Python sandboxing with AI models, supporting US and Indian markets.
      29
      1
      MIT