npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

infura-mcp-server

v0.2.0

Published

Model Context Protocol (MCP) server providing comprehensive read-only Ethereum blockchain access through Infura's infrastructure. Connect Claude Desktop, VS Code, and Cursor to 29 secure Ethereum JSON-RPC tools across 30+ networks including Ethereum, Poly

Readme

Infura MCP Server

A Model Context Protocol (MCP) server implementation that provides comprehensive Ethereum blockchain access through Infura's infrastructure. Connect Claude Desktop, VS Code, and other MCP clients to 29 read-only Ethereum JSON-RPC tools across 30+ networks.

Features

  • 29 read-only Ethereum JSON-RPC tools - Complete blockchain query suite
  • Multi-network support - 30+ networks including Ethereum, Polygon, Arbitrum, Base, Optimism
  • Real-time data - Direct access to Infura's blockchain infrastructure
  • AI-optimized - Comprehensive LLM context for expert blockchain guidance

Tools

Account & Balance Tools (3)

  • eth_getBalance - Get account balance in wei
  • eth_getCode - Get contract bytecode
  • eth_getTransactionCount - Get account nonce/transaction count

Block Tools (7)

  • eth_getBlockNumber - Get latest block number
  • eth_getBlockByHash - Get block details by hash
  • eth_getBlockByNumber - Get block details by number
  • eth_getUncleByBlockHashAndIndex - Get uncle block by hash and index
  • eth_getUncleByBlockNumberAndIndex - Get uncle block by number and index
  • eth_getUncleCountByBlockHash - Count uncle blocks by hash
  • eth_getUncleCountByBlockNumber - Count uncle blocks by number

Transaction Tools (6)

  • eth_getBlockTransactionCountByHash - Count transactions in block by hash
  • eth_getBlockTransactionCountByNumber - Count transactions in block by number
  • eth_getTransactionByBlockHashAndIndex - Get transaction by block hash and index
  • eth_getTransactionByBlockNumberAndIndex - Get transaction by block number and index
  • eth_getTransactionByHash - Get transaction details by hash
  • eth_getTransactionReceipt - Get transaction receipt and logs

Smart Contract Tools (3)

  • eth_call - Execute read-only contract call
  • eth_estimateGas - Estimate gas cost for transaction
  • eth_getStorageAt - Read contract storage slot

Network Tools (5)

  • eth_chainId - Get network chain ID
  • net_isListening - Check if client is listening for connections
  • net_getPeerCount - Get number of connected peers
  • net_getVersion - Get network ID
  • web3_getClientVersion - Get client version string

Log Query Tools (1)

  • eth_getLogs - Get logs with flexible filtering

Utility Tools (4)

  • eth_getFeeHistory - Get historical gas fee data (EIP-1559)
  • eth_getGasPrice - Get current gas price
  • eth_getProtocolVersion - Get Ethereum protocol version
  • eth_isSyncing - Check node synchronization status

Network Support

The Infura MCP Server supports all networks available through MetaMask/Infura infrastructure - providing access to 30+ network endpoints across 18 blockchain ecosystems.

For complete network details and endpoints, see: MetaMask Developer Documentation

Primary Ethereum Networks

  • mainnet - Ethereum Mainnet
  • sepolia - Ethereum Sepolia Testnet
  • holesky - Ethereum Holesky Testnet

Layer 2 & Scaling Solutions

  • arbitrum-mainnet, arbitrum-sepolia - Arbitrum One & Testnet
  • base-mainnet, base-sepolia - Base (Coinbase) & Testnet
  • blast-mainnet, blast-sepolia - Blast & Testnet
  • linea-mainnet, linea-sepolia - Linea (MetaMask) & Testnet
  • mantle-mainnet, mantle-sepolia - Mantle & Testnet
  • optimism-mainnet, optimism-sepolia - Optimism & Testnet
  • polygon-mainnet, polygon-amoy - Polygon PoS & Testnet
  • scroll-mainnet, scroll-sepolia - Scroll & Testnet
  • zksync-mainnet, zksync-sepolia - ZKsync Era & Testnet

Alternative Layer 1 Networks

  • avalanche-mainnet, avalanche-fuji - Avalanche C-Chain & Testnet
  • bsc-mainnet, bsc-testnet - BNB Smart Chain & Testnet
  • celo-mainnet, celo-alfajores - Celo & Testnet
  • opbnb-mainnet, opbnb-testnet - opBNB (Binance Layer 2) & Testnet
  • palm-mainnet, palm-testnet - Palm (NFT-focused) & Testnet
  • starknet-mainnet, starknet-sepolia - Starknet & Testnet
  • swellchain-mainnet, swellchain-testnet - Swellchain & Testnet
  • unichain-mainnet, unichain-sepolia - Unichain (Uniswap) & Testnet

Configuration

Usage with Claude Desktop

Add this to your claude_desktop_config.json:

npx

{
  "mcpServers": {
    "infura-mcp-server": {
      "command": "npx",
      "args": [
        "infura-mcp-server"
      ],
      "env": {
        "INFURA_API_KEY": "your_infura_api_key_here"
      }
    }
  }
}

docker

{
  "mcpServers": {
    "infura-mcp-server": {
      "command": "docker",
      "args": [
        "run",
        "--rm",
        "-i",
        "-e",
        "INFURA_API_KEY=your_infura_api_key_here",
        "-e",
        "INFURA_NETWORK=mainnet",
        "ghcr.io/qbandev/infura-mcp-server:latest"
      ]
    }
  }
}

