Substrate MCP Server

Substrate MCP Server

A Rust-based MCP server for dynamic Substrate blockchain operations.

11
Stars
4
Forks
11
Watchers
0
Issues
Substrate MCP Server provides a Model Context Protocol (MCP) compliant server enabling dynamic interaction with Substrate blockchains. It supports querying balances, pallets, and storage, as well as submitting transactions and accessing block and event data. The server is fully configurable via environment variables and designed for seamless integration with tools such as Cursor, Claude, and development dashboards. Built in Rust, it interfaces with Substrate nodes using the subxt crate.

Key Features

Dynamic querying of account balances and chain storage
Listing and introspection of pallets and their entries
Fetching and filtering events and extrinsics
Submitting and watching signed transactions
System and block metadata retrieval
Custom RPC calls to Substrate nodes
Configurable via environment variables
Integration with subxt crate
Support for runtime metadata files
Stdio-based MCP request handling

Use Cases

Building AI-driven blockchain assistants or chatbots
Natural language querying of live blockchain data
Custom dashboards and monitoring for Substrate chains
Real-time event or transaction alert systems
AI-based anomaly detection and on-chain activity analysis
Developer tooling integration in environments like VSCode or Cursor
Automated reporting of balance changes and statuses
Automated dashboard analytics for blockchain projects
Experimentation and testing using dynamic blockchain queries
Custom backend server for AI agents interacting with blockchain data

README

Substrate MCP Server

MIT License Rust

Trust Score

A Model Context Protocol (MCP) server for Substrate blockchains, written in Rust. This project exposes dynamic Substrate blockchain operations (querying balances, blocks, pallets, storage, events, and more) via the MCP protocol, and is fully configurable via environment variables.

Designed to interface with the subxt crate.

✨ Features

  • Query account balances and storage dynamically
  • List pallets and their entries
  • Fetch and filter events and extrinsics
  • Submit and watch dynamic signed transactions
  • Access system and block information
  • Custom RPC calls to Substrate nodes

🚀 Potential Use Cases

  1. AI-Driven Blockchain Operations

    • Integrate with LLMs (like Cursor or Claude) to allow users to ask questions in natural language (e.g., "What was the last transfer from Alice?"), which are translated into MCP tool calls.
    • Build a chatbot that can answer questions, fetch balances, or explain on-chain activity using your MCP server as the backend.
    • Use the MCP server to provide live updates on-chain activity, such as balance changes or transaction statuses, to development tools like VSCode, Cursor, Claude Code, etc.
  2. Custom Dashboards and Monitoring

    • Create custom dashboards and monitoring systems for your Substrate blockchain
    • Display real-time data and analytics on your blockchain operations
    • Set up alerts and notifications for critical events
    • Use AI agents to detect suspicious activity by analyzing events and extrinsics in real time.

🛠️ Requirements

  • Rust
  • Access to a Substrate node endpoint (WebSocket)
  • A valid signing keypair (as hex)
  • Runtime metadata file for your target chain (see below for naming and placement)

📦 Installation

Clone the repository and build:

sh
git clone https://github.com/ThomasMarches/substrate-mcp-rs.git
cd substrate-mcp-rs
cargo build --release

⚙️ Configuration

Create a .env file in the project root with the following variables:

env
# WebSocket endpoint for the Substrate node
RPC_URL=wss://your-node-url.example.com

# Signing keypair as hex (32 bytes, e.g. output of subkey inspect-key --scheme Sr25519)
SIGNING_KEYPAIR_HEX=your_signing_keypair_hex_here

Generating a Signing Keypair

You can generate a keypair and get the secret seed in hex using subkey:

sh
subkey generate --scheme Sr25519 --output-type Json

Use the secretSeed field (strip the 0x prefix if present) for SIGNING_KEYPAIR_HEX.

Obtaining and Placing Runtime Metadata

Export the runtime metadata from your node and place it at artifacts/metadata.scale:

sh
subxt metadata -f bytes > artifacts/metadata.scale

Important: The file must be named metadata.scale and located in the artifacts/ directory before building. The build will fail if this file is missing or misnamed.

▶️ Usage

To start the MCP server:

sh
cargo run --release

The server will start and listen for MCP requests via stdio.

🖇️ Integrating with Cursor

To use this MCP server with Cursor, you need to add it to your Cursor MCP configuration. This allows Cursor to discover and interact with your Substrate MCP server.

  1. Build your server in release mode:

    sh
    cargo build --release
    
  2. Locate the path to the built binary (typically target/release/substrate-mcp-rs).

  3. In your project (or global) .cursor/mcp.json file, add an entry for your server. For example:

    json
    {
      "mcpServers": {
        "substrate-mcp-rs": {
          "command": "$PROJECT_ROOT_ABSOLUTE_PATH/target/release/substrate-mcp-rs",
          "args": []
        }
      }
    }
    
    • Replace the command path with the absolute path to your built binary if it differs.
  4. Restart Cursor. It should now detect and connect to your Substrate MCP server, making its tools available for use.

For more details, see the Cursor documentation or the Model Context Protocol introduction.

🧰 Available Tools

