MCP server exposing the smartoption-ai customer APIs (copy-trading, agent ops, signal history, data center, quant strategy R&D) as tools for AI agents (Claude Desktop / Claude Code / any MCP client).
Project description
smartoption-mcp
MCP server exposing smartoption-ai customer APIs as tools for AI agents (Claude Desktop, Claude Code, any MCP client). 28 tools spanning copy-trading rules, agent ops, broker config, signal history, virtual ledger, quant strategy products, quant strategy R&D, and the data center (dark-pool / option flow / trader feeds).
Architecture
Claude / Agent
│ MCP stdio
▼
smartoption-mcp ──HTTP + Bearer JWT──▶ backend /api/customer/*
Thin wrapper: each tool maps to one customer API endpoint, authenticated with a per-user JWT (or long-lived API token) loaded from env at startup.
Install
pip install smartoption-mcp
# or, in an isolated venv:
python3.11 -m venv ~/.smartoption-mcp && ~/.smartoption-mcp/bin/pip install smartoption-mcp
Published on PyPI. Installs
the smartoption-mcp CLI. Upgrade with pip install -U smartoption-mcp.
Local dev from this repo:
cd mcp-server
python3.11 -m venv .venv && source .venv/bin/activate
pip install -e .
Configure auth
Log into portal.smartoption.ai → 个人中心 → "API Token(用于 MCP / 脚本)" → 起个名字 → 复制 token. 1-year expiry, revocable any time from the same page.
Set:
SMARTOPTION_JWT— the token (noBearerprefix)SMARTOPTION_API_BASE—https://api.smartoption.ai
Smoke test:
export SMARTOPTION_API_BASE="https://api.smartoption.ai"
export SMARTOPTION_JWT="eyJ..."
.venv/bin/python -c "from smartoption_mcp.client import SmartoptionClient; \
print(SmartoptionClient().list_agents())"
Register with Claude Code / Claude Desktop
Claude Code — edit ~/.claude.json, add under mcpServers:
{
"mcpServers": {
"smartoption": {
"command": "smartoption-mcp",
"env": {
"SMARTOPTION_API_BASE": "https://api.smartoption.ai",
"SMARTOPTION_JWT": "eyJ..."
}
}
}
}
Restart Claude Code. All 28 smartoption tools should appear.
Claude Desktop — same JSON shape at
~/Library/Application Support/Claude/claude_desktop_config.json.
Restart the app after editing.
Once registered, you can ask things like:
- "查一下最近一周苹果相关的喊单"
- "我现在的虚拟仓有哪些标的?"
- "我的跟单 agent 在线吗?最近一次心跳是什么时候?"
- "今天 agent 跑了几条信号,有没有被跳过的?"
- "帮我写一个 MA crossover 策略,先 validate 一遍"
- "解读一下今天 NVDA 的暗盘大单"
Tools
Copy-trading rules
| Tool | Endpoint | Purpose |
|---|---|---|
list_copy_rules |
GET /copy-rules |
Current copy-trading rules + toggles |
update_copy_rules |
PUT /copy-rules |
Replace full settings; confirmed-gated with structured diff |
Agent provisioning & ops
| Tool | Endpoint | Purpose |
|---|---|---|
ensure_agent |
POST /agents/ensure |
Create / provision the user's agent pod (idempotent; force_redeploy gated) |
get_agent_status |
GET /agents |
Online / heartbeat / broker snapshot summary |
get_agent_logs |
GET /agents/<id>/logs |
Tail recent agent-pod stdout |
restart_agent_client |
POST /agents/<id>/restart-client |
Restart in-pod agent process — gated |
stop_agent |
POST /agents/<id>/stop |
Scale agent deployment to 0 — gated |
Broker configuration
| Tool | Endpoint | Purpose |
|---|---|---|
list_broker_configurations |
GET /broker-configurations |
All saved brokers + active flag (no creds returned) |
get_active_broker |
GET /broker-configurations |
Just the active broker name + display name |
set_active_broker |
PUT /active-broker |
Switch active broker — gated |
test_broker_connection |
POST /broker-configurations/test-{ib,tiger,futu,moomoo} |
Verify creds against broker; does NOT save |
refresh_broker_snapshot |
POST /broker-account-snapshot/refresh |
Ask agent to push fresh broker snapshot |
Signal history & run logs
| Tool | Endpoint | Purpose |
|---|---|---|
query_signal_history |
GET /signal-history |
Search parsed alerts (大单 / 喊单) |
get_signal_detail |
GET /signal-history/<id> |
Full SignalForwardRecord for one signal |
get_signal_chain |
GET /signal-history/<id>/chain-slots |
Paired / chained signal context (ROLL_UP pairs etc.) |
list_run_logs |
GET /copy-run-logs |
Per-signal execution outcomes |
Virtual ledger & followers
| Tool | Endpoint | Purpose |
|---|---|---|
list_virtual_lots |
GET /virtual-ledger |
Open virtual lots + qty_by_key |
list_virtual_followers |
GET /virtual-followers |
User's virtual-follower accounts + equity summary |
Quant strategy products (copy-trade catalog)
| Tool | Endpoint | Purpose |
|---|---|---|
list_quant_strategies |
GET /quant-strategies/list |
Available / subscribed quant strategies |
get_quant_strategy_snapshot |
GET /quant-strategies/<id>/snapshot |
One strategy's positions + canonical valuation |
Quant strategy R&D
| Tool | Endpoint | Purpose |
|---|---|---|
validate_strategy_code |
POST /strategy-ai/strategies/validate |
RestrictedPython compile + protocol check (mirrors deploy gate) |
Paired with the develop-quant-strategy skill (in .claude/skills/),
this lets Claude verify draft strategy code locally in ~10ms before
hitting save_strategy_draft / run_strategy_backtest /
deploy_strategy (those write tools land in a follow-up release).
Stateless — no strategy_id required.
Data Center (暗盘大单 / 期权大单 / 交易员)
| Tool | Endpoint | Purpose |
|---|---|---|
list_data_center_tags |
GET /data-center/overview |
Available tags + counts |
list_data_center_channels |
GET /data-center/overview |
Active channels under one tag |
list_data_center_messages |
GET /data-center/messages |
Paged messages with filters |
get_data_center_message_detail |
GET /data-center/messages/<id> |
One message by id |
interpret_data_center_message |
POST /data-center/messages/<id>/interpret (SSE) |
LLM "解读"; stream collected server-side |
chat_about_data_center_message |
POST /data-center/messages/<id>/chat (SSE) |
Per-message free-form chat |
list_data_center_message_chat_history |
GET /data-center/messages/<id>/chat |
Prior chat turns + quota |
Confirmation model
Destructive writes accept a confirmed: bool argument, defaulting to
False (dry-run):
update_copy_rules(new_settings, confirmed=False)→ returns a structured diff (toggle changes + rules added / removed / modified byrule_id). Nothing is written. Show the diff, then re-call withconfirmed=True.ensure_agent(force_redeploy=True, confirmed=False)→ returns a description of the redeploy. Defaultforce_redeploy=Falseis idempotent and skips the gate.set_active_broker,restart_agent_client,stop_agent— same dry-run pattern.refresh_broker_snapshot— no gate (non-destructive async request).
The host (Claude Code / Desktop) also shows tool arguments before each
call, so confirmed=True is always visible in the approval UI — the
in-tool flag is belt + suspenders.
Full-doc replacement. update_copy_rules rejects partial settings:
the proposed doc must contain auto_buy_enabled, auto_sell_enabled,
use_all_matched_rules, and rules. Start from list_copy_rules,
mutate locally, pass the full doc back — preserving every rule's
rule_id so the diff stays stable.
SSE tools
interpret_data_center_message and chat_about_data_center_message
hit a backend SSE endpoint but collect the full stream and return one
payload:
{status, content, duration_ms, event_count} # interpret
{status, content, duration_ms, event_count,
remaining_quota} # chat
status ∈ done / cached / error / quota_exceeded. Time inputs
(start_at / end_at) are pass-through ISO 8601 — include timezone
offset (e.g. -04:00 for ET); the server does not normalize "today" /
"now-7d".
Roadmap
- Remote MCP server (OAuth 2.1) — deferred until a multi-user use
case justifies the operational cost. Until then, each user runs
smartoption-mcplocally with their own API token. - Quant strategy R&D write path —
save_strategy_draft,run_strategy_backtest,deploy_strategyto finish the dev loop started in v0.3.0.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file smartoption_mcp-0.3.1.tar.gz.
File metadata
- Download URL: smartoption_mcp-0.3.1.tar.gz
- Upload date:
- Size: 21.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
339192fcc5538e5c7f10c87abebbce3cd03b6601db15e8cb415a3daf6fff89d5
|
|
| MD5 |
20da6e026a575ad96721f2ee13fa624e
|
|
| BLAKE2b-256 |
ee268b71412f5912c73a4a60ca4d6f4bd363f4f653877e0eb42ac06277b1acc3
|
Provenance
The following attestation bundles were made for smartoption_mcp-0.3.1.tar.gz:
Publisher:
publish-mcp.yml on SmartOption/smartoption-ai
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
smartoption_mcp-0.3.1.tar.gz -
Subject digest:
339192fcc5538e5c7f10c87abebbce3cd03b6601db15e8cb415a3daf6fff89d5 - Sigstore transparency entry: 1680367061
- Sigstore integration time:
-
Permalink:
SmartOption/smartoption-ai@756d75bcac23114a8fedfeb17dfb5c4036977c5a -
Branch / Tag:
refs/tags/mcp-v0.3.1 - Owner: https://github.com/SmartOption
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-mcp.yml@756d75bcac23114a8fedfeb17dfb5c4036977c5a -
Trigger Event:
push
-
Statement type:
File details
Details for the file smartoption_mcp-0.3.1-py3-none-any.whl.
File metadata
- Download URL: smartoption_mcp-0.3.1-py3-none-any.whl
- Upload date:
- Size: 17.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8fc9e920eebc7391e07de276637563e9baaf7521d5d3c52d6d0361851a15964b
|
|
| MD5 |
08fef4e4ad5f7ced2712782e7cf41d81
|
|
| BLAKE2b-256 |
72458c92f73f73d3849b1004460d48751c97e7d7a5675d4da9e14d1c92202986
|
Provenance
The following attestation bundles were made for smartoption_mcp-0.3.1-py3-none-any.whl:
Publisher:
publish-mcp.yml on SmartOption/smartoption-ai
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
smartoption_mcp-0.3.1-py3-none-any.whl -
Subject digest:
8fc9e920eebc7391e07de276637563e9baaf7521d5d3c52d6d0361851a15964b - Sigstore transparency entry: 1680367109
- Sigstore integration time:
-
Permalink:
SmartOption/smartoption-ai@756d75bcac23114a8fedfeb17dfb5c4036977c5a -
Branch / Tag:
refs/tags/mcp-v0.3.1 - Owner: https://github.com/SmartOption
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-mcp.yml@756d75bcac23114a8fedfeb17dfb5c4036977c5a -
Trigger Event:
push
-
Statement type: