Agent Financial Advisor

السجل الرسمي المالية والمدفوعات

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

التثبيت

أضف هذا إلى إعدادات MCP في عميلك (Claude Desktop: claude_desktop_config.json، وCursor: ‏.cursor/mcp.json، ويستخدم VS Code وغيره الصيغة نفسها «mcpServers»).

Remote (streamable-http)
Claude Code
claude mcp add --transport http agent-financial-advisor 'https://agent-financial-advisor.agent-financial-advisor.workers.dev/mcp'
إعداد JSON (Claude Desktop وCursor وVS Code)
{
    "mcpServers": {
        "agent-financial-advisor": {
            "type": "http",
            "url": "https://agent-financial-advisor.agent-financial-advisor.workers.dev/mcp"
        }
    }
}

التوثيق

مأخوذ من ملف README للمشروع على GitHub ويُحدَّث أسبوعيًا. تفتح الروابط على GitHub.

المحتويات
  1. Agent Financial Advisor
  2. Tools
  3. Run locally (Node 20+, no dependencies)
  4. Endpoints
  5. Configuration (env vars)
  6. Deploy (free)
  7. Payments (x402)
  8. Layout

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
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 test          # 28 tests
npm start         # http://localhost:8787  (payments off until PAY_TO is set)

Try it:

curl localhost:8787/llms.txt
curl -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 (send Authorization: Bearer <key> for the keyed free tier and credits).

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\100`Buy credits with x402
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
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.

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 hooks
src/server.js         Node entry
src/worker.js         Cloudflare Workers entry (KV store)
src/billing/          free tier, API keys, credits, x402, ledger
src/tools/            the advisory tools
src/lib/regs.js       rule table with sources (reviewed weekly)
src/lib/calendar.js   NYSE calendar
test/                 node --test suites

الأسئلة الشائعة

ما هو Agent Financial Advisor؟

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

كيف أثبّت Agent Financial Advisor؟

يعمل كخادم بعيد. في Claude Code: claude mcp add --transport http agent-financial-advisor 'https://agent-financial-advisor.agent-financial-advisor.workers.dev/mcp'. وفي العملاء الآخرين، الصق إعداد JSON من هذه الصفحة في إعدادات MCP الخاصة بهم.

هل يحتاج Agent Financial Advisor إلى مفتاح API؟

لا يذكر إدراجه في السجل أي مفتاح أو سر إلزامي. قد تتطلب بعض الميزات حسابًا لدى الخدمة التي يتصل بها.

هل Agent Financial Advisor مفتوح المصدر؟

شيفرته علنية على GitHub، لكن المستودع لا يعلن ترخيصًا قياسيًا.

من يصون Agent Financial Advisor؟

ينشره mytomclinic. يدرجه AI.tn لكنه لا يصونه ولا يوصي به.

من سجل MCP الرسمي. الإدراج ليس توصية: راجع شيفرة الخادم وصلاحياته قبل منحه الوصول إلى بياناتك.