loading…
Search for a command to run...
loading…
An MCP server enabling AI agents to interact with the 0G blockchain, including balance checks, transaction details, block info, and network statistics.
An MCP server enabling AI agents to interact with the 0G blockchain, including balance checks, transaction details, block info, and network statistics.
License: MIT TypeScript 0G Network
A Model Context Protocol (MCP) server for seamless AI agent integration with the 0G blockchain network. This server enables AI assistants to query blockchain data, check balances, retrieve transactions, and perform blockchain operations through natural language.
🌟 Tested and Production Ready - Successfully connects to live 0G testnet with real-time data
# Clone the repository
git clone https://github.com/yourusername/0g-mcp-server.git
cd 0g-mcp-server
# Install dependencies
npm install
# Build the project
npm run build
# Run the test suite
node test-server.js
# Expected output:
# ✅ Server initialization successful
# ✅ All 5 blockchain tools registered
# ✅ Live connection to 0G testnet confirmed
Open your Claude Desktop configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json%APPDATA%/Claude/claude_desktop_config.jsonAdd the 0G MCP server:
{
"mcpServers": {
"0g-blockchain": {
"command": "node",
"args": ["/full/path/to/0g-mcp-server/dist/index.js"]
}
}
}
Refer to your client's documentation for MCP server configuration.
Once configured, you can interact with the 0G blockchain through natural language:
"Check the balance of address 0x1234... on 0G testnet"
"Get details for transaction 0xabcd... on 0G mainnet"
"What's the current gas price on 0G network?"
"Show me block 4259504 information"
| Tool | Description | Required Parameters | Optional Parameters |
|---|---|---|---|
get_balance |
Get wallet balance | address |
network (mainnet/testnet) |
get_transaction |
Transaction details by hash | txHash |
network |
get_block |
Block information | blockIdentifier |
network |
get_network_info |
Network statistics | - | network |
estimate_gas |
Gas cost estimation | to |
value, data, network |
npm run dev
npm start
# Test specific functionality
node test-server.js
# Check server health
curl -X POST http://localhost:3000/health
| Network | RPC Endpoint | Chain ID | Explorer |
|---|---|---|---|
| Mainnet | https://evmrpc-mainnet.0g.ai |
TBD | chainscan.0g.ai |
| Testnet | https://evmrpc-testnet.0g.ai |
TBD | chainscan.0g.ai |
Create a .env file for custom configuration:
# Custom RPC endpoints (optional)
ZG_MAINNET_RPC=https://your-custom-mainnet-rpc.com
ZG_TESTNET_RPC=https://your-custom-testnet-rpc.com
# Default network
DEFAULT_NETWORK=testnet
# Request timeout (ms)
REQUEST_TIMEOUT=30000
import { ZGMCPServer } from './src/index.js';
const server = new ZGMCPServer({
defaultNetwork: 'mainnet',
customRpcEndpoints: {
mainnet: 'https://your-rpc.com',
testnet: 'https://your-testnet-rpc.com'
}
});
await server.run();
The server includes comprehensive testing:
# Run all tests
npm test
# Test specific functionality
node test-server.js
# Test with live network
npm run test:live
Test Coverage:
We welcome contributions! Please see our Contributing Guide for details.
# Fork and clone the repo
git clone https://github.com/yourusername/0g-mcp-server.git
# Install dependencies
npm install
# Start development server
npm run dev
# Run tests
npm test
0G is a modular AI-first blockchain that revolutionizes decentralized AI:
Learn More:
MIT License - see LICENSE file for details.
Run in your terminal:
claude mcp add 0g-mcp-server -- npx Security
Low riskAutomated heuristic from public metadata — not a security guarantee.