1. Conduid
  2. Finance
  3. Demcp Defillama MCP
MCP server · Finance

Demcp Defillama MCP

MCP server: Demcp Defillama MCP

Unclaimed last commit a year ago finance
47Fair

Scored 5 months ago · breakdown

About Demcp Defillama MCP

Demcp Defillama MCP is an MCP server published by demcp in the Finance category: mCP server: Demcp Defillama MCP.

The repository has 62 stars and 15 forks, with the last commit a year ago. Six months or more without a commit doesn't mean the server is broken, but check the open issues before depending on it in production.

Install

From source
git clone https://github.com/demcp/demcp-defillama-mcp

This server has no ConduID identity, so agent calls to it are not receipted. Pin the version you install and review the source before granting it credentials.

Tools (6)

get_chain_tvlAccess historical TVL data for a specific blockchain.

Parameters not published.

get_pool_tvlGet detailed information about a specific liquidity pool.

Parameters not published.

get_poolsList available liquidity pools.

Parameters not published.

get_protocol_tvlGet TVL data for a specific protocol.

Parameters not published.

get_protocolsRetrieve information about top DeFi protocols.

Parameters not published.

get_token_pricesObtain current price information for specific tokens.

Parameters not published.

Ask AI

✦

Ask AI about Demcp Defillama MCP

Powered by Claude · Grounded in docs

I know everything about Demcp Defillama MCP. Ask me about installation, configuration, usage, or troubleshooting.

Security checks

Static checks derived from the repository yesterday. Heuristics on the source, not an audit.

  • ✓README presentThe repository ships documentation.
  • !License declaredNo license file. Legally you have no right to use it in a product.
  • !Tests presentNo tests found. Behaviour changes may go unnoticed between versions.
  • ✓Dependencies pinnedA lockfile pins dependency versions.
  • ✓No dynamic code executionSource scan found no eval, dynamic Function, or shell execution.
  • !Scoped permissionsDoesn't declare a permission scope. Assume it can do anything its process can.

README

DeFiLlama MCP

Python Version Docker

Overview

DeFiLlama MCP is a powerful and flexible tool that provides a microservice-based API wrapper around the DeFi Llama ecosystem. It leverages the FastMCP framework to transform DeFi Llama's comprehensive DeFi data into easily accessible tool endpoints that can be integrated with various AI applications, including LLM agents and autonomous systems.

This project serves as a bridge between the rich data sources provided by DeFi Llama and the emerging needs of AI-driven applications in the Web3 space. By wrapping DeFi Llama's APIs in a standardized MCP (Microservice Communication Protocol) format, developers can quickly integrate real-time DeFi data into their AI systems without dealing with the complexities of direct API integration.

Features

  • Protocol Data Access: Retrieve comprehensive information about DeFi protocols including TVL (Total Value Locked) metrics.
  • Blockchain Analytics: Access historical TVL data for specific blockchains to analyze trends and growth patterns.
  • Token Price Tracking: Fetch current price information for various tokens across multiple chains.
  • Liquidity Pool Data: Get detailed insights into liquidity pools, including TVL and other critical metrics.
  • Standardized Interface: All data is accessible through a consistent API pattern, making it easy to integrate with AI systems.
  • Docker Support: Ready-to-deploy containerization for easy implementation in any environment.
  • Server-Sent Events: Real-time data updates using SSE transport mechanism.

Architecture

DeFiLlama MCP is built using a modular architecture that separates the data-fetching logic from the API interface. The core components include:

  1. API Clients: Specialized HTTP clients for each of DeFi Llama's API endpoints (Main, Coins, Yields).
  2. MCP Tools: Function-based tools that transform raw API responses into structured data for consumption by AI agents.
  3. FastMCP Server: A lightweight server that exposes the tools via HTTP and SSE (Server-Sent Events).
  4. Error Handling: Robust error management to ensure reliability even when upstream services experience issues.

Installation

Prerequisites

  • Python 3.13 or higher
  • uv (Python package installer and environment manager)

Option 1: Local Installation

# Clone the repository
git clone https://github.com/demcp/defillama-mcp.git
cd defillama-mcp

# Create a virtual environment and install dependencies
uv venv
uv pip install -e .

# Run the server
uv run defillama.py

Option 2: Docker Installation

# Clone the repository
git clone https://github.com/demcp/defillama-mcp.git
cd defillama-mcp

# Build the Docker image
docker build -t defillama-mcp .

# Run the container
docker run -p 8080:8080 defillama-mcp

Usage

Once the server is running, it exposes several endpoints that can be used to interact with DeFi Llama data:

