Skip to content

Commit 68318e7

Browse files
committed
fix sdk
1 parent 92ffb7f commit 68318e7

18 files changed

+577
-296
lines changed

CESDK

Submodule CESDK updated from 8ee4a68 to 38834b6

CeMCP.csproj

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222
<!-- Generate runtime config to help find framework assemblies -->
2323
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
2424

25+
<!-- Force .NET 9.0.10 to match NuGet package versions -->
26+
<RuntimeFrameworkVersion>9.0.10</RuntimeFrameworkVersion>
27+
2528
<!-- WPF -->
2629
<UseWPF>true</UseWPF>
2730
<PlatformTarget>x64</PlatformTarget>
@@ -34,9 +37,8 @@
3437
</ItemGroup>
3538

3639
<ItemGroup>
37-
<PackageReference Include="ModelContextProtocol" Version="0.4.0-preview.3" />
38-
<PackageReference Include="ModelContextProtocol.AspNetCore" Version="0.4.0-preview.3" />
3940
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
4041
<PackageReference Include="Scalar.AspNetCore" Version="2.9.0" />
42+
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="9.0.10" />
4143
</ItemGroup>
4244
</Project>

src/ApiServer.cs

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
using System;
2+
using System.Threading.Tasks;
3+
using Microsoft.AspNetCore.Builder;
4+
using Microsoft.AspNetCore.Hosting;
5+
using Microsoft.Extensions.DependencyInjection;
6+
using Microsoft.Extensions.Logging;
7+
using Scalar.AspNetCore;
8+
9+
namespace CEMCP
10+
{
11+
public class ApiServer
12+
{
13+
private WebApplication? _app;
14+
15+
public void Start(string baseUrl)
16+
{
17+
if (_app != null) return; // Already running
18+
19+
var builder = WebApplication.CreateBuilder(new WebApplicationOptions
20+
{
21+
Args = [],
22+
ContentRootPath = System.IO.Path.GetTempPath(),
23+
WebRootPath = System.IO.Path.GetTempPath()
24+
});
25+
26+
// Setup services
27+
builder.Services.AddEndpointsApiExplorer();
28+
builder.Services.AddOpenApi();
29+
builder.Logging.ClearProviders(); // Disable logging
30+
builder.WebHost.UseUrls(baseUrl);
31+
32+
// Build app
33+
_app = builder.Build();
34+
35+
// Setup API documentation
36+
_app.MapOpenApi();
37+
_app.MapScalarApiReference();
38+
39+
// Setup all API endpoints
40+
RegisterEndpoints(_app);
41+
42+
// Start server in background
43+
Task.Run(() => _app.RunAsync());
44+
}
45+
46+
private static void RegisterEndpoints(WebApplication app)
47+
{
48+
// Root endpoint
49+
app.MapGet("/", () => new
50+
{
51+
name = "Cheat Engine API",
52+
version = "1.0.0",
53+
documentation = "/scalar/v1"
54+
})
55+
.WithName("GetRoot")
56+
.WithOpenApi();
57+
58+
// All tool APIs
59+
Tools.ProcessTool.MapProcessApi(app);
60+
Tools.LuaExecutionTool.MapLuaApi(app);
61+
Tools.MemoryReadTool.MapMemoryReadApi(app);
62+
Tools.MemoryWriteTool.MapMemoryWriteApi(app);
63+
Tools.AobScanTool.MapAobScanApi(app);
64+
Tools.DisassembleTool.MapDisassembleApi(app);
65+
Tools.AddressTool.MapAddressApi(app);
66+
Tools.ConversionTool.MapConversionApi(app);
67+
Tools.ThreadListTool.MapThreadListApi(app);
68+
Tools.MemScanTool.MapMemScanApi(app);
69+
}
70+
71+
public void Stop()
72+
{
73+
if (_app == null) return; // Not running
74+
75+
var appToStop = _app;
76+
_app = null;
77+
78+
// Stop server in background (don't freeze CE)
79+
Task.Run(async () =>
80+
{
81+
await appToStop.StopAsync();
82+
await appToStop.DisposeAsync();
83+
});
84+
}
85+
86+
public bool IsRunning => _app != null;
87+
}
88+
}

src/CheatEngineToolsProvider.cs

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

src/McpServer.cs

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

src/Models/ConfigurationModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public string ServerName
5858

5959
public string BaseUrl => $"http://{Host}:{Port}";
6060

61-
public string ScalarUrl => $"{BaseUrl}/scalar/index.html";
61+
public string ScalarUrl => $"{BaseUrl}/scalar/v1";
6262

6363
public string StartStopButtonText => ServerStatus.Equals("running", System.StringComparison.CurrentCultureIgnoreCase) ? "Stop Server" : "Start Server";
6464

0 commit comments

Comments
 (0)