Agent Financial Advisor

io.github.mytomclinic由 GitHub 帳號 mytomclinic 發布v0.1.0更新於 Oct 24, 2026

Compliance, risk, tax and audit checks for AI trading agents: pre-trade, sizing, wash sales, Reg BI.

已驗證Streamable HTTP可網頁執行金融安全與監控

概覽

AI 產生的概覽

遠端 MCP 伺服器,為交易代理提供合規、風險、稅務與績效檢查:盤前規則、部位計算、稅批次、投資組合檢視與策略稽核。

可以做什麼
  • 查詢目前美國交易、保證金、交割與稅務規則,附生效日期與來源
  • 在送出委託前檢查購買力、現金帳戶交割、日內保證金、放空、沖洗交易、集中度與流動性等問題
  • 依固定比例風險、波動率目標或分數凱利計算部位,並規劃稅批次選擇或虧損收割
  • 檢視投資組合的權重、集中度、產業與資產類別曝險、再平衡交易及風險指標,並稽核策略交易紀錄是否過度擬合
  • 檢查選擇權部位的保證金、核准等級、指派與釘住風險,並執行適合度審查並產生稽核備忘錄
適用情境
當助理需要下單、計算部位或就美國股票與選擇權交易提供建議,並希望在行動前取得依規則的防護時使用;也適合需要對投資組合或回測做獨立風險、稅務與績效分析的情況。
執行需求
遠端 streamable-HTTP 端點,無需本機安裝。提供免費額度,可透過免費的 get_api_key 工具取得 API 金鑰,或以 Authorization Bearer 標頭傳送。付費工具按次以 x402 USDC 付款計費。
安裝前請注意
多數工具按次以 USDC 收費,代理可能因此產生支出;額度透過 x402 購買,主網付款使用真實資金。輸出僅為資訊性分析,不構成投資建議,規則也可能變動。選用的 advisor_memo 工具會將交易與投資組合細節傳送給 Anthropic 的 Claude API,並受每日支出上限限制。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Agent Financial Advisor,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Web executable,透過 Streamable HTTP。 遠端服務在工作區中設定後即可從網頁執行環境執行。

交給代理程式安裝

把這段提示詞貼上到 Claude Code、Codex、Cursor 等代理程式,或 SourceWeft 對話中。代理程式會讀取該伺服器的安裝指南,先向你展示發布者、端點和登入方式,經你同意後再把它新增到你的客戶端。金鑰不會寫進任何命令。

閱讀 https://sourceweft.com/mcp/io.github.mytomclinic%2Fagent-financial-advisor/install.md,並按其中說明把這個 MCP 伺服器接入我的客戶端。修改任何設定之前,先告訴我它的發布者、端點和登入方式,等我確認。不要把 API 金鑰寫進命令或我會提交的檔案;問我金鑰應從哪裡取得。

檢視代理程式所依據的安裝指南

其他 MCP 客戶端

把它新增到你客戶端的 mcpServers 設定中。

{
  "mcpServers": {
    "agent-financial-advisor": {
      "type": "http",
      "url": "https://agent-financial-advisor.agent-financial-advisor.workers.dev/mcp"
    }
  }
}

README

Agent Financial Advisor

The compliance officer, risk manager, tax advisor and performance auditor for AI agents that trade and advise. Agents call it before they act; it answers with sourced, deterministic checks and charges a small fee per call.

Tools

ToolPriceDoes
rules_digestfreeCurrent US trading/margin/settlement/tax rules with effective dates and sources
pre_trade_check$0.005Buying power, cash-account violations, intraday margin (post-PDT), Reg SHO, wash sales, concentration, risk-to-stop, liquidity, spread, fat finger, leverage, market hours
position_size$0.005Fixed-fractional, volatility-target or fractional-Kelly sizing with caps
tax_lot_plan$0.02FIFO/LIFO/HIFO/min-tax lot selection, ST/LT split, wash sales, loss harvesting scan
portfolio_review$0.05Weights, HHI, sector/asset-class exposure, rebalance trades, Sharpe/Sortino/drawdown/VaR/beta
strategy_audit$0.10Trade stats, t-stat, Probabilistic and Deflated Sharpe Ratio, overfitting red flags
suitability_check$0.03Reg BI / fiduciary suitability review with a hashed audit memo
advisor_memo$0.10, paid onlyRuns the checks above on a planned trade, options position or portfolio, then Claude writes a go / no-go memo with risks, required changes, rules cited and an audit note. Never looser than the rule checks
options_risk_check$0.01Covered/cash-secured/spread/naked classification, FINRA 4210 margin, cash-account limits, approval level, dividend early assignment, pin risk, auto-exercise, max loss, net Greeks

