Skip to main content
Glama
robinhood-mcp

robinhood-mcp

drasticstatic 工作副本 — 由 Fortuna 交易系统 使用。这是一个从 verygoodplugins/robinhood-mcp 的本地克隆创建的独立仓库。上游仓库被追踪为远程仓库以供自愿对比 — 更改在应用前会经过审查。

# Check for upstream updates (review before applying)
git fetch upstream && git log upstream/main --oneline

robinhood-mcp

Ask DeepWiki PyPI version License: MIT Python 3.11+ MCP

一个用于 Robinhood 投资组合研究的只读 MCP 服务器。封装了 robin_stocks,让 AI 助手能够访问您的投资组合数据进行分析。

⚠️ 仅限研究工具 - 此服务器提供只读访问权限。不提供任何交易功能。

⚠️ 非官方 API - 使用 robin_stocks 非官方 API。可能会在不另行通知的情况下失效。使用风险自负。

您可以用它做什么?

连接后,您可以与 Claude 进行关于您投资组合的自然对话:

投资组合健康检查

“帮我检查一下我的投资组合健康状况。我的总价值是多少,行业集中度如何,有哪些持仓涨跌幅较大?”

Claude 将提取您的持仓,计算行业敞口,识别表现最好和最差的资产,并标记任何集中度风险。

买入前研究

“我正在考虑增加 NVDA 的持仓。请向我展示其基本面、近期新闻、分析师评级以及过去一年的表现。”

获取综合研究,在一次回复中结合价格历史、市盈率、财报日期和分析师情绪。

比较投资

“比较我投资组合中的邮轮公司 - 并排展示 CCL、RCL 和 NCLH 的市盈率、市值和年初至今的表现。”

快速评估类似持仓以识别相对价值。

股息分析

“我今年收到了哪些股息?我的哪些持仓支付股息,它们的收益率是多少?”

追踪您的被动收入并识别投资组合中的股息机会。

风险评估

“我对能源行业的敞口是多少?我在前 5 大持仓中的集中度如何?”

分析行业集中度并识别可能超配的持仓。

财报日历

“我的哪些持仓在未来两周内有财报发布?”

通过个性化日历提前应对财报波动。

业绩归因

“分析我的投资组合回报。是什么在驱动我的收益和亏损?”

了解哪些持仓对您的业绩贡献最大。

自选股研究

“提取我自选列表中所有股票的报价和基本面。现在有哪些看起来很有趣?”

批量研究您正在追踪的股票。

Related MCP server: Public.com MCP Server

安装

pip install robinhood-mcp

或者直接使用 uvx 运行:

uvx robinhood-mcp

配置

环境变量

export ROBINHOOD_USERNAME="your_email"
export ROBINHOOD_PASSWORD="your_password"
export ROBINHOOD_TOTP_SECRET="your_2fa_secret"  # Only if you use authenticator app

注意: 如果您在 Robinhood 上使用 Face ID、Touch ID 或密码登录(没有身份验证器应用),则不需要 ROBINHOOD_TOTP_SECRET。

Claude Desktop

添加到 ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "robinhood": {
      "command": "uvx",
      "args": ["robinhood-mcp"],
      "env": {
        "ROBINHOOD_USERNAME": "your_email",
        "ROBINHOOD_PASSWORD": "your_password"
      }
    }
  }
}

Claude Code

claude mcp add robinhood -- uvx robinhood-mcp

可用工具

工具

描述

robinhood_get_portfolio

投资组合价值、权益、购买力、日内变动

robinhood_get_positions

所有持仓的成本基础、当前价值、盈亏

robinhood_get_position

按代码查询单个持仓的份额、价值和盈亏

robinhood_get_watchlist

您自选列表中的股票

robinhood_get_quote

实时价格、买入/卖出价、成交量

robinhood_get_fundamentals

市盈率、市值、股息收益率、52 周区间

robinhood_get_historicals

OHLCV 价格历史(日/周/月/年)

robinhood_get_news

某代码的近期新闻文章

robinhood_get_earnings

