Substrate MCP Server
A Rust-based MCP server for dynamic Substrate blockchain operations.
Key Features
Use Cases
README
Substrate MCP Server
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
-
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.
-
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:
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:
# 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:
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:
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:
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.
-
Build your server in release mode:
shcargo build --release -
Locate the path to the built binary (typically
target/release/substrate-mcp-rs). -
In your project (or global)
.cursor/mcp.jsonfile, 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
commandpath with the absolute path to your built binary if it differs.
- Replace the
-
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 accountlist_pallets: List all pallets in the runtimelist_pallet_entries: List all storage entries for a palletdynamic_runtime_call: Execute a runtime API callsend_dynamic_signed_transaction: Construct, sign, and send a transactionquery_storage: Query storage by pallet and entryget_latest_events: Get all events from the latest blockfind_events: Find specific events by pallet and variantget_latest_block: Get details about the latest blockget_block_by_hash: Get block details by hashfind_extrinsics: Find extrinsics in the latest blockget_system_info: Get system info via RPCcustom_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 serversrc/tooling/: Contains the Substrate tool implementationartifacts/: Place your runtime metadata file here asmetadata.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 fmtandcargo clippybefore submitting - Add tests where possible
📄 License
MIT
Star History
Repository Owner
User
Repository Details
Programming Languages
Tags
Topics
Join Our Newsletter
Stay updated with the latest AI tools, news, and offers by subscribing to our weekly newsletter.
Related MCPs
Discover similar Model Context Protocol servers
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
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
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
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
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
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?