Skip to content

Extension REST API (Swagger) ​

The StationeersLua VS Code extension talks to the game over plain HTTP REST on /api/*. This is separate from:

  • The MCP JSON-RPC server on the same port (for AI editors)
  • The in-game Lua ic.http client API (HTTP reference)

Enable the API ​

In BepInEx config, section [MCP Server]:

SettingRequired for REST
EnableExtensionApiYes — gates all /api/* routes
PortDefault 3030
BindAddressDefault 127.0.0.1 (localhost only)
EnableExperimentalDebuggerOnly for /api/debug/* routes

Default base URL: http://127.0.0.1:3030

See also MCP Server & Reference Panel and VS Code Extension.

OpenAPI spec ​

The machine-readable spec is at /openapi/extension-api.yaml.

API reference ​

Route overview ​

MethodPathPurpose
GET/api/statusHealth + version
GET/api/editorEditor selection and network scope
GET/PUT/api/editor/codeRead/write IC editor draft (raw Lua body on PUT)
GET/api/chipsList accessible chips
GET/PUT/api/chips/{refId}/codeRead/write chip source
GET/api/chips/{refId}/errorsCompile/runtime errors
POST/api/debug/sessionCreate debugger session
GET/DELETE/api/debug/session/{id}Session state / close
GET/api/debug/session/{id}/eventsPoll debug events
GET/api/debug/session/{id}/stackStack trace
GET/api/debug/session/{id}/scopesScopes for a frame
GET/api/debug/session/{id}/variablesVariables for a reference
POST/api/debug/session/{id}/evaluateEvaluate expression
POST/api/debug/session/{id}/setVariableSet variable
POST/api/debug/session/{id}/completionsCompletions
POST/api/debug/session/{id}/breakpointsSet breakpoints
POST/api/debug/session/{id}/continueContinue
POST/api/debug/session/{id}/pausePause
POST/api/debug/session/{id}/nextStep over
POST/api/debug/session/{id}/stepinStep in
POST/api/debug/session/{id}/stepoutStep out
POST/api/debug/session/{id}/restartRestart session

Error semantics ​

  • 403 — REST or debugger disabled in config
  • 400 — Bridge returned success: false or an error string in JSON
  • 404 — Unknown path
  • 500 — Unhandled server error

Debug session JSON errors may include a structured reason field:

reasonMeaning
unknown_sessionSession id is not registered (closed, timed out, or never created)
session_owned_by_other_clientAnother multiplayer client owns this session

Code PUT endpoints (/api/editor/code, /api/chips/{refId}/code) expect text/plain raw Lua source, not a JSON wrapper.

Debug protocol notes ​

GET /api/status includes:

json
{
  "debugger_enabled": true,
  "debug_protocol": {
    "breakpoints_source_path": true,
    "event_seq": true,
    "session_timeout_seconds": 60
  }
}
  • Breakpoints: POST .../breakpoints accepts optional request-level source_path and per-breakpoint source_path. Breakpoints are keyed by (source_path, line) so require()d modules do not collide with the main chunk. Omitting source_path falls back to the session’s attached source (legacy clients).
  • Verification: each returned breakpoint includes verified (against the compiled prototype line table when available) and optional message.
  • Events: each polled event includes a monotonic seq so the extension can detect gaps / ordering.
  • Session timeout: if the client stops contacting the session for DebugSessionTimeoutSeconds, the game force-resumes the chip and closes the session.

⚠️ This documentation was AI-generated and may contain inaccuracies. Please submit pull requests with corrections as needed.