About 8004swap-mcp
8004swap-mcp wraps the 8004Swap agent SDK as an MCP server for agents that need to trade through its RFQ flow. It supports registry checks, agent registration, quote requests, quote settlement, and x402 payments; the project is currently testnet-only.
Key features
- 01Check agent registration and activity
- 02Register an agent on the Registry
- 03Request RFQ quotes as a taker
- 04Settle quotes on-chain
- 05Pay x402-gated HTTP resources
Use cases
- 01Check whether an address is active before trading
- 02Request and settle an agent-to-agent swap
- 03Use swap proceeds to pay an x402 service
MCP support
The server exposes 8004Swap operations as MCP tools for MCP clients. The tools cover Registry status, registration, quote requests and settlement, as well as x402 payments.
Configuration
Local server config is the same for every client. Copy it into your client’s MCP config file.
npx -y @stakemate/8004swap-mcp-serverAGENT_PRIVATE_KEYSecretDedicated 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_URL8004Swap Relay WebSocket URL. Defaults to the current Base Sepolia testnet deployment if omitted.RPC_URLBase Sepolia RPC URL. Defaults to https://sepolia.base.org if omitted.Local servers need a runtime on your machine (e.g. Node.js 18+). Config file locations differ by client; see your client’s docs.
Tools
5Saved tool list · updated 3w ago
| Parameter | Type | Required | Description |
|---|---|---|---|
| address | string | Yes | EVM address to check |
Details
From the project README@stakemate/8004swap-mcp-server
Exposes 8004Swap as MCP tools, so any MCP-capable agent (Claude, or any other MCP client) can request quotes, settle trades, and check Registry status directly — no human clicking through a UI in between.
Thin wrapper around @stakemate/8004swap-agent-sdk; see ../PROTOCOL.md for
what actually happens on the wire.
Tools
check_agent_status— read-only, no key needed. Checks if an address is registered + active on the 8004Swap Registry.register_agent— one-time self-registration on the Registry. Signs + broadcasts a transaction withAGENT_PRIVATE_KEY.request_quote— acts as taker: broadcasts an RFQ over the Relay, returns signed quotes from subscribed makers. NeedsAGENT_PRIVATE_KEYto authenticate to the Relay (this step costs no gas, it's an off-chain login signature).fill_quote— acts as taker: settles a quote returned byrequest_quoteon-chain viaSettlement.fillQuote(orfillQuoteWithPermitif you pass apermit). Signs + broadcasts a transaction.pay_x402— pays for any x402-gated HTTP resource (protocol v2) using the configured agent's funds: fetches the URL, and if it answers 402 with a payment requirement, signs an EIP-3009transferWithAuthorizationand retries. Only theexactscheme with theeip3009transfer method is supported (the common case for USDC-like tokens); Permit2/ERC-7710 offers are rejected. Not specific to 8004Swap's own protocol — this is how an agent that just swapped into USDC viafill_quotecan turn around and pay some other agent's x402-gated service with it.maxAmountAtomicis required on every call and is the only spending limit — always set it to the most you're willing to authorize for that one call.
There's currently no tool for acting as a maker (subscribing to a pair and responding
to broadcasts) — that role needs a long-lived connection reacting to inbound RFQs,
which doesn't fit MCP's request/response tool-call model well. Use
sdk/relay/examples/makerClient.ts directly for that role today.
Setup
npm install
npm run build
cp .env.example .env # fill in AGENT_PRIVATE_KEY if you want to sign anything
Defaults in .env.example point at the current Base Sepolia deployment — override
RPC_URL/CHAIN_ID/REGISTRY_ADDRESS/SETTLEMENT_ADDRESS/RELAY_URL for a different
network once one exists.
AGENT_PRIVATE_KEY is only needed for register_agent, request_quote, and
fill_quote. Generate a dedicated wallet for this agent — never point this at a key
that holds funds outside this testnet. There is no key rotation or scoping built in:
whoever has this env var can sign as that address.
Running
As a standalone stdio MCP server:
npm start
Point an MCP client at it, e.g. in Claude Desktop's claude_desktop_config.json:
{
"mcpServers": {
"8004swap": {
"command": "node",
"args": ["/absolute/path/to/8004swap/mcp-server/dist/index.js"],
"env": {
"AGENT_PRIVATE_KEY": "0x..."
}
}
}
}
Status
Testnet only, same as the rest of the repo. No formal audit. fill_quote and
register_agent broadcast real (testnet) transactions — there is no dry-run mode.
Comments
New to MCP?
From what the protocol is to installing your first server, these answers cover most first questions.
An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.