财报日期、每股收益预测、实际值

robinhood_get_ratings

分析师买入/持有/卖出评级

robinhood_get_dividends

股息支付历史

robinhood_get_options_positions

当前期权持仓

robinhood_search_symbols

按名称或代码搜索股票

对话示例

简单查询:

  • “我现在的投资组合价值多少?”

  • “按价值展示我前 5 大持仓”

  • “我已经持有 HIMS 了吗?我目前的持仓是多少?”

  • “获取 AAPL 的报价”

对于单代码投资组合问题,优先使用 robinhood_get_position 而不是 robinhood_get_positions。单代码工具避免了重建所有持仓,对于“我应该加仓 HIMS 吗?”这类问题速度快得多。

分析请求:

  • “比较 GOOGL 和 META 的基本面”

  • “我的哪些股票交易价格低于其 52 周平均水平?”

  • “展示 TSLA 过去一年的价格走势图”

  • “我表现最好的股票是什么?最差的是什么?”

研究工作流:

  • “我想了解邮轮行业。提取 CCL、RCL 和 NCLH 的数据 - 比较它们的基本面和近期表现。”

  • “查找我投资组合中市盈率低于 15 且盈利增长为正的股票”

  • “我在几个持仓上亏损严重。展示我表现最差的持仓的基本面和新闻,以帮助我决定是持有还是止损。”

限制

  • 只读:无法下单交易、修改自选列表或更改账户设置

  • 非官方 API:Robinhood 可能随时更改其 API,导致功能失效

  • 无实时流:报价是即时点位,而非实时推送

  • 会话过期:您可能需要定期重新验证

  • 速率限制:高频使用可能会触发 Robinhood 的速率限制

安全说明

  • 凭据仅在本地用于与 Robinhood 进行身份验证

  • 会话令牌由 robin_stocks 缓存在 ~/.tokens/robinhood.pickle 中

  • 切勿提交您的 .env 文件或泄露凭据

  • 此工具无法执行交易 - 设计上即为只读

开发

git clone https://github.com/verygoodplugins/robinhood-mcp.git
cd robinhood-mcp
pip install -e ".[dev]"

# Lint
ruff check . && ruff format --check .

# Test
pytest

# Run locally
robinhood-mcp

故障排除

“Not logged in”(未登录)错误:

  • 验证您的用户名和密码是否正确

  • 如果您使用带有身份验证器应用的 2FA,则需要 ROBINHOOD_TOTP_SECRET

  • 尝试通过 Robinhood 应用登录以确保您的账户未被锁定

“Non-base32 digit found”(发现非 base32 数字)错误:

  • 您的 TOTP 密钥包含无效字符

  • 密钥应仅包含字母 A-Z 和数字 2-7

  • 如果您不使用身份验证器应用,请完全删除 ROBINHOOD_TOTP_SECRET

速率限制:

  • robin_stocks 没有内置速率限制

  • 如果您达到速率限制,请等待几分钟后再重试

许可证

MIT

免责声明

此工具仅用于教育和研究目的。它使用可能随时失效的非官方 API。作者不对任何账户限制、数据不准确或财务损失负责。

本项目与 Robinhood Markets, Inc. 无关联、无背书,也无任何连接。

自动化示例

使用 Claude Code 进行每日投资组合回顾

设置一个 cron 任务以获取每日投资组合简报:

# ~/.claude/commands/portfolio-review.md
---
description: "Daily portfolio health check"
---
Using the robinhood MCP tools:
1. Get my current portfolio value and day change
2. Identify my top 3 gainers and top 3 losers today
3. Flag any positions that are down more than 20% from cost basis
4. Check if any holdings have earnings in the next 7 days
5. Give me a 2-3 sentence summary I can read with my morning coffee

每日运行:

# Add to crontab -e
0 7 * * 1-5 cd ~/Projects && claude -p "/portfolio-review" --dangerously-skip-permissions >> ~/portfolio-reports/$(date +\%Y-\%m-\%d).md

每周研究摘要

