DefiLlama MCP server for AI agents and assistants

Securely connect your AI agents and chatbots (Claude, ChatGPT, Cursor, etc) with DefiLlama MCP or direct API to query protocol data, compare chains, track token prices, and analyze yields through natural language.

DefiLlama logoDefiLlama
No Auth

DefiLlama is a public DeFi data platform covering protocols, chains, prices, yields, and fees. It helps you track the crypto ecosystem with broad, up-to-date market data.

19 Tools

Try DefiLlama now

Type what you want done — sign in and watch it run live in the Tool Router playground.

TOOL ROUTER PLAYGROUND
DefiLlama
Try asking
TOOLS

Supported Tools

Every DefiLlama action and event your agent gets out of the box.

Get Batch Historical Token Prices

Get prices for multiple token identifiers at multiple requested Unix timestamps in one call.

Get Block By Timestamp

Get the closest block height on a chain for a Unix timestamp.

Get Current Token Prices

Get current USD prices and available confidence scores for comma-separated chain:address or coingecko:id tokens.

Get First Token Prices

Get the earliest available price record for one or more token identifiers.

Get Historical Token Prices

Get token prices nearest one Unix timestamp for comma-separated token identifiers.

Get Historical TVL

Return a bounded window of historical DeFi TVL across all chains or for one chain, excluding liquid staking and double-counted TVL.

Get Metric Overview

Get global or per-chain DEX volume, fees/revenue, open interest, or options volume totals, windowed protocol rankings, and optional historical charts.

Get Protocol

Get a protocol's profile, current TVL by chain, and windowed historical TVL and token breakdowns.

Get Protocol Current TVL

Get the current total value locked in USD for one protocol.

Get Protocol Metric Summary

Get one protocol's metadata, historical charts, and totals for the selected DEX volume, fees/revenue, or options volume metric.

Get Stablecoin

Get one stablecoin's metadata, current balances by chain, and a bounded window of aggregate or chain-specific balance history.

Get Stablecoin Price History

Get historical prices for all tracked stablecoins.

Get Stablecoins Chart

Get windowed historical stablecoin market capitalization across all chains or for one chain, optionally filtered to one stablecoin ID.

Get Token Price Chart

Get bounded windows of regular-interval price series for one or more token identifiers over the requested time range.

Get Token Price Percentage Change

Get percentage price changes for token identifiers over a requested period before or after a timestamp.

List Chains TVL

List supported chains with current TVL and native-token identifiers in a bounded local window that can be continued with next_offset.

List Protocols

List DeFi protocols with identifiers, categories, chains, current TVL, and recent TVL changes.

List Stablecoin Chains

List chains with current aggregate stablecoin market capitalization in a bounded local window that can be continued with next_offset.

List Stablecoins

List stablecoins with IDs, peg metadata, circulating amounts, and optional current prices.

SETUP GUIDE

Connect DefiLlama MCP Tool with your Agent

1

Install Composio

typescript
npm install @composio/core ai @ai-sdk/mcp @ai-sdk/openai
Install the Composio SDK and your agent framework
2

Create a session with MCP enabled

typescript
import { Composio } from "@composio/core";

const composio = new Composio();
const { mcp } = await composio.create("your-user-id", {
  toolkits: ["defillama"],
  mcp: true,
});
Create a session scoped to DefiLlama and read its MCP URL and headers
3

Connect your agent to the MCP server

typescript
import { createMCPClient } from "@ai-sdk/mcp";
import { openai } from "@ai-sdk/openai";
import { generateText, stepCountIs } from "ai";

const client = await createMCPClient({
  transport: { type: "http", url: mcp.url, headers: mcp.headers },
});

const { text } = await generateText({
  model: openai("gpt-5.6-sol"),
  tools: await client.tools(),
  prompt: "Compare the current TVL of Ethereum and Solana protocols",
  stopWhen: stepCountIs(10),
});

console.log(text);
await client.close();
Pass the session's MCP URL and headers to your agent and run a DefiLlama request
SETUP GUIDE

Connect DefiLlama API Tool with your Agent

1

Install Composio

typescript
npm install @composio/core @composio/openai openai
Install the Composio SDK, the OpenAI provider, and the OpenAI SDK
2

Create a Composio session

typescript
import OpenAI from "openai";
import { Composio } from "@composio/core";
import { OpenAIResponsesProvider } from "@composio/openai";

const composio = new Composio({ provider: new OpenAIResponsesProvider() });
const client = new OpenAI();

const session = await composio.create("your-user-id", { toolkits: ["defillama"] });
const tools = await session.tools();
Initialize Composio with the OpenAI Responses provider and create a session scoped to DefiLlama
3

Run DefiLlama tools with your agent

typescript
let response = await client.responses.create({
  model: "gpt-5.6-sol",
  tools,
  input: [{ role: "user", content: "Compare the current TVL of Ethereum and Solana protocols" }],
});

while (response.output.some((o) => o.type === "function_call")) {
  const outputs = await composio.provider.handleToolCalls(session, response.output);
  response = await client.responses.create({
    model: "gpt-5.6-sol",
    tools,
    previous_response_id: response.id,
    input: outputs,
  });
}

console.log(response.output_text);
Send a request, execute the DefiLlama tool calls through the session, and print the final answer

Why Use Composio?

AI Native DefiLlama Integration

  • Supports both DefiLlama MCP and direct API based integrations
  • Structured, LLM-friendly schemas for reliable DeFi data queries
  • Rich coverage for protocols, chains, token prices, yields, volumes, fees, and open interest

No Credential Friction

  • DefiLlama's public data tools require no API keys or OAuth setup
  • Start querying DeFi metrics without storing or rotating credentials
  • Keep agent access scoped to the DefiLlama tools your workflow needs

Agent Optimized Design

  • Tools are tuned using real error and success rates to improve reliability over time
  • Comprehensive execution logs so you always know what ran, when, and on whose behalf

Enterprise Grade Security

  • Fine-grained RBAC so you control which agents and users can access DefiLlama
  • Scoped tool access for least-privilege DeFi data workflows
  • Full audit trail of agent actions to support review and compliance
FRAMEWORKS

Use DefiLlama with any AI Agent Framework

Choose a Framework you want to connect DefiLlama with

Rolling this out across your team?

Give your team centralized access control across every framework with Composio’s MCP Gateway.

EXPLORE MCP GATEWAY
FAQ

Frequently asked questions

Start with DefiLlama.It takes 30 seconds.

Managed auth, hosted MCP servers, and every DefiLlama tool your agent needs.Free to start.

Start building