Usage with Cursor

Add this to your Cursor MCP configuration file (.cursor/mcp.json in your workspace or global settings):

npx

{
  "mcpServers": {
    "infura-mcp-server": {
      "command": "npx",
      "args": [
        "infura-mcp-server"
      ],
      "env": {
        "INFURA_API_KEY": "your_infura_api_key_here"
      }
    }
  }
}

docker

{
  "mcpServers": {
    "infura-mcp-server": {
      "command": "docker",
      "args": [
        "run",
        "--rm",
        "-i",
        "-e",
        "INFURA_API_KEY=your_infura_api_key_here",
        "-e",
        "INFURA_NETWORK=mainnet",
        "ghcr.io/qbandev/infura-mcp-server:latest"
      ]
    }
  }
}

To configure in Cursor:

  1. Open Command Palette (Cmd/Ctrl + Shift + P)
  2. Type "MCP: Configure Servers"
  3. Add the JSON configuration above
  4. Restart Cursor to activate the MCP server
  5. Start using blockchain tools in your AI conversations!

Usage with VS Code

For quick installation, click one of the installation buttons below...

Install with NPX in VS Code

Install with Docker in VS Code

For manual installation, add the following JSON block to your User Settings (JSON) file in VS Code. You can do this by pressing Ctrl + Shift + P and typing Preferences: Open Settings (JSON). Optionally, you can add it to a file called .vscode/mcp.json in your workspace. This will allow you to share the configuration with others.

Note that the mcp key is not needed in the .vscode/mcp.json file.

For NPX installation:

{
  "mcp": {
    "servers": {
      "infura-mcp-server": {
        "command": "npx",
        "args": [
          "infura-mcp-server"
        ],
        "env": {
          "INFURA_API_KEY": "your_infura_api_key_here"
        }
      }
    }
  }
}

For Docker installation:

{
  "mcp": {
    "servers": {
      "infura-mcp-server": {
        "command": "docker",
        "args": [
          "run",
          "--rm",
          "-i",
          "-e",
          "INFURA_API_KEY=your_infura_api_key_here",
          "ghcr.io/qbandev/infura-mcp-server:latest"
        ]
      }
    }
  }
}

Usage Examples

Getting Started

  1. Get your Infura API key at MetaMask Developer Portal
  2. Configure your MCP client (Claude Desktop, Cursor, or VS Code) using the examples above
  3. Start exploring blockchain data with AI assistance

AI Assistant Conversations

Once configured, you can have natural blockchain conversations with AI assistants in Claude Desktop, Cursor, or VS Code:

Cursor Chat with Infura MCP

Key Benefits:

  • Contextual insights - AI explains what the data means and provides actionable advice
  • Multi-network analysis - Seamlessly compare data across different blockchain networks
  • Educational guidance - Learn blockchain concepts through natural conversation

📚 AI Assistant & Developer Resources

LLM Context Document

This project includes a comprehensive LLM Context Document (600+ lines) that transforms AI assistants into blockchain experts:

  • 📖 Full Context: .cursor/rules/infura-mcp-server-llm-context.md
  • 📋 Summary: docs/llm-context-summary.md

For AI Assistants: Enables expert-level blockchain interactions while educating users about Ethereum, DeFi, and gas optimization.

For Developers: Reference for adding tools, updating documentation, and maintaining blockchain accuracy.

Environment Variables

  • INFURA_API_KEY (required) - Your Infura API key from MetaMask Developer Portal
  • INFURA_NETWORK (optional) - Target network (default: mainnet)
  • DEBUG (optional) - Enable debug logging

Building

Docker

docker build -t infura-mcp-server .

NPM

npm install
npm test
npm run build

Testing

The server includes comprehensive testing with 100% tool validation:

# Basic validation
npm test

# Comprehensive tool testing (requires API key)
INFURA_API_KEY=your_key npm run test:comprehensive

# Full test suite including integration tests
INFURA_API_KEY=your_key npm run test:full

Troubleshooting

Common Issues

"API key not working"

"Network not supported"

  • Use the INFURA_NETWORK environment variable
  • Refer to the supported networks list above

"Tool not responding"

  • Restart your MCP client (Claude Desktop, VS Code)
  • Verify the configuration JSON syntax

"Rate limit exceeded"

  • Upgrade your Infura plan for higher limits

Getting Help

  1. Check the LLM context document for detailed guidance
  2. Visit Infura documentation for API details
  3. Open an issue on GitHub for bugs or feature requests

🔐 Security

API Key Security

  • Never hardcode API keys in configuration files
  • Monitor API usage in your Infura dashboard regularly
  • Rotate keys for production environments

🛡️ Built-in Security Features

  • Required parameter validation - validates presence of required parameters
  • No arbitrary code execution - only predefined Ethereum JSON-RPC methods
  • HTTPS/TLS encryption for all Infura connections
  • Local execution by default (stdio mode, no network exposure)
  • Read-only operations - server can never modify blockchain state

License

This MCP server is licensed under the MIT License. This means you are free to use, modify, and distribute the software, subject to the terms and conditions of the MIT License. For more details, please see the LICENSE file in the project repository.

Contributing

Contributions are welcome! Please see CONTRIBUTING.md for guidelines.


Transform your AI into a blockchain expert with comprehensive Ethereum data access! 🚀