Trade onchain from an AI agent with Warden MCP
Warden MCP lets AI agents find tokens, quote swaps and trade onchain on Base, BNB Chain, Robinhood Chain, Arc and Solana, within limits you set. This guide takes you from zero to a swap quote, then shows how the limits work.
Server address (Streamable HTTP): https://tokens.wardenprotocol.org/mcp
1. Connect your agent
Market tools need no key, so you can start with a quote right away. Wallet tools need either a sign-in or a key.
Claude app: open Customize, then Connectors, then Add custom connector. Name it Warden, paste the server address, click Add, then Connect, sign in and press Allow. In a chat, open the + menu, then Connectors, and switch Warden on.
Claude Code: keep the key in an environment variable, never in a config file. You mint the key in the Warden app under Portfolio, then Agent access, then Connect your agent.
export WARDEN_TOKEN=wk_your-key claude mcp add-json --scope user warden '{"type":"http","url":"https://tokens.wardenprotocol.org/mcp","headers":{"Authorization":"Bearer ${WARDEN_TOKEN}"}}' Start a new session. If the tools do not show up, type /mcp and pick Warden.
Setup steps for ChatGPT, Grok, Codex and other clients are on the same page: https://tokens.wardenprotocol.org/mcp
2. Find a token
Ask in plain words:
What is trending on Base right now? Show the top three with price history.
The agent calls trending_tokens, search_tokens and price_history. The list_chains tool lists the chains Warden supports with each chain's native coin.
3. Get a swap quote
Price a $50 USDC buy of that token on Base.
The agent calls quote_swap. A quote prices the trade without committing to it and needs no key. Every swap tool takes the same shape: chainId, the token you pay with, the token you receive, and the amount in the smallest unit of the token you pay with. The reply includes approxValueUsd, which is a quick sanity check before anything is signed.
4. Prepare or execute
Two tools take the trade further, and each needs permission from you:
| Tool | Needs | Does |
|---|---|---|
prepare_swap | key + "Prepare swaps" | Builds a swap for you to sign. Never broadcasts. |
execute_swap | key + open session | Signs and sends from your wallet with nobody present. |
Before trading, ask the agent to call agent_permissions. It shows what the key may do, whether a session is open and how much budget is left.
For hands-free trading the agent calls request_session, which gives a link you approve with one tap. session_request_status tells it when you have.
5. The limits
The limits are enforced on the server, not requested from the model:
- Daily budgets, a per-trade cap for unattended trades and the session expiry live server-side. The agent reads
agent_permissionsinstead of assuming. - No tool takes raw calldata or a target address. Swaps go through Warden's router, checked on the server and again by Privy inside its enclave before anything is signed.
-
execute_swapis idempotent onidempotencyKey, so a retry with the same key never repeats a trade. - If a tool answers
needs_humanorsession, the prepared transaction goes back to you. - Token names, descriptions and chat are treated as data, never as instructions.
You set the limits in the Warden app under Portfolio, then Agent access.
Try it
- Warden MCP: https://tokens.wardenprotocol.org/mcp
- Warden Token Terminal: https://tokens.wardenprotocol.org
- Website: https://wardenprotocol.org
- X: https://x.com/wardenprotocol
- Contact: tech@wardenprotocol.org
原文:https://www.a8q9.cn/en/article/trade-onchain-from-an-ai-agent-with-warden-mcp-ad927f.html