
FiveM MCP
io.github.ziyacivan由 GitHub 帳號 ziyacivan 發布v0.6.0更新於 Oct 24, 2026
Build, run and live-test FiveM servers with AI agents: RCON, DevCon, window control, mcpb bridge.
概覽
讓 AI 助理透過 RCON 操作伺服器主控台、透過 devcon 操作執行中的 FiveM 用戶端 F8 主控台,以便建置、執行並即時測試 FiveM 伺服器。
- 可以做什麼
- 此伺服器提供涵蓋 FiveM 測試流程的工具:server_command 以 UDP RCON 送出任意伺服器主控台指令並回傳擷取的輸出,client_command 則透過 devcon 將指令輸入執行中的 Legacy 用戶端 F8 主控台。read_console 與 wait_for_console 可讀取最近的主控台訊息,或封鎖等待符合正規表達式的訊息,作為斷言基礎。另外還包含視窗控制(啟動、聚焦、截圖、鍵盤與滑鼠輸入)、讀取最新的 CitizenFX 用戶端日誌,以及用於 natives、exports、NUI 回呼、位置與傳送的 bridge 資源。內建 test_resource 與 smoke_check 兩個提示,將上述能力組成現成的工作流程。
- 適用情境
- 適用於開發與測試 FiveM 資源的情境:希望由助理重新啟動資源、同時觀察伺服器端與用戶端主控台輸出、驅動遊戲內情境並給出通過或失敗的結論,而不必自己操作鍵盤。它針對開發伺服器,而非正式環境。
- 執行需求
- 透過 npx fivem-mcp-server 以 stdio 在本機執行,需要 Node 22+。需要一台你管理的、正在執行的 FXServer,並設定 FIVEM_RCON_PASSWORD 與 server.cfg 中的 rcon_password 一致,server_command 才能使用。用戶端主控台工具需要同一台機器上執行 Legacy FiveM 用戶端,因為 devcon 預設綁定 localhost。鍵盤、滑鼠與截圖工具僅支援 Windows。選用設定包括 FIVEM_SERVER_LOG、FIVEM_HOST、FIVEM_RCON_ADDRESS、FIVEM_EXECUTABLE 與 FIVEM_MCPB_TOKEN。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 FiveM MCP,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
fivem-mcp
[npm version] [license: MIT] [CI]
An MCP (Model Context Protocol) server that lets AI agents — Claude, Qwen, or anything that speaks MCP — build, run and live-test FiveM servers from the same machine.
It is the missing test layer for the "did it actually work in-game?" question: the agent can run real console commands, watch both the server log and the live F8 console of a running FiveM client, wait for specific output, and react — without you touching the keyboard.
Status
v0.5 drives the whole loop: server console (RCON), client F8 console (devcon), the game
window (launch, focus, screenshot, keyboard/mouse) and an in-game bridge (mcpb) for
natives, exports and NUI callbacks — plus ready-made test prompts. Tools answer with
structured content, carry MCP annotations, and stop as soon as the client cancels. All of it live-verified
against a real FXServer + FiveM Legacy client (see docs/plan.md and scripts/live-*.mjs).
Where it is published
The repository's GitHub Packages sidebar is deliberately empty: the artifact lives on
npmjs.com, not GitHub Packages — the latter would force a scoped @ziyacivan/ package name
and a second registry for no benefit.
Requirements
- Node 22+ (Windows, macOS or Linux for the server side; the client devcon works
wherever the FiveM client runs — this tool must run on that machine for the
client_*tools since devcon binds to localhost by default). - A running FXServer you administer (
rcon_passwordset forserver_command). - The Legacy FiveM client for the client-console tools (Enhanced removed the client devcon ports; see docs/protocol.md).
- The keyboard/mouse/screenshot tools are Windows-only and run on the machine with the game. On other platforms every tool except those is served normally.
Install
Published on npm — no clone needed. Add it to Claude Code in one line:
(-s user = available in every project; drop it for a per-project entry. Verify with claude mcp get fivem — status should read ✓ Connected. Remove with claude mcp remove fivem -s user.)
For a shared project config, put .mcp.json in the repo root and commit it —
Claude Code asks to approve it on first open, and env values can be interpolated
from your local .env-less shell via ${VAR} expansion:
For Claude Desktop (or any client with JSON config), add to
claude_desktop_config.json:
The server is also listed in the MCP Registry as
io.github.ziyacivan/fivem-mcp. Building from source (development):
Configuration (environment)
Tools
Prompts
Two workflows are shipped as MCP prompts, distilled from the live-verified loops:
test_resource(resource, expectations?)— clean restart → console error scan → client-half scan → in-game scenario (keys, screenshot, bridge state) → evidence-backed PASS/FAIL report where anything unverifiable is said so out loud.smoke_check— one fast sweep: connections, which server, error tails on both sides, window + screenshot, persisted client log. OK/WARN/DOWN per line.
The bridge resource (bridge/)
Client-side testing (natives, NUI callbacks, position) is outside what devcon and RCON can reach — the small companion resource closes that gap and ships in this repo.
and point this server at it with FIVEM_MCPB_TOKEN. Then:
Client results come back through an in-band queue polled over RCON (~100 ms granularity since v0.5 — no log file needed; pre-0.5 resources still fall back to the log tail).
Dev servers only. mcpb_enabled defaults to false, the command is accepted only from
the console/RCON (never from a player), and the token is checked when set — but
call_native is exactly as safe as the console it runs behind. Keep RCON and this bridge
off anything you care about; see SECURITY.md. The full wire contract: docs/protocol.md §4.
Typical loop (what an agent does)
server_command: "ensure my-resource"wait_for_console: target=server, pattern="Started resource my-resource|Error"client_command: "connect localhost:30120"drives the join itself, thenread_console: target=clientcatches client-side console output that never reaches the server log.
Security notes — read before exposing anything
- The client devcon socket has no authentication. Anyone who can reach it can run
local console commands in that game client (connect, quit, ...). FiveM binds it to
127.0.0.1unless the client is started with-devcon(then0.0.0.0); this tool assumes the loopback default and never needs more. Do not tunnel it. - RCON is the server's admin root. Keep
rcon_passwordstrong;FIVEM_RCON_PASSWORDlives in your MCP config — protect that file the same way. - FXServer itself has no server-side devcon socket on current builds (verified 2026-09-02), which is why the server half is RCON + log tail.
- Treat
server_commandas giving the agent root on your box the moment it canexecanything; run it only against development servers.
Development
Releasing: move the Unreleased changelog notes under the new version heading, then
pnpm version <patch|minor|major> (bumps and syncs server.json + the bridge manifest,
and tags), npm publish from your machine (prepublishOnly runs the full gate), and
git push --follow-tags. The Release workflow then re-runs the gate, creates the GitHub
Release from CHANGELOG.md, and registers the version with the MCP Registry.
See CONTRIBUTING.md.
Live verification against a real server/game: pnpm live:probe, live:e2e, live:m2, live:m3.
The wire protocol (DevCon frames, RCON/getinfo OOB datagrams, the Cfx string hash)
is documented byte-by-byte in docs/protocol.md, derived from the
open-source CitizenFX server, citizenfx/fivem@03dcc562. Live-verified: RCON reply
format, getinfo response and the >8-byte challenge drop were confirmed against a
real FXServer on 2026-09-02.
License
MIT. The FiveM/CitizenFX name is a trademark of Cfx.re; this project is not affiliated with or endorsed by Cfx.re.
來源:README.md,提交 ce65a7f
工具
0版本歷史
1- v0.6.0最新Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分