Drop-in code (Alpaca order guard, MCP client configs, x402 paying client): examples/.

Run locally (Node 20+, no dependencies)

npm testnpm start         # http://localhost:8787  (payments off until PAY_TO is set)

Try it:

curl localhost:8787/llms.txtcurl -X POST localhost:8787/v1/tools/position_size -H "content-type: application/json" \  -d '{"equity":50000,"entry_price":100,"stop_price":95,"method":"fixed_fractional"}'

MCP clients: point a streamable-HTTP MCP connection at http://localhost:8787/mcp. For the keyed free tier and credits, send Authorization: Bearer <key>, use /mcp?key=<key>, or have the agent call the free get_api_key tool, which binds a new key to the MCP session. Add ?src=<name> to any URL to attribute usage in /stats.

Endpoints

MethodPath
GET/, /llms.txtAgent-readable overview
GET/v1/tools, /openapi.json, /pricing, /.well-known/x402Discovery
POST/v1/tools/{name}Run a tool
POST/mcpMCP JSON-RPC
POST/v1/keysFree API key
GET/v1/keys/meKey balance
POST/v1/credits?pack=5|20|100Buy credits with x402
GET/v1/auditYour tamper-evident audit log: every keyed paid call, hash-chained and server-signed (?since_seq=)
POST/v1/audit/verifyVerify audit entries' hashes, signatures and chain
GET/statsPublic aggregate usage: calls, paid calls, keys issued, revenue (no identities; cached 10 min)
GET/admin/revenueRevenue and usage (ADMIN_TOKEN)

Configuration (env vars)

VarDefault
PAY_TOunsetUSDC receiving address. Unset = free preview, no payments
X402_NETWORKbase-sepoliabase for real money
CDP_API_KEY_JSONunsetSecret: the downloaded CDP key file. When set, payments go through the Coinbase CDP facilitator (needed for mainnet). CDP_API_KEY_ID + CDP_API_KEY_SECRET also work
FACILITATOR_URLCDP if a key is set, else https://x402.org/facilitatorOverride the facilitator
FACILITATOR_AUTHunsetStatic Authorization header for a non-CDP facilitator
X402_MIN_USD0.01Minimum pay-per-call x402 price (credits pay list price)
FREE_DAILY_CALLS / FREE_DAILY_ANON25 / 5Free tier
ADMIN_TOKENunsetFor /admin/revenue
ANTHROPIC_API_KEYunsetSecret: turns on advisor_memo (Claude Sonnet 5.5). Unset = the tool answers 503 and charges nothing
MEMO_DAILY_CAP_USD3Daily Claude spend cap for advisor_memo; past it the tool pauses until 00:00 UTC
DATA_DIR./dataNode store and ledger
PUBLIC_URLrequest hostUsed in payment requirements

Deploy (free)

Cloudflare Workers: npx wrangler kv namespace create AFA_KV, put the id in wrangler.toml, then npx wrangler deploy.

Real USDC: npx wrangler secret put CDP_API_KEY_JSON < secrets/cdp_api_key.json, set X402_NETWORK = "base" in wrangler.toml, deploy.

advisor_memo: npx wrangler secret put ANTHROPIC_API_KEY < secrets/anthropic-key.txt.

Payments (x402)

Speaks x402 v2: a 402 carries a base64 PAYMENT-REQUIRED header (CAIP-2 network, e.g. eip155:8453), clients pay with PAYMENT-SIGNATURE, and the settlement comes back in PAYMENT-RESPONSE. v1 clients (X-PAYMENT, body accepts) still work.

End-to-end test on the test network: npm i --no-save viem && node scripts/e2e-payment.mjs <server url> --fund.

Layout