The server exposes a set of tools for interacting with a Substrate blockchain, including:

  • query_balance: Fetch the balance of an account
  • list_pallets: List all pallets in the runtime
  • list_pallet_entries: List all storage entries for a pallet
  • dynamic_runtime_call: Execute a runtime API call
  • send_dynamic_signed_transaction: Construct, sign, and send a transaction
  • query_storage: Query storage by pallet and entry
  • get_latest_events: Get all events from the latest block
  • find_events: Find specific events by pallet and variant
  • get_latest_block: Get details about the latest block
  • get_block_by_hash: Get block details by hash
  • find_extrinsics: Find extrinsics in the latest block
  • get_system_info: Get system info via RPC
  • custom_rpc: Make a custom RPC call

See src/tooling/substrate.rs for full details and parameters.

🗂️ Project Structure

  • src/main.rs: Entry point, sets up logging and starts the MCP server
  • src/tooling/: Contains the Substrate tool implementation
  • artifacts/: Place your runtime metadata file here as metadata.scale (required before building)

📈 Next Steps and Goals

  • Add E2E tests
  • Add Unit tests
  • Add more tools

🤝 Contributing

Contributions are welcome! Please open issues or pull requests. For larger changes, open an issue first to discuss your proposal.

  • Follow Rust best practices and ensure code is documented
  • Run cargo fmt and cargo clippy before submitting
  • Add tests where possible

📄 License

MIT

Star History

Star History Chart

Repository Owner

Repository Details

Language Rust
Default Branch master
Size 73 KB
Contributors 2
License MIT License
MCP Verified Nov 12, 2025

Programming Languages

Rust
100%

Tags

Topics

ia mcp polkadot rust substrate subxt

Join Our Newsletter

Stay updated with the latest AI tools, news, and offers by subscribing to our weekly newsletter.

We respect your privacy. Unsubscribe at any time.

Related MCPs

Discover similar Model Context Protocol servers

  • solscan-mcp

    solscan-mcp

    A Rust-based MCP server for querying Solscan Pro API on Solana blockchain data.

    solscan-mcp provides a Model Context Protocol (MCP) server that interfaces with the Solscan Pro API to deliver blockchain data from the Solana network. Built in Rust, it allows querying of token information, account activities, and transactions, and is designed for easy integration with language models. The tool supports context-driven investigations by leveraging AI to analyze and report on blockchain wallet behaviors using customized context inputs.

    • 32
    • MCP
    • wowinter13/solscan-mcp
  • Bitcoin MCP Server

    Bitcoin MCP Server

    Real-time Bitcoin blockchain data server for MCP clients.

    Provides tools to deliver real-time Bitcoin blockchain data for use with Model Context Protocol (MCP) clients. Offers specialized endpoints for querying blockchain addresses, transactions, UTXOs, and block information by interfacing with the mempool.space API. Supports easy installation and integration with popular MCP clients, enabling seamless access to blockchain analytics.

    • 0
    • MCP
    • JamesANZ/bitcoin-mcp
  • Bitcoin & Lightning Network MCP Server

    Bitcoin & Lightning Network MCP Server

    Enable AI models to safely interact with Bitcoin and Lightning Network in a standardized way.

    The Bitcoin & Lightning Network MCP Server implements the Model Context Protocol, allowing AI models to interface with Bitcoin and Lightning Network functionalities such as key generation, address validation, transaction decoding, blockchain queries, and lightning payments. It provides standardized endpoints for AI model integration, including support for Claude Desktop and Goose. The solution supports querying blockchain data, parsing transactions and invoices, and managing cryptographic operations in a secure and extensible manner.

    • 65
    • MCP
    • AbdelStark/bitcoin-mcp
  • Web3 MCP

    Web3 MCP

    A Model Context Protocol server for unified blockchain data access.

    Web3 MCP is a Model Context Protocol server that provides access to blockchain data through Ankr's Advanced API. It allows large language models to interact seamlessly with multiple blockchain networks such as Ethereum, BSC, Polygon, and Avalanche. With support for NFT, token, and blockchain query APIs, it enables users and AI agents to retrieve on-chain data, statistics, and analytics efficiently within an MCP context.

    • 3
    • MCP
    • tumf/web3-mcp
  • metoro-mcp-server

    metoro-mcp-server

    Bridge Kubernetes observability data to LLMs via the Model Context Protocol.

    Metoro MCP Server is an implementation of the Model Context Protocol (MCP) that enables seamless integration between Kubernetes observability data and large language models. It connects Metoro’s eBPF-based telemetry APIs to LLM applications such as the Claude Desktop App, allowing AI systems to query and analyze Kubernetes clusters. This solution supports both authenticated and demo modes for accessing real-time cluster insights.

    • 45
    • MCP
    • metoro-io/metoro-mcp-server
  • Hive Intelligence MCP Server

    Hive Intelligence MCP Server

    Unified MCP server delivering advanced cryptocurrency and Web3 analytics.

    Hive Intelligence MCP Server provides comprehensive cryptocurrency, DeFi, and Web3 analytics via the Model Context Protocol. It enables AI assistants to access and orchestrate over 200 specialized tools covering market data, on-chain analytics, portfolio tracking, and security analysis. The server offers both dynamic and category-specific analytics through a unified MCP interface, facilitating intelligent tool orchestration for diverse crypto data needs.

    • 7
    • MCP
    • hive-intel/hive-crypto-mcp
  • Didn't find tool you were looking for?

    Be as detailed as possible for better results