JS

jkoelker/schwab-mcp

开发工具

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

73 stars 26 forks 质量 74 趋势 20MIT

jkoelker/schwab-mcp 是从 https://github.com/jkoelker/schwab-mcp. 导入的 MCP 服务器候选

概览

jkoelker/schwab-mcp 是从 https://github.com/jkoelker/schwab-mcp. 导入的 MCP 服务器候选

概述(AI 翻译)

Schwab模型上下文协议(MCP)服务器将你的Schwab账户连接到基于LLM的应用程序(如Claude Desktop或其他MCP客户端),允许它们获取市场数据、检查账户状态,并(可选地)在您的监督下下订单。

特色

  • 市场数据:实时报价、价格历史、期权链和市场波动。
  • 账户管理:查看余额、头寸和交易。
  • 交易:股票和期权的全面支持,包括复杂策略(OCO,Bracket)。
  • 安全第一:关键操作(如交易)默认被限制在Discord审批流程之后。
  • 大型语言模型集成:专为代理型AI工作流设计。

快速启动

先决条件

  • Python 3.10 或更高版本
  • uv(推荐)或pip
  • Schwab开发者应用密钥和秘密(来自Schwab开发者门户)

安装

对大多数用户来说,通过 uv tool 或 pip 安装最简单:

认证

在运行服务器之前,您必须通过Schwab认证以生成令牌文件。

这会打开一个浏览器窗口,供你登录施瓦布。完成后,一个令牌将被保存到“~/”。

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

README

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

Schwab Model Context Protocol Server

The Schwab Model Context Protocol (MCP) Server connects your Schwab account to LLM-based applications (like Claude Desktop or other MCP clients), allowing them to retrieve market data, check account status, and (optionally) place orders under your supervision.

Features

  • Market Data: Real-time quotes, price history, option chains, and market movers.
  • Account Management: View balances, positions, and transactions.
  • Trading: comprehensive support for equities and options, including complex strategies (OCO, Bracket).
  • Safety First: Critical actions (like trading) are gated behind a Discord approval workflow by default.
  • LLM Integration: Designed specifically for Agentic AI workflows.

Quick Start

Prerequisites

Installation

For most users, installing via uv tool or pip is easiest:

# Using uv (recommended for isolation)
uv tool install 'schwab-mcp[ta] @ git+https://github.com/jkoelker/schwab-mcp.git'

# Using pip
pip install 'schwab-mcp[ta] @ git+https://github.com/jkoelker/schwab-mcp.git'

The ta extra installs pandas and pandas-ta-classic for the technical-analysis tools (SMA, RSI, …). Without it those tools are skipped at startup with a warning; pass --no-technical-tools to run without them deliberately. Add the signal extra (schwab-mcp[ta,signal]) for Signal approvals.

Pass secrets through environment variables (or schwab-mcp save-credentials) rather than command-line flags, which are visible to other local users in ps and end up in shell history:

export SCHWAB_CLIENT_ID=YOUR_KEY
export SCHWAB_CLIENT_SECRET=YOUR_SECRET
export SCHWAB_MCP_DISCORD_TOKEN=BOT_TOKEN   # only for Discord approvals

Authentication

Before running the server, you must authenticate with Schwab to generate a token file.

# If installed via uv tool or pip (with SCHWAB_CLIENT_ID / SCHWAB_CLIENT_SECRET exported)
schwab-mcp auth --callback-url https://127.0.0.1:8182

# If running from source
uv run schwab-mcp auth --callback-url https://127.0.0.1:8182

This will open a browser window for you to log in to Schwab. Once complete, a token will be saved to ~/.local/share/schwab-mcp/token.yaml.

Running the Server

Start the MCP server to expose the tools to your MCP client.

# Credentials come from SCHWAB_CLIENT_ID / SCHWAB_CLIENT_SECRET (see above).

# Basic Read-Only Mode (Safest)
schwab-mcp server

# Streamable HTTP (for reverse proxies / remote MCP connectors)
schwab-mcp server --http --host 127.0.0.1 --port 8000

# With Trading Enabled (Requires Discord Approval; token from SCHWAB_MCP_DISCORD_TOKEN)
schwab-mcp server \
  --discord-channel-id CHANNEL_ID \
  --discord-approver YOUR_USER_ID
在 GitHub 查看完整 README

安装

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

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