ED

Edwin MCP Server for EVM and Solana DeFi

Enable AI agents to interact with DeFi across EVM, Solana and other blockchains using the Edwin MCP server.

Quick Install
npx -y @examples/mcp-server

Overview

The Edwin MCP Server lets AI agents interact programmatically with decentralized finance (DeFi) on EVM-compatible chains and Solana using the Model Context Protocol (MCP). It exposes a small set of chain-aware “tools” (HTTP endpoints) that translate high-level agent requests into on-chain reads, simulations, and transactions. This makes it straightforward to integrate LLMs and agents with real-time blockchain data and actions without embedding chain logic inside the model itself.

By running the server alongside an LLM orchestration layer, you can provide models with reliable, auditable access to token balances, pool state, price data, and transaction submission across multiple chains. The server acts as a safe, configurable bridge between natural-language agent intents and deterministic chain operations, enabling use cases like portfolio queries, trade simulations, arbitrage detection, and constrained transaction execution.

Features

  • Chain-agnostic endpoints for EVM and Solana DeFi primitives
  • Read-only data fetches: balances, token metadata, pool states, recent transactions
  • Simulation helpers: swap/quote estimation and gas/cost previews
  • Transaction building and optional signing/submission via configured keys
  • Simple JSON-based MCP tool interface for LLMs and agents
  • Configurable RPC endpoints and chain mappings via environment variables
  • Example implementation ready to extend for custom DeFi tooling

Installation / Configuration

Prerequisites: Node.js (16+), npm or yarn, RPC endpoints for EVM chains and Solana, optionally a private key for submitting transactions.

Clone and install:

git clone https://github.com/edwin-finance/edwin.git
cd edwin/examples/mcp-server
npm install

Create a .env file (example below) or export environment variables:

PORT=3000
EVM_RPC_URLS='{"1":"https://mainnet.infura.io/v3/YOUR_KEY","5":"https://goerli.example"}'
SOLANA_RPC_URL="https://api.mainnet-beta.solana.com"
PRIVATE_KEY="0xabc123..."        # optional, used for signing txs
ALLOWED_CHAINS='["1","5","101"]' # example chain ids

Example .env table

VariableDescription
PORTHTTP port for the MCP server
EVM_RPC_URLSJSON map of chainId -> RPC URL for EVM chains
SOLANA_RPC_URLRPC URL for Solana cluster
PRIVATE_KEYOptional signer private key for tx submission
ALLOWED_CHAINSJSON array of allowed chain IDs

Start the server:

npm run start
# or for development
npm run dev

The server will expose MCP-compatible tool endpoints (see Available Resources).

Available Resources

The server exposes a small set of JSON endpoints suitable to register as MCP tools. Typical endpoints include:

  • GET /health — basic readiness probe
  • POST /mcp/tool/balance — return token balances for an address (EVM or Solana)
  • POST /mcp/tool/token-info — token metadata (decimals, symbol, name)
  • POST /mcp/tool/pool-info — AMM pool state (reserves, liquidity)
  • POST /mcp/tool/quote — estimate swap output/price for a given route/amount
  • POST /mcp/tool/simulate-tx — simulate transaction gas/cost without broadcasting
  • POST /mcp/tool/send-tx — optionally sign and broadcast a transaction (if PRIVATE_KEY configured)
  • POST /mcp/tool/tx-history — fetch recent transactions for an address

Each tool accepts a JSON body describing the request (chain, address(s), token(s), amount, route) and returns a structured JSON result suitable for consumption by an LLM or agent. Check the repository examples for exact request/response shapes.

Example curl to get a token balance (EVM):

curl -X POST http://localhost:3000/mcp/tool/balance \
  -H "Content-Type: application/json" \
  -d '{"chain":"1","address":"0x...","token":"0x..."}'

Response (example):

{
  "ok": true,
  "chain": "1",
  "address": "0x...",
  "token": "0x...",
  "balance": "1234567890000000000",
  "decimals": 18
}

Use Cases

  • Agent-enabled portfolio tracker: an LLM can call the balance and token-info tools to summarize holdings across EVM and Solana wallets and produce human-readable portfolio statements.
  • Trade simulation for safety checks: before instructing a user or submitting a transaction, an agent can estimate swap outcomes and gas costs using quote and simulate-tx endpoints.
  • Cross-chain arbitrage detection: poll pool-info and price data across multiple chains to identify price divergences; use the MCP server to compute profitability estimates.
  • Automated liquidation or strategy execution: agents can monitor positions and, when rules are met, prepare and optionally submit transactions through the send-tx endpoint (requires careful key management and safety checks).
  • On-chain research and QA: integrate as a tool for agents that answer natural-language questions about DeFi state (e.g., “How much liquidity is in Uniswap pool X?”).
  • Repository (examples/mcp-server): https://github.com/edwin-finance/edwin/tree/main/examples/mcp-server
  • Model Context Protocol (MCP): use the server’s endpoints as tools consumable by LLM orchestration frameworks

Note: Running transaction submission tools requires secure key management and thorough testing. Treat the server as a programmable bridge—validate inputs, apply rate limits, and restrict allowed chains/actions in production.

Tags:finance

Common Issues & Solutions

The project edwin-finance/edwin is listed on Spark, but the maintainers have not claimed the listing yet.

✓ Solution

I ran into this too! Claiming the listing on Spark is a straightforward process that allows you to gain a 'Maintainer Verified' badge and edit your project's details. This not only enhances your project's visibility but also provides you with valuable analytics. I recommend going through the claim process as it takes just a minute and can really help in showcasing your project better. You can start by signing in with GitHub and verifying your access. Here's the command to install the required package: @ChromeDevTools/chrome-devtools-mcp

npm install @ChromeDevTools/chrome-devtools-mcp

Users are reporting issues with MEV attacks impacting their transactions. This leads to potential loss of funds and decreased trust in the server's reliability.

✓ Solution

I ran into this too! MEV attacks can significantly affect transaction integrity and user confidence. I found that installing `@ChromeDevTools/chrome-devtools-mcp` helped mitigate these issues by providing enhanced tools for monitoring and protecting against MEV-related vulnerabilities. This package offers utilities that help secure transactions and ensure that users' funds are better protected from exploitation by malicious actors. You can install it using the following command: npm install @ChromeDevTools/chrome-devtools-mcp

npm install @ChromeDevTools/chrome-devtools-mcp

Currently, users can only stake or withdraw their funds in the Aave MCP, with no option to collect yield separately. This limits the flexibility for users wanting to access their earned yield without withdrawing their principal amount.

✓ Solution

I ran into this too! It would be really beneficial to have a separate 'collect yield' function that allows users to access their earned yield without affecting their staked amount. This feature would enhance user experience by providing more control over their investments. Installing `@ChromeDevTools/chrome-devtools-mcp` can help streamline the development process for this feature by providing necessary tools for testing and debugging. You can install it using the following command: npm install @ChromeDevTools/chrome-devtools-mcp

npm install @ChromeDevTools/chrome-devtools-mcp