src/app.js            fetch-style router: REST, MCP, billing hookssrc/server.js         Node entrysrc/worker.js         Cloudflare Workers entry (KV store)src/billing/          free tier, API keys, credits, x402, ledgersrc/tools/            the advisory toolssrc/lib/regs.js       rule table with sources (reviewed weekly)src/lib/calendar.js   NYSE calendartest/                 node --test suites

來源:README.md,提交 9006933

工具

8

rules_digest

Current trading rules digest

Free. The current US trading, margin, settlement and tax rules an agent must follow, with effective dates and sources. Includes changes your training data may predate, such as the June 2026 replacement of the Pattern Day Trader rule. Price: free.

輸入參數topic

pre_trade_check

Pre-trade compliance and risk check

Run an order past a compliance officer and risk manager before sending it to the broker. Checks buying power, cash-account settlement violations, FINRA intraday margin (post-PDT) or legacy PDT limits, Reg SHO short-sale rules, wash-sale exposure, position concentration, per-trade risk versus stop, liquidity, spread, fat-finger prices, leverage and market hours. Returns approve / approve_with_warnings / reject with reasons and a resized quantity when useful. Price: $0.005.

輸入參數order必填marketpolicyaccount必填

position_size

Position sizing

Size a position the way a risk manager would: fixed-fractional risk to a stop, volatility targeting (ATR or annualized vol), or fractional Kelly from your edge statistics. Applies a max-position cap and round lots, and explains the binding constraint. Price: $0.005.

輸入參數atrsideequity必填method必填avg_winavg_losslot_sizerisk_pctwin_rateannual_volstop_priceentry_price必填另有 5 個

tax_lot_plan

Tax lot selection and wash-sale check

Act as the tax advisor for a sale: compares FIFO, LIFO, HIFO and minimum-tax lot selection, splits short- and long-term gains, estimates tax, flags wash sales, and notes lots about to turn long-term. With mode=harvest it scans positions for tax-loss harvesting. Price: $0.02.

輸入參數lots必填modesellas_ofpricessymboltax_ratesmin_harvest_lossrecent_transactions

portfolio_review

Portfolio review

A periodic advisor review of a portfolio: weights, concentration (HHI and effective number of holdings), sector and asset-class exposure, drift from targets with the trades to rebalance, and, given return history, volatility, Sharpe, Sortino, drawdown, VaR/CVaR and beta. Ends with prioritized findings. Price: $0.05.

輸入參數cashlimitsreturnstargetsholdings必填rebalance_bandrisk_free_rateperiods_per_yearbenchmark_returns

strategy_audit

Strategy audit and overfitting check

An independent performance auditor for a trading strategy or backtest. From a trade list and/or periodic returns it computes win rate, expectancy, profit factor, streaks, Sharpe/Sortino/drawdown, and tests whether the edge is real: t-stat, Probabilistic Sharpe Ratio and the Deflated Sharpe Ratio that corrects for how many variants you tried. Returns a verdict and red flags. Price: $0.1.

輸入參數tradesreturnsn_trialsstarting_equityperiods_per_yeartrial_sharpe_variance

suitability_check

Best-interest suitability review

The compliance review a robo-advisor or advisory agent should run before recommending a portfolio to a person: compares the proposal with the client's age, horizon, risk tolerance, liquidity needs and experience under Reg BI / fiduciary standards, flags complex products, and returns a timestamped, hashed suitability memo for the audit file. Price: $0.03.

輸入參數client必填productsallocation必填annual_fee_pctmax_single_position_pct

options_risk_check

Options risk and margin check

Check an options book (existing or proposed legs) the way a broker's options desk would: covered, cash-secured, spread or naked; margin requirement under FINRA Rule 4210; cash-account limits; required approval level; early-assignment risk around ex-dividend dates; pin risk; auto-exercise of expiring in-the-money longs and the capital it needs; max loss; and net Greeks. Returns approve / approve_with_warnings / reject with reasons. Price: $0.01.

輸入參數legs必填as_ofpolicyaccount必填underlying必填

版本歷史

1
  1. v0.1.0最新Oct 12, 2026

評分

已滿足適用檢查項的 90%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通必需25 分
  • 已宣告認證方式必需10 分
  • 已列出工具必需15 分
  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分

    請在儲存庫或註冊中心條目中宣告授權條款。