FiveM Unofficial MCP
A FiveM development MCP server for searching framework docs, managing resources, inspecting logs, testing NUI/game clients, and profiling FXServer.
Search and read cached docs/native references for FiveM, Qbox, QBCore, ESX, ox_lib, oxmysql, and KQ Link.
Check server status, read logs and diagnostics, run allowlisted console commands, and start/stop/restart managed FXServer processes.
List, read, create, edit, delete, deploy, start/stop/restart, and diagnose development resources.
Run an edit-build-refresh-restart dev cycle and collect fresh client/server errors.
Test in-game behavior: inspect state, spawn/delete entities, teleport, set weather/time, send input, run allowlisted client commands, and take screenshots.
Inspect and interact with NUI pages, evaluate JavaScript in NUI, and wait for UI/log/resource conditions.
Evaluate Lua on the client or server and run read-only SQL through oxmysql when enabled.
Create, run, and clean up scenario tests and regression suites.
Measure server/client performance and profile resource tick timing.
Provides tools for FiveM resource development, including framework documentation search, resource creation/editing/deployment, server log and diagnostics inspection, NUI testing, game/player state operations, Lua evaluation, database queries, scenario tests, and FXServer profiling.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@FiveM Unofficial MCP check my FiveM server status and show recent console errors"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
FiveM Unofficial MCP
A standalone Model Context Protocol server for FiveM resource development. Use it with Codex, Claude Code, or Claude Desktop to search framework docs, manage development resources, inspect logs, test NUI, and profile FXServer. This community project is unaffiliated with Cfx.re, Rockstar Games, Anthropic, and OpenAI.
Quick start
Use a development server, not your live one.
1. Install
Install Node.js 22 or newer. Download and extract the GitHub ZIP (or git clone it), open PowerShell in the folder that contains package.json, and run:
npm ciThis installs and builds everything.
2. Run the setup
npm run setupIt asks for the folder that contains your server.cfg, then:
copies the
bakery_ai_bridgeresource into your server'sresourcesfolder (or updates it in place),adds a marked block to the top of
server.cfgwith a freshly generated token (the original is saved asserver.cfg.before-fivem-mcp),writes
config.json,prints the exact command to connect Claude Code, Codex or Claude Desktop, and offers to register it with Claude Code for you.
Optional answers: your FiveM license: identifier (enables the in-game test tools; find it in txAdmin's player info) and developer extras (auto opt-in, lua_eval, read-only db_query). Running setup again is safe: it keeps your token and replaces only its own block.
3. Restart and check
Restart FXServer, then restart your MCP client, and run:
npm run checkIt explains in plain words what works and what to fix. When it says Everything needed is working, ask your client to call server_get_status.
For the in-game tools, join the server and run bakery_ai_test on in F8 (automatic if you enabled developer extras).
To also download the offline documentation, run npm run knowledge:sync.
Connecting a client by hand
npm run setup prints these commands with your real path filled in. Replace C:/Projects/fivem-unofficialMCP/dist/index.js with the full path to your folder's dist/index.js if you set it up yourself.
Codex
codex mcp add fivem-unofficial -- node "C:/Projects/fivem-unofficialMCP/dist/index.js"
codex mcp listOr add this entry to ~/.codex/config.toml. The longer timeout accommodates scenario runs.
[mcp_servers.fivem-unofficial]
command = "node"
args = ["C:/Projects/fivem-unofficialMCP/dist/index.js"]
tool_timeout_sec = 180Reload Codex and check /mcp in the CLI. Codex MCP documentation
Claude Code
claude mcp add --transport stdio --scope user fivem-unofficial -- node "C:/Projects/fivem-unofficialMCP/dist/index.js"
claude mcp listRun /mcp in Claude Code to check the connection. Claude Code MCP documentation
Claude Desktop
Open Settings → Developer → Edit Config. Merge this entry into the existing mcpServers object, then quit and reopen Claude Desktop.
{
"mcpServers": {
"fivem-unofficial": {
"command": "node",
"args": ["C:/Projects/fivem-unofficialMCP/dist/index.js"]
}
}
}On Windows the configuration file is normally %APPDATA%\Claude\claude_desktop_config.json. Local MCP server setup
Related MCP server: SJ RedM MCP Server
FiveM on a VPS
The MCP and FXServer run on the same machine because the bridge listens on 127.0.0.1. For a VPS, build and run the MCP on the VPS alongside FXServer. A Codex or Claude client on your PC can use it if the client launches that remote process over SSH stdio. The local client examples above assume a same-machine install. Your FiveM game can join the server from your PC. Local client logs, NUI DevTools, and Windows window capture require the game client on the MCP host.
Manual setup
npm run setup does all of this for you. To do it by hand instead:
Copy
resources/bakery_ai_bridgeinto your server'sresourcesfolder, soresources/bakery_ai_bridge/fxmanifest.luaexists. A category such as[custom]also works.Generate a token:
node -e "console.log(require('node:crypto').randomBytes(32).toString('hex'))"Add this at the top of
server.cfg. Use plainset(notsetr/sets) so the token stays on the server.set bakery_ai_enabled 1 set bakery_ai_port 32124 set bakery_ai_token "PASTE_YOUR_GENERATED_TOKEN_HERE" add_ace resource.bakery_ai_bridge command.status allow add_ace resource.bakery_ai_bridge command.refresh allow add_ace resource.bakery_ai_bridge command.profiler allow add_ace resource.bakery_ai_bridge command.record allow add_ace resource.bakery_ai_bridge command.saveJSON allow # For in-game test tools: # add_ace identifier.license:YOUR_LICENSE bakery_ai.test allow ensure bakery_ai_bridgeLeave out
ensure bakery_ai_bridgeif something else (such asensure [custom]) already starts it.Copy
config.example.jsontoconfig.jsonand changecwdto the folder containingserver.cfgandworkspaceto itsresourcesfolder (forward slashes on Windows)."tokenConfig": "server.cfg"reads the token from that file, so you do not need an environment variable.Restart FXServer and your MCP client, then run
npm run check.
To keep the bridge settings out of server.cfg, use the private CFG template, point tokenConfig at it, and exec it above the bridge's ensure.
Optional configuration
For the in-game tools, the test account needs add_ace identifier.license:YOUR_LICENSE bakery_ai.test allow (setup adds it when you give your license). Join the server and run bakery_ai_test on in F8, then check testClients in server_get_status. Run bakery_ai_test off to end the test session.
Developer extras, all off by default: set bakery_ai_auto_optin 1 opts the test account in automatically after joins and bridge restarts, set bakery_ai_eval 1 enables lua_eval, and set bakery_ai_sql 1 enables read-only db_query through oxmysql. List the F8 commands the MCP may run in allowClientCommands, for example ["racing"], or ["*"] for any.
If the resources you want to manage live in a category like [custom], point workspace and servers[].resources to the folder that directly contains them.
Configuration reference
Field | Meaning |
| Source resource directory, relative to |
| Unique target ID and the value |
| FXServer working directory, relative to |
| Installed resource directory, relative to |
| Optional local executable relative to |
| Loopback port matching |
| The cfg file (relative to |
| Alternative to |
| Server allowlist, selected from |
| Allowlisted F8 commands for testing. Empty by default. |
| Local FiveM client settings. Defaults to port |
Set BAKERY_FIVEM_CONFIG to use an alternate config file. Set BAKERY_FIVEM_STATE_DIR to relocate audits, scenarios, screenshots, and the knowledge cache. Use the same state directory for the MCP host and knowledge sync. Normal MCP shutdown stops FXServer processes it owns. Start FXServer independently if it needs to outlive the MCP client.
Knowledge base
Source | Content |
| Cfx.re guides and the client, server, and shared native reference |
| Qbox guides and API reference |
| QBCore framework and resource docs |
| English ESX Legacy core and add-on docs |
| Overextended library docs |
| Overextended database API docs |
| Public KuzQuality KQ Link docs and optional local indexing of an installed |
Use knowledge_sources for counts and sync dates, knowledge_search to find an API, and knowledge_read for a line range and the original source reference. Search can filter by source, kind, and native apiSet.
npm run knowledge:sync
npm run knowledge:sync -- fivem ox_libGit ignores the generated cache in .bakery-data/knowledge/. Sync preserves the previous snapshot when a download fails. Documentation and installed resource code retain their original ownership and terms. Source catalog
Tool catalog
Area | Tools |
Docs |
|
Server |
|
Resources |
|
Player and game |
|
Client and NUI |
|
Lua and database |
|
Scenario tests |
|
Profiling |
|
Read a source file before editing it. Pass the returned
sha256asexpectedSha256, ornullfor a new file.dev_cyclecan build and restart the resource and gather fresh errors.Deletion requires one-time local approval. Call
resource_deleteto get a request ID, runnode dist/index.js approve-delete REQUEST_ID "ABSOLUTE_RESOURCE_PATH", then callresource_deletewith the approval ID. The resource moves to recoverable storage under.bakery-data/trash/.For NUI, use
nui_snapshotto find a control,nui_actto interact, andwait_forto wait on UI state or a log condition.game_screenshotsupports local Windows window capture with NUI and game-only capture withscreencaptureorscreenshot-basic.To run a scenario, pass the vehicle smoke example to
test_create_scenario. Calltest_execute_scenariowith{"scenario":"vehicle_smoke","participants":{"default":1}}, using your opted-in player ID in place of1.Resources can expose a development-only
bakeryAiTest(action, data, scope)client export orbakeryAiTest(action, data, scope, playerId)server export. Validate the caller and make scenario cleanup idempotent.
Troubleshooting
Start with npm run check. It tests the config, the installed bridge, the token and the connection, and says what to fix.
Symptom | What to check |
Tools reply | The message names the field and the fix. Running |
| The token was pasted into |
Client cannot launch the MCP | Run |
Knowledge sources show as missing | Run |
Bridge authentication fails | The token changed after FXServer started. Restart FXServer, then the MCP client. |
| No |
Bridge unreachable | Confirm FXServer started |
No opted-in test client | Check the license ACE, join your dev server, and run |
NUI tools show no pages | Open the local FiveM client, join a server, and check the DevTools port. |
Tests
npm testTests cover the MCP connection, source editing, scenario execution, local log parsing, Lua syntax, knowledge searches, config error messages, and the setup and check scripts (against temporary folders). To include the optional live test, set BAKERY_SMOKE_FXSERVER to your FXServer executable and BAKERY_SMOKE_LICENSE_CFG to a local cfg containing a valid server license. It creates an isolated temporary instance on loopback ports 33124 and 33125.
Available Tools
43 toolsclient_get_logsBRead-only
Read the local FiveM client log: client Lua prints and script errors plus NUI console output. Pass next as after to read only newer lines.
Inputs: after, level, limit, contains, +1 more.
db_queryBRead-only
Run one read-only SQL query (SELECT/SHOW/DESCRIBE/EXPLAIN/WITH) through oxmysql on the dev database. Use ? placeholders with params. Needs bakery_ai_sql 1.
Inputs: query (required), limit, params, server.
dev_cycleADestructive
Edit-verify loop for one resource: run its npm build (if it has one), refresh and restart it, wait, then report new server and client errors. Optionally run a client command to open its UI and return a screenshot.
Inputs: resource (required), open, build, player, +3 more.
game_delete_entityCDestructive
Delete a bridge-spawned entity by ID
Inputs: entityId (required), player, server.
game_execute_commandBDestructive
Run a client console command as if typed in F8 (e.g. a resource's RegisterCommand to open its UI). Must be in allowClientCommands. Arguments are single tokens.
Inputs: command (required), args, player, server.
game_get_entitiesCRead-only
List entities spawned by the bridge
Inputs: player, server.
game_get_stateCRead-only
Player position, heading, health, armor, vehicle, clock, resolution and whether NUI has focus
Inputs: player, server.
game_inputBDestructive
Hold game controls for a duration (max 4000 ms), e.g. accelerate to drive or interact to press E. Use a named control or a raw GTA control ID; steer uses value -1 (left) to 1 (right).
Inputs: controls (required), player, server, durationMs.
game_screenshotARead-only
Screenshot the game. auto/window captures the local FiveM window including NUI; game uses the bridge (no NUI, works for remote clients). baseline names a visual baseline: saved on first use (or with saveBaseline), compared afterwards (returns diffPercent and a diff image when over 0.5%).
Inputs: method, player, server, baseline, +2 more.
game_set_environmentCDestructive
Override client weather and/or clock time, or reset both
Inputs: hour, reset, minute, player, +2 more.
game_spawnBDestructive
Spawn a client-local test vehicle, ped or object (cleaned up by test_cleanup). warpIn puts the player in a spawned vehicle.
Inputs: kind (required), model (required), player, server, +3 more.
game_teleportCDestructive
Teleport the player (on foot) to world coordinates
Inputs: position (required), player, server.
knowledge_readBRead-only
Read a line range of a cached document by source and ID from knowledge_search. Use next to continue.
Inputs: id (required), source (required), from, lines.
knowledge_searchBRead-only
Search cached guides, FiveM natives and installed KQ Link source. Use an exact API name, native hash or technical phrase.
Inputs: query (required), kind, limit, apiSet, +1 more.
knowledge_sourcesARead-only
List local documentation snapshots, record counts and last sync times
Inputs: no named parameters.
lua_evalBDestructive
Run a Lua snippet on the test client or the server (bridge resource context: natives, exports and events are available). Expressions return their value; print output is captured. Needs bakery_ai_eval 1.
Inputs: code (required), side, player, server.
nui_actADestructive
Act on a resource's NUI: click, hover, type (value; submit presses Enter), key (value, e.g. Escape) or scroll (value = pixels). Target by ref from nui_snapshot, CSS selector or visible text. Returns a fresh snapshot.
Inputs: action (required), resource (required), ref, text, +5 more.
nui_evalCDestructive
Evaluate a JavaScript expression in a resource's NUI page (awaits promises, returns JSON)
Inputs: resource (required), expression (required).
nui_listBRead-only
List resources with an NUI page and whether each shows visible content
Inputs: visibleOnly.
nui_snapshotBRead-only
Compact text outline of a resource's visible NUI: text, headings and interactive elements as [ref] role "label". Use refs with nui_act.
Inputs: resource (required), maxChars, selector.
performance_getBRead-only
Measure the server (process RSS, bridge heap) or the test client (frame time, bridge Lua heap)
Inputs: target (required), player, server.
performance_get_resourceCRead-only
Resource tick timing (mean, p95, max ms) from a saved profile ID
Inputs: resource (required), profileId (required), server.
performance_profileBDestructive
Start a Cfx profiler recording (frames), or stop and save it. Pass the returned profile ID to performance_get_resource.
Inputs: action (required), frames, server.
resource_controlBDestructive
Start, stop or restart a resource on the server and verify its new state
Inputs: action (required), resource (required), server.
resource_createBDestructive
Create a Lua or JavaScript resource with a manifest and client/server entry points
Inputs: resource (required), language.
resource_deleteADestructive
Request, then (after the user approves locally) consume approval to move a resource to recoverable storage
Inputs: resource (required), approvalId.
resource_deployCDestructive
Copy a workspace resource to a server's resource folder (no-op when shared) and optionally refresh and restart it
Inputs: resource (required), ensure, server.
resource_editADestructive
Write a whole source file. Pass its current SHA-256 from resource_read, or null to create a new file
Inputs: file (required), content (required), resource (required), expectedSha256 (required).
resource_get_diagnosticsCRead-only
Live resource state, path and its recent server errors
Inputs: resource (required), server.
resource_listCRead-only
Page through resources in the workspace
Inputs: after, limit, prefix.
resource_readBRead-only
List a resource directory, or read a line range of a source file with its SHA-256 (needed for resource_edit)
Inputs: resource (required), file, from, limit, +1 more.
resource_test_adapterCDestructive
Call a resource's exported bakeryAiTest(action, data) adapter on the client or server side
Inputs: action (required), resource (required), data, side, +2 more.
server_execute_commandCDestructive
Run an allowlisted FXServer console command (status, refresh, say)
Inputs: command (required), text, server.
server_get_diagnosticsBRead-only
Status plus the 10 most recent server errors and the last managed process exit
Inputs: server.
server_get_logsBRead-only
Read deduplicated FXServer console lines. Pass the returned next as after (with epoch) to read only newer lines.
Inputs: after, epoch, level, limit, +2 more.
server_get_statusARead-only
Bridge readiness, uptime, enabled dev features and opted-in test client IDs. Omit server to get every configured server.
Inputs: server.
server_lifecycleBDestructive
Start, stop or restart an FXServer process launched by this MCP (needs executable in config.json)
Inputs: action (required), server.
test_cleanupCDestructive
Delete bridge-spawned entities and clear weather/time overrides on the test client
Inputs: runId, player, server.
test_create_scenarioBDestructive
Store a named test: ordered actions (any game operation, client_command or input), delays and assertions on saved results, plus cleanup steps
Inputs: scenario (required).
test_execute_scenarioCDestructive
Run a stored scenario with participant names mapped to opted-in player IDs
Inputs: scenario (required), participants (required), wait, server.
test_get_resultsARead-only
Get a scenario run by ID: state, step counts, failures, cleanup errors and error log references
Inputs: id (required).
test_run_regressionCDestructive
Run several stored scenarios in order and report each outcome
Inputs: scenarios (required), participants (required), server.
wait_forARead-only
Wait until exactly one condition holds, polling every 250 ms: nuiFocused, nui (text or selector present/absent in a resource's NUI), serverLog or clientLog (regex on new lines), or resourceState.
Inputs: nui, player, server, clientLog, +4 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 43 tools
Most tools have clearly distinct resource+action targets, and the prefix namespacing (server_/resource_/game_/nui_/test_/performance_/knowledge_) makes the boundary obvious. A few pairs overlap in intent: server_get_status vs server_get_diagnostics (diagnostics is 'status plus errors'), resource_control vs dev_cycle (both refresh/restart), and nui_list vs resource_list, though the descriptions differentiate them.
Names are uniformly snake_case with a stable domain prefix for nearly every tool (server_, resource_, game_, nui_, test_, performance_, knowledge_). A handful of cross-cutting tools (db_query, lua_eval, client_get_logs, wait_for, dev_cycle) break the prefix pattern, and ordering varies (game_get_state vs game_spawn vs resource_list), but the scheme is still predictable.
43 tools is heavy for a single server, even though the domain (server ops, resource authoring, in-game testing, NUI automation, profiling, DB, docs) is genuinely broad. Several groups could be consolidated: three diagnostics tools, performance_get split from performance_get_resource, and generic one-offs like db_query and lua_eval could be folded in.
Coverage is strong end to end: resource CRUD plus deploy/control, server lifecycle and logs, game state/spawn/teleport/environment, NUI snapshot-act-eval, scenario testing, profiling and DB inspection. Obvious gaps remain in test scenario lifecycle (no list/update/delete for stored scenarios, only create/execute) and no file-level delete or patch for resources.
Maintenance
Related MCP Connectors
A MCP server built for developers enabling Git based project management with project and personal…
MCP registry & directory: search, find & install 31k+ MCP servers & tools. Catalog and marketplace.
MCP server to assist with JxBrowser development.
Official Rewst MCP server: build, run, and debug Rewst workflows, forms, apps, and integrations.
Related MCP Servers
- AlicenseBqualityDmaintenanceProvides comprehensive access to MCP documentation through structured guides, full-text search, and interactive development workflows for building servers and clients.343 npmMIT
- AlicenseBqualityDmaintenanceA unified development tool for RedM that provides access to RDR3 discoveries, framework documentation (VORP/RSGCore), native functions across 86+ namespaces, and database operations with smart context-aware loading.137MIT
- AlicenseBqualityDmaintenanceA focused MCP server for FiveM teams to scaffold resources, generate NUI templates, and perform safe file edits.1143 npm1MIT
- AlicenseNot gradedqualityBmaintenanceEnables MCP clients to research game mods by searching documentation and definitions, inspecting dependencies and playsets, validating saved files with structural and Tiger checks, and preparing or editing mod content with preview and write controls. It also supports starting or previewing the game through a local stdio connection.8 npmGPL 3.0