@baixfeng/godot-mcp-cli 1.0.11

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 (115) hide show
  1. package/README.md +187 -0
  2. package/addons/godot_mcp/command_handler.gd +161 -0
  3. package/addons/godot_mcp/command_handler.gd.uid +1 -0
  4. package/addons/godot_mcp/commands/base_command_processor.gd +221 -0
  5. package/addons/godot_mcp/commands/base_command_processor.gd.uid +1 -0
  6. package/addons/godot_mcp/commands/debugger_commands.gd +221 -0
  7. package/addons/godot_mcp/commands/debugger_commands.gd.uid +1 -0
  8. package/addons/godot_mcp/commands/editor_commands.gd +237 -0
  9. package/addons/godot_mcp/commands/editor_commands.gd.uid +1 -0
  10. package/addons/godot_mcp/commands/editor_script_commands.gd +365 -0
  11. package/addons/godot_mcp/commands/editor_script_commands.gd.uid +1 -0
  12. package/addons/godot_mcp/commands/input_commands.gd +337 -0
  13. package/addons/godot_mcp/commands/input_commands.gd.uid +1 -0
  14. package/addons/godot_mcp/commands/node_commands.gd +222 -0
  15. package/addons/godot_mcp/commands/node_commands.gd.uid +1 -0
  16. package/addons/godot_mcp/commands/project_commands.gd +298 -0
  17. package/addons/godot_mcp/commands/project_commands.gd.uid +1 -0
  18. package/addons/godot_mcp/commands/scene_commands.gd +337 -0
  19. package/addons/godot_mcp/commands/scene_commands.gd.uid +1 -0
  20. package/addons/godot_mcp/commands/script_commands.gd +349 -0
  21. package/addons/godot_mcp/commands/script_commands.gd.uid +1 -0
  22. package/addons/godot_mcp/mcp_asset_commands.gd +153 -0
  23. package/addons/godot_mcp/mcp_asset_commands.gd.uid +1 -0
  24. package/addons/godot_mcp/mcp_debug_output_publisher.gd +1669 -0
  25. package/addons/godot_mcp/mcp_debug_output_publisher.gd.uid +1 -0
  26. package/addons/godot_mcp/mcp_debugger_bridge.gd +1455 -0
  27. package/addons/godot_mcp/mcp_debugger_bridge.gd.uid +1 -0
  28. package/addons/godot_mcp/mcp_enhanced_commands.gd +1083 -0
  29. package/addons/godot_mcp/mcp_enhanced_commands.gd.uid +1 -0
  30. package/addons/godot_mcp/mcp_input_handler.gd +545 -0
  31. package/addons/godot_mcp/mcp_input_handler.gd.uid +1 -0
  32. package/addons/godot_mcp/mcp_runtime_debugger_bridge.gd +464 -0
  33. package/addons/godot_mcp/mcp_runtime_debugger_bridge.gd.uid +1 -0
  34. package/addons/godot_mcp/mcp_script_resource_commands.gd +165 -0
  35. package/addons/godot_mcp/mcp_script_resource_commands.gd.uid +1 -0
  36. package/addons/godot_mcp/mcp_server.gd +260 -0
  37. package/addons/godot_mcp/mcp_server.gd.uid +1 -0
  38. package/addons/godot_mcp/plugin.cfg +7 -0
  39. package/addons/godot_mcp/runtime_debugger.gd +81 -0
  40. package/addons/godot_mcp/runtime_debugger.gd.uid +1 -0
  41. package/addons/godot_mcp/ui/mcp_panel.gd +94 -0
  42. package/addons/godot_mcp/ui/mcp_panel.gd.uid +1 -0
  43. package/addons/godot_mcp/ui/mcp_panel.tscn +96 -0
  44. package/addons/godot_mcp/utils/node_utils.gd +82 -0
  45. package/addons/godot_mcp/utils/node_utils.gd.uid +1 -0
  46. package/addons/godot_mcp/utils/resource_utils.gd +81 -0
  47. package/addons/godot_mcp/utils/resource_utils.gd.uid +1 -0
  48. package/addons/godot_mcp/utils/script_utils.gd +114 -0
  49. package/addons/godot_mcp/utils/script_utils.gd.uid +1 -0
  50. package/addons/godot_mcp/websocket_server.gd +197 -0
  51. package/addons/godot_mcp/websocket_server.gd.uid +1 -0
  52. package/dist/cli.d.ts +2 -0
  53. package/dist/cli.js +561 -0
  54. package/dist/cli.js.map +1 -0
  55. package/dist/index.d.ts +1 -0
  56. package/dist/index.js +156 -0
  57. package/dist/index.js.map +1 -0
  58. package/dist/resources/asset_resources.d.ts +29 -0
  59. package/dist/resources/asset_resources.js +145 -0
  60. package/dist/resources/asset_resources.js.map +1 -0
  61. package/dist/resources/debug_resources.d.ts +11 -0
  62. package/dist/resources/debug_resources.js +106 -0
  63. package/dist/resources/debug_resources.js.map +1 -0
  64. package/dist/resources/debugger_resources.d.ts +62 -0
  65. package/dist/resources/debugger_resources.js +201 -0
  66. package/dist/resources/debugger_resources.js.map +1 -0
  67. package/dist/resources/editor_resources.d.ts +47 -0
  68. package/dist/resources/editor_resources.js +155 -0
  69. package/dist/resources/editor_resources.js.map +1 -0
  70. package/dist/resources/project_resources.d.ts +33 -0
  71. package/dist/resources/project_resources.js +137 -0
  72. package/dist/resources/project_resources.js.map +1 -0
  73. package/dist/resources/scene_resources.d.ts +33 -0
  74. package/dist/resources/scene_resources.js +160 -0
  75. package/dist/resources/scene_resources.js.map +1 -0
  76. package/dist/resources/script_resources.d.ts +51 -0
  77. package/dist/resources/script_resources.js +203 -0
  78. package/dist/resources/script_resources.js.map +1 -0
  79. package/dist/tools/asset_tools.d.ts +5 -0
  80. package/dist/tools/asset_tools.js +125 -0
  81. package/dist/tools/asset_tools.js.map +1 -0
  82. package/dist/tools/debugger_tools.d.ts +2 -0
  83. package/dist/tools/debugger_tools.js +342 -0
  84. package/dist/tools/debugger_tools.js.map +1 -0
  85. package/dist/tools/editor_tools.d.ts +2 -0
  86. package/dist/tools/editor_tools.js +165 -0
  87. package/dist/tools/editor_tools.js.map +1 -0
  88. package/dist/tools/enhanced_tools.d.ts +5 -0
  89. package/dist/tools/enhanced_tools.js +706 -0
  90. package/dist/tools/enhanced_tools.js.map +1 -0
  91. package/dist/tools/input_tools.d.ts +2 -0
  92. package/dist/tools/input_tools.js +408 -0
  93. package/dist/tools/input_tools.js.map +1 -0
  94. package/dist/tools/node_tools.d.ts +5 -0
  95. package/dist/tools/node_tools.js +217 -0
  96. package/dist/tools/node_tools.js.map +1 -0
  97. package/dist/tools/project_tools.d.ts +5 -0
  98. package/dist/tools/project_tools.js +162 -0
  99. package/dist/tools/project_tools.js.map +1 -0
  100. package/dist/tools/scene_tools.d.ts +5 -0
  101. package/dist/tools/scene_tools.js +260 -0
  102. package/dist/tools/scene_tools.js.map +1 -0
  103. package/dist/tools/script_resource_tools.d.ts +5 -0
  104. package/dist/tools/script_resource_tools.js +5 -0
  105. package/dist/tools/script_resource_tools.js.map +1 -0
  106. package/dist/tools/script_tools.d.ts +5 -0
  107. package/dist/tools/script_tools.js +154 -0
  108. package/dist/tools/script_tools.js.map +1 -0
  109. package/dist/utils/godot_connection.d.ts +30 -0
  110. package/dist/utils/godot_connection.js +285 -0
  111. package/dist/utils/godot_connection.js.map +1 -0
  112. package/dist/utils/types.d.ts +16 -0
  113. package/dist/utils/types.js +2 -0
  114. package/dist/utils/types.js.map +1 -0
  115. package/package.json +58 -0
