mcpField
M
Mcp Server For Ai To Blockchain Interactions — Balances, Swaps, Transfers, Gas, Prices. Non Custodial. Multi Chain.

Mcp Server For Ai To Blockchain Interactions — Balances, Swaps, Transfers, Gas, Prices. Non Custodial. Multi Chain.

Local
github.com/y0exchangeFinance7Updated 33w ago

About Mcp Server For Ai To Blockchain Interactions — Balances, Swaps, Transfers, Gas, Prices. Non Custodial. Multi Chain.

@y0exchange/mcp is a multi-chain DeFi MCP server for AI agents, with asset data, quotes, and transaction building. Write operations produce unsigned transactions for users to sign on their own devices; private keys are not handled by the service.

Key features

  1. 01Query balances and cross-chain portfolios
  2. 02Get prices, gas data, and swap quotes
  3. 03Review transaction history
  4. 04Build unsigned swap and transfer transactions
  5. 05Support Ethereum, BNB Chain, Arbitrum, Base, and Polygon

Use cases

  1. 01Review assets and USD values across chains
  2. 02Compare swap quotes and gas costs
  3. 03Prepare a swap or transfer for signing on-device

MCP support

The MCP server exposes DeFi lookup and transaction-building tools over stdio or Streamable HTTP. Read tools work without an API key; swaps and transfers require Y0_API_KEY and produce unsigned transactions for the user to sign.

Configuration

Local server config is the same for every client. Copy it into your client’s MCP config file.

mcp.json · Universal config
{
"mcpServers": {
"y0exchange": {
"command": "npx",
"args": [
"-y",
"@y0exchange/mcp"
],
"env": {
"Y0_API_KEY": "<Y0_API_KEY>"
}
}
}
}
Run commandnpx -y @y0exchange/mcp
Environment variables to set
Y0_API_KEYSecret

Local servers need a runtime on your machine (e.g. Node.js 18+). Config file locations differ by client; see your client’s docs.

Packages
npm@y0exchange/mcp

Tools

8

Saved tool list · updated 3w ago

ParameterTypeRequiredDescription
addressstringNoWallet address (0x...). Optional if API key is configured.
chainIdnumberNoChain ID (default: 1 for Ethereum). Supported: 1, 56, 42161, 8453, 137

Details

From the project README

@y0exchange/mcp

Let AI agents trade crypto. Non-custodial. Multi-chain. One MCP server.

npm version npm downloads license y0.exchange


What is this?

@y0exchange/mcp is a Model Context Protocol server that gives AI agents real-time access to DeFi — balances, prices, gas, swap quotes, transaction history, and the ability to execute swaps and transfers.

Connect it to Claude, ChatGPT, or any MCP-compatible AI client. Your users talk to AI, AI talks to the blockchain.

User  →  AI Agent  →  @y0exchange/mcp  →  Blockchain
                            ↓
                     y0 Signing Service (user signs on their device)

Non-custodial by design. y0 never touches private keys. Write operations build unsigned transactions — the user always signs on their own device.


Quick Start

1. Get your API key

Sign in at app.y0.exchange → API Keys → copy your key.

2. Add connector (recommended)

The simplest way — works on Claude Desktop, claude.ai, Claude Mobile, and ChatGPT:

  1. Open your AI app → Settings → Connectors → Add custom connector
  2. Name: y0
  3. URL: https://mcp.y0.exchange/mcp?key=YOUR_API_KEY
  4. Save — done!

No installs, no config files, no terminal. The API key links to your wallet — the AI agent automatically knows your address and permissions.

For developer IDEs (Cursor, Windsurf)

Add to your MCP config (e.g. .cursor/mcp.json):

{
  "mcpServers": {
    "y0": {
      "command": "npx",
      "args": ["-y", "@y0exchange/mcp"],
      "env": {
        "Y0_API_KEY": "y0_your_api_key_here"
      }
    }
  }
}
Claude Code
claude mcp add --transport http y0 https://mcp.y0.exchange/mcp?key=YOUR_API_KEY
Any MCP client (stdio)
Y0_API_KEY=y0_... npx @y0exchange/mcp

The server communicates over stdio — compatible with any MCP client.

Read-only mode

Without Y0_API_KEY, read-only tools (balances, prices, gas, quotes, history) still work. Omit the key to experiment without an account.


Remote Server (HTTP)

The hosted remote server at mcp.y0.exchange powers the connector approach above. You can also self-host it.

Self-host the remote server
# Build
pnpm --filter @y0exchange/mcp build

# Run
pnpm --filter @y0exchange/mcp start:remote

# Or with Docker
docker build -f mcp/Dockerfile -t y0-mcp-remote .
docker run -p 3100:3100 \
  -e SIGNING_SERVICE_URL=https://api.y0.exchange \
  -e ZEROX_API_KEY=your_key \
  y0-mcp-remote

The remote server exposes:

  • POST /mcp — Streamable HTTP MCP endpoint
  • GET /health — health check

Environment variable PORT controls the listening port (default: 3100).

How it differs from stdio
stdio (npx)Remote (HTTP)
Runs onUser's machineYour server
Transportstdin/stdoutStreamable HTTP
Works on mobileNoYes
Works on claude.aiNoYes
AuthY0_API_KEY env var?key= in URL or Authorization header
DeploymentNone (npm)Docker / any Node.js host

Tools

Read-only — work out of the box, no API keys required
ToolDescription
get_balanceNative + ERC-20 token balances for any wallet
get_portfolioAggregated portfolio across all chains with USD values
get_priceReal-time token prices with 24h change
get_quoteSwap quotes with routing preview, fees, and gas estimate
get_gasGas prices across chains with USD cost estimates
get_historyTransaction history with smart classification
Write — requires Y0_API_KEY
ToolDescription
swapBuild unsigned swap tx → user approves on device
sendBuild unsigned transfer tx → user approves on device

Write tools use your API key to identify your wallet. The AI agent never needs to ask for your address — it's resolved automatically from the key.


Supported Chains

ChainIDStatus
Ethereum1Production
BNB Chain56Production
Arbitrum42161Production
Base8453Production
Polygon137Production

Configuration

All configuration is via environment variables. None are required for read-only tools.

Core
VariableDescriptionDefault
Y0_API_KEYYour y0 API key (required for swap/send)—
SIGNING_SERVICE_URLy0 Signing Service endpointhttps://api.y0.exchange
Swap Providers
VariableDescription
ZEROX_API_KEY0x swap API key (tried first)
ONEINCH_API_KEY1inch swap API key (fallback)
Block Explorers (for get_history)
VariableDescription
ETHERSCAN_API_KEYEtherscan API key
BSCSCAN_API_KEYBSCScan API key
ARBISCAN_API_KEYArbiscan (falls back to Etherscan key)
BASESCAN_API_KEYBaseScan (falls back to Etherscan key)
POLYGONSCAN_API_KEYPolygonScan (falls back to Etherscan key)
Pricing
VariableDescription
COINGECKO_API_KEYCoinGecko Pro key (optional, free tier works)

How Swaps Work

1. User says: "Swap 1 ETH to USDC"

2. AI calls get_quote → shows price, fees, slippage

3. User confirms → AI calls swap (no wallet address needed — resolved from API key)

4. MCP authenticates with y0 Signing Service via Y0_API_KEY
   → builds unsigned transaction
   → sends push notification to user's mobile app

5. User reviews and signs on their device (biometric + wallet)

6. Transaction executes on-chain

Your keys never leave your device. The MCP server and y0 Signing Service only handle unsigned transaction payloads.


Example Conversations

"What's my portfolio worth?"

AI calls get_portfolio → returns breakdown by chain, token allocations, total USD value

"How much gas would a swap cost on Base right now?"