# ~/.claude/commands/weekly-research.md
---
description: "Weekly deep dive on portfolio"
---
For each of my top 10 holdings by value:
1. Pull current fundamentals and compare to sector averages
2. Get recent news and analyst rating changes
3. Flag any significant changes from last week
4. Identify 2-3 stocks from my watchlist that might be worth adding

Format as a markdown report I can review on the weekend.

致谢

由 Jack Arturo 在 Very Good Plugins 倾情打造。

由 robin_stocks 和 FastMCP 提供支持。

链接

Available Tools

13 tools
robinhood_get_dividendsA

Get all dividend payments received.

Returns list of dividend payments with amount, payable date, record date, and instrument details.

Inputs: no named parameters. Returns: result

robinhood_get_earningsC

Get earnings data for a stock.

Inputs: symbol (required). Returns: result

robinhood_get_fundamentalsC

Get fundamental data for a stock.

Inputs: symbol (required). Returns: object

robinhood_get_historicalsC

Get historical price data for a stock.

Inputs: symbol (required), interval, span. Returns: result

robinhood_get_newsA

Get recent news articles for a stock.

Inputs: symbol (required). Returns: result

robinhood_get_options_positionsA

Get all current options positions (read-only).

Returns list of options positions with chain symbol, type, strike price, expiration, and quantity.

Inputs: no named parameters. Returns: result

robinhood_get_portfolioA

Get current portfolio value and performance metrics.

Returns portfolio profile with equity, extended hours equity, withdrawable amount, and other account details.

Inputs: no named parameters. Returns: object

robinhood_get_positionA

Get one current stock position with a faster single-symbol lookup.

Inputs: symbol (required). Returns: object

robinhood_get_positionsA

Get all current stock positions with details.

Returns a dict mapping stock symbols to position details including price, quantity, average buy price, equity, and percent change.

Inputs: no named parameters. Returns: object

robinhood_get_quoteB

Get real-time quote for a stock symbol.

Inputs: symbol (required). Returns: object

robinhood_get_ratingsB

Get analyst ratings summary for a stock.

Inputs: symbol (required). Returns: object

robinhood_get_watchlistC

Get stocks in a watchlist.

Inputs: name. Returns: result

robinhood_search_symbolsB

Search for stock symbols by company name or ticker.

Inputs: query (required). Returns: result

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A3.7/5.0

    Scored across 13 tools

    Disambiguation5/5

    Each tool targets a distinct data type (dividends, earnings, fundamentals, etc.) with clear boundaries. The only potential overlap is between get_position and get_positions, but they are differentiated by single vs. all symbols.

    Naming Consistency5/5

    All tools follow a uniform 'robinhood_verb_noun' pattern, using snake_case and descriptive verbs (get, search). No mixing of styles or vague names.

    Tool Count5/5

    13 tools is well-suited for a data-heavy financial service, covering a broad range of endpoints without being overwhelming. The count feels neither sparse nor excessive.

    Completeness4/5

    The tool set comprehensively covers read-only data retrieval (quotes, positions, dividends, earnings, news, etc.), but lacks write operations (e.g., placing orders) which might be expected from a brokerage service. Minor gap for transactional use cases.

    Maintenance

    ActivityMaintained
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      A read-only MCP server that provides access to Charles Schwab account data and market information, including portfolio positions, real-time quotes, options chains, price history, and account balances through AI assistants.
      9
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      This MCP server connects AI assistants to a Public.com brokerage account, enabling natural language trading of stocks, options, and crypto, along with portfolio management, quotes, and orders.
      46
      914 PyPI
      67
      Apache 2.0
    • A
      license
      A
      quality
      B
      maintenance
      A read-only MCP server for Trading 212 accounts, enabling AI assistants to query balances, positions, orders, dividends, pies, and instruments without trading capabilities.
      12
      1
      MIT
    • F
      license
      Not graded
      quality
      D
      maintenance
      A local-first MCP server that connects Claude Code to your Robinhood account, enabling read-only portfolio insights, tax analysis, and natural language queries, with optional human-in-the-loop trading actions.
      -