Skip to content

Commit 92ffb7f

Browse files
committed
update to .net (broken)
1 parent 9ee0cee commit 92ffb7f

40 files changed

+1497
-2229
lines changed

.claude/settings.local.json

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,16 @@
99
"Bash(dir:*)",
1010
"WebFetch(domain:raw.githubusercontent.com)",
1111
"Read(//c/Users/Shadow/Documents/Coding/cheat-engine/Cheat Engine/bin/**)",
12-
"Read(//c/Users/Shadow/Documents/Coding/cheat-engine/Cheat Engine/plugin/c# template/CEPluginLibrary/**)"
12+
"Read(//c/Users/Shadow/Documents/Coding/cheat-engine/Cheat Engine/plugin/c# template/CEPluginLibrary/**)",
13+
"Bash(taskkill /F /IM dotnet.exe)",
14+
"Bash(taskkill /F /IM MSBuild.exe)",
15+
"Read(//c/Program Files/Cheat Engine/plugins/c# template/**)",
16+
"Read(//c/Users/Snufkin/AppData/Local/Programs/Cheat Engine/plugins/c# template/CEPluginLibrary/**)",
17+
"Read(//c/Users/Snufkin/AppData/Local/Programs/Cheat Engine/plugins/c# template/CEPluginLibrary .NET 8/Properties/**)",
18+
"Read(//c/Users/Snufkin/AppData/Local/Programs/Cheat Engine/plugins/c# template/CEPluginLibrary .NET 8/**)",
19+
"Bash(curl:*)"
1320
],
1421
"deny": [],
1522
"ask": []
1623
}
17-
}
24+
}

CESDK

Submodule CESDK updated from d3a6bd9 to 8ee4a68

CLAUDE.md

Lines changed: 43 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
44

55
## Project Overview
66

7-
This is a Cheat Engine MCP (Model Context Protocol) Server that provides REST API access to Cheat Engine functionality through a C# plugin and Python MCP client. The project enables AI tools to interact with Cheat Engine for memory analysis, process manipulation, and debugging tasks.
7+
This is a Cheat Engine MCP (Model Context Protocol) Server that provides MCP tool access to Cheat Engine functionality through a C# plugin using the official MCP C# SDK. The project enables AI tools to interact with Cheat Engine for memory analysis, process manipulation, and debugging tasks via Server-Sent Events (SSE).
88

99
## Build Commands
1010

@@ -39,19 +39,14 @@ uv sync
3939
- Registers Lua functions for CE integration
4040
- Provides configuration UI through WPF window
4141

42-
- **McpServer.cs**: OWIN-based web server that hosts the REST API
43-
- Uses Web API with Swagger documentation
42+
- **McpServer.cs**: MCP SSE server using the official Model Context Protocol C# SDK
43+
- Exposes all Cheat Engine functionality as MCP tools
44+
- Runs in SSE (Server-Sent Events) mode for compatibility with CE plugin environment
4445
- Configurable host/port via environment variables or config file
4546

46-
- **CheatEngineController.cs**: Main API controller with endpoints for:
47-
- Lua execution
48-
- Process management
49-
- Memory reading/writing
50-
- AOB scanning
51-
- Disassembly
52-
- Memory scanning
53-
5447
- **CheatEngineTools.cs**: Service layer that delegates to specialized tools in `/Tools` directory
48+
- All tools are exposed via MCP protocol
49+
- Includes: Lua execution, process management, memory operations, AOB scanning, disassembly, memory scanning
5550

5651
### SDK Layer (`/SDK`)
5752

@@ -72,23 +67,21 @@ Wrapper classes around Cheat Engine SDK functionality:
7267
- Configuration file: `%APPDATA%\CeMCP\config.json`
7368
- Environment variable overrides: `MCP_HOST`, `MCP_PORT`
7469

75-
### Python MCP Client
70+
### Python MCP Client (Legacy)
7671

77-
- **cheat_engine_mcp_server.py**: FastMCP-based server that exposes tools for AI interaction
78-
- Provides async wrappers for all REST API endpoints
79-
- Uses httpx for HTTP communication with configurable timeout (600s)
72+
Note: The Python MCP client is now deprecated as the C# plugin directly implements the MCP protocol using the official SDK. You can connect directly to the MCP SSE server from any MCP-compatible client.
8073

8174
## Development Workflow
8275

8376
1. Build the C# plugin with `dotnet build`
8477
2. Copy `ce-mcp.dll` from `bin/` to Cheat Engine plugins directory
8578
3. Enable the plugin in Cheat Engine
8679
4. Use "MCP" menu to start/configure the server
87-
5. Test endpoints at `http://localhost:6300/swagger`
80+
5. Connect to the MCP SSE server at `http://localhost:6300` using any MCP-compatible client
8881

