mcp-garry-codes
This server provides a suite of read-only analysis, search, scaffolding, testing, and packaging tools for Garry's Mod (GLua) development.
Search official GMod documentation by keyword or exact symbol, filtered by realm and category.
Search community sources like GitHub, Facepunch, Reddit, and Steam for GLua solutions and undocumented quirks.
Lint GLua code statically for syntax errors, realm mismatches, and global pollution.
Audit network security to detect unauthenticated net receivers, SQL injection, and missing network strings.
Analyze performance to catch Zero-GC hot-path traps like allocations in render hooks.
Scaffold common GMod components such as SWEPs, SENTs, nextbots, STOOLs, VGUI panels, HUDs, effects, DarkRP modules, and gamemodes.
Run headless GLua unit tests using a mock Source Engine runtime with Vector/Angle/net/hook simulation.
Package and validate addons against Steam Workshop/GMA rules, with optional .gma compilation.
Provides access to the Facepunch Garry's Mod Wiki and developer archives, enabling search and retrieval of GLua functions, hooks, libraries, and official examples for addon development.
Searches GitHub for GLua repositories and code examples, along with Facepunch archives and developer discussions, to find community patterns and solutions.
Enables validation and packaging of Garry's Mod addons against Steam Workshop rules, including addon.json schema verification and GMA compilation.
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., "@mcp-garry-codes audit my addon for net security vulnerabilities"
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.
mcp-garry-codes β The Principal Garry's Mod Protocol Server
mcp-garry-codesis a specialized, production-grade Model Context Protocol (MCP) server engineered specifically for the Garry's Mod (GLua) ecosystem. It bridges AI coding agents with deep Source Engine awareness, static verification, net-security vulnerability auditing, zero-GC performance profiling, and headless testing.
Created & Maintained by: M A R W A N
β‘ The Garry's Mod Engineering Dilemma
Garry's Mod development represents a notoriously hostile coding environment:
Three Rigid Execution Realms (
SERVER,CLIENT, andMENU) with strict serialization and transmission rules.Micro-Allocation Garbage Collection Traps inside high-frequency rendering and simulation hooks (
RenderScreenspaceEffects,HUDPaint,Think,Move) triggering severe client FPS drops.Pervasive Network Vulnerabilities stemming from unvalidated client-authoritative net messages, rate-limit exploitation, SQL injections, and command execution backdoors.
Source Engine VGUI & Prediction Peculiarities where standard desktop GUI mental models fail.
mcp-garry-codes equips LLMs and autonomous coding assistants with the deep domain knowledge and verification tools necessary to produce bulletproof GLua code.
Related MCP server: LLMMO Game Server
π οΈ Tool Suite (9 Core Tools)
Tool Name | Realm Mode | Primary Function | Side Effects |
| Read-only | Query Facepunch Garry's Mod Wiki and indexed documentation filtered by realm and category. | Cached disk/memory |
| Read-only | Retrieve exact parameter signatures, return values, caveats, and official examples. | Cached |
| Read-only | Targeted search across GitHub GLua repositories, Facepunch archives, and developer discussions. | HTTPS query |
| Read-only / Pure | Static analysis parsing GMod C-style syntax ( | |
| Read-only / Audit | Scan addon message graphs for unauthenticated receivers, SQL injections, and missing | None |
| Read-only / Audit | Profile GLua code for Zero-GC hot-path violations (allocations in | None |
| Creation | Scaffold idiomatic SWEPs, SENTs, NextBots, STOOLs, VGUI panels, HUDs, Effects, DarkRP modules, or gamemodes. | File creation (Workspace only) |
| Execution / Sandbox | Run headless GLua unit tests using the embedded Source Engine mock runtime via LuaJIT / Python. | Sandboxed subprocess |
| Verification / Build | Validate | Optional |
π¦ Addressable MCP Resources
Connect to rich contextual resources using standard MCP URIs:
gmod://wiki/hooksβ Authoritative list of Garry's Mod hooks across all realms.gmod://wiki/librariesβ Core functions and libraries available in GLua.gmod://realms/matrixβ Execution realm boundaries, powers, and restrictions.gmod://schemas/addon_jsonβ Steam Workshopaddon.jsonschema specification.
π§ Guided Workflow Prompts
audit_addonβ Comprehensive security and performance review of an addon folder.fix_net_exploitβ Guided repair workflow for net message vulnerabilities and authorization checks.scaffold_swepβ Interactive creation of a predicted, zero-latency weapon.build_derma_menuβ Responsive, DPI-scaled VGUI Derma interface builder.scaffold_nextbotβ Autonomous NextBot AI entity with navigation coroutines.scaffold_toolgun_stoolβ Production Toolgun STOOL with CPanel convars, left/right clicks, and language strings.scaffold_darkrp_moduleβ Modular DarkRP package with custom jobs, shipments, categories, and hooks.scaffold_effectβ Custom 3D particle and billboard render effect.optimize_zero_gcβ Profile and optimize rendering hooks for zero garbage-collection stutter.
π Quick Start & Installation
Option 1: Run instantly with npx (Recommended)
npx -y mcp-garry-codesOption 2: Global installation via npm
npm install -g mcp-garry-codes
mcp-garry-codesπ» Client Configuration
1. Antigravity IDE & Cursor (mcp_config.json)
Add the server definition to your mcp_config.json:
{
"mcpServers": {
"mcp-garry-codes": {
"command": "npx",
"args": ["-y", "mcp-garry-codes"],
"env": {
"WORKSPACE_ROOT": "${workspaceFolder}",
"PYTHON_PATH": "python"
}
}
}
}2. Claude Desktop (claude_desktop_config.json)
{
"mcpServers": {
"garrys-mod": {
"command": "npx",
"args": ["-y", "mcp-garry-codes"]
}
}
}π‘οΈ Security Architecture & Threat Model
Workspace Path Jail: All file queries, linter checks, and scaffolding operations are verified with
PathGuardand strictly quarantined within the user's configured workspace.Subprocess Isolation: External processes (
python,glualint,luajit) execute viachild_process.execFilewith explicit argument arraysβno shell interpolation (shell: false) and strict execution timeouts (5,000ms default).Automated Credential Redaction: Result envelopes pass through sanitization regexes that scrub Steam API keys, MySQL connection strings, and RCON passwords.
Net Message Auditing: Receivers executing mutations without checking
ply:IsAdmin()or access privileges are flagged as critical vulnerabilities.
π§ͺ Headless GLua Simulation Engine
mcp-garry-codes includes an embedded Source Engine mock runtime (src/test_harness/lua/glua_mock.lua) and Python test orchestrator (src/test_harness/python/gmod_tester.py). It enables running headless unit tests without launching the Garry's Mod 32-bit or 64-bit client executable:
Full 3D
VectorandAnglemetatables (Distance,Dot,Cross,Length2D,RotateAroundAxis).Mock
EntityandPlayerobjects with health, inventory, and trace methods.In-memory FIFO bitstream queue verifying
net.Write*andnet.Read*alignment.Event bus verifying
hook.Addandhook.Run.
π License
This project is licensed under the MIT License.
Author: M A R W A N
Available Tools
9 toolsanalyze_performanceAnalyze GLua Hot-Path PerformanceARead-onlyIdempotent
Profile Garry's Mod Lua code via static AST inspection to detect runtime performance traps, Zero-GC violations, and LuaJIT garbage collector bottlenecks. Purely analytical static inspection; does NOT execute code, does NOT evaluate scripts in a VM, and does NOT modify files on disk. Operates under zero-side-effect guarantees. Provide either file_path (workspace path) or code_content (raw snippet); when both are supplied, file_path takes precedence. Automatically inspects high-frequency rendering and simulation hooks (HUDPaint, RenderScreenspaceEffects, Think, Move). Use this tool to prevent client FPS stutter and server tickrate drops by flagging table allocations (Color(), Vector(), Angle()), unlocalized global lookups, and dynamic font creation inside per-frame hooks. Do NOT use for syntax or realm correctness checks (use lint_glua instead), network message exploit detection (use audit_net_security instead), or functional assertion testing (use run_glua_test instead). Returns a GModToolResult envelope with status ('success' or 'failed'), summary, and data containing performance_score (0-100), issues array (hook_name, line, severity, category, description, recommended_code), and allocation metrics (allocations_in_hot_path, global_calls_in_hot_path, dynamic_draw_calls).
Inputs: file_path, code_content. Returns: data, status, summary, evidence, +2 more
audit_net_securityAudit Network Message SecurityARead-onlyIdempotent
Perform static AST security auditing across an addon's network messaging architecture (Garry's Mod net library) to identify exploitable receivers, SQL injection vectors, and missing network string registrations. Purely static AST analysis requiring no authentication, no network transmission, and zero file modifications. Scans code without executing it. Specify addon_dir (root directory of the addon; defaults to workspace root if omitted). Optionally provide file_paths array to restrict scanning to specific Lua files within that addon. Use this tool before releasing or deploying multiplayer Garry's Mod addons to detect unauthenticated net.Receive handlers (missing ply:IsAdmin or permission checks), client-authoritative SQL queries, and unregistered net strings that crash network channels. Do NOT use for general syntax validation (use lint_glua instead) or rendering performance profiling (use analyze_performance instead). Returns a GModToolResult envelope with status ('success' or 'failed'), summary, and data containing addon_dir, messages_found, registered_strings, network_graph (transmitters and receivers), and categorized vulnerabilities array (severity, type, message_name, file, line, description, recommended_fix, vulnerable_code).
Inputs: addon_dir, file_paths. Returns: data, status, summary, evidence, +2 more
get_gmod_symbolGet Exact GMod Symbol DocumentationARead-onlyIdempotent
Retrieve authoritative, complete API documentation for a specific, known Garry's Mod symbol (function, hook, library method, panel, or class) from the Facepunch Wiki index. Read-only lookup operation with zero side effects, no authentication required, and instant indexed retrieval; does NOT modify the workspace. If the symbol is not found in the index, returns status 'failed' with data null and provides actionable search alternatives in nextActions. Requires an exact, case-sensitive or standard symbol identifier (e.g. 'net.Receive', 'surface.DrawPoly', 'GM:PlayerInitialSpawn', 'Entity:TakeDamage'). Set include_examples to false (defaults to true) to exclude code examples and reduce token consumption. Use this tool when you know the exact symbol name and require complete parameter specifications, return types, engine caveats, realm affinity, or code examples. Do NOT use for keyword or topic searches (use search_gmod_wiki instead). Do NOT use for third-party addon code or community forum workarounds (use web_search_glua instead). Returns a GModToolResult envelope with status ('success' or 'failed'), summary, and data containing symbol, realm, description, arguments array (name, type, optional, default, description), returns array, examples array, notes, warnings, and canonical wiki_url.
Inputs: symbol (required), include_examples. Returns: data, status, summary, evidence, +2 more
lint_gluaLint GLua Static CodeARead-onlyIdempotent
Perform deep static analysis and AST validation on Garry's Mod Lua (GLua) source code to detect syntax errors, realm boundary violations (server/client/menu mismatches), global namespace pollution, and missing AddCSLuaFile calls. Purely read-only static analysis requiring zero credentials or network access. Does NOT execute code and does NOT modify files on disk; when fix_formatting is true, the formatted code is returned strictly inside the result envelope without overwriting the source file. Provide either file_path (workspace-relative or absolute) or code_content (raw Lua snippet); when both are supplied, file_path takes precedence. If target_realm is 'auto', automatically detects the execution realm from file path prefixes (sv_, cl_, sh_) or defaults to 'shared'. Use this tool before committing code or running tests to ensure syntax and realm hygiene. Do NOT use for runtime performance profiling (use analyze_performance instead to detect GC allocations in render hooks), network vulnerability scanning (use audit_net_security instead), or functional test execution (use run_glua_test instead). Returns a GModToolResult envelope containing status ('success' or 'failed'), summary, data with valid (boolean), error_count, warning_count, realm_detected, diagnostics list (line, column, severity, rule code, message, suggestion), and optional formatted_code.
Inputs: file_path, code_content, target_realm, fix_formatting. Returns: data, status, summary, evidence, +2 more
package_and_validatePackage and Validate GMA AddonAIdempotent
Verify a Garry's Mod addon directory against official Steam Workshop and GMA packaging rules (addon.json validation, file extension whitelist, path casing), with optional .gma archive compilation. Read-only validation by default; does NOT mutate files. If build_gma is true AND validation passes with zero illegal files, compiles a .gma binary package using the external gmad executable (requires GMAD_PATH environment variable) to output_gma_path (defaults to '<addon_dir>/out.gma'). addon_dir specifies the root directory of the addon (defaults to workspace root). Set build_gma to true (default false) to trigger .gma compilation. Optional output_gma_path sets the target .gma binary path. Use this tool as the final verification gate before uploading addons to the Steam Workshop or deploying to a dedicated server. Checks addon.json structure, flags non-whitelisted files (e.g. .psd, .git, .exe), and warns on uppercase characters that cause 404s on Linux servers. Use scaffold_gmod_component to bootstrap addon structures, and lint_glua/audit_net_security to audit code quality prior to packaging. Returns a GModToolResult envelope with status ('success' or 'failed'), summary, and data containing valid (boolean), addon_json_valid (boolean), total_files, total_size_bytes, illegal_files array (path, rejection reason), warnings array (casing and metadata warnings), and optional gma_path.
Inputs: addon_dir, build_gma, output_gma_path. Returns: data, status, summary, evidence, +2 more
run_glua_testRun Headless GLua Unit TestsARead-onlyIdempotent
Execute headless Garry's Mod unit tests and assertions using the embedded Source Engine mock runtime (Python/Lua test harness) without requiring the Garry's Mod game client. Sandboxed headless subprocess execution with a default 5000ms timeout (configurable via timeout_ms up to 30000ms). Safe and non-destructive; does NOT modify source files on disk. Surfaces assertion failures and runtime exceptions with exact line numbers and stack traces. Provide either test_file_path (workspace path to a test script) or code_to_test (inline GLua test string with assertions); when both are provided, test_file_path takes precedence. Configure mock_realm ('client', 'server', 'shared', default 'shared') to set SERVER and CLIENT boolean constants and simulate realm-specific global libraries. Use this tool to execute automated test suites, verify mathematical computations, test hook callbacks, and validate net message serialization logic. Do NOT use for static analysis without execution (use lint_glua instead) or Zero-GC allocation profiling (use analyze_performance instead). Returns a GModToolResult envelope with status ('success' when all assertions pass, 'failed' on assertion or execution error), summary, and data containing passed (boolean), tests_run count, failures count, errors array (test_name, error_message, stack_trace), output_log (raw stdout/stderr), and execution_time_ms.
Inputs: mock_realm, timeout_ms, code_to_test, test_file_path. Returns: data, status, summary, evidence, +2 more
scaffold_gmod_componentScaffold Garry's Mod ComponentAIdempotent
Generate production-grade, realm-separated Garry's Mod boilerplate code for 10 standard component architectures: SWEP (weapons), SENT (scripted entities), nextbot (NextBot AI with pathfinding coroutines), custom_tool (toolgun STOOLs with CPanel), vgui_panel (Derma UI), hud (Zero-GC HUDPaint overlays), gamemode (GM framework), effect (dynamic particle render effects), darkrp_module (DarkRP jobs, shipments, categories), and addon_skeleton (standard directory layout with addon.json). Dual operational mode: when output_dir is omitted (default), operates as a zero-side-effect preview returning a virtual code_manifest without touching the disk; when output_dir is provided, writes files directly to disk relative to workspace, creating directories and overwriting existing files at target paths. Implements idiomatic realm separation (e.g. server init.lua, client cl_init.lua with AddCSLuaFile headers, shared.lua). Requires component_type (enum: 'swep', 'sent', 'nextbot', 'custom_tool', 'vgui_panel', 'hud', 'gamemode', 'effect', 'darkrp_module', 'addon_skeleton') and alphanumeric identifier name (e.g. 'weapon_plasma_rifle', 'nb_stalker', 'tool_remover'). Optional output_dir designates target folder on disk. Optional options object configures category, base class, author, printable_name, and vgui_type ('frame', 'button', 'scroll', 'custom'). Use this tool when bootstrapping new Garry's Mod addons, weapons, entities, AI nextbots, STOOLs, or UI panels with idiomatic architecture and prediction support. Do NOT use for editing existing code or linting (use lint_glua). After scaffolding, use package_and_validate to verify Steam Workshop packaging compliance. Returns a GModToolResult envelope with status ('success' or 'failed'), summary, and data containing component_type, files_created array (path, purpose), and code_manifest mapping relative file paths to generated Lua source code strings.
Inputs: name (required), component_type (required), options, output_dir. Returns: data, status, summary, evidence, +2 more
search_gmod_wikiSearch Official Garry's Mod WikiARead-onlyIdempotent
Query the official Facepunch Garry's Mod Wiki and indexed API reference by keyword or conceptual topic across functions, hooks, libraries, panels, and enums. Read-only operation with zero side effects, no authentication required, and cached offline-first execution with live documentation fallback; does NOT modify the workspace. Requires a query string. Optionally filter by category ('functions', 'hooks', 'libraries', 'panels', 'enums', 'all', default 'all'), realm ('server', 'client', 'shared', 'menu', 'all', default 'all'), and max_results (1 to 20, default 5). Use this tool for broad discovery, conceptual exploration, or finding candidate APIs when the exact symbol name is unknown. Do NOT use if you already know the exact function or hook identifier (use get_gmod_symbol instead for complete signatures, argument specifications, caveats, and official examples). Do NOT use for third-party libraries, community forum solutions, or undocumented engine quirks (use web_search_glua instead). Returns a GModToolResult envelope with status ('success' or 'failed'), summary, and data containing query, category, realm, total_matches, and an array of matching results (title, canonical wiki_url, realm, summary, signature, category).
Inputs: query (required), realm, category, max_results. Returns: data, status, summary, evidence, +2 more
web_search_gluaSearch GLua Community & GitHubARead-onlyIdempotent
Search external Garry's Mod developer communities, GitHub repositories, Facepunch archives, Reddit, and Steam Community forums for community-developed solutions, workarounds, and undocumented engine behaviors. Read-only external web search with open-world egress; requires no credentials and produces zero local file mutations or state modifications. Requires a query string. Optionally filter target domains with domain_filter ('github', 'facepunch', 'reddit', 'steam', 'all', default 'all') and limit results with max_results (1 to 10, default 5). Use this tool for troubleshooting obscure runtime bugs, researching community conventions, finding GitHub code implementations, or resolving undocumented engine quirks where official documentation is silent. Do NOT use for official Garry's Mod API reference, hook signatures, or standard library documentation (use get_gmod_symbol for exact lookups or search_gmod_wiki for topic searches). Returns a GModToolResult envelope with status ('success' or 'failed'), summary, and data containing query and results array (title, destination url, snippet, source platform).
Inputs: query (required), max_results, domain_filter. Returns: data, status, summary, evidence, +2 more
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogβ¦
TDQS
Scored across 9 tools
Each tool has a clearly distinct primary purpose, and cross-references between similar tools (get vs search, lint vs audit vs analyze) are explicit. However, the three static analyzers (lint_glua, audit_net_security, analyze_performance) all operate on code and return diagnostic-like results, which could lead to misselection if an agent requests a generic 'check my code' without specifying the concern.
All tool names are lowercase snake_case and start with a verb (get, web_search, lint, search, audit, analyze, scaffold, run, package), creating a generally consistent pattern. Minor deviations exist: web_search_glua and search_gmod_wiki both express search but with different word order and prefixes, and the glua suffix is inconsistently placed (web_search_glua, lint_glua, run_glua_test).
Nine tools is well within the ideal 3-15 range and maps neatly to a GMod addon development workflow: documentation lookup, community search, three distinct code quality checks, scaffolding, testing, and packaging. Each tool earns its place with a specific function, and none feel redundant or padding.
The tool set covers the full addon development lifecycle: discover APIs (get, search), research community solutions (web search), write/analyze code (scaffold, lint, audit, analyze), test (run_glua_test), and package (package_and_validate). There are no dead ends or obvious missing operations for the stated domain of Garry's Mod addon development.
Maintenance
Related MCP Connectors
Code intelligence for coding agents: semantic, AST, graph, and full-text search. 279+ languages.
Code intelligence platform for AI agents. 20 tools for architecture, security & impact analysis.
Code intelligence for LLMs. Analyze, search, and retrieve code from any public git repository.
Checks AI-written code for leaked keys and made-up packages, on your machine. Never uploads code.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to interact with Godot game projects through real-time error detection, automated testing, code analysis, and safe git-based patching. Provides comprehensive project context and development workflow automation for Godot developers.MIT
- AlicenseNot gradedqualityDmaintenanceEnables LLM-driven text game state management by exposing MCP tools for managing players, locations, items, entities, and abstract concepts.MIT
- AlicenseCqualityCmaintenanceEnables AI agents to interact with the Godot game engine, including project inspection, scene/script parsing, headless exports, runtime control with live scene-tree inspection and evaluation, and API documentation search.100807 npm5MIT
- AlicenseAqualityDmaintenanceA local-first MCP server for AI-assisted Garry's Mod addon development.3828 npm4MIT