
Defi Mcp
io.github.matiosera3-ops由 GitHub 帳號 matiosera3-ops 發布v0.1.6更新於 Oct 25, 2026
AI agent access to on-chain DeFi data on Polygon & Arbitrum: balances, positions, prices.
概覽
一個本機 MCP 伺服器,讓助理讀取 Polygon 與 Arbitrum 上的鏈上 DeFi 資料:代幣餘額、Aave v3 部位、Chainlink 價格與 Uniswap 兌換模擬。
- 可以做什麼
- 讀取 Polygon 與 Arbitrum 上支援代幣的錢包餘額,含原始數值與小數位。讀取錢包的 Aave v3 借貸部位:抵押品、債務、可借額度、LTV 與健康因子。從 Chainlink 價格來源讀取代幣目前美元價格。在四個費率級別上模擬 Uniswap v3 兌換,回傳最佳輸出量與 gas 估算,不送出交易。用簡單的 hello 工具檢查伺服器連線。
- 適用情境
- 適合讓助理回答關於 Polygon 或 Arbitrum 上錢包持倉、Aave v3 借貸健康狀況或代幣價格的問題,或在手動操作前預覽兌換的預期輸出。適合偏好直接讀取鏈上資料而非中心化 DeFi 資料 API 的使用者。
- 執行需求
- 以 Python 套件形式在本機執行(需 Python 3.10+),可透過 pip 安裝或以 uvx 執行。需要 RPC 服務商 API 金鑰,透過環境變數 POLYGON_RPC_URL(必要)與選用的 ARBITRUM_RPC_URL 設定;未設定時 Arbitrum 工具會優雅失敗。需要網路存取鏈。僅支援桌面用戶端。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Defi Mcp,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
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
來源:README.md,提交 9f8a8ed
工具
0版本歷史
1- v0.1.6最新Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分