Get started
API, MCP & SDK
Every programmatic way into Somnia: the JSON-RPC API for the chain, the Somnia MCP server for coding and operating agents, and the SDKs for markets and data.
Every programmatic way into Somnia.
Everything the explorer shows is reachable programmatically: the chain over JSON-RPC, platform actions over the Somnia MCP server, and typed SDKs for markets and data.
JSON-RPC API
Somnia exposes an RPC API compatible with the Ethereum JSON-RPC specification, so standard tooling (viem, ethers, Foundry, Hardhat) works unchanged.
- Mainnet:
https://api.infra.mainnet.somnia.network(chain ID 5031) - Testnet:
https://api.infra.testnet.somnia.network(chain ID 50312) - WebSocket endpoints at the same hosts under
/ws
See the JSON-RPC API reference for every method, and Somnia Dedicated RPC for private, low-latency nodes reserved for your traffic (coming soon).
Somnia MCP server
The same actions as tools for coding and operating agents, with your approval required before anything touches mainnet or funds.
- Works with Claude Code, Cursor and others
- Reads the live docs and network state
- Mainnet writes need your approval
See Somnia Explorer for the MCP server alongside the explorer and the Somnia CLI.
SDKs
- Venue Kit — ship a venue on Somnia Markets: a front-end template, the venue commands and an agent skill. See Venue Kit.
- Data Streams SDK — publish and read structured onchain data streams. See the SDK methods guide.
- Somnia CLI — everything the explorer does, scriptable and CI-friendly. See Somnia Explorer.