@@ -0,0 +1,285 @@
1
+ var __extends = (this && this.__extends) || (function () {
2
+ var extendStatics = function (d, b) {
3
+ extendStatics = Object.setPrototypeOf ||
4
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
+ return extendStatics(d, b);
7
+ };
8
+ return function (d, b) {
9
+ if (typeof b !== "function" && b !== null)
10
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
11
+ extendStatics(d, b);
12
+ function __() { this.constructor = d; }
13
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14
+ };
15
+ })();
16
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
17
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
18
+ return new (P || (P = Promise))(function (resolve, reject) {
19
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
20
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
21
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
22
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
23
+ });
24
+ };
25
+ var __generator = (this && this.__generator) || function (thisArg, body) {
26
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
27
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
28
+ function verb(n) { return function (v) { return step([n, v]); }; }
29
+ function step(op) {
30
+ if (f) throw new TypeError("Generator is already executing.");
31
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
32
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
33
+ if (y = 0, t) op = [op[0] & 2, t.value];
34
+ switch (op[0]) {
35
+ case 0: case 1: t = op; break;
36
+ case 4: _.label++; return { value: op[1], done: false };
37
+ case 5: _.label++; y = op[1]; op = [0]; continue;
38
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
39
+ default:
40
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
41
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
42
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
43
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
44
+ if (t[2]) _.ops.pop();
45
+ _.trys.pop(); continue;
46
+ }
47
+ op = body.call(thisArg, _);
48
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
49
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
50
+ }
51
+ };
52
+ import WebSocket from 'ws';
53
+ import { EventEmitter } from 'events';
54
+ var GodotConnection = /** @class */ (function (_super) {
55
+ __extends(GodotConnection, _super);
56
+ function GodotConnection(url, // Use explicit IP
57
+ timeout, maxRetries, retryDelay) {
58
+ if (url === void 0) { url = 'ws://127.0.0.1:9080'; }
59
+ if (timeout === void 0) { timeout = 20000; }
60
+ if (maxRetries === void 0) { maxRetries = 3; }
61
+ if (retryDelay === void 0) { retryDelay = 2000; }
62
+ var _this = _super.call(this) || this;
63
+ _this.url = url;
64
+ _this.timeout = timeout;
65
+ _this.maxRetries = maxRetries;
66
+ _this.retryDelay = retryDelay;
67
+ _this.ws = null;
68
+ _this.connected = false;
69
+ _this.reconnecting = false;
70
+ _this.commandQueue = new Map();
71
+ _this.commandId = 0;
72
+ console.error('GodotConnection created with URL:', _this.url);
73
+ return _this;
74
+ }
75
+ GodotConnection.prototype.connect = function () {
76
+ return __awaiter(this, void 0, void 0, function () {
77
+ var retries, tryConnect, error_1;
78
+ var _this = this;
79
+ return __generator(this, function (_a) {
80
+ switch (_a.label) {
81
+ case 0:
82
+ if (this.connected)
83
+ return [2 /*return*/];
84
+ retries = 0;
85
+ tryConnect = function () {
86
+ return new Promise(function (resolve, reject) {
87
+ console.error("Connecting to Godot WebSocket server at ".concat(_this.url, "... (Attempt ").concat(retries + 1, "/").concat(_this.maxRetries + 1, ")"));
88
+ _this.ws = new WebSocket(_this.url, {
89
+ perMessageDeflate: false,
90
+ handshakeTimeout: 10000,
91
+ maxPayload: 64 * 1024 * 1024, // 64MB to match Godot
92
+ followRedirects: true,
93
+ skipUTF8Validation: true,
94
+ headers: {
95
+ 'Connection': 'Upgrade',
96
+ 'Upgrade': 'websocket',
97
+ 'Host': '127.0.0.1:9080'
98
+ }
99
+ });
100
+ // Use on() instead of event properties for better error handling
101
+ _this.ws.on('open', function () {
102
+ console.error('WebSocket connection established');
103
+ _this.connected = true;
104
+ resolve();
105
+ });
106
+ _this.ws.on('message', function (data) {
107
+ var _a;
108
+ try {
109
+ var response = JSON.parse(data.toString());
110
+ console.error('Received response:', response);
111
+ if ('commandId' in response) {
112
+ var commandId = response.commandId;
113
+ var pendingCommand = _this.commandQueue.get(commandId);
114
+ if (pendingCommand) {
115
+ clearTimeout(pendingCommand.timeout);
116
+ _this.commandQueue.delete(commandId);
117
+ if (response.status === 'success') {
118
+ pendingCommand.resolve(response.result);
119
+ }
120
+ else {
121
+ pendingCommand.reject(new Error(response.message || 'Unknown error'));
122
+ }
123
+ }
124
+ }
125
+ else if ('event' in response) {
126
+ var eventName = response.event;
127
+ var payload = (_a = response.data) !== null && _a !== void 0 ? _a : response;
128
+ _this.emit(eventName, payload);
129
+ }
130
+ }
131
+ catch (error) {
132
+ console.error('Error parsing response:', error);
133
+ }
134
+ });
135
+ _this.ws.on('error', function (error) {
136
+ console.error('WebSocket error:', error);
137
+ if (!_this.connected) {
138
+ reject(error);
139
+ }
140
+ });
141
+ _this.ws.on('close', function (code, reason) {
142
+ console.error("WebSocket closed (code: ".concat(code, ", reason: ").concat(reason || 'No reason provided', ")"));
143
+ _this.connected = false;
144
+ _this.ws = null;
145
+ // Reject pending commands
146
+ _this.commandQueue.forEach(function (command, id) {
147
+ clearTimeout(command.timeout);
148
+ command.reject(new Error('Connection closed'));
149
+ });
150
+ _this.commandQueue.clear();
151
+ if (!_this.reconnecting && _this.connected) {
152
+ _this.reconnecting = true;
153
+ setTimeout(function () {
154
+ _this.reconnecting = false;
155
+ _this.connect().catch(function () {
156
+ // Silent catch for reconnect failure
157
+ });
158
+ }, _this.retryDelay);
159
+ }
160
+ });
161
+ // Set connection timeout
162
+ var connectionTimeout = setTimeout(function () {
163
+ if (!_this.connected) {
164
+ if (_this.ws) {
165
+ _this.ws.terminate();
166
+ _this.ws = null;
167
+ }
168
+ reject(new Error('Connection timeout'));
169
+ }
170
+ }, _this.timeout);
171
+ // Clear timeout when connected
172
+ _this.ws.on('open', function () {
173
+ clearTimeout(connectionTimeout);
174
+ });
175
+ });
176
+ };
177
+ _a.label = 1;
178
+ case 1:
179
+ if (!(retries <= this.maxRetries)) return [3 /*break*/, 9];
180
+ _a.label = 2;
181
+ case 2:
182
+ _a.trys.push([2, 4, , 8]);
183
+ return [4 /*yield*/, tryConnect()];
184
+ case 3:
185
+ _a.sent();
186
+ return [2 /*return*/];
187
+ case 4:
188
+ error_1 = _a.sent();
189
+ retries++;
190
+ if (!(retries <= this.maxRetries)) return [3 /*break*/, 6];
191
+ console.error("Connection attempt failed. Retrying in ".concat(this.retryDelay, "ms..."));
192
+ return [4 /*yield*/, new Promise(function (resolve) { return setTimeout(resolve, _this.retryDelay); })];
193
+ case 5:
194
+ _a.sent();
195
+ return [3 /*break*/, 7];
196
+ case 6: throw error_1;
197
+ case 7: return [3 /*break*/, 8];
198
+ case 8: return [3 /*break*/, 1];
199
+ case 9: return [2 /*return*/];
200
+ }
201
+ });
202
+ });
203
+ };
204
+ GodotConnection.prototype.sendCommand = function (type_1) {
205
+ return __awaiter(this, arguments, void 0, function (type, params) {
206
+ var error_2;
207
+ var _this = this;
208
+ if (params === void 0) { params = {}; }
209
+ return __generator(this, function (_a) {
210
+ switch (_a.label) {
211
+ case 0:
212
+ if (!(!this.ws || !this.connected)) return [3 /*break*/, 4];
213
+ _a.label = 1;
214
+ case 1:
215
+ _a.trys.push([1, 3, , 4]);
216
+ return [4 /*yield*/, this.connect()];
217
+ case 2:
218
+ _a.sent();
219
+ return [3 /*break*/, 4];
220
+ case 3:
221
+ error_2 = _a.sent();
222
+ throw new Error("Failed to connect: ".concat(error_2.message));
223
+ case 4: return [2 /*return*/, new Promise(function (resolve, reject) {
224
+ var _a;
225
+ var commandId = "cmd_".concat(_this.commandId++);
226
+ var command = { type: type, params: params, commandId: commandId };
227
+ var timeoutId = setTimeout(function () {
228
+ if (_this.commandQueue.has(commandId)) {
229
+ _this.commandQueue.delete(commandId);
230
+ reject(new Error("Command timed out: ".concat(type)));
231
+ }
232
+ }, _this.timeout);
233
+ _this.commandQueue.set(commandId, {
234
+ resolve: resolve,
235
+ reject: reject,
236
+ timeout: timeoutId
237
+ });
238
+ if (((_a = _this.ws) === null || _a === void 0 ? void 0 : _a.readyState) === WebSocket.OPEN) {
239
+ var data = JSON.stringify(command);
240
+ console.error('Sending command:', data);
241
+ _this.ws.send(data);
242
+ }
243
+ else {
244
+ clearTimeout(timeoutId);
245
+ _this.commandQueue.delete(commandId);
246
+ reject(new Error('WebSocket not connected'));
247
+ }
248
+ })];
249
+ }
250
+ });
251
+ });
252
+ };
253
+ GodotConnection.prototype.disconnect = function () {
254
+ var _this = this;
255
+ if (this.ws) {
256
+ this.commandQueue.forEach(function (command, commandId) {
257
+ clearTimeout(command.timeout);
258
+ command.reject(new Error('Connection closed'));
259
+ _this.commandQueue.delete(commandId);
260
+ });
261
+ try {
262
+ this.ws.close(1000, 'Client disconnecting');
263
+ }
264
+ catch (error) {
265
+ console.error('Error during disconnect:', error);
266
+ }
267
+ this.ws = null;
268
+ this.connected = false;
269
+ }
270
+ };
271
+ GodotConnection.prototype.isConnected = function () {
272
+ var _a;
273
+ return this.connected && ((_a = this.ws) === null || _a === void 0 ? void 0 : _a.readyState) === WebSocket.OPEN;
274
+ };
275
+ return GodotConnection;
276
+ }(EventEmitter));
277
+ export { GodotConnection };
278
+ var connectionInstance = null;
279
+ export function getGodotConnection() {
280
+ if (!connectionInstance) {
281
+ connectionInstance = new GodotConnection();
282
+ }
283
+ return connectionInstance;
284
+ }
285
+ //# sourceMappingURL=godot_connection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"godot_connection.js","sourceRoot":"","sources":["../../src/utils/godot_connection.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,SAAS,MAAM,IAAI,CAAC;AAC3B,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAetC;IAAqC,mCAAY;IAW/C,yBACU,GAAmC,EAAG,kBAAkB;IACxD,OAAuB,EACvB,UAAsB,EACtB,UAAyB;QAHzB,oBAAA,EAAA,2BAAmC;QACnC,wBAAA,EAAA,eAAuB;QACvB,2BAAA,EAAA,cAAsB;QACtB,2BAAA,EAAA,iBAAyB;QAEjC,YAAA,MAAK,WAAE,SAAC;QALA,SAAG,GAAH,GAAG,CAAgC;QACnC,aAAO,GAAP,OAAO,CA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AC;;;;KACJ;IAED,oCAAU,GAAV;QAAA,iBAgBC;QAfC,IAAI,IAAI,CAAC,EAAE,EAAE,CAAC;YACZ,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,UAAC,OAAO,EAAE,SAAS;gBAC3C,YAAY,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;gBAC9B,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC,CAAC;gBAC/C,KAAI,CAAC,YAAY,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;YACtC,CAAC,CAAC,CAAC;YAEH,IAAI,CAAC;gBACH,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,sBAAsB,CAAC,CAAC;YAC9C,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO,CAAC,KAAK,CAAC,0BAA0B,EAAE,KAAK,CAAC,CAAC;YACnD,CAAC;YACD,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC;YACf,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;QACzB,CAAC;IACH,CAAC;IAED,qCAAW,GAAX;;QACE,OAAO,IAAI,CAAC,SAAS,IAAI,CAAA,MAAA,IAAI,CAAC,EAAE,0CAAE,UAAU,MAAK,SAAS,CAAC,IAAI,CAAC;IAClE,CAAC;IACH,sBAAC;AAAD,CAAC,AA3MD,CAAqC,YAAY,GA2MhD;;AAED,IAAI,kBAAkB,GAA2B,IAAI,CAAC;AAEtD,MAAM,UAAU,kBAAkB;IAChC,IAAI,CAAC,kBAAkB,EAAE,CAAC;QACxB,kBAAkB,GAAG,IAAI,eAAe,EAAE,CAAC;IAC7C,CAAC;IACD,OAAO,kBAAkB,CAAC;AAC5B,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Interface for FastMCP tool definition
4
+ */
5
+ export interface MCPTool<T = any> {
6
+ name: string;
7
+ description: string;
8
+ parameters: z.ZodType<T>;
9
+ execute: (args: T) => Promise<string>;
10
+ }
11
+ /**
12
+ * Generic response from a Godot command
13
+ */
14
+ export interface CommandResult {
15
+ [key: string]: any;
16
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/utils/types.ts"],"names":[],"mappings":""}
package/package.json ADDED
@@ -0,0 +1,58 @@
1
+ {
2
+ "name": "@baixfeng/godot-mcp-cli",
3
+ "version": "1.0.11",
4
+ "description": "CLI and MCP server for AI assistants to interact with Godot Engine",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "bin": {
8
+ "godot-mcp": "dist/index.js"
9
+ },
10
+ "files": [
11
+ "dist",
12
+ "addons"
13
+ ],
14
+ "scripts": {
15
+ "build": "tsc",
16
+ "start": "node dist/index.js",
17
+ "dev": "nodemon --watch src --exec \"tsc && node dist/index.js\"",
18
+ "test": "node tests/tools.test.js --skip-runtime",
19
+ "test:all": "node tests/tools.test.js",
20
+ "test:cli": "node tests/cli.test.js",
21
+ "test:debugger": "node tests/debugger.test.js",
22
+ "prepublishOnly": "npm run build && node -e \"require('fs').cpSync('../addons/godot_mcp','./addons/godot_mcp',{recursive:true});require('fs').cpSync('../README.md','./README.md')\"",
23
+ "postpublish": "node -e \"require('fs').rmSync('./addons',{recursive:true,force:true});require('fs').rmSync('./README.md',{force:true})\""
24
+ },
25
+ "repository": {
26
+ "type": "git",
27
+ "url": "git+https://github.com/nguyenchiencong/godot-mcp-cli.git"
28
+ },
29
+ "bugs": {
30
+ "url": "https://github.com/nguyenchiencong/godot-mcp-cli/issues"
31
+ },
32
+ "homepage": "https://github.com/nguyenchiencong/godot-mcp-cli#readme",
33
+ "keywords": [
34
+ "godot",
35
+ "mcp",
36
+ "fastmcp",
37
+ "claude",
38
+ "ai",
39
+ "cli",
40
+ "game-development"
41
+ ],
42
+ "author": "baixfeng",
43
+ "license": "MIT",
44
+ "engines": {
45
+ "node": ">=18.0.0"
46
+ },
47
+ "dependencies": {
48
+ "fastmcp": "^3.25.4",
49
+ "ws": "^8.13.0",
50
+ "zod": "4.1.13"
51
+ },
52
+ "devDependencies": {
53
+ "@types/node": "^20.3.1",
54
+ "@types/ws": "^8.5.5",
55
+ "nodemon": "^3.1.9",
56
+ "typescript": "^5.1.3"
57
+ }
58
+ }