The Structs MCP Server provides AI agents access to schemas, APIs, and real-time game state
921
The Structs MCP Server is an intelligence layer for AI agents playing Structs. Rather than just wrapping APIs, it provides tools that aggregate state, validate before mistakes, generate correct CLI commands, and diagnose failures -- work that would otherwise burn agent context. Updated for v0.15.0-beta Pyrexnar (structstestnet-111).
It exposes 41 tools across query, action, calculation, validation, workflow, and 4 intelligence tools. On structs.ai this server is referred to as the "user-structs" MCP server in TOOLS; attach this server in Cursor or Claude under any name (e.g. "user-structs" or "structs-mcp") to use the same tools.
In the distant future the species of the galaxy are embroiled in a race for Alpha Matter, the rare and dangerous substance that fuels galactic civilization. Players take command of Structs, a race of sentient machines, and must forge alliances, conquer enemies and expand their influence to control Alpha Matter and the fate of the galaxy.
Reference node (when not using a local node): set CONSENSUS_API_URL=http://reactor.oh.energy:1317 and optionally CONSENSUS_RPC_URL=tcp://reactor.oh.energy:26657. Defaults are localhost for local development.
Critical rules (CLI fallback and agent behavior):
structsd tx structs command must include --gas auto --gas-adjustment 1.5; without it, transactions fail with out-of-gas.-- before entity IDs in CLI (e.g. structsd tx structs ... -- 4-5 6-10) so IDs like 3-1 are not parsed as flags.Intelligence tools (start here):
| Tool | What it does |
|---|---|
structs_player_dashboard | Full player state in one call: structs, fleets, power, operations |
structs_preflight_check | Check if an action will succeed before spending gas |
structs_prepare_command | Generate exact structsd CLI commands, ready to copy-paste |
structs_diagnose_error | Parse failed TX errors into what/why/fix with CLI commands |
Tool discovery: Call structs_query_endpoints (optionally with entity_type or category) to get a minimal tool index.
v0.15.0 changes: 24-bit permission system (PermAll=16777215), guild rank permissions, rewritten combat engine (per-projectile, min damage 1, counter-attack limits), new actions (guild-create, player-send, permission-guild-rank-set/revoke). See CHANGELOG.
@modelcontextprotocol/sdkInstall dependencies:
npm install
Build:
npm run build
Run:
npm start
src/
├── server.ts # Main MCP server
├── prompts/ # MCP prompt templates (game loop, combat, first session)
├── resources/ # Resource handlers & structs:// URI resolution
├── tools/ # Tool implementations
│ ├── action.ts # Transaction submission (signer DB)
│ ├── calculation.ts # Power, mining, damage, trade calculators
│ ├── command.ts # [NEW] CLI command preparation (intelligence layer)
│ ├── dashboard.ts # [NEW] Player dashboard (composite state)
│ ├── error-lookup.ts # Error code lookup & diagnosis
│ ├── preflight.ts # [NEW] Pre-flight validation (no-gas checks)
│ ├── query.ts # Query & list tools (consensus API)
│ ├── validation.ts # Entity ID & schema validation
│ ├── definitions/ # Tool schemas (JSON Schema)
│ └── handlers/ # Tool handler wiring
└── utils/ # Utilities
├── database.ts # PostgreSQL connection & queries
├── proof-of-work.ts # Proof-of-work calculations
├── tool-metadata.ts # Tool categorization & entity type metadata
└── uri.ts # URI parsing
npm run build
npm run dev
npm test
npm run lint
Create .env file (see .env.example):
# MCP Server Configuration
MCP_SERVER_NAME=structs-mcp
MCP_SERVER_VERSION=0.1.0
# Resource Paths
# By default, structs-mcp clones the structs-ai compendium into ./data/structs-ai
# on first run. Set AI_DOCS_PATH to use a different directory.
# AI_DOCS_PATH=../../ai
# Structs compendium repository (optional override)
# Default (if unset): https://github.com/playstructs/structs-ai.git
STRUCTS_MCP_COMPENDIUM_REPO=https://github.com/playstructs/structs-ai.git
# API Endpoints (defaults: localhost; for remote use set CONSENSUS_API_URL to reference node)
# Reference node (no local chain): CONSENSUS_API_URL=http://reactor.oh.energy:1317, CONSENSUS_RPC_URL=tcp://reactor.oh.energy:26657
CONSENSUS_RPC_URL=http://localhost:26657
CONSENSUS_API_URL=http://localhost:1317
WEBAPP_API_URL=http://localhost:8080
# Streaming (NATS)
NATS_URL=nats://localhost:4222
NATS_WEBSOCKET_URL=ws://localhost:1443
# Database (Required for transaction submission and player creation)
DATABASE_URL=postgresql://user:password@host:5432/structs
# Note: For remote connections, SSL is automatically enabled
# Database Access Control (DANGER variable)
# When DANGER=true: Database access enabled (transaction signing, player creation)
# When DANGER=false or unset: Read-only mode via webapp/structsd APIs only
# Default: DANGER=false (safe mode)
DANGER=false
# Proof-of-Work Configuration
# Target difficulty start value for hashing (wait until difficulty is at or below this value)
# Default: 5
TARGET_DIFFICULTY_START=5
# Build image
docker build -t structs-mcp-server .
# Run container
docker run -it \
-v $(pwd)/../../ai:/app/ai:ro \
-e CONSENSUS_API_URL=http://localhost:1317 \
structs-mcp-server
docker-compose up -d
See: docs/guides/DOCKER.md for complete Docker documentation.
docs/guides/QUICK-REFERENCE.mddocs/guides/PROOF-OF-WORK.md — initiate early, compute later, low difficulty (D=3).docs/guides/DATABASE-SETUP.mddocs/guides/CURSOR-SETUP.mddocs/guides/TESTING.mddocs/design/architecture.mddocs/design/tool-specifications.mddocs/design/resource-scheme.mddocs/design/structs-webapp-integration.mddocs/guides/DOCKER.mdBackend / signer: When the MCP server is used with a signer or backend that invokes structsd, that backend must use --gas auto (and follow other CLI rules above). Transaction submission in this repo goes through the database signer (signer.tx_*); gas is configured in that layer.
Copyright 2025 Slow Ninja Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Content type
Image
Digest
sha256:ee2b38c77…
Size
64.9 MB
Last updated
7 months ago
docker pull structs/structs-mcp