Skip to content

Add use case: Game Server Management via API#58

Open
mcjkrs wants to merge 3 commits intohesamsheikh:mainfrom
mcjkrs:add-game-server-management
Open

Add use case: Game Server Management via API#58
mcjkrs wants to merge 3 commits intohesamsheikh:mainfrom
mcjkrs:add-game-server-management

Conversation

@mcjkrs
Copy link
Copy Markdown

@mcjkrs mcjkrs commented Mar 8, 2026

Summary

  • Adds a new use case for managing dedicated game servers via REST API
  • Covers 17+ games: Valheim, Palworld, Rust, ARK, Factorio, Counter-Strike 2, Enshrouded, Project Zomboid, and more
  • Category: Infrastructure & DevOps

What the use case covers

  • Ordering and deploying game servers from chat
  • Server lifecycle control (start/stop/restart)
  • Reading and updating game-specific configuration
  • Monitoring server status and player counts
  • Console/RCON commands and log inspection
  • No custom MCP server needed — standard REST API with JWT auth

Verification

This use case is based on a production API at claws.supercraft.host powering Supercraft game server hosting. The API is live, documented, and has been tested with AI agents.

Summary by CodeRabbit

  • Documentation
    • Added a comprehensive Game Server Management guide: ordering, configuration, lifecycle control (start/stop/update), monitoring, console/log access, supported games, setup steps, example conversations, and API integration notes.
    • Minor README update: updated Use Cases badge count.

Order, configure, and control dedicated game servers for 17+ games
(Valheim, Palworld, Rust, ARK, Factorio, etc.) through a REST API.
Covers server lifecycle, config management, console commands, and logs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 8, 2026

Note

.coderabbit.yaml has unrecognized properties

CodeRabbit is using all valid settings from your configuration. Unrecognized properties (listed below) have been ignored and may indicate typos or deprecated fields that can be removed.

⚠️ Parsing warnings (1)
Validation error: Unrecognized key(s) in object: 'path_instructions'
⚙️ Configuration instructions
  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
📝 Walkthrough

Walkthrough

Adds a new "Game Server Management" use case document and updates the README to list that entry, describing REST-API driven ordering, lifecycle control, configuration, monitoring, console/log access, and per-game guidance for managing dedicated game servers via conversational agents.

Changes

Cohort / File(s) Summary
Documentation & README
README.md, usecases/game-server-management.md
Added a new use case entry to README and introduced usecases/game-server-management.md. The new document details ordering and lifecycle APIs (start/stop/update), JWT auth flows, monitoring/logs/console access, supported games, per-game configs, setup steps, CRITICAL purchase/login token guidance, and example conversations.

Sequence Diagram(s)

sequenceDiagram
    participant User as "User (operator)"
    participant Agent as "OpenClaw Agent"
    participant API as "Game Server Hosting API"
    participant GS as "Game Server Instance"

    User->>Agent: "Order new server (game, region, config)"
    Agent->>API: POST /servers {game, sku, config, jwt}
    API-->>Agent: 201 Created {server_id, status=provisioning}
    Agent->>User: "Server provisioning started (server_id)"

    Agent->>API: GET /servers/{server_id}/status
    API-->>Agent: 200 {status=running, ip, port}

    User->>Agent: "Send console command /inspect"
    Agent->>API: POST /servers/{server_id}/console {cmd}
    API->>GS: deliver console command
    GS-->>API: console output
    API-->>Agent: console output
    Agent->>User: console output

    User->>Agent: "Stop server"
    Agent->>API: POST /servers/{server_id}/actions {action: stop}
    API-->>Agent: 202 Accepted {status=stopping}
    Agent->>User: "Stop initiated"
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 I hopped through docs with joyful ears,
I nudged a server past provisioning fears,
A twitch, a ping, the console sings,
Start, stop, and logs on tiny wings,
Rabbit cheers for deployed game gears. 🎮

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Add use case: Game Server Management via API' accurately and specifically describes the main change in the pull request, which adds a new use case document for game server management.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@README.md`:
- Line 53: Update the use-case count badge in the README to reflect the new
entry: increment the number shown in the badge from 36 to 37 so it matches the
added "Game Server Management" table row (the badge token showing "36" in the
README header must be changed to "37").

In `@usecases/game-server-management.md`:
- Around line 46-55: Update the "Game Server Management" section added to
AGENTS.md to include an explicit warning that JWT bearer tokens must not be
pasted or stored in AGENTS.md (or any committed repo file); mention that tokens
should be stored in environment/secret storage (e.g., secrets manager, .env
excluded from VCS) and referenced at runtime, and add a brief sentence pointing
readers to the login-link/purchase flow as the source of the token rather than
manual paste; modify the "Game Server Management" heading content in AGENTS.md
accordingly.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 735824e7-113d-4975-91d2-f9807556c089

