@akiojin/unity-mcp-server 4.2.0 → 5.0.0

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@akiojin/unity-mcp-server",
3
- "version": "4.2.0",
3
+ "version": "5.0.0",
4
4
  "description": "MCP server and Unity Editor bridge — enables AI assistants to control Unity for AI-assisted workflows",
5
5
  "type": "module",
6
6
  "main": "src/core/server.js",
@@ -153,7 +153,7 @@ const baseConfig = {
153
153
 
154
154
  // LSP client defaults
155
155
  lsp: {
156
- requestTimeoutMs: 60000
156
+ requestTimeoutMs: 120000
157
157
  },
158
158
 
159
159
  // Indexing (code index) settings
@@ -649,10 +649,9 @@ function wrapUnityConnectError(error, host, port) {
649
649
  }
650
650
 
651
651
  function buildUnityConnectionHint(_host, _port) {
652
- const configPath = config.__configPath || '.unity/config.json';
653
652
  return (
654
653
  `Start Unity Editor and ensure the Unity MCP package is running (TCP listener). ` +
655
- `Check ${configPath} (unity.mcpHost/unity.port). ` +
656
- `If using WSL2/Docker → Windows Unity, set unity.mcpHost=host.docker.internal.`
654
+ `Check UNITY_MCP_MCP_HOST / UNITY_MCP_PORT and Unity Project Settings (Host/Port). ` +
655
+ `If using WSL2/Docker → Windows Unity, set UNITY_MCP_MCP_HOST=host.docker.internal.`
657
656
  );
658
657
  }
@@ -7,7 +7,7 @@ import { BaseToolHandler } from '../base/BaseToolHandler.js';
7
7
  export default class AddressablesAnalyzeToolHandler extends BaseToolHandler {
8
8
  constructor(unityConnection) {
9
9
  super(
10
- 'addressables_analyze',
10
+ 'analyze_addressables',
11
11
  'Analyze Unity Addressables for duplicates, dependencies, and unused assets',
12
12
  {
13
13
  type: 'object',
@@ -68,7 +68,7 @@ export default class AddressablesAnalyzeToolHandler extends BaseToolHandler {
68
68
  await this.unityConnection.connect();
69
69
  }
70
70
 
71
- const result = await this.unityConnection.sendCommand('addressables_analyze', {
71
+ const result = await this.unityConnection.sendCommand('analyze_addressables', {
72
72
  action,
73
73
  ...parameters
74
74
  });
@@ -6,7 +6,7 @@ import { BaseToolHandler } from '../base/BaseToolHandler.js';
6
6
  */
7
7
  export default class AddressablesBuildToolHandler extends BaseToolHandler {
8
8
  constructor(unityConnection) {
9
- super('addressables_build', 'Build Unity Addressables content or clean build cache', {
9
+ super('build_addressables', 'Build Unity Addressables content or clean build cache', {
10
10
  type: 'object',
11
11
  properties: {
12
12
  action: {
@@ -75,7 +75,7 @@ export default class AddressablesBuildToolHandler extends BaseToolHandler {
75
75
  const timeout = 300000; // 5 minutes
76
76
 
77
77
  const result = await this.unityConnection.sendCommand(
78
- 'addressables_build',
78
+ 'build_addressables',
79
79
  {
80
80
  action,
81
81
  ...parameters
@@ -7,7 +7,7 @@ import { BaseToolHandler } from '../base/BaseToolHandler.js';
7
7
  export default class AddressablesManageToolHandler extends BaseToolHandler {
8
8
  constructor(unityConnection) {
9
9
  super(
10
- 'addressables_manage',
10
+ 'manage_addressables',
11
11
  'Manage Unity Addressables assets and groups - add, remove, organize entries and groups',
12
12
  {
13
13
  type: 'object',
@@ -141,7 +141,7 @@ export default class AddressablesManageToolHandler extends BaseToolHandler {
141
141
  await this.unityConnection.connect();
142
142
  }
143
143
 
144
- const result = await this.unityConnection.sendCommand('addressables_manage', {
144
+ const result = await this.unityConnection.sendCommand('manage_addressables', {
145
145
  action,
146
146
  ...parameters
147
147
  });
@@ -5,7 +5,7 @@ import { BaseToolHandler } from '../base/BaseToolHandler.js';
5
5
  */
6
6
  export class InputSystemControlToolHandler extends BaseToolHandler {
7
7
  constructor(unityConnection) {
8
- super('input_system_control', 'Main handler for Input System operations', {
8
+ super('control_input_system', 'Main handler for Input System operations', {
9
9
  type: 'object',
10
10
  properties: {
11
11
  operation: {
@@ -127,7 +127,7 @@ function validateTouchAction(params, context = 'action') {
127
127
  */
128
128
  export class InputTouchToolHandler extends BaseToolHandler {
129
129
  constructor(unityConnection) {
130
- super('input_touch', 'Touch input (tap/swipe/pinch/multi) with batching.', {
130
+ super('simulate_touch', 'Touch input (tap/swipe/pinch/multi) with batching.', {
131
131
  type: 'object',
132
132
  properties: {
133
133
  ...actionProperties,
@@ -181,7 +181,7 @@ export class InputTouchToolHandler extends BaseToolHandler {
181
181
  const hasBatch = Array.isArray(params.actions) && params.actions.length > 0;
182
182
  const payload = hasBatch ? { actions: params.actions } : params;
183
183
 
184
- const result = await this.unityConnection.sendCommand('input_touch', payload);
184
+ const result = await this.unityConnection.sendCommand('simulate_touch', payload);
185
185
  return result;
186
186
  }
187
187
  }
@@ -7,7 +7,7 @@ import { BaseToolHandler } from '../base/BaseToolHandler.js';
7
7
 
8
8
  export default class PackageManagerToolHandler extends BaseToolHandler {
9
9
  constructor(unityConnection) {
10
- super('package_manager', 'Manage Unity packages - search, install, remove, and list packages', {
10
+ super('manage_packages', 'Manage Unity packages - search, install, remove, and list packages', {
11
11
  type: 'object',
12
12
  properties: {
13
13
  action: {
@@ -84,7 +84,7 @@ export default class PackageManagerToolHandler extends BaseToolHandler {
84
84
  await this.unityConnection.connect();
85
85
  }
86
86
 
87
- const result = await this.unityConnection.sendCommand('package_managerr', {
87
+ const result = await this.unityConnection.sendCommand('manage_packages', {
88
88
  action,
89
89
  ...parameters
90
90
  });
@@ -30,6 +30,11 @@ export class ScriptEditSnippetToolHandler extends BaseToolHandler {
30
30
  description:
31
31
  'If true, run validation and return preview text without writing to disk. Default=false.'
32
32
  },
33
+ skipValidation: {
34
+ type: 'boolean',
35
+ description:
36
+ 'If true, skip LSP validation for faster execution. Lightweight syntax checks (brace balance) are still performed. Use for simple edits on large files. Default=false.'
37
+ },
33
38
  instructions: {
34
39
  type: 'array',
35
40
  minItems: 1,
@@ -114,6 +119,7 @@ export class ScriptEditSnippetToolHandler extends BaseToolHandler {
114
119
  const info = await this.projectInfo.get();
115
120
  const { relative, absolute } = this.#resolvePaths(info, params.path);
116
121
  const preview = params.preview === true;
122
+ const skipValidation = params.skipValidation === true;
117
123
  const instructions = params.instructions;
118
124
 
119
125
  let original;
@@ -142,7 +148,13 @@ export class ScriptEditSnippetToolHandler extends BaseToolHandler {
142
148
  }
143
149
 
144
150
  if (working === original) {
145
- return this.#buildResponse({ preview, results, original, updated: working });
151
+ return this.#buildResponse({
152
+ preview,
153
+ results,
154
+ original,
155
+ updated: working,
156
+ validationSkipped: skipValidation
157
+ });
146
158
  }
147
159
 
148
160
  // Pre-syntax check on edited content before LSP validation
@@ -154,19 +166,30 @@ export class ScriptEditSnippetToolHandler extends BaseToolHandler {
154
166
  );
155
167
  }
156
168
 
157
- const diagnostics = await this.#validateWithLsp(info, relative, working);
158
- const hasErrors = diagnostics.some(d => this.#severityIsError(d.severity));
159
- if (hasErrors) {
160
- const first = diagnostics.find(d => this.#severityIsError(d.severity));
161
- const msg = first?.message || 'syntax error';
162
- throw new Error(`syntax_error: ${msg}`);
169
+ // LSP validation (skip if skipValidation=true for large files)
170
+ let diagnostics = [];
171
+ if (!skipValidation) {
172
+ diagnostics = await this.#validateWithLsp(info, relative, working);
173
+ const hasErrors = diagnostics.some(d => this.#severityIsError(d.severity));
174
+ if (hasErrors) {
175
+ const first = diagnostics.find(d => this.#severityIsError(d.severity));
176
+ const msg = first?.message || 'syntax error';
177
+ throw new Error(`syntax_error: ${msg}`);
178
+ }
163
179
  }
164
180
 
165
181
  if (!preview) {
166
182
  await fs.writeFile(absolute, working, 'utf8');
167
183
  }
168
184
 
169
- return this.#buildResponse({ preview, results, original, updated: working, diagnostics });
185
+ return this.#buildResponse({
186
+ preview,
187
+ results,
188
+ original,
189
+ updated: working,
190
+ diagnostics,
191
+ validationSkipped: skipValidation
192
+ });
170
193
  }
171
194
 
172
195
  #resolvePaths(info, rawPath) {
@@ -279,12 +302,20 @@ export class ScriptEditSnippetToolHandler extends BaseToolHandler {
279
302
  return await this.lsp.validateText(relative, updatedText);
280
303
  }
281
304
 
282
- #buildResponse({ preview, results, original, updated, diagnostics = [] }) {
305
+ #buildResponse({
306
+ preview,
307
+ results,
308
+ original,
309
+ updated,
310
+ diagnostics = [],
311
+ validationSkipped = false
312
+ }) {
283
313
  const out = {
284
314
  success: true,
285
315
  applied: !preview,
286
316
  results,
287
317
  diagnostics,
318
+ validationSkipped,
288
319
  beforeHash: this.#hash(original),
289
320
  afterHash: this.#hash(updated)
290
321
  };