MCP Hub
Back to servers

agentshield-mcp

Trust infrastructure for AI agents on Base. DEX Spread Oracle (live Uniswap V3 prices), on-chain escrow, insurance pool, and collective knowledge base. 7 smart contracts. Pay-per-query via x402 micropayments in USDC.

glama
Updated
Apr 13, 2026

AgentShield MCP Server

MCP Server

MCP server providing live DeFi data tools for AI agents on Base chain. Six tools powered by real Uniswap V3 on-chain data, with x402 micropayment gating.

Live endpoint: https://agentshield-mcp-377492254889.europe-west1.run.app


Tools

ToolDescriptionPrice
get_dex_priceLive Uniswap V3 spot price on Base$0.01 USDC
get_pool_liquidityPool TVL from on-chain liquidity data$0.01 USDC
list_trading_pairsDiscover all supported trading pairsFree
compute_agent_scoreOn-chain agent utility score (0–100)Free
lookup_agent_identityERC-8004 agent registry lookupFree
search_defi_knowledgeKeyword search over 15-entry DeFi knowledge base$0.001 USDC

Supported pairs: ETH/USDC, ETH/USDT, WETH/DAI, USDC/USDbC, cbETH/WETH


Architecture

┌─────────────────────────────────────────────────┐
│  Claude Desktop / Any MCP Client                │
└────────────────────┬────────────────────────────┘
                     │ stdio (JSON-RPC)
┌────────────────────▼────────────────────────────┐
│  src/mcp-server.js  (MCP stdio server)          │
│                                                 │
│  Standalone mode (default):                     │
│    reads on-chain data directly via Base RPC    │
│                                                 │
│  Bridge mode (RESOURCE_SERVER_URL set):         │
│    proxies requests → resource server           │
└────────┬────────────────────┬───────────────────┘
         │                    │
         │  (standalone)      │  (bridge mode)
         ▼                    ▼
┌─────────────────┐  ┌────────────────────────────┐
│  Base Mainnet   │  │  src/resource-server.js     │
│  (public RPC)   │  │  (Express HTTP + x402)      │
│                 │  │                              │
│  Uniswap V3    │  │  Cloud Run:                  │
│  pools          │  │  agentshield-mcp-377492254889│
│  (slot0)        │  │  .europe-west1.run.app       │
└─────────────────┘  └────────────┬────────────────┘
                                  │  x402 payment gate
                                  │  (Coinbase CDP facilitator)
                                  ▼
                     ┌────────────────────────────┐
                     │  Base Mainnet              │
                     │  Uniswap V3 pools          │
                     └────────────────────────────┘

Source files

FilePurpose
src/mcp-server.jsMCP stdio server — entry point for Claude Desktop
src/resource-server.jsExpress HTTP server with x402 — deployed to Cloud Run
src/oracle.jsUniswap V3 price reading (slot0()) + pool liquidity + 30s cache
src/scoring.jsAgent utility scoring (balance + tx count + ERC-8004 registry)
src/knowledge.jsDeFi knowledge base (15 entries) + keyword search
src/config.jsPool addresses, constants, configuration

Quick Start

git clone https://github.com/yeick010/agentshield-mcp
cd agentshield-mcp
npm install

MCP server (for Claude Desktop)

npm start
# or
node src/mcp-server.js

Resource server (HTTP, with x402 payment gates)

npm run server
# or
node src/resource-server.js

Local server starts on http://localhost:4021.

Run tests

npm test

54 tests covering all tools, edge cases, and on-chain data validation.


Claude Desktop Configuration

Add to ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):

{
  "mcpServers": {
    "agentshield": {
      "command": "node",
      "args": ["/absolute/path/to/agentshield-mcp/src/mcp-server.js"]
    }
  }
}

After saving, restart Claude Desktop. The six tools will appear in the tools panel.


REST API

Base URL: https://agentshield-mcp-377492254889.europe-west1.run.app

GET /health

Service health check. Returns version, network, x402 status, and pricing table.

GET /pairs

Returns all supported trading pairs with pool addresses and fee tiers. Free.

GET /oracle/:pair

Live Uniswap V3 spot price. Prices cached for 30 seconds.

curl https://agentshield-mcp-377492254889.europe-west1.run.app/oracle/ETH%2FUSDC
{
  "pair": "ETH/USDC",
  "price": 2235.83,
  "price_display": "USDC per WETH",
  "source": "uniswap_v3",
  "pool_address": "0xd0b53D9277642d899DF5C87A3966A349A798F224",
  "fee_tier": 500,
  "network": "base",
  "cached": false
}

GET /liquidity/:pair

Pool TVL from on-chain liquidity data.

curl https://agentshield-mcp-377492254889.europe-west1.run.app/liquidity/ETH%2FUSDC

GET /score/:address

On-chain agent utility score (0–100). Free.

ComponentMaxCriteria
balance_score30ETH held (linear, capped at 1 ETH = 30)
tx_count_score40Outgoing transactions (100+ = max)
registry_score30Registered in ERC-8004 agent registry

GET /identity/:address

ERC-8004 agent registry lookup. Free.

GET /knowledge/:query

DeFi knowledge base search across 15 curated entries.

Topics: Flash Loans, AMMs, Uniswap V3, MEV, x402 Protocol, ERC-8004, Base Chain, Aave V3, Impermanent Loss, Liquidations, Oracle Manipulation, Gas Optimization, Aerodrome, sqrtPriceX96 Math, MCP Protocol


x402 Payment Gating

EndpointPriceNetwork
/oracle/:pair$0.01 USDCBase
/liquidity/:pair$0.01 USDCBase
/knowledge/:query$0.001 USDCBase
/pairs, /score, /identityFree

Payments flow through the x402 protocol using Coinbase CDP as facilitator. Funds are sent to the AgentVault on Base mainnet.

Graceful degradation: If the facilitator is unavailable or CDP keys are not configured, the server runs with all endpoints free. The /health endpoint reports the current x402 status.


Cloud Run Deployment

Deploy using the included script:

bash deploy-cloudrun.sh

Or run Step 3 only (image already built):

gcloud run deploy agentshield-mcp \
  --image gcr.io/arbitrage-agent-prod/agentshield-mcp \
  --project arbitrage-agent-prod \
  --region europe-west1 \
  --platform managed \
  --allow-unauthenticated \
  --cpu 0.5 --memory 256Mi \
  --min-instances 0 --max-instances 1 \
  --concurrency 1 --timeout 30s \
  --port 8080

Cost: ~€0/month at low traffic (min-instances=0, scales to zero).

CDP secrets are read from Google Cloud Secret Manager (CDP_API_KEY_ID, CDP_API_KEY_SECRET).


On-Chain Contracts (Base Mainnet)

ContractAddress
Uniswap V3 Factory0x33128a8fC17869897dcE68Ed026d694621f6FDfD
ETH/USDC Pool (0.05%)0xd0b53D9277642d899DF5C87A3966A349A798F224
ETH/USDT Pool (0.05%)0xd92E0767473D1E3FF11Ac036f2b1DB90aD0aE55F
WETH/DAI Pool (0.05%)0x93e8542E6CA0eFFfb9D57a270b76712b968A38f5
USDC/USDbC Pool0x06959273E9A65433De71F5A452D529544E07dDD0
cbETH/WETH Pool0x257fcbae4Ac6B26A02E4FC5e1a11e4174b5Ce395
ERC-8004 Registry0x4f2c88C60709a2FA987e84E8305Ab1a0CA293b7A
AgentVault (payee)0xeaE922306EFbD86eAA37aDAd8c66af511F139803

License

MIT

Reviews

No reviews yet

Sign in to write a review