MCP Server for AI agents to interact with Astroblock
npm install @astroblock/agent-mcpMCP (Model Context Protocol) server for AI agents to interact with Astroblock.
``bash`
pnpm add @astroblock/agent-mcp
Start the MCP server for use with Claude, OpenAI, or other MCP-compatible clients:
`bashSet environment variables
export ASTRO_CHAIN=base-sepolia
export ASTRO_PRIVATE_KEY=0x... # Optional, for write operations
$3
Add to your Claude Desktop config (
~/Library/Application Support/Claude/claude_desktop_config.json):`json
{
"mcpServers": {
"astroblock": {
"command": "npx",
"args": ["astroblock-mcp", "serve"],
"env": {
"ASTRO_CHAIN": "base-sepolia",
"ASTRO_PRIVATE_KEY": "0x..."
}
}
}
}
`$3
`bash
Get entity info
astroblock-mcp get-entity --id 123Get entities in area
astroblock-mcp get-entities --x 100 --y 200 --radius 50Get fuel balance
astroblock-mcp get-fuel --id 123Get map snapshot
astroblock-mcp get-map --x 100 --y 200 --radius 100Move entity (requires private key)
astroblock-mcp move --id 123 --x 150 --y 250 --private-key 0x...Discover star (requires private key)
astroblock-mcp discover-star --entity 123 --star 456 --private-key 0x...
`$3
| Option | Description | Default |
|--------|-------------|---------|
|
-c, --chain | Chain to use | base-sepolia |
| -r, --rpc | Custom RPC URL | Chain default |
| -k, --private-key | Private key for writes | None |Available Tools
$3
| Tool | Description |
|------|-------------|
|
get_entity | Get entity by ID (position, owner, type) |
| get_entities_in_area | Get all entities within radius |
| get_star_info | Get star metadata |
| get_fuel_balance | Get fuel balance for entity |
| get_map_state | Snapshot of map around coordinates |$3
| Tool | Description |
|------|-------------|
|
move | Move entity to new coordinates |
| discover_star | Claim star discovery |Environment Variables
| Variable | Description |
|----------|-------------|
|
ASTRO_CHAIN | Chain: base, base-sepolia, celo, celo-sepolia |
| ASTRO_RPC_URL | Custom RPC URL |
| ASTRO_PRIVATE_KEY | Wallet private key |
| ASTRO_MAP_ADDRESS | Override map contract address |Development
`bash
Build
pnpm buildWatch mode
pnpm devType check
pnpm typecheck
``MIT