Skip to content

Commit c5791a5

Browse files
TMHSDigitalclaude
andcommitted
feat: add txAdmin integration tools and skill
Add four MCP tools that drive a running txAdmin panel over HTTP: txadmin_server_control, txadmin_resource_control, txadmin_player_search, and txadmin_kick_player. A dependency-free client (urllib + cookiejar) authenticates via POST /auth/password, stores the session cookie, and echoes the csrfToken in the x-txadmin-csrftoken header. Credentials are read only from TXADMIN_URL / TXADMIN_USERNAME / TXADMIN_PASSWORD. Add the txadmin-integration skill and update README, CLAUDE.md, docs (index, getting-started, architecture), and ROADMAP counts and tables (10 skills, 10 MCP tools). Extend the CI py_compile list. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 3a90cf4 commit c5791a5

12 files changed

Lines changed: 576 additions & 23 deletions

File tree

.cursor-plugin/plugin.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@
2929
"skills/performance-optimization/SKILL.md",
3030
"skills/nui-development/SKILL.md",
3131
"skills/database-integration/SKILL.md",
32-
"skills/state-bags/SKILL.md"
32+
"skills/state-bags/SKILL.md",
33+
"skills/txadmin-integration/SKILL.md"
3334
],
3435
"rules": [
3536
"rules/cfx-lua-conventions.mdc",

.github/workflows/validate.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,3 +256,5 @@ jobs:
256256
python3 -m py_compile mcp-server/tools/event_search.py
257257
python3 -m py_compile mcp-server/tools/docs_search.py
258258
python3 -m py_compile mcp-server/tools/detect_framework.py
259+
python3 -m py_compile mcp-server/tools/txadmin_client.py
260+
python3 -m py_compile mcp-server/tools/txadmin.py

CLAUDE.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Project documentation for Claude Code and AI assistants working on this reposito
66

77
## Project Overview
88

9-
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.
9+
CFX Developer Tools is a Cursor IDE plugin for FiveM and RedM (CFX) resource development. It includes 10 skills, 6 rules, 24 code snippets, 11 starter templates, and a companion Python MCP server with 10 tools for resource scaffolding, native lookup, manifest generation, framework detection, live doc and event search, and txAdmin server control.
1010

1111
**Works with:** Cursor (plugin), Claude Code (terminal and in-editor), and any MCP-compatible client.
1212

@@ -40,7 +40,7 @@ CFX-Developer-Tools/
4040
workflows/ # CI / release / native-update / docs-index automation
4141
```
4242

43-
## Skills (9)
43+
## Skills (10)
4444

4545
| Skill | Description |
4646
|-------|-------------|
@@ -53,6 +53,7 @@ CFX-Developer-Tools/
5353
| `nui-development` | NUI lifecycle, message routing, asset loading, callbacks, and Vite / Svelte integration |
5454
| `database-integration` | oxmysql, ghmattimysql, MariaDB connection patterns, prepared statements, migration flow |
5555
| `state-bags` | StateBag CRUD, replicated vs local, change handlers, and replacement of legacy SetX patterns |
56+
| `txadmin-integration` | Control a running server, manage resources, search players, and kick players through the txAdmin API |
5657

5758
## Rules (6)
5859

@@ -65,9 +66,9 @@ CFX-Developer-Tools/
6566
| `security-best-practices.mdc` | Global | Flag hardcoded API keys, server-trust violations, unsafe NUI callbacks, missing input validation |
6667
| `performance-rules.mdc` | CFX resource files | Flag thread blockers, unbounded loops, missing `Wait()` in `CreateThread`, expensive natives in tight loops |
6768

68-
## MCP Server (6 tools)
69+
## MCP Server (10 tools)
6970

70-
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.
71+
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. The txAdmin tools additionally talk to a running txAdmin panel over HTTP, using credentials from the `TXADMIN_URL` / `TXADMIN_USERNAME` / `TXADMIN_PASSWORD` environment variables.
7172

7273
| Tool | Description |
7374
|------|-------------|
@@ -77,6 +78,10 @@ The companion MCP server is Python-based (FastMCP). It exposes CFX-aware tools t
7778
| `search_events_tool` | Search the indexed CFX events database for canonical net-event and exports usage patterns |
7879
| `detect_framework_tool` | Detect ESX / QBCore / Qbox / ox_core / VORP / RSG / standalone from a workspace path |
7980
| `search_docs_tool` | Search the indexed `docs.fivem.net` snapshot for parameters, gotchas, and code samples |
81+
| `txadmin_server_control_tool` | Start, stop, or restart the FXServer through a running txAdmin panel |
82+
| `txadmin_resource_control_tool` | Start, stop, restart, or ensure a single resource through txAdmin |
83+
| `txadmin_player_search_tool` | Search players known to the server by name, notes, or identifier through txAdmin |
84+
| `txadmin_kick_player_tool` | Kick an online player by netid through txAdmin |
8085

8186
## Development Workflow
8287

README.md

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@
2121
<a href="#features">Features</a> &bull;
2222
<a href="#quick-start">Quick Start</a> &bull;
2323
<a href="#mcp-server">MCP Server</a> &bull;
24-
<a href="#skills-9">Skills</a> &bull;
24+
<a href="#skills-10">Skills</a> &bull;
2525
<a href="#rules-6">Rules</a> &bull;
2626
<a href="#roadmap">Roadmap</a>
2727
</p>
2828

2929
---
3030

3131
<p align="center">
32-
9 skills &nbsp;&bull;&nbsp; 6 rules &nbsp;&bull;&nbsp; 6 MCP tools &nbsp;&bull;&nbsp; 12,000+ natives &nbsp;&bull;&nbsp; 101 events &nbsp;&bull;&nbsp; 24 snippets &nbsp;&bull;&nbsp; 11 templates
32+
10 skills &nbsp;&bull;&nbsp; 6 rules &nbsp;&bull;&nbsp; 10 MCP tools &nbsp;&bull;&nbsp; 12,000+ natives &nbsp;&bull;&nbsp; 101 events &nbsp;&bull;&nbsp; 24 snippets &nbsp;&bull;&nbsp; 11 templates
3333
</p>
3434

3535
Scaffold complete FiveM/RedM resources, look up native functions, generate manifests, detect frameworks, search documentation, and write optimized scripts in Lua, JavaScript, and C# -- all from within Cursor's AI chat. Covers the full CFX development lifecycle from project setup to database integration.
@@ -46,7 +46,7 @@ Scaffold complete FiveM/RedM resources, look up native functions, generate manif
4646
flowchart LR
4747
A["You ask Cursor\na CFX question"] --> B["Cursor loads\na Skill"]
4848
B --> C{"MCP server\navailable?"}
49-
C -- Yes --> D["CFX MCP Server\n(6 tools)"]
49+
C -- Yes --> D["CFX MCP Server\n(10 tools)"]
5050
C -- No --> E["Skill guidance\nonly"]
5151
D --> F["Scaffold, lookup,\ngenerate, search,\ndetect, docs"]
5252
E --> G["AI-assisted answer\nin Cursor chat"]
@@ -124,7 +124,7 @@ Then ask the AI agent to scaffold a resource, look up a native, or generate a ma
124124

125125
</details>
126126

127-
## Skills (9)
127+
## Skills (10)
128128

129129
| Skill | What it does |
130130
|:------|:-------------|
@@ -137,6 +137,7 @@ Then ask the AI agent to scaffold a resource, look up a native, or generate a ma
137137
| **NUI Development** | Build in-game web UIs with proper message passing and devtools setup |
138138
| **Database Integration** | oxmysql queries, schema design, migrations, and connection pooling |
139139
| **State Bags** | Modern data sync with Entity/Player/Global state bags, change handlers, and security |
140+
| **txAdmin Integration** | Control a running server, manage resources, search players, and kick players through the txAdmin API |
140141

141142
## Rules (6)
142143

@@ -235,7 +236,7 @@ pip install -r requirements.txt
235236
The server starts automatically when Cursor invokes an MCP tool.
236237

237238
<details>
238-
<summary><strong>Available Tools (6)</strong></summary>
239+
<summary><strong>Available Tools (10)</strong></summary>
239240

240241
&nbsp;
241242

@@ -247,6 +248,10 @@ The server starts automatically when Cursor invokes an MCP tool.
247248
| `search_events_tool` | Search 101 events by name, side, game, or framework (cfx, esx, qbcore, qbox, oxcore, vorp, rsg, baseevents, chat) |
248249
| `detect_framework_tool` | Scan workspace files to detect ESX, QBCore, Qbox, ox_core, VORP, RSG, or standalone with confidence score |
249250
| `search_docs_tool` | Search the FiveM/RedM documentation index by keyword or section |
251+
| `txadmin_server_control_tool` | Start, stop, or restart the FXServer through txAdmin (requires txAdmin credentials) |
252+
| `txadmin_resource_control_tool` | Start, stop, restart, or ensure a single resource through txAdmin |
253+
| `txadmin_player_search_tool` | Search players by name, notes, or identifier through txAdmin |
254+
| `txadmin_kick_player_tool` | Kick an online player by netid through txAdmin |
250255

251256
</details>
252257

@@ -293,11 +298,11 @@ What framework does this resource use?
293298
CFX-Developer-Tools/
294299
.cursor-plugin/ Plugin manifest
295300
.cursor/ MCP server configuration
296-
skills/ AI skill files (9 skills)
301+
skills/ AI skill files (10 skills)
297302
rules/ Coding convention rules (6 rules)
298303
snippets/ Code snippets -- Lua, JS, C# (24 files)
299304
templates/ Resource starter templates (11 sets)
300-
mcp-server/ Python MCP server (6 tools) and data files
305+
mcp-server/ Python MCP server (10 tools) and data files
301306
docs/ Architecture, roadmap, contributing guide, docs site landing page
302307
assets/ Logo and images
303308
.github/ CI/CD workflows (validate, release, update-natives, update-docs-index, stale, deploy-docs)

docs/ARCHITECTURE.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,12 @@ Cursor AI Agent --(MCP protocol)--> MCP Server --(reads)--> Data Files
6666
| `search_events_tool` | Searches 101 events by name, side, game, or framework |
6767
| `detect_framework_tool` | Scans workspace files to detect ESX, QBCore, Qbox, ox_core, VORP, RSG, or standalone |
6868
| `search_docs_tool` | Searches the FiveM/RedM documentation index by keyword or section |
69+
| `txadmin_server_control_tool` | Starts, stops, or restarts the FXServer through a running txAdmin panel |
70+
| `txadmin_resource_control_tool` | Starts, stops, restarts, or ensures a single resource through txAdmin |
71+
| `txadmin_player_search_tool` | Searches players by name, notes, or identifier through txAdmin |
72+
| `txadmin_kick_player_tool` | Kicks an online player by netid through txAdmin |
73+
74+
The four txAdmin tools talk to a running txAdmin panel over HTTP, authenticating with credentials from the `TXADMIN_URL` / `TXADMIN_USERNAME` / `TXADMIN_PASSWORD` environment variables.
6975

7076
### Data files
7177

docs/GETTING-STARTED.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ This guide takes you from zero to building FiveM/RedM resources with AI assistan
2626
- Generate a correct `fxmanifest.lua` with all the right directives
2727
- Write code that follows FiveM/RedM best practices automatically
2828

29-
The plugin includes **9 skills**, **6 rules**, **24 code snippets**, **11 starter templates**, and **6 MCP tools** (including a searchable database of 12,000+ native functions, 101 events, and documentation search).
29+
The plugin includes **10 skills**, **6 rules**, **24 code snippets**, **11 starter templates**, and **10 MCP tools** (including a searchable database of 12,000+ native functions, 101 events, documentation search, and txAdmin server control).
3030

3131
<details>
3232
<summary><strong>What is Cursor?</strong></summary>
@@ -203,7 +203,7 @@ You may see a prompt asking you to **trust the workspace**. Click **Yes, I trust
203203
When you open the folder, Cursor:
204204

205205
- Reads `.cursor-plugin/plugin.json` and registers the plugin
206-
- Makes the 9 skills available to the AI assistant
206+
- Makes the 10 skills available to the AI assistant
207207
- Activates the 6 coding rules based on file types you open
208208
- Loads the MCP server configuration from `.cursor/mcp.json`
209209

docs/ROADMAP.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -129,12 +129,12 @@ Connect the plugin to live FiveM/RedM server infrastructure for real-time develo
129129

130130
txAdmin exposes a REST API on port 40120 (default) with session cookie authentication.
131131

132-
- [ ] Add MCP tool: `txadmin_server_control` (start, stop, restart FXServer)
133-
- [ ] Add MCP tool: `txadmin_resource_control` (start, stop, restart, refresh individual resources)
134-
- [ ] Add MCP tool: `txadmin_player_search` (search connected players by name or identifier)
135-
- [ ] Add MCP tool: `txadmin_kick_player` (kick with reason)
136-
- [ ] Add connection configuration (host, port, session token via environment variable)
137-
- [ ] Add skill for txAdmin setup and authentication
132+
- [x] Add MCP tool: `txadmin_server_control` (start, stop, restart FXServer)
133+
- [x] Add MCP tool: `txadmin_resource_control` (start, stop, restart, ensure individual resources)
134+
- [x] Add MCP tool: `txadmin_player_search` (search players by name, notes, or identifier)
135+
- [x] Add MCP tool: `txadmin_kick_player` (kick with reason)
136+
- [x] Add connection configuration (URL, username, password via environment variables)
137+
- [x] Add skill for txAdmin setup and authentication
138138

139139
### RCON and server commands
140140

docs/index.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
**AI-powered development toolkit for FiveM and RedM resource development in Cursor IDE.**
44

5-
9 skills -- 6 rules -- 6 MCP tools -- 12,000+ natives -- 101 events -- 24 snippets -- 11 templates
5+
10 skills -- 6 rules -- 10 MCP tools -- 12,000+ natives -- 101 events -- 24 snippets -- 11 templates
66

77
---
88

@@ -15,6 +15,7 @@ CFX Developer Tools is a plugin for [Cursor](https://www.cursor.com/) that teach
1515
- Generate a correct `fxmanifest.lua` with all the right directives
1616
- Detect which framework your project uses (ESX, QBCore, Qbox, ox_core, VORP, RSG)
1717
- Search the FiveM/RedM documentation index
18+
- Control a running server through txAdmin (start/stop/restart, manage resources, search and kick players)
1819
- Write code that follows FiveM/RedM best practices automatically
1920

2021
## Quick start
@@ -35,6 +36,7 @@ For a detailed walkthrough, see the [Getting Started guide](GETTING-STARTED.md).
3536
- **Native function lookup** -- Search 12,000+ GTA5/RDR3 native functions by name, hash, or description
3637
- **Event reference** -- Searchable database of 101 events across CFX, ESX, QBCore, Qbox, ox_core, VORP, and RSG
3738
- **Documentation search** -- Query the FiveM/RedM docs index by keyword or section
39+
- **txAdmin integration** -- Control the FXServer, manage resources, and search or kick players through a running txAdmin panel
3840
- **Performance-aware coding rules** -- Catch common mistakes like `Wait(0)` in loops, runtime hashing, and more
3941
- **Snippet library** -- 24 copy-paste-ready code patterns across Lua, JavaScript, and C#
4042
- **NUI development** -- Skills and templates for building in-game web UIs with React or Svelte 5
@@ -58,9 +60,9 @@ For a detailed walkthrough, see the [Getting Started guide](GETTING-STARTED.md).
5860
flowchart LR
5961
A["You ask Cursor\na CFX question"] --> B["Cursor loads\na Skill"]
6062
B --> C{"MCP server\navailable?"}
61-
C -- Yes --> D["CFX MCP Server\n(6 tools)"]
63+
C -- Yes --> D["CFX MCP Server\n(10 tools)"]
6264
C -- No --> E["Skill guidance\nonly"]
63-
D --> F["Scaffold, lookup,\ngenerate, search,\ndetect, docs"]
65+
D --> F["Scaffold, lookup,\ngenerate, search,\ndetect, docs, txAdmin"]
6466
E --> G["AI-assisted answer\nin Cursor chat"]
6567
F --> G
6668
```

mcp-server/server.py

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@
1616
from tools.event_search import search_events
1717
from tools.docs_search import search_docs
1818
from tools.detect_framework import detect_framework
19+
from tools.txadmin import (
20+
txadmin_server_control,
21+
txadmin_resource_control,
22+
txadmin_player_search,
23+
txadmin_kick_player,
24+
)
1925

2026
mcp = FastMCP("cfx-dev-tools")
2127

@@ -130,5 +136,69 @@ def search_docs_tool(
130136
return search_docs(query, section, NATIVES_PATH)
131137

132138

139+
@mcp.tool()
140+
def txadmin_server_control_tool(action: str) -> str:
141+
"""Start, stop, or restart the FXServer through txAdmin.
142+
143+
Requires the TXADMIN_USERNAME, TXADMIN_PASSWORD, and optionally TXADMIN_URL
144+
environment variables to be set. See the txadmin-integration skill.
145+
146+
Args:
147+
action: One of start, stop, or restart.
148+
"""
149+
return txadmin_server_control(action)
150+
151+
152+
@mcp.tool()
153+
def txadmin_resource_control_tool(action: str, resource: str) -> str:
154+
"""Start, stop, restart, or ensure a single server resource through txAdmin.
155+
156+
Requires txAdmin credentials in the environment (see txadmin-integration skill).
157+
158+
Args:
159+
action: One of start, stop, restart, or ensure.
160+
resource: The resource name (folder name) to act on.
161+
"""
162+
return txadmin_resource_control(action, resource)
163+
164+
165+
@mcp.tool()
166+
def txadmin_player_search_tool(
167+
search_value: str = "",
168+
search_type: str = "playerName",
169+
filters: str | None = None,
170+
limit: int = 25,
171+
) -> str:
172+
"""Search players known to the server by name, notes, or identifier.
173+
174+
Requires txAdmin credentials in the environment (see txadmin-integration skill).
175+
176+
Args:
177+
search_value: Text to search for.
178+
search_type: Search mode - playerName, playerNotes, or playerIds.
179+
filters: Comma-separated filters - isAdmin, isOnline, isWhitelisted, hasNote (optional).
180+
limit: Maximum number of players to display (server caps at 100).
181+
"""
182+
return txadmin_player_search(search_value, search_type, filters, limit)
183+
184+
185+
@mcp.tool()
186+
def txadmin_kick_player_tool(
187+
netid: int,
188+
reason: str = "",
189+
mutex: str = "current",
190+
) -> str:
191+
"""Kick an online player by their server network id (netid) through txAdmin.
192+
193+
Requires txAdmin credentials in the environment (see txadmin-integration skill).
194+
195+
Args:
196+
netid: The player's server id (netid) from the player list.
197+
reason: Optional kick reason shown to the player.
198+
mutex: Server instance mutex; 'current' (default) targets the running server.
199+
"""
200+
return txadmin_kick_player(netid, reason, mutex)
201+
202+
133203
if __name__ == "__main__":
134204
mcp.run()

0 commit comments

Comments
 (0)