MCP server

K3 Studio is an MCP server for the agent it runs. Claude Code gets the server's console, its errors, the database and the running game as tools.

How it connects

When the agent panel starts Claude Code, K3 Studio opens an HTTP endpoint on 127.0.0.1 with a random port and a random bearer token, and passes it with --mcp-config. There is nothing to set up, nothing listens beyond your machine, and your own MCP servers still load as usual.

{
  "mcpServers": {
    "fed": {
      "type": "http",
      "url": "http://127.0.0.1:<port>/mcp",
      "headers": { "Authorization": "Bearer <token>" }
    }
  }
}
  • Game tools act on the first connected player through the fed-bridge dev resource. Press Esc to take control back.
  • db_execute changes data, so K3 Studio asks you first. db_query is read-only.

Tools

Server & editor

server_status

Whether K3 Studio's FXServer is running, its endpoint, and how many runtime errors are open.

server_console

The latest server and client console lines (FXServer output and the FiveM client log).

lines integer
How many lines, newest last (default 50, max 500).
server_command

Runs a command in the FXServer console, e.g. 'ensure inventory' or 'refresh'.

command string required
runtime_errors

SCRIPT ERRORs the server and client consoles reported since each resource last restarted, with file, line, count and stack.

diagnostics

Language server diagnostics (qbx-lua-ls: wrong-side natives, undefined globals, ...) for one file or all open files.

path string
Absolute path; omit for all files.
open_file

Opens a file in K3 Studio's editor, optionally at a 1-based line, so the user sees it.

path string required
line integer
playtests_run

Runs the playtests (Lua files in each resource's playtests/ folder, in the game or with '-- side: server' on the server) and returns PASS/FAIL per test with the failure's message and line. filter: only tests whose name contains it.

filter string

Database

db_query

Runs a read-only SQL statement (SELECT, SHOW, DESCRIBE, EXPLAIN) on the server's database; returns tab-separated rows.

sql string required
db_execute

Runs a SQL statement that changes data on the server's database; K3 Studio asks the user first.

sql string required

Game

game_state

The player's position, heading, street, zone, vehicle and interior in the running game.

game_players

Every connected player: id, name, ping and position.

game_teleport

Moves the player (and their vehicle) to x, y, z, optionally facing heading.

x number required
y number required
z number required
heading number
game_spawn_vehicle

Spawns a vehicle by model name (e.g. 'adder') and puts the player in it.

model string required
game_walk_to

Sends the player to x, y, z like a person would: on foot along the navmesh (run: running) or driving when in a vehicle, so zones and markers on the way trigger (game_teleport skips them). Returns at once with the distance; check arrival with game_wait_for or game_state.

x number required
y number required
z number required
run boolean
game_press

Holds a game control down for ms (default 100, max 5000), as if the player pressed it: an id (38) or name (INPUT_PICKUP) from FiveM's controls list.

control string required
ms integer
game_screenshot

Saves what FiveM's window shows as a PNG and returns its path (open it to see the game). The game must be on screen.

game_wait_for

Re-evaluates a Lua condition in the game (side 'server': on the server) every 100 ms until it's truthy, up to timeout_ms (max 7000). Returns its value or 'timed out'.

code string required
side "game" | "server"
timeout_ms integer
game_eval

Runs Lua and returns its value: side 'game' runs in the player's client, 'server' on the server. An expression or statements.

code string required
side "game" | "server"