
Defi Mcp
io.github.matiosera3-opsPublished by GitHub account matiosera3-opsv0.1.6Updated Oct 25, 2026
AI agent access to on-chain DeFi data on Polygon & Arbitrum: balances, positions, prices.
Overview
A local MCP server that gives an assistant read-only on-chain DeFi data on Polygon and Arbitrum: token balances, Aave v3 positions, Chainlink prices and Uniswap
- What you can do
- Read wallet token balances for supported tokens on Polygon and Arbitrum, with raw amounts and decimals. Read a wallet's Aave v3 lending position: collateral, debt, borrowing power, LTV and health factor. Read current USD token prices from Chainlink price feeds. Simulate a Uniswap v3 swap across four fee tiers to get the best output amount and a gas estimate, without submitting a transaction. Check server connectivity with a simple hello tool.
- When to use it
- Useful when you want an assistant to answer questions about on-chain wallet holdings, Aave v3 borrowing health or token prices on Polygon or Arbitrum, or to preview a swap's expected output before doing anything manually. It suits users who prefer direct chain reads over a centralized DeFi data API.
- Requirements
- Runs locally as a Python package (Python 3.10+) installed via pip or run with uvx. Needs an RPC provider API key, configured through the POLYGON_RPC_URL environment variable (required) and optionally ARBITRUM_RPC_URL; Arbitrum tools fail gracefully without it. Network access to the chains is required. Desktop client only.
Installation
In SourceWeft
- Open Defi Mcp in the dashboard and add it to a workspace.
- Enable the server for the chats that should use its tools.
Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.
Other MCP clients
Follow the launch instructions in the repository.
README
defi-mcp
An MCP (Model Context Protocol) server that gives AI agents direct, on-chain access to DeFi data on EVM chains — wallet balances, Aave v3 lending positions, and live token prices, with no centralized API in the middle.
Status: Live and functional. 5 tools available today, more on the roadmap.
Why
Most "DeFi + AI" integrations route through a centralized API that can rate-limit, paywall, or simply disappear. defi-mcp talks directly to the chain (via your own RPC provider) and to first-party oracles (Chainlink), so the data your AI agent gets is exactly what's on-chain — verifiable, and not dependent on a third-party API staying online.
Tools
get_token_balance
Reads the ERC-20 balance of any wallet address for a supported token.
Supported tokens:
- Polygon:
USDC,USDC.e,USDT,WETH,WMATIC,WBTC,DAI,AAVE - Arbitrum:
USDC,USDC.e(bridged),USDT,WETH,WBTC,ARB
get_aave_position
Reads a user's full Aave v3 lending/borrowing position: collateral, debt, available borrowing power, and health factor — straight from the Aave v3 Pool contract.
A health_factor below 1.0 means the position is at risk of liquidation. A null health factor means the user has no outstanding debt.
get_token_price
Reads the current USD price of a token directly from a Chainlink price feed — the same oracle DeFi protocols use internally, so the price is consistent with what get_aave_position reports.
Supported feeds:
- Polygon:
ETH/WETH,MATIC/WMATIC,WBTC,USDC,USDT - Arbitrum:
ETH/WETH,WBTC,ARB,USDC,USDT
simulate_swap
Simulates a Uniswap v3 swap on-chain via the QuoterV2 contract — no transaction submitted, no wallet needed. Tries all four fee tiers (0.01%, 0.05%, 0.3%, 1%) and returns the best available output amount.
Supported tokens:
- Polygon:
USDC,USDC.e,USDT,WETH,WMATIC,WBTC,DAI,AAVE - Arbitrum:
USDC,USDC.e(bridged),USDT,WETH,WBTC,ARB
If no pool exists for the pair at any fee tier, returns {"error": "No liquidity found for this pair on any fee tier"}.
hello
Simple connectivity check — confirms the MCP server is reachable and responding.
Supported chains
Installation
Requires Python 3.10+ and an RPC provider API key (e.g. Alchemy, free tier works).
Create a .env file in your working directory (see .env.example):
Each chain only needs its RPC URL configured. Tools called with chain="arbitrum" will fail gracefully if ARBITRUM_RPC_URL is not set.
Usage with Claude Desktop
Add this to your Claude Desktop MCP config (claude_desktop_config.json):
Restart Claude Desktop, and the tools above will be available to the model.
Testing locally
You can test the server directly with the official MCP Inspector:
Roadmap
- Track Uniswap v3 LP positions and impermanent loss
- Monitor protocol TVLs
- Additional chains (Ethereum, Base)
-
defi-mcp-cloud— hosted tier with MEV-specific tools, caching, and higher rate limits
Architecture
Open-core model: this repository (MIT licensed) covers standard on-chain read tools. A separate defi-mcp-cloud will offer a hosted version with MEV-related tools, request caching, and managed RPC access for users who don't want to run their own infrastructure.
Resources
- defi-storage-cheatsheet — verified EVM storage slot layouts for Aave v3 and Uniswap v3, with
web3.pysnippets. Useful if you want to read on-chain state directly viaeth_getStorageAtinstead of callingviewfunctions — the lower-level approach behind some of what this server does under the hood.
Contributing
Issues and PRs welcome. This is an early-stage project — feedback on what tools would actually be useful to you is especially valuable.
License
MIT
Source: README.md at commit 9f8a8ed
Tools
0Version history
1- v0.1.6LatestSep 16, 2026
Score
50% of the applicable checks met
How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.
- Reached in the last 30 days25 pts
Keep the endpoint answering the MCP handshake; SourceWeft probes it every 30 days.
- Auth declared10 pts
Declare the credential headers in the registry entry, or keep the endpoint answering the probe so its auth can be classified.
- Tools listed15 pts
Answer tools/list without a credential, or ship a package that starts in a sandbox without one.
- DescriptionRequired15 pts
- Logo10 pts
- Documentation15 pts
- License10 pts