How miscusi-peek/cheatengine-mcp-bridge works
Purpose and Entry Points
This repository exposes Cheat Engine’s process-memory, debugging, reverse-engineering, and automation capabilities as an MCP server for AI clients. The primary launch point is MCP_Server/mcp_cheatengine.py; it serves MCP JSON-RPC over stdio. Cheat Engine loads MCP_Server/ce_mcp_bridge.lua, which executes privileged CE APIs against the attached target process.
MCP Tool Server
MCP_Server/mcp_cheatengine.py defines the FastMCP server and its large tool surface: process lifecycle, memory reads/writes/scans, pointer resolution, disassembly, debugging, injection, symbols, GUI/input, and DBVM/DBK operations. Tool handlers convert MCP arguments into bridge commands, enforce per-call timeout behavior, and return structured results to the AI client.
Core paths:
• MCP_Server/mcp_cheatengine.py
• MCP_Server/requirements.txt
• AI_Context/MCP_Bridge_Command_Reference.md
Cheat Engine Execution Bridge
MCP_Server/ce_mcp_bridge.lua is the authoritative execution layer inside Cheat Engine. It hosts the bridge pipe endpoint, receives serialized requests, dispatches command handlers to CE Lua APIs, and returns responses. Its worker/main-thread coordination is architecturally important: blocking transport work stays off CE’s GUI/API execution context, while CE interactions execute in the appropriate main-thread context.
Core paths:
• MCP_Server/ce_mcp_bridge.lua
• AI_Context/CE_LUA_Documentation.md
• AI_Context/MCP_Bridge_Command_Reference.md
Native Windows Transport
The default control path is: AI MCP client → stdio → Python MCP server → Windows named pipe → Lua bridge → Cheat Engine → target executable. The named pipe is Windows-specific and requires pywin32; Cheat Engine and DBVM are material runtime dependencies for advanced debugging and kernel/hypervisor-backed functionality.
Core paths:
• MCP_Server/mcp_cheatengine.py
• MCP_Server/ce_mcp_bridge.lua
• MCP_Server/requirements.txt
TCP Relay Boundary
MCP_Server/ce_tcp_relay.py decouples the MCP server from the Windows host that owns Cheat Engine. It bridges TCP connections to the local CE named pipe, allowing the Python MCP process to run under WSL, Linux, containers, VMs, or remote hosts. Transport selection and relay address are controlled through CE_MCP_TRANSPORT, CE_MCP_HOST, and CE_MCP_PORT.
Core paths:
• MCP_Server/ce_tcp_relay.py
• MCP_Server/mcp_cheatengine.py
• MCP_Server/requirements-tcp.txt
Request and Trust Boundaries
The MCP client is untrusted relative to the target process: requested operations can inspect or mutate arbitrary process memory, alter protections, inject code/DLLs, control processes, and interact with DBVM/DBK. Shell-related capabilities are separately gated by CE_MCP_ALLOW_SHELL. The TCP relay introduces a network control boundary and must be bound only to trusted interfaces because a reachable relay grants control of the CE bridge.
Core paths:
• MCP_Server/mcp_cheatengine.py
• MCP_Server/ce_tcp_relay.py
• MCP_Server/ce_mcp_bridge.lua
Engineering Context
The implementation and protocol expectations are documented for agents and maintainers in the repository’s AI context material. The available test harness exercises the MCP-to-bridge integration rather than being a separate runtime component.
Core paths:
• AI_Context/AI_Guide_MCP_Server_Implementation.md
• AI_Context/MCP_Bridge_Command_Reference.md
• MCP_Server/test_mcp.py
Main entry points: mcp_cheatengine.py FastMCP tool server · ce_tcp_relay.py TCP relay · ce_mcp_bridge.lua Main-thread dispatcher · MCP_Bridge_Command_Reference.md Bridge command reference
Components 17
MCP control plane
- AI MCP client · Requests privileged reverse-engineering operations.
- stdio JSON-RPC
- FastMCP tool server · Validates tool calls, applies timeouts, and formats structured results.
MCP_Server/mcp_cheatengine.py - Tool surface · Process, memory, debug, injection, symbols, GUI, and DBVM/DBK operations.
MCP_Server/mcp_cheatengine.py - Shell capability gate · Shell-related operations require CE_MCP_ALLOW_SHELL.
MCP_Server/mcp_cheatengine.py
Transport boundary
- Windows named pipe · Default pywin32 transport to the Cheat Engine host.
- TCP relay · Network-exposed relay; bind only to trusted interfaces.
MCP_Server/ce_tcp_relay.py - Transport selection · CE_MCP_TRANSPORT, CE_MCP_HOST, and CE_MCP_PORT select relay mode.
MCP_Server/mcp_cheatengine.py - TCP dependencies
MCP_Server/requirements-tcp.txt
Cheat Engine runtime
- Bridge pipe worker · Receives serialized requests away from CE's GUI execution context.
MCP_Server/ce_mcp_bridge.lua - Main-thread dispatcher · Runs CE Lua API handlers on the appropriate main thread.
MCP_Server/ce_mcp_bridge.lua - Cheat Engine · Hosts the Lua bridge and privileged CE APIs.
- Attached target process · Memory and execution target controlled through Cheat Engine.
- Runtime dependencies · pywin32 supports named pipes; CE and DBVM enable advanced operations.
MCP_Server/requirements.txt
Documentation
- Bridge command reference · Defines MCP-to-bridge command expectations.
AI_Context/MCP_Bridge_Command_Reference.md - CE Lua documentation
AI_Context/CE_LUA_Documentation.md - Implementation guide
AI_Context/AI_Guide_MCP_Server_Implementation.md
Connections 19
- AI MCP client → stdio JSON-RPC: JSON-RPC
- stdio JSON-RPC → FastMCP tool server: serves
- FastMCP tool server → Tool surface: dispatches
- Tool surface → Shell capability gate: shell requests
- Tool surface → Windows named pipe: default commands
- Transport selection → FastMCP tool server: configures
- Transport selection → TCP relay: selects address
- FastMCP tool server → TCP relay: remote transport
- TCP relay → Windows named pipe: forwards TCP to
- Windows named pipe → Bridge pipe worker: serialized requests
- Bridge pipe worker → Main-thread dispatcher: coordinates
- Main-thread dispatcher → Cheat Engine: CE Lua APIs
- Cheat Engine → Attached target process: inspect / mutate / debug
- Runtime dependencies → FastMCP tool server: pywin32
- TCP dependencies → TCP relay: installs
- Bridge command reference → FastMCP tool server: documents commands
- Bridge command reference → Main-thread dispatcher: documents commands
- CE Lua documentation → Main-thread dispatcher: documents APIs
- Implementation guide → FastMCP tool server: implementation context