Project documentation for Claude Code and AI assistants working on this repository.
CFX Developer Tools is a Cursor IDE plugin for FiveM and RedM (CFX) resource development. It includes 9 skills, 6 rules, 24 code snippets, 11 starter templates, and a companion Python MCP server with 6 tools for resource scaffolding, native lookup, manifest generation, framework detection, and live doc and event search.
Works with: Cursor (plugin), Claude Code (terminal and in-editor), and any MCP-compatible client.
This is a monorepo. Skills, rules, snippets, templates, and the companion MCP server live in the same repository because CFX resource development crosses all of those layers in a single workflow.
Version: 0.10.1 License: CC-BY-NC-ND-4.0 Author: TMHSDigital
CFX-Developer-Tools/
.cursor-plugin/
plugin.json # Plugin manifest (version, skills, rules)
skills/
<skill-name>/
SKILL.md # One skill per directory (kebab-case)
rules/
<rule-name>.mdc # Cursor rule files
snippets/ # Lua, JS, C# code snippets
templates/ # Resource starter templates (blank per-framework skeletons)
examples/ # Complete, runnable reference resources
mcp-server/
server.py # MCP server entry point (Python, FastMCP)
tools/ # One module per tool
data/ # Native databases, doc index, events
requirements.txt
docs/ # MkDocs Material site
.github/
workflows/ # CI / release / native-update / docs-index automation
| Skill | Description |
|---|---|
resource-scaffolding |
Generate a complete CFX resource skeleton (fxmanifest, client/server entries, NUI scaffolding) |
native-functions |
Look up GTA5, RDR3, and CFX-platform native functions with parameter and return types |
fxmanifest |
Author and validate fxmanifest.lua (fx_version, games, dependencies, NUI files, exports) |
client-server-patterns |
Event routing, NetEvents vs Events, callback patterns, state synchronization |
framework-detection |
Detect ESX / QBCore / Qbox / ox_core / VORP / RSG / standalone from a workspace |
performance-optimization |
Threads, OneSync, native batching, NUI message rate, and resource memory budget |
nui-development |
NUI lifecycle, message routing, asset loading, callbacks, and Vite / Svelte integration |
database-integration |
oxmysql, ghmattimysql, MariaDB connection patterns, prepared statements, migration flow |
state-bags |
StateBag CRUD, replicated vs local, change handlers, and replacement of legacy SetX patterns |
| Rule | Scope | Description |
|---|---|---|
cfx-lua-conventions.mdc |
**/*.lua |
Flag CFX-specific Lua antipatterns (string concat in tight loops, missing local, deprecated natives) |
cfx-javascript-conventions.mdc |
**/*.js, **/*.ts |
Flag JS/TS antipatterns in CFX context (NUI message routing, async event handlers) |
cfx-csharp-conventions.mdc |
**/*.cs |
Flag C# patterns specific to FiveM (BaseScript, Tick handlers, async exports) |
fxmanifest-standards.mdc |
**/fxmanifest.lua |
Flag missing fx_version, games, 'cerulean' declarations and deprecated directives like lua54 'yes' |
security-best-practices.mdc |
Global | Flag hardcoded API keys, server-trust violations, unsafe NUI callbacks, missing input validation |
performance-rules.mdc |
CFX resource files | Flag thread blockers, unbounded loops, missing Wait() in CreateThread, expensive natives in tight loops |
The companion MCP server is Python-based (FastMCP). It exposes CFX-aware tools that read from local data files (mcp-server/data/) and the working tree.
| Tool | Description |
|---|---|
scaffold_resource_tool |
Generate a complete CFX resource (fxmanifest, client/server entries, optional NUI) from a name and framework selection |
lookup_native_tool |
Search GTA5, RDR3, and CFX-platform natives by name, hash, or namespace; returns parameters, return type, and usage notes |
generate_manifest_tool |
Author or update an fxmanifest.lua with required keys, dependencies, and NUI declarations |
search_events_tool |
Search the indexed CFX events database for canonical net-event and exports usage patterns |
detect_framework_tool |
Detect ESX / QBCore / Qbox / ox_core / VORP / RSG / standalone from a workspace path |
search_docs_tool |
Search the indexed docs.fivem.net snapshot for parameters, gotchas, and code samples |
macOS / Linux:
ln -s "$(pwd)" ~/.cursor/plugins/cfx-developer-toolsWindows (PowerShell as Admin):
New-Item -ItemType SymbolicLink -Path "$env:USERPROFILE\.cursor\plugins\cfx-developer-tools" -Target (Get-Location)cd mcp-server
pip install -r requirements.txt
python server.py# JSON schema and content-count checks (run by CI)
python .github/scripts/validate_plugin.py
# Native database refresh (manual; usually run by update-natives.yml)
python .github/scripts/transform_natives.pyReleases are automated. The release.yml workflow:
- Reads conventional commits since the last tag.
- Computes the next semver bump (PATCH for
fix:, MINOR forfeat:, MAJOR forBREAKING CHANGE). - Updates
plugin.jsonversionand the README version badge. - Creates the tag, the GitHub Release, and floating major / minor tags.
- Invokes
release-doc-syncto update**Version:**in this file and prepend a CHANGELOG entry. - Syncs the GitHub repo "About" section (description, homepage, topics) with live artifact counts.
Do not hand-edit plugin.json version, the README badge, or the **Version:** line above. The release pipeline owns them.
- No em dashes. Use regular dashes (
-) or rewrite the sentence. CI flags em and en dashes in markdown. - No hardcoded credentials. Use environment variables, server-side
convars, or secrets stores. CI flags suspicious patterns. - Skill frontmatter:
name(matching directory) anddescriptiononly. - Rule frontmatter:
description,alwaysApply, andglobs(when path-scoped). - Snippets: must compile or load cleanly inside a CFX resource (Lua / JS / C#), no placeholder credentials.
- Templates: every
fxmanifest.luamust declarefx_version,games, and'cerulean'. Avoidlua54 'yes'(deprecated; uselua54 true). - MCP tool naming: snake_case Python functions decorated with
@mcp.tool(), suffix_toolfor clarity in agent prompts.
| Resource | Use |
|---|---|
runtime.fivem.net/doc/natives.json |
GTA5 native database upstream |
runtime.fivem.net/doc/natives_rdr3.json |
RDR3 native database upstream |
docs.fivem.net |
Authoritative scripting reference, refreshed monthly via update-docs-index.yml |
mcp-server/data/natives_gta5.json |
Local GTA5 native lookup index |
mcp-server/data/natives_rdr3.json |
Local RDR3 native lookup index |
mcp-server/data/events.json |
Indexed canonical CFX event names and payloads |
mcp-server/data/docs_index.json |
Indexed docs.fivem.net snippets for offline search |
You have context-mode MCP tools available. These rules are NOT optional - they protect your context window from flooding. A single unrouted command can dump 56 KB into context and waste the entire session.
Any Bash command containing curl or wget is intercepted and replaced with an error message. Do NOT retry.
Instead use:
ctx_fetch_and_index(url, source)to fetch and index web pagesctx_execute(language: "javascript", code: "const r = await fetch(...)")to run HTTP calls in sandbox
Any Bash command containing fetch('http, requests.get(, requests.post(, http.get(, or http.request( is intercepted and replaced with an error message. Do NOT retry with Bash.
Instead use:
ctx_execute(language, code)to run HTTP calls in sandbox - only stdout enters context
WebFetch calls are denied entirely. The URL is extracted and you are told to use ctx_fetch_and_index instead.
Instead use:
ctx_fetch_and_index(url, source)thenctx_search(queries)to query the indexed content
Bash is ONLY for: git, mkdir, rm, mv, cd, ls, npm install, pip install, and other short-output commands.
For everything else, use:
ctx_batch_execute(commands, queries)- run multiple commands + search in ONE callctx_execute(language: "shell", code: "...")- run in sandbox, only stdout enters context
If you are reading a file to Edit it → Read is correct (Edit needs content in context).
If you are reading to analyze, explore, or summarize → use ctx_execute_file(path, language, code) instead. Only your printed summary enters context. The raw file content stays in the sandbox.
Grep results can flood context. Use ctx_execute(language: "shell", code: "grep ...") to run searches in sandbox. Only your printed summary enters context.
- GATHER:
ctx_batch_execute(commands, queries)- Primary tool. Runs all commands, auto-indexes output, returns search results. ONE call replaces 30+ individual calls. - FOLLOW-UP:
ctx_search(queries: ["q1", "q2", ...])- Query indexed content. Pass ALL questions as array in ONE call. - PROCESSING:
ctx_execute(language, code)|ctx_execute_file(path, language, code)- Sandbox execution. Only stdout enters context. - WEB:
ctx_fetch_and_index(url, source)thenctx_search(queries)- Fetch, chunk, index, query. Raw HTML never enters context. - INDEX:
ctx_index(content, source)- Store content in FTS5 knowledge base for later search.
When spawning subagents (Agent/Task tool), the routing block is automatically injected into their prompt. Bash-type subagents are upgraded to general-purpose so they have access to MCP tools. You do NOT need to manually instruct subagents about context-mode.
- Keep responses under 500 words.
- Write artifacts (code, configs, PRDs) to FILES - never return them as inline text. Return only: file path + 1-line description.
- When indexing content, use descriptive source labels so others can
ctx_search(source: "label")later.
| Command | Action |
|---|---|
ctx stats |
Call the ctx_stats MCP tool and display the full output verbatim |
ctx doctor |
Call the ctx_doctor MCP tool, run the returned shell command, display as checklist |
ctx upgrade |
Call the ctx_upgrade MCP tool, run the returned shell command, display as checklist |