cred402/docs/api/mcp-tools.md
caelum0x b26dfadaba
Some checks failed
ci / backend (typecheck · test) (push) Failing after 34s
ci / frontend (build) (push) Failing after 41s
ci / demo loop (smoke) (push) Failing after 36s
ci / odra contracts (fmt · build) (push) Failing after 27s
docs: fix stale MCP tool count (16 -> 78) in mcp-tools.md
The docs still listed only the original 16 tools; mcp/tools.ts has grown
to 78 (RealFi/Flare bridge, risk analytics, marketplace, automations).
Found while independently verifying this week's launch-maxxing submissions,
which had propagated the stale "16 tools" claim into live external PRs.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-11-12 01:30:27 +03:00

3.3 KiB

Cred402 MCP server (p2 §12)

Cred402 ships its own Model Context Protocol server so any AI agent can operate the protocol naturally — register, earn via x402, build reputation, borrow, and dispute — through MCP tools rather than bespoke API calls.

Implementation: mcp/server.ts (stdio JSON-RPC 2.0, zero external deps), mcp/tools.ts (tool registry), mcp/resources.ts (resources).

Run it

npm run mcp            # start the stdio MCP server
npm run mcp:demo       # drive it like a real MCP client (end-to-end)

Connect from an MCP client (e.g. Claude Desktop):

{
  "mcpServers": {
    "cred402": { "command": "npx", "args": ["tsx", "mcp/server.ts"], "cwd": "/path/to/cred402" }
  }
}

Tools (78)

This doc previously listed only the original 16 core tools below (still the right starting point for register/earn/borrow/dispute). The registry in mcp/tools.ts has since grown to 78 tools — compliance/portfolio reporting, credit simulation, peer benchmarking, risk analytics, RealFi/Flare bridge tools (FXRP mint/redeem, keeper automation, confidential scoring), and the x402 service marketplace. Treat mcp/tools.ts as the canonical list (run npm run mcp and send tools/list, or grep "name:" mcp/tools.ts) rather than hand-counting this doc — it will drift again as tools are added.

Core 16 (register/earn/borrow/dispute lifecycle):

cred402.register_agent          cred402.get_agent_passport
cred402.get_agent_reputation     cred402.get_agent_credit_line
cred402.request_rwa_evidence     cred402.submit_rwa_evidence
cred402.record_x402_receipt      cred402.finalize_receipt
cred402.open_dispute             cred402.submit_dispute_evidence
cred402.deposit_credit_pool      cred402.draw_agent_credit
cred402.repay_agent_credit       cred402.watch_protocol_events
cred402.get_risk_policy          cred402.explain_credit_score

Remaining 62 cover: operator/fiat verification and RealFi profile; agent discovery, attestation, compliance/portfolio reporting; credit simulation, peer benchmarking, offers, history, risk alerts, yield projection; onboarding, reputation/score trend, fleet overview, credit-line review, multichain summary, agent comparison/dossier/health/similar-agents; credit cost, LP deposit preview, safe-draw, protocol config, x402/dispute stats, reputation movers, category analytics, risk score v2, credit data commons, cross-chain exposure, service verticals; the Flare bridge (info, XRP price, FXRP draw/repay/mint/redeem, collateral, FAssets status, confidential score, positions); KeeperHub (reliability, audit, evaluate/run/run-fleet); automations (create/list/tick/remove); and the x402 service marketplace (list/buy services, scheduler status/tick). See mcp/tools.ts for exact names and schemas.

Resources

cred402://agents/{agent_id}
cred402://receipts/{receipt_id}
cred402://rwa/{asset_id}
cred402://credit-lines/{agent_id}
cred402://disputes/{dispute_id}
cred402://risk-policies/current

Supported MCP methods

initialize, tools/list, tools/call, resources/list, resources/templates/list, resources/read, ping, and the notifications/initialized notification.

The server runs an in-process Cred402Economy (the same ledger simulation the dashboard uses). For a live deployment, swap the ledger for casper-js-sdk contract calls — the tool surface is unchanged.