📥 Commits

Reviewing files that changed from the base of the PR and between 31ea39a and 1f70e55.

📒 Files selected for processing (2)
  • README.md
  • usecases/game-server-management.md

Comment thread README.md
Comment thread usecases/game-server-management.md
- Update use case count badge from 36 to 37
- Add explicit warning not to store JWT tokens in AGENTS.md

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@usecases/game-server-management.md`:
- Around line 58-73: The template lacks a mandatory confirmation step for the
billable endpoint POST /orders/purchase; update the operating rules and the
user-flow steps so the agent always asks for explicit confirmation before
calling POST /orders/purchase and, in that confirmation prompt, restates the
selected game, plan, region, billing term, and total price; modify the "Confirm
destructive operations" rule to include purchases and ensure any handler that
triggers POST /orders/purchase validates an explicit affirmative confirmation
containing those details before proceeding.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 92675a7a-1df4-4ed0-94f3-3b449c722e3f

📥 Commits

Reviewing files that changed from the base of the PR and between 1f70e55 and 93ac127.

📒 Files selected for processing (2)
  • README.md
  • usecases/game-server-management.md

Comment thread usecases/game-server-management.md
- Add critical warning: send checkout/login URL to user before calling any tools
- Add cron polling recommendation (every 30s) instead of while/sleep loops
- Add purchase and claim endpoints to agent config example
- Clarify purchase does not require auth

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

♻️ Duplicate comments (1)
usecases/game-server-management.md (1)

71-75: ⚠️ Potential issue | 🟠 Major

Require explicit confirmation for purchases and console actions.

Line 74 still limits confirmation to restart/config changes, but this doc also exposes a billable POST /orders/purchase flow and potentially destructive POST /servers/{id}/console actions. Please require explicit confirmation for both, and for purchases restate the game, plan, region, billing term, and total price before calling the endpoint.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@usecases/game-server-management.md` around lines 71 - 75, Update the
confirmation policy to require explicit user confirmation for purchases and
console actions in addition to restarts/config changes: add explicit
confirmation steps before invoking POST /orders/purchase and POST
/servers/{id}/console, and for purchases require the assistant to restate and
obtain confirmation of the game title, plan, region, billing term, and total
price (clear summary) before calling the purchase endpoint; ensure the doc's
checklist and any procedural text referencing restarts/config changes (the
current "Confirm destructive operations") is broadened to include these two
endpoints and the exact fields to be reiterated for purchases.
🧹 Nitpick comments (1)
usecases/game-server-management.md (1)

82-84: Document when the cron poller must stop.

The polling flow says to create a 30s cron, but it never says to cancel it once /auth/claim reaches a terminal state. Without that, agents can leave orphaned jobs running indefinitely and keep hammering the claim endpoint.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@usecases/game-server-management.md` around lines 82 - 84, Add explicit stop
conditions for the 30s cron that polls GET /auth/claim: cancel the cron as soon
as the claim response enters any terminal state (e.g., status:"ready" — after
securely saving the JWT token — or status:"failed"/"expired"/"cancelled"), and
also cancel on repeated non-recoverable HTTP errors or after a configurable max
retry count/timeout to avoid orphaned jobs; document these terminal states and
the requirement to clear the cron immediately after saving the JWT token (or on
other terminal responses).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@usecases/game-server-management.md`:
- Around line 71-75: Update the confirmation policy to require explicit user
confirmation for purchases and console actions in addition to restarts/config
changes: add explicit confirmation steps before invoking POST /orders/purchase
and POST /servers/{id}/console, and for purchases require the assistant to
restate and obtain confirmation of the game title, plan, region, billing term,
and total price (clear summary) before calling the purchase endpoint; ensure the
doc's checklist and any procedural text referencing restarts/config changes (the
current "Confirm destructive operations") is broadened to include these two
endpoints and the exact fields to be reiterated for purchases.

---

Nitpick comments:
In `@usecases/game-server-management.md`:
- Around line 82-84: Add explicit stop conditions for the 30s cron that polls
GET /auth/claim: cancel the cron as soon as the claim response enters any
terminal state (e.g., status:"ready" — after securely saving the JWT token — or
status:"failed"/"expired"/"cancelled"), and also cancel on repeated
non-recoverable HTTP errors or after a configurable max retry count/timeout to
avoid orphaned jobs; document these terminal states and the requirement to clear
the cron immediately after saving the JWT token (or on other terminal
responses).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 37a0bede-c73c-4ed0-a6f3-a16a68139311

📥 Commits

Reviewing files that changed from the base of the PR and between 93ac127 and b363291.

📒 Files selected for processing (1)
  • usecases/game-server-management.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant