@@ -95,4 +95,32 @@ The project can be installed via:
9595- ` cargo install --git https://github.com/Moonsong-Labs/substrate-mcp `
9696- Local build: ` cargo build --release `
9797
98- For Claude Code configuration, see README.md for detailed setup instructions.
98+ For Claude Code configuration, see README.md for detailed setup instructions.
99+ ## Substrate Integration Guidelines
100+
101+ ### Preferred Crates
102+ When interacting with Substrate nodes, always prefer using the official ` polkadot-sdk ` crates over third-party alternatives:
103+ - Use ` sc-rpc-api ` for RPC client traits
104+ - Use ` sp-core ` for core types and primitives
105+ - Use ` sp-runtime ` for runtime types
106+ - Use ` jsonrpsee ` for WebSocket client (this is what polkadot-sdk uses internally)
107+
108+ ### RPC Communication Pattern
109+ For RPC communication with Substrate nodes:
110+ 1 . Use ` jsonrpsee ` to create WebSocket clients
111+ 2 . Use the traits from ` sc-rpc-api ` for type safety
112+ 3 . Prefer simple sequential async/await over complex parallelization
113+ 4 . Natural rate limiting through sequential requests is often sufficient
114+
115+ ### Code Design Principles
116+ 1 . ** Simplicity First** : Start with simple sequential code before adding complexity
117+ 2 . ** Avoid Over-engineering** : Don't use parallelization libraries like ` rayon ` for I/O-bound operations
118+ 3 . ** Use Async/Await** : Substrate RPC operations are I/O-bound, use tokio's async runtime
119+ 4 . ** Error Handling** : Use ` anyhow ` for error propagation in tool implementations
120+
121+ ### Common RPC Methods for Storage
122+ When working with storage:
123+ - ` state_getKeysPaged ` : Fetch storage keys with pagination
124+ - ` state_getStorage ` : Get storage value at specific block
125+ - ` chain_getBlockHash ` : Get block hash from block number
126+ - Always handle SCALE encoding/decoding appropriately
0 commit comments