Skip to content

MCP Server & AI Editor Integration ​

StationeersLua includes a built-in Model Context Protocol (MCP) server that exposes game state, chip discovery, code read/write, and debug surfaces to AI-aware editors such as Cursor, Windsurf, and other MCP clients.

How It Works ​

The HTTP listener runs locally inside your game client (default port 3030). It exposes two independent surfaces on the same port:

  • MCP JSON-RPC — for AI editors (Cursor, Windsurf, Claude Code, etc.)
  • Extension REST — for the VS Code extension (chip browsing, code sync, debugger attach)

Each surface is enabled independently via its own config toggle. Both share the same port.

For the Extension REST route reference (Swagger), see Extension REST API (Swagger).

Companion mods (LuaMcpRegistry) ​

LaunchPad mods that reference only the released StationeersLua.dll can register extra MCP documentation (lazy Markdown URIs) and tools from OnLoaded via StationeersLua.LuaMcpRegistry, the same public pattern as LuaLibraryRegistry for chip VMs. Use namespaced URIs (for example stationeers://your_mod/api). Ship sample scripts under Examples/ next to the mod DLL and call LuaMcpRegistry.RegisterBundledExampleDocumentation so each .lua / .md / .ic10 file becomes an MCP resource plus an index (StationeersLua, ScriptedScreens, and StationeersLuaAI use this). search_docs scopes: built-in all, lua (everything except stationeers://ss/), or ss (ScriptedScreens only). Mods can also call LuaMcpRegistry.RegisterDocumentationSearchScope("my_mod", "stationeers://my_mod/") so clients may pass scope: "my_mod" and only match resources whose URI contains that substring (repeat calls OR additional needles). The list_search_docs_scopes MCP tool lists every valid scope; a non-empty unknown scope makes search_docs return an error (no silent fallback to all). After registering many resources, LuaMcpRegistry.RequestDocumentationSearchIndexRefresh() schedules a background index rebuild.

MCP Tools ​

Editor & Chip Management ​

ToolDescription
get_editor_stateQuery the current in-game editor selection, network scope, chip list, and wireless-only context
get_editor_codeRead the live IC editor draft text (not the compiled chip source)
set_editor_codeUpdate the IC editor draft — does not compile or export to the chip
list_chipsEnumerate accessible Lua chips on the current data network(s)
list_disksList vanilla Data Disks near accessible chips (read-only; skips Configuration Disks)
get_diskRead a Data Disk's stored text by ref ID (read-only; write with ic.disk.write)
get_chip_codeRead a chip's current source by ref ID
set_chip_codeWrite source to a chip by ref ID — compiles and exports immediately
patch_chip_codeApply exact substring replacements to a chip's source without rewriting the entire file. Supports ordered replacements, replace_all, and occurrence targeting
get_chip_errorsRetrieve error details for chips with debugger authority
get_chip_logsGet buffered print() / script log output for a chip, including the current log revision
list_library_modulesList library chip modules visible on the current network(s)

Device & Network ​

ToolDescription
get_network_devicesEnumerate devices on the current data network
get_all_network_devicesList all data cable networks in the world and their connected devices
read_device_valueRead a logic value from a device by reference ID and LogicType name
get_device_logic_typesGet all readable and writable LogicType values for a device
ToolDescription
get_game_stateQuery world name, time, and other top-level game state
list_search_docs_scopesJSON list of valid search_docs scope values: built-ins all, lua, ss, plus mod-registered scopes and their URI substring needles
search_docsFull-text search across indexed documentation resources. Optional scope: omit or all for everything; built-ins lua, ss; mod names from list_search_docs_scopes. An unknown non-empty scope returns an error (no silent fallback to all)
search_stationpediaFull-text search over the in-game Stationpedia encyclopedia entries

Debugger Tools conditional ​

These tools are only registered when both Enabled and EnableExtensionApi are true:

ToolDescription
get_debug_session_stateGet the active VS Code debugger session state for an attached chip
get_debug_stack_traceGet the stack trace for a paused chip in the active debugger session
get_debug_scopesGet debugger scopes for a paused frame (use get_debug_stack_trace for frame IDs)
get_debug_variablesGet debugger variables for a scope or variable reference

set_editor_code vs set_chip_code vs patch_chip_code

  • set_editor_code updates what is displayed in the in-game IC editor without compiling or exporting. Use it when you want to stage a change for the player to review.
  • set_chip_code writes directly to the chip and compiles immediately — equivalent to pressing Export in the editor.
  • patch_chip_code applies targeted substring replacements to the chip's current source. Use it for small edits so tool arguments stay small instead of rewriting the entire source.

MCP Resources ​

The server exposes the following resources that AI editors can read for context:

Guides & API ​

URIContent
stationeers://lua/readmeMCP server README and recommended workflow
stationeers://lua/guideFull StationeersLua scripting guide
stationeers://lua/migrationIC10 to Lua instruction-by-instruction guide
stationeers://lua/api/logicLogic read/write and batch API reference
stationeers://lua/api/deviceDevice discovery and slot API reference
stationeers://lua/api/memoryChip memory API reference
stationeers://lua/api/persistPer-chip ic.persist key/value store
stationeers://lua/api/diskPortable vanilla Data Disk ic.disk API
stationeers://lua/api/networkInter-chip networking API reference
stationeers://lua/api/httpHTTP request API reference
stationeers://lua/api/timerTimer / scheduler API (ic.timer)
stationeers://lua/api/utilityUtility functions reference
stationeers://lua/api/eventsEvent system reference
stationeers://lua/api/libraryLibrary chip / require() reference

Enums ​

URIContent
stationeers://lua/enums/logic_typeComplete LogicType enum values with descriptions (LT.*)
stationeers://lua/enums/logic_slot_typeComplete LogicSlotType enum values for slot-based reads (LST.*)
stationeers://lua/enums/batch_methodLogicBatchMethod enum values (Sum, Average, Minimum, Maximum)
stationeers://lua/enums/sorter_instructionSorterInstruction enum (Logic Sorter stack opcodes)
stationeers://lua/enums/condition_operationConditionOperation enum (packed compare modes)

Bundled Examples ​

URIContent
stationeers://lua/examples/indexCatalog of all example scripts shipped with StationeersLua
stationeers://lua/examples/<path>Individual example file (.lua, .ic10, or .md)

Example files are loaded from the Examples/ directory next to the mod DLL at startup. Other mods (e.g. ScriptedScreens) can register their own example bundles under separate URI prefixes.

The stationeers://lua/readme text is also provided as initialize.result.instructions so MCP clients display it automatically when the server is selected.

Configuration ​

All settings live in the StationeersLua config file under [MCP Server]. The LSP-related keys (EnableLspServer, LspPort, and ExternalLuaLanguageServer*) also live in this section - see Language servers & editor intelligence for their full reference.

SettingDefaultDescription
EnabledfalseEnable the MCP JSON-RPC surface for AI editors
EnableExtensionApifalseEnable the REST surface for the VS Code extension — can be used without enabling Enabled
Port3030Shared HTTP listener port for both surfaces
BindAddress127.0.0.1Bind address for the HTTP listener. Use AllowRemoteConnections instead of changing this to 0.0.0.0
AllowRemoteConnectionsfalseBind to all interfaces instead of localhost only
AllowedBrowserOrigins(empty)Comma-separated browser Origin values that may call the HTTP listener (e.g. https://my-tool.example). When empty, requests that include an Origin header are rejected (anti CSRF / DNS-rebinding). Desktop MCP clients and the VS Code extension do not send Origin and are not affected. CORS responses no longer use a wildcard.
AllowPersonalAreaNetworkChipAccessfalseWhen true, MCP and the VS Code extension can list and edit Lua chips on your worn PAN gear (suit networking module or dev board) without the IC editor or a wireless data link. See Suit Networking Module.
AllowNetworkChipAccessfalseMaster toggle for network-wide chip access. When disabled, both MCP and the VS Code extension stay single-chip scoped.
AllowNetworkChipAccessOnlyForWirelessBoardstrueWhen network access is enabled, keep the normal IC editor single-chip scoped and allow only the Wireless Development Board to expose full network scope. Set to false to let the normal wired IC editor expose its whole data network too.
AllowMultiplayerDebugProxyfalseAllow multiplayer clients to proxy VS Code debugger traffic to the authoritative server over in-game mod network messages
EnableExperimentalDebuggerfalse[Experimental] Enable the VS Code DAP debugger integration. When disabled, debug session endpoints and MCP debug tools are unavailable, and the VS Code extension hides the Debug button in the Chip Explorer

The HTTP listener only starts if at least one of Enabled or EnableExtensionApi is true.

Local HTTP listener ​

The listener has no login or API key. Access control is environmental:

  • Binding — By default the listener binds to loopback (127.0.0.1 / localhost). Only processes on the same machine can reach it unless you set AllowRemoteConnections = true, which binds all interfaces (0.0.0.0) for LAN use.
  • Browser traffic — Web pages send an Origin header. Only origins listed in AllowedBrowserOrigins are accepted; an empty list rejects all browser-origin calls. This prevents arbitrary sites from using your browser to call http://localhost:3030 while you play. CORS responses no longer use a wildcard.
  • Host header — When bound locally, requests whose Host is not a loopback name or address are rejected (DNS-rebinding mitigation). This check is skipped when AllowRemoteConnections is enabled.

Treat AllowRemoteConnections as exposing read/write chip access on your LAN to anyone who can reach the port.

Network Access Mode Defaults ​

  • By default, AllowNetworkChipAccess = false, so network-wide chip access is disabled everywhere.
  • If you enable AllowNetworkChipAccess and leave the new default AllowNetworkChipAccessOnlyForWirelessBoards = true, the normal IC editor stays single-chip scoped and only the Wireless Development Board gets full remote network scope.
  • If you want the older behavior where opening a normal IC editor also exposes the whole wired data network, set AllowNetworkChipAccessOnlyForWirelessBoards = false.

Dedicated Servers

Dedicated servers never start the local HTTP listener. In multiplayer, the listener runs in each non-dedicated game client. MCP and REST calls from your machine are forwarded to the authoritative server over in-game mod messages; the dedicated server does not open port 3030.

Multiplayer scope ​

On a multiplayer client, the server decides which chips and networks each proxy request may touch. Scope comes from your in-game state (IC editor selection, worn wireless or PAN modules, held laptop, and the relevant config toggles), not from chip lists you send in the request envelope.

The VS Code debugger uses the same model: your client talks to its local listener, and debug traffic is proxied to the server when AllowMultiplayerDebugProxy is enabled. Debug session ownership is tied to your connection on the server.

Anything that touches the in-game IC editor is the exception, because the editor is a window in your own game rather than a piece of world state the server owns. get_editor_state, get_editor_code, set_editor_code and the REST endpoints behind them always run on your client. A set_chip_code or patch_chip_code call with mode: editor_only also stays entirely on your client, since it never writes the chip. With mode: editor_then_chip the call is split: your client applies the editor draft, then the export is proxied to the server, and the single response reports both halves. If the editor is closed or another chip is selected when the write arrives, the export still succeeds and the response carries editor_synced: false with a reason.

Wireless Development Board & IC Editor Integration ​

When a player has the Wireless Development Board installed in their equipped EVA suit and connected to a wireless network:

  • With AllowNetworkChipAccess = true, the MCP server and VS Code chip explorer can use the wireless board as a remote network-scoped development context
  • With the default AllowNetworkChipAccessOnlyForWirelessBoards = true, opening a normal IC editor still exposes only the currently selected chip, while the wireless board exposes the chips on its selected wireless data network
  • If you set AllowNetworkChipAccessOnlyForWirelessBoards = false, the normal IC editor also expands to its full wired data network and MCP/REST tools can operate across both the wired editor network and the wireless suit-board network simultaneously
  • The in-game IC editor motherboard dropdown is still extended to include chip targets from the connected wireless network — a laptop or computer running an IC editor board can browse and select remote wireless chips without physically wiring to them

TIP

This requires AllowNetworkChipAccess to be enabled. The wireless board also has an internal MotherboardLuaDebugger slot — install a debugger motherboard there to enable wireless chip error inspection and VS Code debug sessions on the wireless network.

get_editor_state and REST /api/editor fields ​

When the suit Wireless Development Board supplies MCP/REST scope but no IC motherboard editor is open, the response includes:

  • wireless_remote_access_only: true — the suit board is only a remote data-network bridge, not a selected chip or circuit housing.
  • selected_chip_ref_id, selected_housing_ref_id, and selected_housing_name are unset (null) in that mode. Use network_id, network_ids, and network_names for where you are connected.

When a normal IC editor is open, wireless_remote_access_only is false and the holder fields describe the dropdown-selected chip’s holder as usual. Wired plus wireless scope can be merged when both are active and config allows it.

When scope comes from a worn Suit Networking Module or dev-board PAN only (AllowPersonalAreaNetworkChipAccess), the response includes:

  • pan_remote_access_only: true — worn PAN gear only, not a remote data network.
  • personal_area_network_name — display label for the PAN group (for example YourName (PAN)).

PAN and wireless-remote modes can both be active; check both flags and network_ids / network_names together.

In-Game Lua Reference Panel ​

The IC10 editor's built-in help buttons (f, x, s(x)) are replaced with a searchable Lua API reference panel when the Lua formatter is active.

  • Functions — All ic.*, global, and utility functions with signatures and descriptions
  • Logic Variables — LT.* enum values
  • Slot Variables — LST.* enum values
  • IC10 Migration — Side-by-side IC10 → Lua translation reference

When ScriptedScreens is also installed, its API sections (surface, element, canvas, layout, etc.) are appended to the panel automatically via cross-mod reflection.

Reference data is shipped as multilingual embedded XML assets (LuaReference_EN.xml, LuaReference_RU.xml, LuaReference_FR.xml, LuaReference_DE.xml) and loaded based on the game's current language (falls back to EN).

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