AI calls get_gas with chainId 8453 → returns gas price + USD estimates for different tx types

"Swap 500 USDC to ETH on Arbitrum"

AI calls get_quote → shows expected output → user confirms → swap builds unsigned tx → user signs

"Send 0.5 ETH to vitalik.eth"

AI calls send → builds unsigned transfer → user signs on device


Skill: Smarter DeFi Workflows

The MCP server gives Claude access to DeFi tools. The y0 DeFi Skill teaches Claude how to use them well — checking balances before swaps, warning about gas costs, recommending optimal chains, and following DeFi best practices automatically.

What it adds
  • Pre-swap safety checks (balance, gas, slippage recommendations)
  • Portfolio analysis with concentration risk warnings
  • Cross-chain gas comparison and routing suggestions
  • Confirmation gates before any write operation
  • Domain expertise: stablecoin slippage, native token reserves, test transaction recommendations
Install the skill

Claude.ai:

  1. Download skill.zip
  2. Go to Settings → Capabilities → Skills
  3. Click Upload skill and select the downloaded skill.zip
  4. Make sure your y0 MCP connector is also connected

Claude Code:

# Place the skill folder in your Claude Code skills directory
cp -r skill/ ~/.claude/skills/y0-defi-assistant/
Verify it works

Ask Claude: "Check my crypto portfolio" — it should automatically call get_portfolio, present a clear breakdown, and note any concentration risks or gas optimization opportunities.


For B2B Partners

Building an AI-powered trading product? y0 provides the infrastructure:

  • MCP server — this package, plug into any AI agent
  • Signing UI — white-label transaction approval widget
  • Signing Service — managed backend for transaction building + lifecycle
  • B2B Portal — API keys, usage dashboards, billing

Get in touch to set up your integration.


Architecture

┌───────────────────────────────────────────────────────────┐
│                    AI Agents                               │
│  Claude Desktop / Claude Code / Cursor / GPT / custom     │
│  claude.ai / Claude Mobile                                │
└──────────┬───────────────────────────────┬────────────────┘
           │ stdio (local)                 │ HTTP (remote)
           │ npx @y0exchange/mcp           │ .../mcp?key=YOUR_API_KEY
           ▼                               ▼
┌──────────────────────────────────────────────────────────┐
│                   @y0exchange/mcp                         │
│                                                          │
│  ┌─────────────────┐  ┌──────────────────┐               │
│  │   Read Tools     │  │   Write Tools    │               │
│  │                  │  │                  │               │
│  │  get_balance     │  │  swap ─────────────► y0 Signing  │
│  │  get_portfolio   │  │  send ─────────────► Service     │
│  │  get_price       │  │                  │               │
│  │  get_quote       │  └──────────────────┘               │
│  │  get_gas         │                                     │
│  │  get_history     │                                     │
│  └────────┬─────────┘                                     │
└───────────┼───────────────────────────────────────────────┘
            │
   ┌────────▼─────────┐
   │   Blockchain RPCs │
   │   CoinGecko API   │
   │   0x / 1inch APIs │
   │   Block Explorers │
   └───────────────────┘

Mobile / Web (claude.ai, Claude Mobile):
  Uses remote HTTP server — no local process needed.

Desktop / CLI (Claude Desktop, Claude Code, Cursor):
  Can use either stdio (npx) or remote HTTP.

Development

# Clone the monorepo
git clone https://github.com/y0exchange/y0exchange.git
cd y0exchange

# Install dependencies
pnpm install

# Build
pnpm --filter @y0exchange/mcp build

# Run stdio server (local dev)
pnpm --filter @y0exchange/mcp start

# Run remote HTTP server (local dev)
pnpm --filter @y0exchange/mcp start:remote

# Watch mode (rebuilds on change)
pnpm --filter @y0exchange/mcp dev

License

MIT — use it freely in your products. See LICENSE for details.


Built by y0.exchange — AI-native DeFi infrastructure

Comments

Markdown supported

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.