You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add GitHub Actions workflow and update copilot instructions
- Add build-dlls.yml workflow to build Debug and Release DLLs on push/PR
- Update copilot-instructions.md with comprehensive architecture details
- Document build paths, thread safety patterns, and resource management
- Add examples for adding new tools and resources
Copy file name to clipboardExpand all lines: .github/copilot-instructions.md
+72-15Lines changed: 72 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,6 +4,12 @@
4
4
5
5
Cheat Engine MCP Server — a C# plugin that exposes Cheat Engine functionality as MCP tools over SSE (Server-Sent Events) using the official [Model Context Protocol C# SDK](https://github.com/modelcontextprotocol/csharp-sdk).
6
6
7
+
**Key Architecture**:
8
+
-**MCP SSE Server**: ASP.NET Core app on `http://127.0.0.1:6300` with SSE at `/sse`
9
+
-**CE Plugin Host**: Runs inside Cheat Engine process, manages server lifecycle via menu
10
+
-**CESDK Submodule**: C# wrapper for CE's Lua API (git submodule dependency)
11
+
-**Single DLL**: All dependencies embedded, copy to CE plugins folder to deploy
12
+
7
13
## Cheat Engine Lua API Reference
8
14
9
15
The full CE Lua API documentation is at `C:\Program Files\Cheat Engine\celua.txt`. Always consult this file when:
@@ -14,54 +20,64 @@ The full CE Lua API documentation is at `C:\Program Files\Cheat Engine\celua.txt
14
20
## Build and Test
15
21
16
22
```bash
17
-
# Initialize submodule (first time)
23
+
# Initialize submodule (first time only)
18
24
git submodule update --init --recursive
19
25
20
-
# Build
26
+
# Build Debug
21
27
dotnet build
22
28
23
29
# Build Release
24
30
dotnet build -c Release
25
31
```
26
32
27
-
Deploy: copy `ce-mcp.dll` from `bin/` to Cheat Engine plugins directory, enable in CE, use "MCP" menu.
33
+
**Deploy**: Copy `ce-mcp.dll` from `bin/x64/Debug/net10.0-windows/` (or Release) to Cheat Engine plugins directory, enable in CE, use "MCP" → "Start MCP Server" menu.
34
+
35
+
**Requirements**: .NET 10.0 SDK, CE 7.6.2+, ASP.NET Core 10.0 runtime. CE must have `ce.runtimeconfig.json` set to .NET 10.0 (see README).
28
36
29
37
## Architecture
30
38
31
39
### Core Components
32
40
33
-
-**Plugin.cs** — Main CE plugin entry point (`CESDKPluginClass`). Manages MCP server lifecycle, registers Lua functions for CE menu integration, provides WPF config UI.
34
-
-**McpServer.cs** — MCP SSE server using `ModelContextProtocol.AspNetCore`. Registers all tools via `WithTools<T>()` and maps endpoints with `MapMcp()`.
35
-
-**ServerConfig.cs** — Configuration management (host/port/name). Loads from `%APPDATA%\CeMCP\config.json` with env var overrides (`MCP_HOST`, `MCP_PORT`).
41
+
-**Plugin.cs** — Main CE plugin entry point (`McpPlugin : CheatEnginePlugin`). Manages MCP server lifecycle, registers Lua functions for CE menu integration (`toggle_mcp_server`, `show_mcp_config`), provides WPF config UI. Handles assembly resolution for WPF components.
42
+
-**McpServer.cs** — MCP SSE server using `ModelContextProtocol.AspNetCore`. Registers all tools via `WithTools<T>()`, resources via `WithResources<T>()`, and maps endpoints with `MapMcp()`. Runs ASP.NET Core with minimal logging in background task.
43
+
-**ServerConfig.cs** — Configuration management (host/port/name). Loads from `%APPDATA%\CeMCP\config.json` with env var overrides (`MCP_HOST`, `MCP_PORT`). Uses source-generated JSON serialization.
44
+
-**ThemeHelper.cs** — Cross-platform dark mode detection (Windows registry, macOS `defaults`, Linux GTK settings)
36
45
37
46
### Tools (`src/Tools/`)
38
47
39
-
All tools use `[McpServerToolType]` on the class and `[McpServerTool]` + `[Description]` on methods. Tools are static classes with static methods. Each returns anonymous objects with `success` boolean and either result data or `error` message.
48
+
All tools use `[McpServerToolType]` on the class and `[McpServerTool(Name = "tool_name")]` + `[Description]` on methods. Tools are static classes with static methods. Each returns anonymous objects with `success` boolean and either result data or `error` message.
40
49
41
-
-**ProcessTool** — Process and thread management (list/open/get processes, list threads)
-**LuaExecutionTool** — Execute arbitrary Lua scripts in CE with stack management
47
56
-**ConversionTool** — String format conversion (MD5, ANSI/UTF8)
48
57
58
+
### Resources (`src/Resources/`)
59
+
60
+
Resources use `[McpServerResourceType]` on class and `[McpServerResource(UriTemplate = "scheme://path")]` + `[Description]` on methods. Resources are read-only state/data (vs tools which perform actions). Return JSON strings.
61
+
62
+
-**ProcessResources** — `process://current` (opened process info), `process://threads` (thread list)
-**ConfigWindow.xaml/.cs** — WPF config window. Supports dark/light theme via `ThemeHelper`.
70
+
-**ConfigWindow.xaml/.cs** — WPF config window. Supports dark/light theme via `ThemeHelper`. Runs in STA thread with dispatcher for cross-thread UI updates.
56
71
57
72
## Adding New Tools
58
73
59
74
1. Create a new file in `src/Tools/` with `[McpServerToolType]` class attribute
60
75
2. Add static methods with `[McpServerTool(Name = "tool_name")]` and `[Description("...")]`
61
-
3. Use `[Description]` on parameters for schema generation
76
+
3. Use `[Description]` on parameters for MCP schema generation
0 commit comments