8982
## Adding New Tools
9083

91-
To add a new tool/endpoint to the MCP server:
84+
To add a new MCP tool to the server:
9285

9386
**Important**: Always examine existing implementations first. Look at similar tools in `/Tools`, models in `/Models`, and SDK wrappers in `/SDK` to understand patterns and conventions.
9487

@@ -152,43 +145,47 @@ public NewFeatureResponse DoSomething(NewFeatureRequest request)
152145
}
153146
```
154147

155-
### 5. Add Controller Endpoint
156-
Add endpoint to `CheatEngineController.cs`:
148+
### 5. Add MCP Tool in McpServer.cs
149+
Add the MCP tool definition in the `ConfigureTools` method in `McpServer.cs`:
157150
```csharp
158-
[HttpPost]
159-
[Route("new-feature")]
160-
public NewFeatureResponse DoSomething([FromBody] NewFeatureRequest request)
161-
{
162-
return tools.DoSomething(request);
163-
}
164-
```
165-
166-
### 6. Add Python MCP Tool
167-
Add corresponding tool in `ce-mcp-client/src/cheat_engine_mcp_server.py`:
168-
```python
169-
@mcp.tool()
170-
async def do_something(parameter: str) -> Dict[str, Any]:
171-
"""
172-
Description of what this tool does
173-
174-
Args:
175-
parameter: Description of the parameter
176-
177-
Returns:
178-
Dictionary with result and success status
179-
"""
180-
return await make_request("new-feature", "POST", {"Parameter": parameter})
151+
builder.AddTool("do_something", "Description of what this tool does",
152+
async (arguments, cancellationToken) =>
153+
{
154+
var request = new NewFeatureRequest
155+
{
156+
Parameter = arguments.GetValueOrDefault("parameter")?.ToString() ?? ""
157+
};
158+
var response = _tools.DoSomething(request);
159+
return new
160+
{
161+
success = response.Success,
162+
result = response.Result,
163+
error = response.Error
164+
};
165+
},
166+
new Dictionary<string, object>
167+
{
168+
["type"] = "object",
169+
["properties"] = new Dictionary<string, object>
170+
{
171+
["parameter"] = new Dictionary<string, object>
172+
{
173+
["type"] = "string",
174+
["description"] = "Description of the parameter"
175+
}
176+
},
177+
["required"] = new[] { "parameter" }
178+
});
181179
```
182180

183181
## Project Structure
184182

185183
```
186184
├── SDK/ # Cheat Engine SDK wrappers
187185
├── Tools/ # Specialized functionality tools
188-
├── Controllers/ # Web API controllers
189186
├── Models/ # Data transfer objects
190-
├── ce-mcp-client/ # Python MCP client
191-
│ └── src/cheat_engine_mcp_server.py
187+
├── McpServer.cs # MCP SSE server implementation
188+
── CheatEngineTools.cs # Service layer for tools
192189
└── Plugin.cs # Main plugin entry point
193190
```
194191

@@ -200,7 +197,7 @@ The server supports configuration through:
200197
2. Configuration file at `%APPDATA%\CeMCP\config.json`
201198
3. Runtime configuration through WPF configuration window
202199

203-
Default server runs on `http://127.0.0.1:6300` with Swagger UI available for API testing.
200+
Default server runs on `http://127.0.0.1:6300` as an MCP SSE server.
204201

205202
## Important Implementation Notes
206203

CeMCP.csproj

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,42 @@
1-
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
1+
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFramework>net481</TargetFramework>
3+
<TargetFramework>net9.0-windows</TargetFramework>
44
<OutputType>Library</OutputType>
5-
<UseWPF>true</UseWPF>
65
<AssemblyName>ce-mcp</AssemblyName>
6+
<RootNamespace>CEMCP</RootNamespace>
77
<LangVersion>latest</LangVersion>
88
<Version>1.0.0</Version>
99
<AssemblyVersion>$(Version)</AssemblyVersion>
1010
<FileVersion>$(Version)</FileVersion>
1111
<Nullable>enable</Nullable>
12+
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
1213
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
14+
<GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute>
15+
<SelfContained>true</SelfContained>
16+
<IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract>
17+
<IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract>
18+
19+
<!-- Force all dependencies to be copied locally -->
20+
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
21+
22+
<!-- Generate runtime config to help find framework assemblies -->
23+
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
24+
25+
<!-- WPF -->
26+
<UseWPF>true</UseWPF>
27+
<PlatformTarget>x64</PlatformTarget>
28+
<Platforms>x64</Platforms>
29+
<SupportedOSPlatformVersion>7.0</SupportedOSPlatformVersion>
1330
</PropertyGroup>
1431

