DeFi MCP

Connect an AI assistant or IDE to Blockdaemon's DeFi APIs over the Model Context Protocol — no HTTP client code required.

Connect an AI assistant or IDE to Blockdaemon's DeFi APIs over the Model Context Protocol (MCP), so you can query balances, request swap quotes, and build transactions conversationally — without writing HTTP client code.

📘

Who this is for

Developers of any experience level. Used an MCP server before? Skip to Quickstart. New to MCP? Start with Overview.

At a glance

Endpoint
https://svc.blockdaemon.com/defi/v1/mcp/http
Transport

Streamable HTTP (no stdio)

Auth

X-Api-Key header, same key as other Blockdaemon APIs

Supported clients

Claude Code · VS Code · Codex CLI · Cursor · Claude Desktop (via proxy)


Overview

What it is

The DeFi MCP Server exposes Blockdaemon's DeFi APIs as MCP tools. Connect your assistant to the server once, and from then on it discovers the available tools and calls them on your behalf in response to ordinary prompts.

What it solves

Without MCPWith the DeFi MCP Server
Hand-write request builders, auth headers, and response parsers per endpointThe client handles tool discovery and invocation
DeFi data lives outside your editorBalances, quotes, and liquidity data are one prompt away
A separate integration per tool or IDEOne endpoint works with every MCP-compatible client

What you can do

🔗 Chain data

Balances, blocks, transactions, gas prices, contract calls

🔄 DEX

Swap quotes, swaps, liquidity pools, routes

🌉 Bridging

Cross-chain routes, quotes, swaps

🏦 Lending and borrowing

Pool data, deposits, borrows, repayments, user positions

📈 Liquid staking

Stake and unstake, rewards, APR

🌾 Yield aggregation

Vault and pool balances, deposits, withdrawals

🪙 Tokens and NFTs

Balances, metadata, ownership

⚙️ Account abstraction, oracles, and derivatives

Account abstraction, oracles, and derivatives

📘

Note

The tool list is defined by the server and evolves over time. For the authoritative list of supported operations, see the DeFi API documentation.


Before you begin

You need three things.

1. A Blockdaemon API key

Create one in the Blockdaemon dashboard. New to Blockdaemon? Follow Get your API credentials for step-by-step instructions.

The key must have access to the DeFi product. You can reuse the key you already use for other Blockdaemon APIs — no separate MCP key is required.

2. The endpoint

https://svc.blockdaemon.com/defi/v1/mcp/http

This is an MCP-over-HTTP endpoint using the Streamable HTTP transport. Your client connects to this single URL — there's no local process to install. Any client that supports the http (sometimes called streamable-http) transport type can connect; you don't need a Blockdaemon-specific client.

🚧

stdio is not supported

The server only speaks Streamable HTTP. Clients that only support stdio need a bridging proxy — see Claude Desktop.

3. Authentication

Every request must carry your key in an X-Api-Key header:

X-Api-Key: <YOUR_BLOCKDAEMON_API_KEY>

Requests without a valid key are rejected before reaching any tool. Each client section below shows how to supply the header without hardcoding the key in a committed file.


Quickstart

Pick your client, then follow the matching section. All five point at the same endpoint.

ClientConfig fileHow the header is passed
Claude Code.mcp.json (project) or ~/.claude.json (user)"type": "http" + headers
Visual Studio Code.vscode/mcp.json"type": "http" + headers with ${input:...}
OpenAI Codex CLI~/.codex/config.tomlurl + env_http_headers
Cursor.cursor/mcp.json (project) or ~/.cursor/mcp.json (user)url + headers
Claude Desktopclaude_desktop_config.jsonvia the mcp-remote proxy (stdio → HTTP)

Claude Code, VS Code, Codex CLI, and Cursor pass custom headers natively and are the better choice for authenticated or automated workflows. Claude Desktop requires a proxy.


Client setup

Each section follows the same order: prerequisites → configuration → authentication → verification → troubleshooting.

Claude Code

Prerequisites

Add via CLI (recommended)

Choose a scope explicitly. Without --scope, the server is added at user scope, which is easy to forget later.

# Project scope — writes .mcp.json in the repo root, shared with your team
claude mcp add --scope project --transport http blockdaemon-defi \
  https://svc.blockdaemon.com/defi/v1/mcp/http \
  --header "X-Api-Key: ${BLOCKDAEMON_API_KEY}"

# User scope — writes ~/.claude.json, available in all your projects
claude mcp add --scope user --transport http blockdaemon-defi \
  https://svc.blockdaemon.com/defi/v1/mcp/http \
  --header "X-Api-Key: ${BLOCKDAEMON_API_KEY}"

Or configure by hand

.mcp.json in the project root:

{
  "mcpServers": {
    "blockdaemon-defi": {
      "type": "http",
      "url": "https://svc.blockdaemon.com/defi/v1/mcp/http",
      "headers": {
        "X-Api-Key": "${BLOCKDAEMON_API_KEY}"
      }
    }
  }
}

Authentication

Export the key before launching Claude Code, and reference it as ${BLOCKDAEMON_API_KEY} so the raw value never enters a committed file:

export BLOCKDAEMON_API_KEY="your-api-key"

Verify

claude mcp list

Confirm blockdaemon-defi reports as connected, then ask Claude to list the tools for that server.

Troubleshooting

SymptomFix
401 / 403Check the key value and that the header is exactly X-Api-Key: <key>.
Server not listedConfirm you passed --transport http; Claude Code defaults to stdio.
Added to the wrong placeRe-run with an explicit --scope, and remove the stale entry.
Hanging connectionRaise the timeout with the MCP_TIMEOUT environment variable.

Example workflows

Once connected, you interact in plain language — the assistant selects the tool.

Check a token balance

"What's the USDC balance of wallet 0xabc123... on Ethereum?"

The assistant calls the balance tool with the address, chain, and token, and returns a readable result — for example, the wallet holds 1,250.42 USDC on Ethereum mainnet.

Request a swap quote

"Get me a quote to swap 1 ETH for USDC on Ethereum."

The assistant calls the DEX quote tool with the token pair, chain, and amount, and returns the expected output, route, and fees — with no need to know the underlying aggregator's request shape.

Chain several calls

"Get a quote for swapping 1 ETH to USDC, then show me my current ETH balance on that wallet."

The assistant invokes multiple tools in sequence and combines the results.

Bridge tokens across chains

"What's the cheapest route to bridge 500 USDC from Ethereum to Arbitrum? Show me the breakdown."

The assistant calls the bridge quote tool with the source chain, destination chain, token, and amount, then returns the available routes ranked by cost — including protocol fees, gas estimates on both chains, and expected arrival time.

Inspect a lending position

"Show me my current borrow position on Aave for wallet 0xabc123... on Ethereum — what's my health factor and how much can I safely borrow?"

The assistant calls the user account data tool to retrieve the collateral value, total debt, available borrow capacity, and health factor, presenting a summary that makes the risk level immediately clear.


Best practices

Protect your API key

  • Never commit keys. Use each client's secret mechanism: ${VAR} in Claude Code, ${input:...} in VS Code, env_http_headers in Codex, user-scope config in Cursor, an env block in Claude Desktop.
  • Scope keys narrowly and rotate them on a schedule via the Blockdaemon dashboard.

Respect rate limits

  • Limits are enforced per API key. Batch or cache repeated lookups — balances rarely need sub-second polling. For current limits by plan, see the Blockdaemon documentation.

Handle errors deliberately

  • Treat MCP tool errors like any API error: read the code and message before retrying. Don't blind-retry 4xx responses such as invalid parameters or bad auth.

Choose the right client for the job

  • For automated or CI-adjacent workflows, prefer Claude Code, Codex CLI, VS Code, or Cursor — they pass headers natively.
  • For Claude Desktop in a team, standardize on the mcp-remote proxy with the env pattern and document key rotation for shared machines.

Troubleshooting

Start here for issues that aren't client-specific.

IssueLikely causeFix
401 / 403Missing or malformed X-Api-Key headerConfirm the header is exactly X-Api-Key: <key> and the key is current
Invalid API keyKey revoked, expired, or mistypedGenerate a new key at app.blockdaemon.com
Connection errorsWrong transport configured, e.g. stdio instead of HTTPConfigure the client for HTTP / Streamable HTTP, not a local process
Requests never reach the serverNetwork or proxy blocking egressConfirm outbound access to svc.blockdaemon.com
TimeoutsSlow network or an unusually large requestRaise the client's connection and tool timeouts (see the client sections)
📘

Still stuck?

Capture your client's MCP log output and contact Blockdaemon support.


FAQ

Do I need a separate API key for the MCP server?

No. Use the same Blockdaemon key you use elsewhere, provided it has DeFi product access.

Which clients are supported?

Any client that supports the Streamable HTTP transport. This guide covers Claude Code, VS Code, Codex CLI, Cursor, and Claude Desktop.

Does the server support stdio?

No — HTTP only. Clients limited to stdio, such as Claude Desktop natively, need a bridging proxy like mcp-remote.

Is the tool list the same across clients?

Yes. The server defines the tool list, so every client on the same endpoint sees the same tools.

Are there rate limits?

Yes, standard Blockdaemon per-key limits apply. See the Blockdaemon documentation for current figures.


Reference

👋 Need Help?

Contact us through email or our support page for any issues, bugs, or assistance you may need.


Did this page help you?