Available Tools

  • get_protocols: Retrieve information about top DeFi protocols.
  • get_protocol_tvl: Get TVL data for a specific protocol.
  • get_chain_tvl: Access historical TVL data for a specific blockchain.
  • get_token_prices: Obtain current price information for specific tokens.
  • get_pools: List available liquidity pools.
  • get_pool_tvl: Get detailed information about a specific liquidity pool.

Example: Using with Python

import httpx

# Query the MCP server for protocol data
async def get_protocol_data(protocol_name: str):
    async with httpx.AsyncClient() as client:
        response = await client.post(
            "http://localhost:8080/tools/get_protocol_tvl",
            json={"protocol": protocol_name}
        )
        return response.json()

# Usage
import asyncio
result = asyncio.run(get_protocol_data("aave"))
print(result)

Example: Using with LangChain

from langchain.agents import load_tools
from langchain.agents import initialize_agent
from langchain.llms import OpenAI

# Load DeFiLlama MCP tools
tools = load_tools(["defillama-mcp"], base_url="http://localhost:8080")

# Initialize an agent with the tools
llm = OpenAI(temperature=0)
agent = initialize_agent(tools, llm, agent="zero-shot-react-description", verbose=True)

# Run the agent
agent.run("What is the current TVL of Uniswap?")

Example: Using with Autonomous Agents

from autogen import Agent, ConversableAgent

financial_analyst = ConversableAgent(
    name="FinancialAnalyst",
    llm_config={
        "tools": [
            {
                "name": "defillama_protocol_tvl",
                "url": "http://localhost:8080/tools/get_protocol_tvl"
            }
        ]
    }
)

# The agent can now access DeFi data during its reasoning process
financial_analyst.initiate_chat("Analyze the TVL trends for Aave protocol")

API Reference

GET /protocols

Returns a list of DeFi protocols tracked by DeFi Llama.

Response:

[
  {
    "id": "ethereum:0x7fc66500c84a76ad7e9c93437bfc5ac33e2ddae9",
    "name": "Aave",
    "symbol": "AAVE",
    "chain": "Ethereum",
    "tvl": 6240000000
  },
  ...
]

POST /tools/get_protocol_tvl

Get TVL information for a specific protocol.

Request:

{
  "protocol": "aave"
}

Response:

{
  "ethereum": 3240000000,
  "polygon": 980000000,
  "avalanche": 570000000,
  "optimism": 450000000,
  "arbitrum": 1000000000,
  "total": 6240000000
}

POST /tools/get_chain_tvl

Get historical TVL data for a blockchain.

Request:

{
  "chain": "ethereum"
}

Response:

[
  {
    "date": "2023-01-01",
    "tvl": 28500000000
  },
  {
    "date": "2023-01-02",
    "tvl": 28700000000
  },
  ...
]

Contributing

Contributions are welcome! Here's how you can help improve DeFiLlama MCP:

  1. Fork the Repository: Create your own fork of the project.
  2. Create a Feature Branch: git checkout -b feature/amazing-feature
  3. Commit Your Changes: git commit -m 'Add some amazing feature'
  4. Push to the Branch: git push origin feature/amazing-feature
  5. Open a Pull Request: Submit your changes for review.

Development Guidelines

  • Follow PEP 8 style guidelines for Python code.
  • Write tests for new features.
  • Update documentation to reflect changes.
  • Ensure backward compatibility when possible.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

  • DeFi Llama for providing the comprehensive DeFi data APIs.
  • The FastMCP team for creating the microservice framework.
  • All contributors who have helped shape this project.

Roadmap

  • Add support for more DeFi Llama endpoints
  • Implement caching layer for improved performance
  • Develop authentication and rate limiting
  • Create detailed documentation site
  • Build example integrations with popular AI frameworks
  • Add metric collection and monitoring

Contact

For questions, suggestions, or discussions about this project, please open an issue on GitHub or contact the maintainers:


uv run defillama.py

README fetched from the repository yesterday. The original is authoritative.

Questions

About Demcp Defillama MCP

How do I install Demcp Defillama MCP?

No package has been published for this server, so install it from source: clone the repository and follow its README.

Is Demcp Defillama MCP safe to use with an AI agent?

Its trust score is 47 out of 100 (fair). It passes 3 of the 6 static security checks run so far; the failures are listed above. It has no ConduID identity yet, so agent calls to it are not receipted.

Is Demcp Defillama MCP still maintained?

The last commit was a year ago and 2 open issues. That's long enough that you should check whether the maintainer is responding to issues before depending on it.