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-bridgedev resource. Press Esc to take control back. db_executechanges data, so K3 Studio asks you first.db_queryis read-only.
Tools
Server & editor
Whether K3 Studio's FXServer is running, its endpoint, and how many runtime errors are open.
The latest server and client console lines (FXServer output and the FiveM client log).
linesinteger- How many lines, newest last (default 50, max 500).
Runs a command in the FXServer console, e.g. 'ensure inventory' or 'refresh'.
commandstring required
SCRIPT ERRORs the server and client consoles reported since each resource last restarted, with file, line, count and stack.
Language server diagnostics (qbx-lua-ls: wrong-side natives, undefined globals, ...) for one file or all open files.
pathstring- Absolute path; omit for all files.
Opens a file in K3 Studio's editor, optionally at a 1-based line, so the user sees it.
pathstring requiredlineinteger
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.
filterstring
Database
Runs a read-only SQL statement (SELECT, SHOW, DESCRIBE, EXPLAIN) on the server's database; returns tab-separated rows.
sqlstring required
Runs a SQL statement that changes data on the server's database; K3 Studio asks the user first.
sqlstring required
Game
The player's position, heading, street, zone, vehicle and interior in the running game.
Every connected player: id, name, ping and position.
Moves the player (and their vehicle) to x, y, z, optionally facing heading.
xnumber requiredynumber requiredznumber requiredheadingnumber
Spawns a vehicle by model name (e.g. 'adder') and puts the player in it.
modelstring required
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.
xnumber requiredynumber requiredznumber requiredrunboolean
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.
controlstring requiredmsinteger
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.
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'.
codestring requiredside"game" | "server"timeout_msinteger
Runs Lua and returns its value: side 'game' runs in the player's client, 'server' on the server. An expression or statements.
codestring requiredside"game" | "server"