OA

open-agent-tools/open-stocks-mcp

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

11 stars 5 forks 质量 79 趋势 26Apache-2.0

MCP Server for stock market data - Robinhood, Schwab APIs with multi-broker support

概览

An MCP (Model Context Protocol) server providing access to stock market data and trading capabilities through multiple broker APIs. - ✅ across Robinhood + Schwab (see Tool Reference for current breakdown) - ✅ - Support for Robinhood and Charles Schwab - ✅ - stocks, options, order management - ✅ - Robinhood stock and options trading tested with real orders - ✅ - HTTP transport, Docker support, comprehensive testing - ✅ - OAuth authentication, tools ready for testing (see Tool Reference) - 🔧 - Real financial data instead of N/A values Schwab requires a developer account and API approval (several days). See Schwab Setup Guide for full setup instructions. The /metrics endpoint exposes: - open_stocks_mcp_tool_calls_total (counter by tool) - open_stocks_mcp_tool_avg_calls_per_minute (gauge by tool; average over the rolling window) - open_stocks_mcp_tool_latency_ms (gauge by tool and quantile: 0.50, 0.95, 0.

README

以下为原文 README 节选,完整内容请查看原文。

Open Stocks MCP

An MCP (Model Context Protocol) server providing access to stock market data and trading capabilities through multiple broker APIs.

Features

🚀 Current Status: v0.6.5 - Multi-Broker Support (Robinhood + Schwab)

  • ✅ MCP tools across Robinhood + Schwab (see Tool Reference for current breakdown)
  • ✅ Multi-broker architecture - Support for Robinhood and Charles Schwab
  • ✅ Complete trading functionality - stocks, options, order management
  • ✅ Live trading validated - Robinhood stock and options trading tested with real orders
  • ✅ Production-ready - HTTP transport, Docker support, comprehensive testing
  • ✅ Schwab integration complete - OAuth authentication, tools ready for testing (see Tool Reference)
  • 🔧 Account details fixed - Real financial data instead of N/A values

Installation

pip install open-stocks-mcp

For development:

git clone https://github.com/Open-Agent-Tools/open-stocks-mcp.git
cd open-stocks-mcp
uv sync   # installs all deps including dev group

Quick Start

1. Set Up Credentials

Create a .env file:

For Robinhood:

[email protected]
ROBINHOOD_PASSWORD=your_password

For Schwab (optional):

SCHWAB_API_KEY=your_api_key
SCHWAB_APP_SECRET=your_app_secret
SCHWAB_CALLBACK_URL=https://127.0.0.1:8182/
SCHWAB_TOKEN_PATH=~/.tokens/schwab_token.json

# Enable both brokers
ENABLED_BROKERS=robinhood,schwab

Note: Schwab requires a developer account and API approval (several days). See Schwab Setup Guide for full setup instructions.

2. Start the Server

HTTP Transport (Recommended)

open-stocks-mcp-server --transport http --port 3001

STDIO Transport

open-stocks-mcp-server --transport stdio

3. Test the Server

# Health check (HTTP transport)
curl http://localhost:3001/health

# Prometheus metrics (no auth required)
curl http://localhost:3001/metrics

# Interactive testing
uv run mcp dev src/open_stocks_mcp/server/app.py

The /metrics endpoint exposes:

  • open_stocks_mcp_tool_calls_total (counter by tool)
  • open_stocks_mcp_tool_avg_calls_per_minute (gauge by tool; average over the rolling window)
  • open_stocks_mcp_tool_latency_ms (gauge by tool and quantile: 0.50, 0.95, 0.99)

Distributed tracing setup (OpenTelemetry, Jaeger, Tempo):

MCP Tool Execution Timeout

Each MCP tools/call invocation is bounded by a configurable deadline. Tools that exceed the deadline return a structured JSON error instead of blocking the server indefinitely.

  • YAML key: timeout.tool_execution_timeout_seconds (default: 30)
  • Environment override: OPEN_STOCKS_MCP_TOOL_EXECUTION_TIMEOUT_SECONDS (e.g., 60)

When a tool times out its response body is:

{
  "status": "error",
在 GitHub 查看完整 README

安装

This server does not publish a one-line install command.

Open the repository installation guide 新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "open-stocks": { "command": "open-stocks-mcp-server", "args": ["--transport", "stdio"] } } }