To let an AI agent swap crypto safely, connect it to a swap MCP server such as https://torrentswap.com/mcp. The agent can list assets, compare quotes, check addresses and create a one-time deposit address, but it never holds your keys. You approve the route and send the deposit from your own wallet.
This guide shows the real setup for Claude, Claude Code, ChatGPT and Cursor, the exact tools the agent gets, example prompts with the calls they trigger, and the guardrails that keep an AI agent crypto workflow from turning into an expensive mistake. If you would rather skip MCP entirely, the last sections cover the plain REST alternative.
What MCP is, and what a crypto AI agent can actually do with it
The Model Context Protocol (MCP) is an open standard for connecting AI applications to outside tools and data. Anthropic published it in November 2024, and it is now supported by Claude, ChatGPT, Cursor, VS Code and many other clients. An MCP server advertises a list of tools; the assistant decides when to call them and shows you the results.
For crypto, that matters because the assistant can stop guessing. Instead of quoting a price from training data, it asks a live service. With the TorrentSwap server, the agent works with real routes from NEAR Intents, Chainflip and Flashnet across 39 assets on 17 networks, ranked by the amount you receive. Every quoted amount already includes all fees, including network and protocol fees. There is no account and no API key.
Just as important is what the agent cannot do. It cannot sign transactions, move funds or see a private key. The last step, sending the deposit, always happens in your wallet. That design is the main reason "ai agent crypto trading" through a deposit-address swap is safer than handing a bot a hot wallet.
The five tools your agent gets
| Tool | What it does | Changes anything? |
|---|---|---|
list_assets | Returns every swappable asset with the id used in quotes (for example bitcoin-btc, ethereum-eth, tron-usdt), plus ticker, network and decimals. Optional query and network filters. | No (read-only) |
get_quote | Live routes for a pair and amount, best first. Each route names the protocol and gives expectedReceive, minimumReceived, estimated time and a quoteToken. | No (read-only) |
validate_address | Checks an address, including its checksum, against the network of a given asset and returns the canonical form. | No (read-only) |
create_swap | Turns a quoteToken plus destination and refund addresses into a one-time depositAddress, the exact amount to send, expiresAt and a swapId. Repeating the call with the same inputs returns the same address. | Creates a swap order; no funds move until you pay |
get_swap_status | Follows a swap from awaiting_deposit through confirming, exchanging and sending to completed, or to refunded or expired. | No (read-only) |
The server also ships instructions that tell the model the intended order: list assets, quote, show the route, ask the user for both addresses, create the swap only after confirmation, and never ask for a seed phrase.
Setup: Claude on the web and Claude Desktop
In Claude, remote MCP servers are added as custom connectors. According to Anthropic's help center, custom connectors are available on Free, Pro, Max, Team and Enterprise plans, with Free accounts limited to one. On a personal plan:
- Open Customize > Connectors.
- Click + Add, then Add custom connector.
- Name it
TorrentSwapand pastehttps://torrentswap.com/mcpas the server URL, then continue. - Under Authentication choose No sign in (the server needs no OAuth), then click Add.
- In a chat, open the + menu, choose Connectors and switch TorrentSwap on for that conversation.
On Team and Enterprise plans an owner adds the connector once under Organization settings > Connectors, and members then connect it from their own connector list. Note that Claude Desktop uses this same connector flow for remote servers; Anthropic says it will not connect to remote servers written directly into claude_desktop_config.json.
Setup: Claude Code
Claude Code adds remote servers from the terminal. One command is enough:
claude mcp add --transport http torrentswap https://torrentswap.com/mcp
The default scope is local to the current project. Add --scope user to make the server available in every project, or --scope project to write it to a shared .mcp.json that teammates approve on first use. Run claude mcp list in your shell, or /mcp inside a session, to confirm it shows as connected.
Setup: ChatGPT (MCP app or custom GPT action)
ChatGPT offers two routes.
Option 1: a developer-mode MCP app
- Go to Settings > Apps & Connectors > Advanced settings and enable Developer mode. In workspaces, an admin may need to enable it first.
- Click Create, give the app a name, enter
https://torrentswap.com/mcpas the MCP server URL and choose no authentication. - Confirm the warning about unverified connectors and enable the app in a chat.
Which plans can use developer mode, and whether write actions are allowed, has changed several times and differs between personal and business plans, so check OpenAI's current help article for your account. OpenAI's developer docs state that ChatGPT requires manual confirmation before write actions run, which is exactly what you want for create_swap.
Option 2: a custom GPT with Actions
If you build GPTs, open the GPT editor, go to Configure > Actions, choose Import from URL and enter https://torrentswap.com/openapi.json. Set authentication to none. The OpenAPI 3.1 spec exposes four operations: listAssets, getQuote, createSwap and getSwapStatus. The create operation is flagged with x-openai-isConsequential: true, which per OpenAI's actions documentation means ChatGPT must ask for confirmation every time and hides the "always allow" option.
Setup: Cursor and other MCP clients
Cursor reads MCP servers from .cursor/mcp.json in a project or ~/.cursor/mcp.json for all projects. Remote servers use a url field:
{
"mcpServers": {
"torrentswap": { "url": "https://torrentswap.com/mcp" }
}
}
The same block works in most clients that accept an mcpServers map, including VS Code. No headers or tokens are needed.
Example prompts and the tool calls behind them
Once connected, talk to the agent in plain language. A good first prompt is:
Quote 0.05 BTC to ETH. Show me the protocol, what I get and the minimum. Do not create anything yet.
The agent will typically call list_assets to resolve tickers, then:
get_quote {
"sellAssetId": "bitcoin-btc",
"buyAssetId": "ethereum-eth",
"sellAmount": "0.05"
}
The response lists routes best first. Each one carries the executing protocol, expectedReceive (after all fees), minimumReceived (below this the deposit is refunded), an estimated duration and a quoteToken. Slippage defaults to 1.5% and can be set between 0.1% and 5%.
When you are ready, give the agent your addresses explicitly:
Use the best route. Send the ETH to 0xYourAddress and refund to bc1qYourAddress if it fails. Validate both first.
validate_address { "assetId": "ethereum-eth", "address": "0xYourAddress" }
validate_address { "assetId": "bitcoin-btc", "address": "bc1qYourAddress" }
create_swap {
"quoteToken": "v2...",
"destinationAddress": "0xYourAddress",
"refundAddress": "bc1qYourAddress"
}
The agent replies with a deposit address, the exact amount and an expiry time. You send exactly that amount in one transaction from your own wallet. Then ask "check my swap" and the agent calls get_swap_status with the swapId. Other prompts that work well:
- "Which networks can I receive USDT on?" (filters
list_assets) - "Compare 500 USDT on Tron to USDC on Solana against USDC on Base."
- "Is this a valid Solana address for USDC: ...?"
Guardrails: how to keep an AI agent swap safe
| Risk | Guardrail |
|---|---|
| Key exposure | The agent never needs a private key or seed phrase. If any assistant asks for one, stop. Funds only move when you sign in your wallet. |
| Stale prices | Quote tokens are valid for about 2 minutes. If you take longer to confirm, have the agent re-quote rather than reuse an old token. |
| Wrong or invented addresses | Always paste addresses yourself and have the agent run validate_address. The destination is on the buy asset's network; the refund address is on the sell asset's network. |
| Partial or late deposits | Send the exact amount, in one transaction, before expiresAt. Each deposit address is single-use. |
| Price moving during the swap | The minimumReceived floor is enforced by the protocol; if it cannot be met, the deposit goes back to your refund address. |
| Over-eager automation | Approve create_swap manually each time. Anthropic advises using "Allow always" only for servers and tools you trust to run unsupervised, and warns that tool output can contain hidden instructions. |
On the server side, the quote token is sealed, so the route, amount and fee cannot be altered between quote and swap, and swap creation is idempotent, so a retry never produces a second deposit address. TorrentSwap never holds funds.
The REST alternative
If you are building your own agent framework, or your client does not speak MCP, the same flow is available over HTTPS at https://torrentswap.com/api/v1 with CORS enabled and no key:
# Quote (read-only)
curl "https://torrentswap.com/api/v1/quote?from=bitcoin-btc&to=ethereum-eth&amount=0.05"
# Create the swap from the chosen route's quoteToken
curl -X POST https://torrentswap.com/api/v1/swap \
-H "Content-Type: application/json" \
-d '{"quoteToken":"v2...","destinationAddress":"0x...","refundAddress":"bc1q..."}'
# Poll status
curl "https://torrentswap.com/api/v1/status?swapId=..."
Assets come from /api/v1/assets, and the full contract is in the OpenAPI spec at /openapi.json, which LangChain and other OpenAPI-aware tools can import. Address validation runs server-side when a swap is created, so an invalid address is rejected before a deposit address exists. Requests are rate-limited per IP: 60 quotes per minute, 30 swap creations per 5 minutes and 120 status checks per minute.
| MCP server | REST API | |
|---|---|---|
| Best for | Chat assistants and IDE agents | Custom bots, backends, scripts |
| Endpoint | https://torrentswap.com/mcp | https://torrentswap.com/api/v1 |
| Address check | Dedicated validate_address tool | Enforced on swap creation |
| Auth | None | None |
| Fee | Included in quotes | Included in quotes |
For a broader look at how different swap MCP servers handle custody, fees and supported chains, see our comparison of crypto swap MCP servers.
Start building
Copy the server URL, connection snippets and OpenAPI link from the TorrentSwap developer page, add the connector to your assistant, and ask for a quote. Your agent can be quoting live cross-chain routes in about a minute, while you keep control of every deposit.
Sources
- Introducing the Model Context Protocol (Anthropic)
- What is the Model Context Protocol? (modelcontextprotocol.io)
- Getting started with custom connectors using remote MCP (Claude Help Center)
- Connect Claude Code to tools via MCP (Claude Code docs)
- Developer mode and MCP apps in ChatGPT (OpenAI Help Center)
- Building MCP servers for ChatGPT and API integrations (OpenAI)
- Configuring actions in GPTs (OpenAI Help Center)
- GPT Actions in production: consequential flag (OpenAI)
- Model Context Protocol in Cursor (Cursor docs)
- TorrentSwap API and MCP server
- TorrentSwap OpenAPI specification
Facts were checked against these sources on October 22, 2026. See our editorial policy.