
A Model Context Protocol (MCP) server for Substrate blockchains, written in Rust and interfacing the subxt crate.
概览
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. - 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 - 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.
README
以下为原文 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.
安装
This server does not publish a one-line install command.
Open the repository installation guide 新手?先看 mcpskill.org 教程 →配置
{
"mcpServers": {
"substrate-mcp-rs": {
"command": "$PROJECT_ROOT_ABSOLUTE_PATH/target/release/substrate-mcp-rs",
"args": []
}
}
}