32+
<ItemGroup>
33+
<FrameworkReference Include="Microsoft.AspNetCore.App" />
34+
</ItemGroup>
1535

1636
<ItemGroup>
17-
<PackageReference Include="Microsoft.Extensions.Hosting" Version="9.0.8" />
18-
<PackageReference Include="Microsoft.Extensions.Logging" Version="9.0.8" />
19-
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="9.0.8" />
20-
<PackageReference Include="Microsoft.Owin" Version="4.2.3" />
21-
<PackageReference Include="Microsoft.Owin.Hosting" Version="4.2.3" />
22-
<PackageReference Include="Microsoft.AspNet.WebApi.Owin" Version="5.3.0" />
23-
<PackageReference Include="Microsoft.AspNet.WebApi.OwinSelfHost" Version="5.3.0" />
24-
<PackageReference Include="System.Threading.Tasks.Extensions" Version="4.6.3" />
25-
<PackageReference Include="Swashbuckle.Core" Version="5.6.0" />
26-
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
27-
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
28-
<PackageReference Include="Costura.Fody" Version="6.0.0">
29-
<PrivateAssets>all</PrivateAssets>
30-
</PackageReference>
31-
<PackageReference Include="Fody" Version="6.9.3">
32-
<PrivateAssets>all</PrivateAssets>
33-
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
34-
</PackageReference>
37+
<PackageReference Include="ModelContextProtocol" Version="0.4.0-preview.3" />
38+
<PackageReference Include="ModelContextProtocol.AspNetCore" Version="0.4.0-preview.3" />
39+
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
40+
<PackageReference Include="Scalar.AspNetCore" Version="2.9.0" />
3541
</ItemGroup>
3642
</Project>

CeMCP.csproj.user

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<Project>
22
<PropertyGroup>
33
<UnoPlatformIDE>vscode</UnoPlatformIDE>
4-
<UnoPlatformIDEVersion>1.103.2</UnoPlatformIDEVersion>
5-
<UnoPlatformExtension>unoplatform.vscode 0.21.3</UnoPlatformExtension>
4+
<UnoPlatformIDEVersion>1.105.1</UnoPlatformIDEVersion>
5+
<UnoPlatformExtension>unoplatform.vscode 0.22.1</UnoPlatformExtension>
66
<UnoRemoteControlPort>0</UnoRemoteControlPort>
7-
<UnoVSCodeCSharpExtension>ms-dotnettools.csharp 2.87.31</UnoVSCodeCSharpExtension>
8-
<UnoVSCodeCSharpDevKitExtension>ms-dotnettools.csdevkit 1.41.11</UnoVSCodeCSharpDevKitExtension>
7+
<UnoVSCodeCSharpExtension>ms-dotnettools.csharp 2.93.22</UnoVSCodeCSharpExtension>
8+
<UnoVSCodeCSharpDevKitExtension>ms-dotnettools.csdevkit 1.70.3</UnoVSCodeCSharpDevKitExtension>
99
</PropertyGroup>
1010
</Project>

CeMCP.sln

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CeMCP", "CeMCP.csproj", "{C
77
EndProject
88
Global
99
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10-
Debug|Any CPU = Debug|Any CPU
11-
Release|Any CPU = Release|Any CPU
10+
Debug|x64 = Debug|x64
11+
Release|x64 = Release|x64
1212
EndGlobalSection
1313
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14-
{C9BA2D19-89F7-4469-8B13-D01978472711}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15-
{C9BA2D19-89F7-4469-8B13-D01978472711}.Debug|Any CPU.Build.0 = Debug|Any CPU
16-
{C9BA2D19-89F7-4469-8B13-D01978472711}.Release|Any CPU.ActiveCfg = Release|Any CPU
17-
{C9BA2D19-89F7-4469-8B13-D01978472711}.Release|Any CPU.Build.0 = Release|Any CPU
14+
{C9BA2D19-89F7-4469-8B13-D01978472711}.Debug|x64.ActiveCfg = Debug|x64
15+
{C9BA2D19-89F7-4469-8B13-D01978472711}.Debug|x64.Build.0 = Debug|x64
16+
{C9BA2D19-89F7-4469-8B13-D01978472711}.Release|x64.ActiveCfg = Release|x64
17+
{C9BA2D19-89F7-4469-8B13-D01978472711}.Release|x64.Build.0 = Release|x64
1818
EndGlobalSection
1919
GlobalSection(SolutionProperties) = preSolution
2020
HideSolutionNode = FALSE

CheatEngineTools.cs

Lines changed: 0 additions & 108 deletions
This file was deleted.

0 commit comments

Comments
 (0)