io.github.Stakemate369/8004swap-mcp

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

MCP server exposing 8004Swap (no-KYC agent-to-agent RFQ swap) as tools any MCP agent can call.

التثبيت

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

NPM package @stakemate/8004swap-mcp-server
Claude Code
claude mcp add 8004swap-mcp -e 'AGENT_PRIVATE_KEY=<your agent_private_key>' -e 'RELAY_URL=<RELAY_URL>' -e 'RPC_URL=<RPC_URL>' -- npx -y @stakemate/8004swap-mcp-server@0.1.0
إعداد JSON (Claude Desktop وCursor وVS Code)
{
    "mcpServers": {
        "8004swap-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "@stakemate/8004swap-mcp-server@0.1.0"
            ],
            "env": {
                "AGENT_PRIVATE_KEY": "<your agent_private_key>",
                "RELAY_URL": "<RELAY_URL>",
                "RPC_URL": "<RPC_URL>"
            }
        }
    }
}

متغيرات البيئة

  • AGENT_PRIVATE_KEY سري Dedicated wallet private key for this agent (testnet). Required only for tools that sign: request_quote, fill_quote, register_agent. check_agent_status works without it. Never reuse a key that holds funds outside this testnet.
  • RELAY_URL 8004Swap Relay WebSocket URL. Defaults to the current Base Sepolia testnet deployment if omitted.
  • RPC_URL Base Sepolia RPC URL. Defaults to https://sepolia.base.org if omitted.

التوثيق

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

المحتويات
  1. 8004Swap
  2. Architecture
  3. Running locally
  4. Current network (Base Sepolia)
  5. Contributing
  6. License

8004Swap

Non-custodial RFQ exchange built only for autonomous agents (not humans). Every trade is a direct match between two agents (maker/taker), settled atomically on-chain — no pre-funded liquidity pool, following the 0x Protocol / CoW Swap pattern.

Differentiator: no-KYC access + on-chain reputation via ERC-8004, not just another exchange with a bot layer bolted onto infra that still requires human KYC.

Status: testnet (Base Sepolia). No real funds at risk. No formal audit yet.

Architecture

Maker agent   ──┐                                    ┌── Taker agent
                │   WebSocket (RFQ, off-chain          │
                ▼    EIP-712 signature, gasless)        ▼
           ┌─────────────────────────────────────────────┐
           │                 Relay (relay/)               │
           │  RFQ matching, best-price ranking            │
           └─────────────────────┬─────────────────────────┘
                                  │ signed quote
                                  ▼
                     ┌───────────────────────────┐
                     │   Settlement.sol           │  ← atomic settlement,
                     │   (contracts/Settlement.sol)│    Chainlink oracle,
                     └─────────────┬───────────────┘    risk caps
                                   │ isActive() / recordFill()
                                   ▼
                     ┌───────────────────────────┐
                     │   Registry.sol             │  ← who's allowed to trade
                     │   (contracts/Registry.sol) │
                     └───────────────────────────┘
  • Registry.sol — registry of authorized agents (self-registration, msg.sender proves key control). Owner can pause globally.
  • Settlement.sol — settles an EIP-712-signed Quote. Requires a Chainlink oracle registered per pair (deny-by-default), checks staleness, applies risk caps (maxTradeAmount, maxVolumePerWindow) and an optional anti-sybil fee (feeBps).
  • relay/ — WebSocket server that authenticates agents (login signature), matches RFQs by token pair, and returns the best signed quote to the taker, who settles on-chain by calling fillQuote directly.
  • sdk/ (@stakemate/8004swap-agent-sdk) — TypeScript client that wraps the WS handshake, EIP-712 signing and on-chain settlement, for anyone integrating an agent without reimplementing the protocol from scratch. See sdk/README.md.
  • sdk-python/ (8004swap-agent-sdk) — same thing, in Python (eth_account + websockets + web3.py). See sdk-python/README.md.
  • mcp-server/ (@stakemate/8004swap-mcp-server) — exposes the protocol as MCP tools (request_quote, fill_quote, check_agent_status, register_agent), so any MCP-capable agent can trade directly without a human in the loop. See mcp-server/README.md.

See PROTOCOL.md for the exact Relay message format.

Running locally

Contracts (Foundry)
forge build
forge test
Relay
cd relay
npm install
cp .env.example .env   # fill in BASE_RPC_URL, REGISTRY_ADDRESS
npm run dev

Agent examples (maker/taker) live in relay/examples/ — they run against the local or hosted Relay. To integrate a new agent, prefer sdk/ (@stakemate/8004swap-agent-sdk), which wraps the same flow as those examples as a library.

Contract deployment
forge script script/DeploySepolia.s.sol --rpc-url <sepolia_rpc> --private-key <key> --broadcast

script/Deploy.s.sol is the mainnet version (4 pairs against USDC) — do not run without an explicit decision, contracts have not gone through a formal audit yet.

Current network (Base Sepolia)

  • Registry: 0x7Bb793b6Ada038cf9c26c6BB54cA15Db6BD35ed1
  • Settlement: 0x5Cc2558dF13739c05cb57Caf0E9cfe1629a6a945
  • Active pair: WETH/test-USDC

Contributing

Open to external contributors — contracts, relay, SDKs in other languages, support for new chains. See CONTRIBUTING.md.

License

MIT

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

ما هو io.github.Stakemate369/8004swap-mcp؟

MCP server exposing 8004Swap (no-KYC agent-to-agent RFQ swap) as tools any MCP agent can call.

كيف أثبّت io.github.Stakemate369/8004swap-mcp؟

يعمل على جهازك. في Claude Code: claude mcp add 8004swap-mcp -e 'AGENT_PRIVATE_KEY=<your agent_private_key>' -e 'RELAY_URL=<RELAY_URL>' -e 'RPC_URL=<RPC_URL>' -- npx -y @stakemate/8004swap-mcp-server@0.1.0. وفي العملاء الآخرين، الصق إعداد JSON من هذه الصفحة في إعدادات MCP الخاصة بهم.

هل يحتاج io.github.Stakemate369/8004swap-mcp إلى مفتاح API؟

نعم. يتطلب AGENT_PRIVATE_KEY، وتضبطها في إعداداته.

هل io.github.Stakemate369/8004swap-mcp مفتوح المصدر؟

نعم. شيفرته متاحة على GitHub بترخيص MIT.

من يصون io.github.Stakemate369/8004swap-mcp؟

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

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