cheatengine 5.8.15 → 5.8.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/ce_mcp_server.js +34 -28
  2. package/package.json +1 -1
package/ce_mcp_server.js CHANGED
@@ -300,41 +300,47 @@ class CEMCPServer {
300
300
  log.info('Cheat Engine MCP Bridge Started. Waiting for input...');
301
301
  log.info(`Node.js version: ${process.version}`);
302
302
 
303
- const readline = require('readline');
304
- const rl = readline.createInterface({
305
- input: process.stdin,
306
- output: process.stdout,
307
- terminal: false,
308
- });
309
-
310
- rl.on('line', async (line) => {
311
- if (!line.trim()) return;
312
-
313
- this.requestCount++;
314
-
315
- try {
316
- const request = JSON.parse(line);
317
- const response = this.handleRequest(request);
303
+ // Use raw stdin/stdout for MCP protocol - no readline to avoid buffering issues
304
+ process.stdin.setEncoding('utf8');
305
+
306
+ let buffer = '';
307
+
308
+ process.stdin.on('data', async (chunk) => {
309
+ buffer += chunk;
310
+
311
+ // Process complete lines
312
+ let lines = buffer.split('\n');
313
+ buffer = lines.pop(); // Keep incomplete line in buffer
314
+
315
+ for (const line of lines) {
316
+ if (!line.trim()) continue;
318
317
 
319
- if (response) {
320
- // Handle async tool calls
321
- if (response instanceof Promise) {
322
- const result = await response;
323
- process.stdout.write(JSON.stringify(result) + '\n');
318
+ this.requestCount++;
319
+
320
+ try {
321
+ const request = JSON.parse(line);
322
+ const response = this.handleRequest(request);
323
+
324
+ if (response) {
325
+ // Handle async tool calls
326
+ if (response instanceof Promise) {
327
+ const result = await response;
328
+ process.stdout.write(JSON.stringify(result) + '\n');
329
+ } else {
330
+ process.stdout.write(JSON.stringify(response) + '\n');
331
+ }
332
+ }
333
+ } catch (err) {
334
+ if (err instanceof SyntaxError) {
335
+ log.error(`Failed to decode JSON: ${err.message}`);
324
336
  } else {
325
- process.stdout.write(JSON.stringify(response) + '\n');
337
+ log.error(`Critical Error (request #${this.requestCount}): ${err.stack}`);
326
338
  }
327
339
  }
328
- } catch (err) {
329
- if (err instanceof SyntaxError) {
330
- log.error(`Failed to decode JSON: ${err.message}`);
331
- } else {
332
- log.error(`Critical Error (request #${this.requestCount}): ${err.stack}`);
333
- }
334
340
  }
335
341
  });
336
342
 
337
- rl.on('close', () => {
343
+ process.stdin.on('end', () => {
338
344
  log.info('Received end of input');
339
345
  this.pipeClient.stop();
340
346
  log.info(`Server Stopped (processed ${this.requestCount} requests)`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cheatengine",
3
- "version": "5.8.15",
3
+ "version": "5.8.16",
4
4
  "description": "Cheat Engine MCP Server - AI-assisted reverse engineering bridge",
5
5
  "main": "ce_mcp_server.js",
6
6
  "bin": {