semantic-js-mcp 0.10.3 → 0.10.4

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/SETUP.md CHANGED
@@ -1,93 +1,439 @@
1
- # Setup
1
+ # Setup Instructions
2
2
 
3
- This guide provides one setup procedure for both people and coding agents. For
4
- a new installation, complete Guards, Prerequisites, Choose A Version, one
5
- installation route, and Verify The Installation in that order.
6
-
7
- For an update, rollback, removal, or source checkout, go directly to the named
8
- section and follow its references to the shared verification steps.
3
+ Use these instructions one numbered step at a time. Do not skip a step. Each
4
+ step says where to continue or when to stop.
9
5
 
10
6
  ## Guards
11
7
 
12
- Setup changes software or MCP configuration on the user's machine. Before
13
- making a change, confirm all of the following:
14
-
15
- 1. The user explicitly requested the setup operation.
16
- 2. Choose exactly one installation route. Use the Codex route for Codex and the
17
- generic stdio route for another compatible MCP host.
18
- 3. Keep the package out of the current project's dependencies.
19
- Do not run `npm install semantic-js-mcp` without `--global`.
20
- 4. Inspect existing MCP configuration before editing it, and preserve every
21
- unrelated server and setting.
22
- 5. Obtain any approval required for network access, global installation,
23
- configuration changes, cleanup, or restart.
24
- 6. Respect the security policy and configuration schema of the operating
25
- system, organization, repository, and MCP host.
26
-
27
- If a guard cannot be satisfied, stop and report `blocked` with the specific
28
- reason. Do not continue from a failed command, a partial installation, or an
29
- unknown configuration format.
8
+ ### 1. Start Here
9
+
10
+ Keep this execution contract for the entire procedure:
11
+
12
+ - one requested operation;
13
+ - one recorded host route;
14
+ - one host application name when generic configuration requires it;
15
+ - one recorded server source when maintaining an existing installation;
16
+ - one numbered step at a time;
17
+ - one command or configuration action before waiting for its complete result;
18
+ and
19
+ - no success report until the configured host application shows Semantic JS
20
+ MCP tools whose names start with `lsp_`, such as `lsp_document_symbols`.
21
+
22
+ Use the language of the user's latest message for explanations, questions,
23
+ expected results, stop conditions, and the final report. Keep commands,
24
+ identifiers, status values, and pasted output unchanged. Do not switch the
25
+ surrounding prose to English merely because this procedure is written in
26
+ English.
27
+
28
+ Do not replace the recorded host route because another
29
+ application, executable, plugin system, or package manager is available.
30
+
31
+ Complete Sections 1.1 through 1.4 before invoking any terminal, filesystem, package-manager, or host tool.
32
+
33
+ Until Section 1.4 records the command runner, do not inspect installations,
34
+ plugins, source checkouts, configuration files, executable paths, or package
35
+ state. Reading this procedure is not permission to inspect the user's machine.
36
+
37
+ #### 1.1 Identify The Requested Operation
38
+
39
+ Choose the operation the user requested:
40
+
41
+ - Record exactly one operation: `new installation`.
42
+ - Record exactly one operation: `verification`.
43
+ - Record exactly one operation: `update`.
44
+ - Record exactly one operation: `rollback`.
45
+ - Record exactly one operation: `removal`.
46
+ - Record exactly one operation: `source checkout`.
47
+ - If the request is unclear, ask one question and wait for the answer.
48
+ - After recording the operation, continue at Section 1.2.
49
+
50
+ Do not perform a different operation because it seems useful.
51
+
52
+ Recording `new installation`, `verification`, `update`, `rollback`, `removal`, or `source checkout` does not authorize a tool call.
53
+
54
+ After recording the operation, do not inspect anything. Continue directly at
55
+ Section 1.2.
56
+
57
+ #### 1.2 Record The Host Route
58
+
59
+ Record exactly one host route:
60
+
61
+ - `Codex direct`;
62
+ - `generic stdio`; or
63
+ - `no host`.
64
+
65
+ The host application and the host route are different facts. The host
66
+ application is the program that will load the MCP server. The host route says
67
+ whether this procedure has a documented direct integration for that
68
+ application.
69
+
70
+ The server source is a third fact. It records how the host obtains Semantic JS
71
+ MCP:
72
+
73
+ - `Codex plugin`;
74
+ - `global npm package`; or
75
+ - `source checkout`.
76
+
77
+ The host route does not identify the server source. A `generic stdio` host may
78
+ start either the global executable or `server.mjs` from a source checkout.
79
+
80
+ The application running the agent can also be the MCP host. Do not reject the
81
+ current application as a host merely because its name also identifies the
82
+ agent or command-line interface. For example, an agent running in
83
+ Factory/Droid may record `Factory/Droid` as the host application and
84
+ `generic stdio` as the host route.
85
+
86
+ Use a direct integration only after positive evidence identifies the application running this setup session.
87
+
88
+ For an agent, positive evidence is an explicit host identity supplied by the
89
+ session's system instructions, host interface, or dedicated integration. For a
90
+ person following this file without an agent, positive evidence is the coding
91
+ application that person is currently configuring and will restart. A web
92
+ browser or text viewer used only to read this file is not the host.
93
+
94
+ Apply these decisions in order:
95
+
96
+ 1. If the operation is `source checkout` and no host registration was
97
+ requested, record `no host`.
98
+ 2. Otherwise, if positive evidence identifies Codex as the application running
99
+ this setup session, record `Codex direct`.
100
+ 3. Otherwise, record `generic stdio`.
101
+
102
+ If no documented direct integration is positively identified, record `generic stdio` and continue without asking the user to identify the agent.
103
+
104
+ After recording `generic stdio`, choose the target host in this order:
105
+
106
+ 1. If the user already named the application to configure, record that exact
107
+ application and continue.
108
+ 2. Otherwise, if positive session evidence identifies the application running
109
+ the current session, recommend that application as the target host.
110
+ 3. Otherwise, ask for the application name because no target can be
111
+ identified.
112
+
113
+ When recommending the current application, state:
114
+
115
+ > Recommended target host: `<application>` using `generic stdio`. Confirm this
116
+ > target, or name a different application.
117
+
118
+ Wait for the answer. If the user confirms, record the recommended application.
119
+ If the user names another application, record that application instead. This
120
+ choice changes the target host, not the recorded `generic stdio` route.
121
+
122
+ Do not repeatedly ask for the application name after positive session evidence already identifies it. If the user asks who or what is running the session,
123
+ state both facts: the agent or interface identity and the application that is
124
+ the recommended MCP host.
125
+
126
+ Do not present direct integrations as a menu. Do not ask the user to choose
127
+ between Codex and another route. Do not infer a host from the model provider,
128
+ model name, installed programs, executable files, or a command that happens to
129
+ run successfully. Available MCP tools may corroborate that the already
130
+ identified current application loaded a server; they do not identify the
131
+ application by themselves.
132
+
133
+ The presence of an installed host executable is not positive host evidence.
134
+ The output of `codex --version`, `codex plugin marketplace list`, or
135
+ `codex plugin list` proves only that the Codex CLI can be inspected. It does
136
+ not authorize the `Codex direct` route.
137
+
138
+ Codex is the only direct integration documented in this version. A future
139
+ direct integration must define its own positive host evidence and recorded
140
+ route. Until then, every session without positive Codex evidence uses
141
+ `generic stdio`.
142
+
143
+ Continue at Section 1.3.
144
+
145
+ #### 1.3 Choose One Host Route
146
+
147
+ Choose exactly one installation route.
148
+
149
+ Apply that choice to a new installation.
150
+
151
+ For a new installation, record the server source from the selected path:
152
+
153
+ - `Codex direct` uses `Codex plugin`;
154
+ - `generic stdio` uses `global npm package`; and
155
+ - the `source checkout` operation uses `source checkout`.
156
+
157
+ For verification, update, rollback, or removal, do not infer the server source
158
+ from the host route. If the request already identifies it, record it. Otherwise,
159
+ inspect only the recorded Semantic JS MCP host entry after Section 1.4 records
160
+ the command runner. Record `global npm package` only when the entry launches
161
+ `semantic-js-mcp serve`. Record `source checkout` only when it launches `node`
162
+ with an absolute path to that checkout's `server.mjs`. A Codex plugin entry uses
163
+ `Codex plugin`. If the source cannot be confirmed, stop and report `blocked`.
164
+
165
+ Do not uninstall the global package merely because the host route is `generic
166
+ stdio`.
167
+
168
+ For verification, inspect only the recorded host entry and server source, then
169
+ continue at Section 6.
170
+ Do not install, update, remove, or reconfigure anything.
171
+
172
+ For an update, rollback, or removal, continue only with the recorded host route
173
+ and server source for the existing installation.
174
+
175
+ Do not inspect, modify, or remove an installation from another host route or
176
+ server source.
177
+
178
+ - If the operation is `source checkout` and the recorded host route is
179
+ `Codex direct`,
180
+ stop and report `blocked`. Source checkout registration is not supported by the Codex plugin route.
181
+ - If the operation is `source checkout` and the recorded host route is
182
+ `no host`, use Section 11.
183
+ - If the operation is `source checkout` and the recorded host route is
184
+ `generic stdio`, use Section 11.
185
+ - If the operation is `verification`, use Section 6.
186
+ - If the recorded host route is `Codex direct`, use Section 4.
187
+ - If the recorded host route is `generic stdio`, use Section 5.
188
+
189
+ Do not combine the Codex, generic package, and source checkout routes.
190
+
191
+ Do not run `npm install semantic-js-mcp` without `--global`.
192
+
193
+ Do not use `npx`, `npm exec`, `@latest`, or an npm cache as an installation route.
194
+
195
+ Before using the selected route, continue at Section 1.4.
196
+
197
+ #### 1.4 Decide Who Will Run Commands
198
+
199
+ Use these rules. Do not choose a different command runner.
200
+
201
+ - When the recorded host route is `Codex direct`, the agent may run the
202
+ read-only checks in Sections 2 and 3 and the official `codex plugin` commands
203
+ in Section 4. It must not install a global package or edit Codex
204
+ configuration another way. If a command is blocked, the user must run it.
205
+ - When the recorded host route is `generic stdio`, the user must run every
206
+ terminal command and every configuration action. The agent must provide one
207
+ command or action and wait for the complete result.
208
+ - For a source checkout with no host registration, the agent may run commands
209
+ inside the repository when its rules allow them.
210
+
211
+ The presence of a shell or command-execution tool does not allow the agent to
212
+ install a global package, run doctor, modify host configuration, or test
213
+ whether its sandbox permits those actions.
214
+
215
+ When the recorded host route is `generic stdio`, record `user` as the command runner.
216
+
217
+ Keep the user as command runner even for apparently harmless checks such as
218
+ `node --version`, `rg --version`, and `semantic-js-mcp --version`. These commands
219
+ have low side-effect risk, but they are not sandbox-neutral evidence:
220
+ the agent may observe a different `PATH`, Node version manager, global package
221
+ prefix, or installation from the user's normal terminal. `semantic-js-mcp
222
+ doctor` also starts provider processes and uses temporary directories, so the
223
+ user must run it for the generic route.
224
+
225
+ Do not invoke any tool that reads or changes the user's local machine.
226
+ This includes terminal, filesystem, package-manager, process, host-configuration,
227
+ and source-search tools. The agent must not perform even read-only local checks.
228
+
229
+ Do not inspect Codex, another direct integration, a global package, a source
230
+ checkout, or a host configuration on behalf of the user. Give the user the one
231
+ command or configuration action required by the current numbered step and wait
232
+ for the complete result.
233
+
234
+ When the recorded host route is `generic stdio`, do not change `HOME`,
235
+ `TMPDIR`, the npm prefix, the npm cache, the working directory, or the
236
+ installation directory to make a command run inside the agent. The user must
237
+ run the command in a normal terminal instead.
238
+
239
+ Once the user is required to run commands, the agent must not retry the same
240
+ operation inside its sandbox.
241
+
242
+ Continue at Section 1.5.
243
+
244
+ #### 1.5 Build One Command
245
+
246
+ Before running a command or giving it to the user, confirm all of these facts:
247
+
248
+ - the requested operation;
249
+ - the recorded host route;
250
+ - the host application name, when the generic route requires it;
251
+ - the server source, when the current operation requires it and it is already
252
+ known;
253
+ - the operating system and shell;
254
+ - the exact numeric package version, when already resolved;
255
+ - the current numbered step; and
256
+ - who will run the command.
257
+
258
+ The command must:
259
+
260
+ - perform one action;
261
+ - match the confirmed operating system and shell;
262
+ - contain no unresolved placeholder;
263
+ - quote a path when the shell requires it;
264
+ - modify only Semantic JS MCP or its recorded host entry; and
265
+ - use an official host command when one exists.
266
+
267
+ Do not join commands with `&&` or `;`. Do not shorten output with a pipe such
268
+ as `| head`. Do not use `sudo`, `chmod`, or `chown` to bypass a security or
269
+ sandbox restriction. Do not replace an entire configuration file.
270
+
271
+ When the user will run the command, present:
272
+
273
+ 1. the current section number;
274
+ 2. one sentence explaining the command;
275
+ 3. one command in a code block;
276
+ 4. the expected successful result;
277
+ 5. the result that requires stopping; and
278
+ 6. a request for the complete output.
279
+
280
+ Wait for the user's response before building another command.
281
+
282
+ Continue at Section 1.6.
283
+
284
+ #### 1.6 Evaluate One Result
285
+
286
+ Read the complete output of the command. Do not use only its exit code.
287
+
288
+ - Apply the success and failure conditions written in the current step before
289
+ using a command's exit code. For example, doctor may report `untrusted` with
290
+ a nonzero exit code and still allow the next documented step.
291
+ - If the step's success condition is met and no unhandled error is present,
292
+ continue to the next numbered step.
293
+ - If the output is incomplete, ask for the complete output and wait.
294
+ - If an agent-run command was blocked by its sandbox, continue at Section 7.2.
295
+ - If another command failed, the configuration format is unknown, or
296
+ installation is incomplete, stop and report `blocked`.
297
+ - If a step says to obtain approval, wait for that approval.
298
+
299
+ A later successful command does not erase an earlier incomplete installation.
300
+ Only the cleanup and clean reinstall described in Section 7.1 can clear it.
301
+
302
+ Setup changes software or MCP configuration on the user's machine. Inspect
303
+ existing MCP configuration before editing it, preserve every unrelated server
304
+ and setting, and obtain approval for global installation, configuration,
305
+ cleanup, or restart when the execution environment requires it.
30
306
 
31
307
  Setup does not authorize source-code analysis. No source-code call is required
32
308
  to verify installation unless the user separately requests a functional test.
33
309
 
310
+ - For a new installation, continue at Section 2.
311
+ - For verification, continue at Section 6.
312
+ - For an update, continue at Section 8.
313
+ - For a rollback, continue at Section 9.
314
+ - For removal, continue at Section 10.
315
+ - For a source checkout, continue at Section 11.
316
+
34
317
  ## Prerequisites
35
318
 
319
+ ### 2. Check The Required Programs
320
+
321
+ When the recorded host route is `Codex direct`, the agent may run each
322
+ read-only check in this section. If a check is blocked, ask the user to run that
323
+ one command and wait for the complete output.
324
+
325
+ When the recorded host route is `generic stdio`, ask the user to run Section
326
+ 2.1 and wait for the complete output. Then ask the user to run Section 2.2 and
327
+ wait again. Do not run these commands inside the agent.
328
+
329
+ #### 2.1 Check Node.js
330
+
36
331
  Run:
37
332
 
38
333
  ```bash
39
334
  node --version
335
+ ```
336
+
337
+ - If the command reports Node.js 22 or newer, continue at Section 2.2.
338
+ - If it is missing or older than 22, stop and report `blocked`.
339
+
340
+ Installing, replacing, or downgrading Node.js is a separate system change and
341
+ requires the user's approval.
342
+
343
+ #### 2.2 Check Ripgrep
344
+
345
+ Run:
346
+
347
+ ```bash
40
348
  rg --version
41
349
  ```
42
350
 
43
- Both commands must succeed. Semantic JS MCP requires Node.js 22 or newer and
44
- `rg` (ripgrep) on `PATH`.
351
+ - If the command succeeds, continue at Section 3.
352
+ - If it fails, stop and report `blocked`.
45
353
 
46
- If either prerequisite is missing, report `blocked`. Installing, replacing, or
47
- downgrading Node.js or ripgrep is a separate system change and requires the
48
- user's approval.
354
+ Installing ripgrep is a separate system change and requires the user's
355
+ approval.
49
356
 
50
357
  ## Choose A Version
51
358
 
52
- When the supplied npm URL ends in `/v/X.Y.Z`, use that exact numeric version.
53
- For example, `/v/0.10.2` requests version `0.10.2`.
359
+ ### 3. Resolve The Exact Version
360
+
361
+ #### 3.1 Check The Supplied URL
362
+
363
+ If the supplied npm URL ends in `/v/X.Y.Z`, record that numeric version. For
364
+ example, `/v/1.2.3` requests version `1.2.3`. Continue at Section 3.3.
365
+
366
+ If the URL does not contain a numeric version, continue at Section 3.2.
367
+
368
+ #### 3.2 Read The Current Registry Version
369
+
370
+ When the recorded host route is `Codex direct`, the agent may run this
371
+ read-only command. If it is blocked, ask the user to run it and wait for the
372
+ complete output.
373
+
374
+ When the recorded host route is `generic stdio`, ask the user to run this
375
+ command and wait for its complete output. Do not run it inside the agent.
54
376
 
55
- When no version is supplied for an installation or update, run:
377
+ Run:
56
378
 
57
379
  ```bash
58
380
  npm view semantic-js-mcp version
59
381
  ```
60
382
 
61
- Record the returned numeric version. Commands in this guide use `X.Y.Z` as a
62
- placeholder; replace it before execution. A command containing the literal
63
- `X.Y.Z` is not ready to run.
383
+ - If the command returns one numeric version, record it and continue at
384
+ Section 3.3.
385
+ - If the command fails or the result is unclear, stop and report `blocked`.
386
+
387
+ Do not silently substitute `latest`, an installed version, or a newer version.
64
388
 
65
- Do not silently substitute `latest`, an installed version, or a newer version
66
- for the version the user requested.
389
+ #### 3.3 Choose The Next Section
390
+
391
+ - For an update, return to Section 8.2.
392
+ - If the recorded host route is `Codex direct`, continue at Section 4.
393
+ - If the recorded host route is `generic stdio`, continue at Section 5.
67
394
 
68
395
  ## Install With Codex
69
396
 
70
- Use this route when Codex is the MCP host. The plugin supplies both the MCP
71
- server configuration and the semantic-navigation skill, so a separate global
72
- npm installation is unnecessary.
397
+ ### 4. Install In Codex
398
+
399
+ Use this section only when the recorded host route is `Codex direct`. For any
400
+ other route, return to Section 1.3. The Codex plugin installs the server
401
+ configuration and the semantic-navigation skill. A global npm installation is
402
+ not needed.
73
403
 
74
- ### 1. Inspect Codex State
404
+ #### 4.1 Check The Codex Version
75
405
 
76
406
  Run:
77
407
 
78
408
  ```bash
79
409
  codex --version
410
+ ```
411
+
412
+ - If Codex CLI is version 0.144.4 or newer, continue at Section 4.2.
413
+ - Otherwise, stop and report `blocked`.
414
+
415
+ #### 4.2 Inspect The Marketplace
416
+
417
+ Run:
418
+
419
+ ```bash
80
420
  codex plugin marketplace list
81
- codex plugin list
82
421
  ```
83
422
 
84
- Codex CLI must be version 0.144.4 or newer. The two list commands establish
85
- whether the marketplace or plugin already exists. There is no need to locate
86
- or edit a Codex configuration file.
423
+ Record whether marketplace `elnonathan` is present. Continue at Section 4.3.
424
+
425
+ #### 4.3 Inspect The Plugin
426
+
427
+ Run:
428
+
429
+ ```bash
430
+ codex plugin list
431
+ ```
87
432
 
88
- If the Codex version is too old, report `blocked`.
433
+ Record the offered and installed Semantic JS MCP versions, when present.
434
+ Continue at Section 4.4.
89
435
 
90
- ### 2. Add Or Refresh The Marketplace
436
+ #### 4.4 Add Or Refresh The Marketplace
91
437
 
92
438
  If marketplace `elnonathan` is absent, run:
93
439
 
@@ -95,13 +441,16 @@ If marketplace `elnonathan` is absent, run:
95
441
  codex plugin marketplace add elnonathan/semantic-js-mcp
96
442
  ```
97
443
 
98
- If marketplace `elnonathan` is already present, refresh it instead:
444
+ If marketplace `elnonathan` is present, run instead:
99
445
 
100
446
  ```bash
101
447
  codex plugin marketplace upgrade elnonathan
102
448
  ```
103
449
 
104
- ### 3. Confirm The Offered Version
450
+ - If the selected command succeeds, continue at Section 4.5.
451
+ - If it fails, stop and report `blocked`.
452
+
453
+ #### 4.5 Confirm The Offered Version
105
454
 
106
455
  Run:
107
456
 
@@ -109,268 +458,583 @@ Run:
109
458
  codex plugin list
110
459
  ```
111
460
 
112
- Find `semantic-js-mcp@elnonathan` and confirm that its offered version matches
113
- the version recorded in Choose A Version. If it differs, report `blocked`
114
- instead of installing a different release.
461
+ - If `semantic-js-mcp@elnonathan` offers the version recorded in Section 3,
462
+ continue at Section 4.6.
463
+ - If it offers another version, stop and report `blocked`.
115
464
 
116
- ### 4. Install The Plugin
465
+ #### 4.6 Install The Plugin
117
466
 
118
467
  Run:
119
468
 
120
469
  ```bash
121
470
  codex plugin add semantic-js-mcp@elnonathan
122
- codex plugin list
123
471
  ```
124
472
 
125
- The final list must show `semantic-js-mcp@elnonathan` as `installed, enabled`
126
- at the requested version.
473
+ - If the command succeeds, continue at Section 4.7.
474
+ - If it fails, stop and report `blocked`.
475
+
476
+ Do not also run `npm install` or `semantic-js-mcp doctor` for the Codex route.
477
+
478
+ #### 4.7 Confirm The Installed Plugin
479
+
480
+ Run:
481
+
482
+ ```bash
483
+ codex plugin list
484
+ ```
127
485
 
128
- Do not also run `npm install` or `semantic-js-mcp doctor` for this route. The
129
- plugin owns the package and server configuration.
486
+ - If the requested version is `installed, enabled`, continue at Section 4.8.
487
+ - Otherwise, stop and report `blocked`.
130
488
 
131
- ### 5. Restart Codex
489
+ #### 4.8 Restart Codex
132
490
 
133
- Start a new Codex session so it can load the plugin. A coding agent cannot
134
- restart its own active session; in that case, report `pending-restart` and ask
135
- the user to start the new session.
491
+ Start a new Codex session. An agent cannot restart its own active session.
136
492
 
137
- After restart, continue with Verify The Installation.
493
+ - If the user must start the new session, report `pending-restart` and wait.
494
+ - After the new session starts, continue at Section 6.1.
138
495
 
139
496
  ## Install With Another MCP Host
140
497
 
141
- Use this route only when the application is not Codex and its official
142
- documentation confirms support for local MCP servers over `stdio`.
498
+ ### 5. Install In Another MCP Host
143
499
 
144
- ### 1. Confirm The Host Configuration
500
+ Use this section only for the application recorded in Section 1.2.
145
501
 
146
- Before installing the package:
502
+ The user runs every terminal command and configuration action in this section.
503
+ The agent provides one command or action, waits for the complete result, and
504
+ then decides whether to continue. The agent must not execute these steps
505
+ inside its own shell or sandbox.
147
506
 
148
- 1. identify the MCP host by name;
149
- 2. find its documented MCP configuration location and schema;
150
- 3. inspect the existing configuration;
151
- 4. record any existing Semantic JS MCP entry; and
152
- 5. preserve every unrelated entry.
507
+ #### 5.1 Confirm The Host Configuration
153
508
 
154
- If the host, stdio support, configuration location, or schema cannot be
155
- confirmed, report `blocked`. Configuration formats are host-specific, so do
156
- not copy a filename, JSON shape, URL, or port from another application.
509
+ If the host application name is not already known, ask:
157
510
 
158
- ### 2. Install The Exact Global Version
511
+ > I cannot identify the current host application. Which application should I configure?
159
512
 
160
- Replace `X.Y.Z` with the recorded version, then run:
513
+ Ask this only when Section 1.2 could not identify or confirm a target host.
514
+ Wait for the answer and record the exact application name. The application
515
+ name locates the generic configuration; it does not change the recorded
516
+ `generic stdio` route into a direct integration.
161
517
 
162
- ```bash
163
- npm install --global semantic-js-mcp@X.Y.Z
164
- ```
518
+ Before installing the package, confirm from the host's installed help or
519
+ official documentation:
520
+
521
+ - support for local MCP servers over `stdio`;
522
+ - the configuration location or official configuration command; and
523
+ - the exact configuration fields the host accepts.
524
+
525
+ When the host provides a configuration command, confirm the exact subcommand
526
+ grammar for the pending configuration action before constructing a command
527
+ that changes state. A command name is not enough to infer its argument grammar.
528
+ If the complete current help output was not already supplied, ask the user to
529
+ run the exact subcommand with `--help` and wait for that output.
530
+
531
+ Inspect the existing configuration and record any existing Semantic JS MCP
532
+ entry. Preserve every unrelated entry.
533
+
534
+ - If all facts are confirmed, continue at Section 5.2.
535
+ - If any fact is unknown, ask the user for the missing fact and wait. If it
536
+ cannot be confirmed, stop and report `blocked`.
537
+
538
+ Give the user one read-only command or one host-supported inspection action and
539
+ wait for the complete result. Do not inspect the local configuration inside the
540
+ agent.
541
+
542
+ Do not copy a path, JSON shape, URL, or port from another application.
543
+
544
+ #### 5.2 Install The Exact Global Version
545
+
546
+ Build the command by placing the numeric version recorded in Section 3
547
+ immediately after `npm install --global semantic-js-mcp@`. Confirm that the
548
+ finished command contains that exact numeric version and no placeholder. Give
549
+ the command to the user and wait for the complete npm output. Do not run it
550
+ inside the agent.
551
+
552
+ Read the complete npm output. A zero exit code is not enough when the output
553
+ also reports a permission or extraction problem.
165
554
 
166
- Read the complete npm output. A zero exit code is not sufficient when npm also
167
- reports a permission or extraction problem.
168
555
  Treat `EPERM`, `EACCES`, `TAR_ENTRY_ERROR`, or a missing-file error as a partial installation.
169
556
 
170
- Do not edit the host configuration after a partial installation. Remove the
171
- partial global package only with the user's approval, then report `blocked`
172
- with the npm error.
557
+ - If installation completes without those errors, continue at Section 5.3.
558
+ - If installation is partial, stop. Do not run doctor and do not edit the host
559
+ configuration. Continue at Section 7.1.
173
560
 
174
- ### 3. Check The Executable
561
+ #### 5.3 Check The Installed Version
175
562
 
176
- Run:
563
+ Ask the user to run:
177
564
 
178
565
  ```bash
179
566
  semantic-js-mcp --version
567
+ ```
568
+
569
+ Wait for the complete output.
570
+
571
+ - If it exactly matches the version recorded in Section 3, continue at
572
+ Section 5.4.
573
+ - Otherwise, stop and continue at Section 7.5.
574
+
575
+ The version command succeeding does not prove that an earlier partial
576
+ installation became complete.
577
+
578
+ #### 5.4 Run Doctor
579
+
580
+ Ask the user to run:
581
+
582
+ ```bash
180
583
  semantic-js-mcp doctor
181
584
  ```
182
585
 
183
- The version must exactly match the requested version. Interpret the structured
184
- doctor status as follows:
586
+ Wait for the complete output.
185
587
 
186
- - `pass`: continue;
187
- - `untrusted`: continue, but preserve the reported uncertainty;
188
- - `blocked` or `fail`: do not configure the host until the reported problem is
189
- corrected with the user's approval.
588
+ - If doctor reports `pass`, continue at Section 5.5.
589
+ - If doctor reports `untrusted`, record the reported uncertainty and continue
590
+ at Section 5.5.
591
+ - If doctor reports `fail` or `blocked`, stop and continue at Section 7.3.
190
592
 
191
- ### 4. Register The Server
593
+ Do not shorten or filter the doctor output.
192
594
 
193
- Using the host's documented schema, add one server with these values:
595
+ #### 5.5 Register The Server
596
+
597
+ Use only the configuration method and fields confirmed in Section 5.1. Ask the
598
+ user to add one entry with these values:
194
599
 
195
600
  - server name: `semanticjsmcp`
196
601
  - transport: `stdio`
197
602
  - executable or command: `semantic-js-mcp`
198
603
  - arguments: one argument, `serve`
199
- - enabled: `true`, only when the host schema defines an enabled field
604
+ - enabled: `true`, only if the host defines that field
605
+
606
+ Do not construct the add command unless Section 5.1 recorded its exact current
607
+ grammar. If that grammar is missing, return to Section 5.1 before showing any
608
+ state-changing command.
609
+
610
+ Change only the Semantic JS MCP entry. Do not replace the entire configuration
611
+ file. Do not add an environment variable unless the host documents that field
612
+ and a previous numbered step established why it is needed.
613
+
614
+ - Give the user one safe host-supported action and wait for the result.
615
+ - If the entry is saved and validated, continue at Section 5.6.
616
+ - If the configuration format is uncertain, stop and report `blocked`.
200
617
 
201
- Save the smallest possible configuration change and preserve every unrelated
202
- entry. Do not add a URL, port, shell command, credentials, or background
203
- service.
618
+ An added-entry message is not enough. Compare the host's reported transport,
619
+ command, and arguments with the requested values. The executable must be
620
+ exactly `semantic-js-mcp` and its only argument must be `serve`. A reported
621
+ command such as `stdio semantic-js-mcp serve` is incorrect because `stdio`
622
+ became part of the executable command.
204
623
 
205
- Do not start `semantic-js-mcp serve` manually. The MCP host must start the
206
- process and communicate with it through standard input and standard output.
624
+ When the host provides a status or list command, ask the user to run it before
625
+ restart and wait for the complete output. Preserve unrelated entries. If the
626
+ new entry reports `failed`, do not continue to restart. Remove only the broken
627
+ Semantic JS MCP entry using the documented method, then continue at Section
628
+ 7.7.
207
629
 
208
- ### 5. Restart The Host
630
+ Do not start `semantic-js-mcp serve` manually. Do not pipe JSON-RPC messages to
631
+ it, run it in the background, or start a second server to test the first one.
632
+ The configured host application must start it over standard input and standard
633
+ output.
209
634
 
210
- Restart or reload the host exactly as its documentation requires, then continue
211
- with Verify The Installation.
635
+ A manually started server does not prove that the configured host application loaded the MCP tools.
636
+
637
+ #### 5.6 Restart The Host
638
+
639
+ Ask the user to restart or reload the host exactly as its documentation
640
+ requires. Wait for confirmation.
641
+
642
+ - If the host confirms that it already reloaded the entry and its MCP tool list
643
+ contains the `lsp_` tools, treat the reload as complete and continue at
644
+ Section 6.2.
645
+ - Until the user confirms the restart, report `pending-restart` and wait.
646
+ - After restart, continue at Section 6.2.
212
647
 
213
648
  ## Verify The Installation
214
649
 
215
- Verification occurs after the required restart or reload.
650
+ ### 6. Verify The Current State
216
651
 
217
- ### Codex
652
+ For a `verification` operation, use this section without changing the existing
653
+ installation. A restart is required only when an earlier step changed the host
654
+ entry or the host requires it to refresh MCP tools.
218
655
 
219
- 1. Run `codex plugin list`.
220
- 2. Confirm that `semantic-js-mcp@elnonathan` is `installed, enabled` at the
221
- requested version.
222
- 3. Open the MCP tool list in the new Codex session.
656
+ #### 6.1 Verify Codex
223
657
 
224
- ### Another MCP Host
658
+ Use this section only when the recorded host route is `Codex direct`.
225
659
 
226
660
  Run:
227
661
 
662
+ ```bash
663
+ codex plugin list
664
+ ```
665
+
666
+ Confirm that `semantic-js-mcp@elnonathan` is `installed, enabled` at the
667
+ requested version. Open the MCP tool list in the new Codex session.
668
+
669
+ - If tools whose names start with `lsp_` are present, continue at
670
+ Section 6.3.
671
+ - If they are absent, continue at Section 7.7.
672
+
673
+ #### 6.2 Verify Another MCP Host
674
+
675
+ Use this section only when the recorded host route is `generic stdio`.
676
+
677
+ First confirm the recorded Semantic JS MCP host entry and use its command and
678
+ arguments to record the server source.
679
+
680
+ If the server source is `global npm package`, ask the user to run these as
681
+ separate steps. Wait for and evaluate each complete result before giving the
682
+ next command:
683
+
228
684
  ```bash
229
685
  semantic-js-mcp --version
686
+ ```
687
+
688
+ ```bash
230
689
  semantic-js-mcp doctor
231
690
  ```
232
691
 
233
- The version must match. Doctor must return `pass` or `untrusted`; preserve any
234
- uncertainty reported by `untrusted`.
692
+ The version must match. Doctor must report `pass` or `untrusted`.
235
693
 
236
- Confirm that the host still contains the `semanticjsmcp` entry, then open the
237
- host's MCP tool list.
694
+ If the server source is `source checkout`, confirm its repository root and ask
695
+ the user to run these as separate steps from that root:
238
696
 
239
- ### Expected Result
697
+ ```bash
698
+ npm run check:runtime
699
+ ```
240
700
 
241
- The host must expose tools whose base names begin with `lsp_`. Some hosts add
242
- the server name as a prefix.
701
+ ```bash
702
+ npm run doctor
703
+ ```
704
+
705
+ The runtime check must succeed. Doctor must report `pass` or `untrusted`. Do not
706
+ run global executable checks for a source checkout.
707
+
708
+ After the checks for the recorded server source pass, confirm that the host
709
+ still contains the recorded `semanticjsmcp` entry, then open its MCP tool list.
243
710
 
244
- Use one of these outcomes:
711
+ - If tools whose names start with `lsp_` are present, continue at
712
+ Section 6.3.
713
+ - If they are absent, continue at Section 7.7.
245
714
 
246
- - `success`: the requested version is registered and `lsp_*` tools are
715
+ #### 6.3 Report The Result
716
+
717
+ Use exactly one outcome:
718
+
719
+ - `success`: the requested version is registered and the `lsp_` tools are
247
720
  available;
248
721
  - `pending-restart`: installation and configuration succeeded, but a new host
249
- session is still required to check tool discovery;
722
+ session is still needed; or
250
723
  - `blocked`: a prerequisite, installation, configuration, doctor, version, or
251
- tool-discovery check failed.
724
+ tool check failed.
725
+
726
+ Package installation by itself is not `success`.
727
+
728
+ Report the recorded host route, configured host application, requested version,
729
+ installed version, changed Semantic JS MCP entry, doctor status for a generic
730
+ host, tool result, and any remaining problem. Do not expose credentials or
731
+ unrelated configuration.
252
732
 
253
- Package installation or configuration text by itself is not `success`. Missing
254
- tools are a reason to inspect registration and restart state, not to start the
255
- server manually.
733
+ An installation-only request ends here. Do not call an `lsp_` tool against
734
+ source code unless the user separately requests a functional test.
256
735
 
257
- An installation-only request ends after tool discovery. Do not call an `lsp_*`
258
- tool against source code unless the user separately requests a functional test
259
- or explicitly approves the target file.
736
+ #### 6.4 Run An Optional Functional Test
260
737
 
261
- Report the outcome, detected host, requested and installed versions, changed
262
- Semantic JS MCP entry, doctor status for a generic installation, tool-discovery
263
- result, and any remaining blocker or uncertainty. Do not expose credentials or
264
- unrelated configuration values.
738
+ Use this section only after Section 6.3 reports `success` and the user
739
+ separately requests a source-code test.
740
+
741
+ Confirm one repository root and one JavaScript, TypeScript, JSX, TSX, or Vue
742
+ source file. Use `lsp_document_symbols` on that file as the first functional
743
+ test. Do not start with the user's home directory, a parent containing multiple
744
+ repositories, or `lsp_workspace_symbols` with a common query such as `app` or
745
+ `test`.
746
+
747
+ A result limit may reduce presentation without reducing collection work. Keep
748
+ the first test narrow by selecting one file, not by applying a small result
749
+ limit to a broad workspace query. Report the literal collection status and any
750
+ error or uncertainty.
265
751
 
266
752
  ## Troubleshooting
267
753
 
268
- | Symptom | Action |
269
- | ------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- |
270
- | Node.js is older than 22 or `node` is missing | Report `blocked`. Change Node.js only with separate user approval. |
271
- | `rg` is missing | Report `blocked`. Install ripgrep only with separate user approval. |
272
- | npm reports `EPERM`, `EACCES`, `TAR_ENTRY_ERROR`, or a missing file | Treat the installation as partial. Do not configure the host. Remove only the partial global package when authorized. |
273
- | `semantic-js-mcp --version` differs from the requested version | Report `blocked`; do not configure the different version. |
274
- | Doctor returns `blocked` or `fail` | Correct only the reported prerequisite and only with user approval. |
275
- | Codex offers the wrong version | Run `codex plugin marketplace upgrade elnonathan`, check again, and report `blocked` if it still differs. |
276
- | The host does not show `lsp_*` tools | Confirm the saved entry, command, arguments, enabled state, and required restart. Do not invent a URL or port. |
277
- | The host configuration location or schema is unknown | Use installed help or official host documentation. Report `blocked` rather than guessing. |
278
-
279
- Troubleshooting never requires disabling a security control, bypassing a
280
- sandbox, executing a remote shell pipeline, or replacing an entire
281
- configuration file.
754
+ ### 7. When Something Goes Wrong
282
755
 
283
- ## Update
756
+ Troubleshooting identifies the next safe step. It does not authorize bypassing
757
+ a security control or ignoring an earlier error.
284
758
 
285
- Record the installed version and existing Semantic JS MCP entry first. Resolve
286
- the exact target version with Choose A Version.
759
+ #### 7.1 If npm Shows A Permission Or Extraction Error
287
760
 
288
- For Codex, run:
761
+ This includes `EPERM`, `EACCES`, `TAR_ENTRY_ERROR`, `Operation not permitted`,
762
+ or a missing-file error.
289
763
 
290
- ```bash
291
- codex plugin marketplace upgrade elnonathan
292
- codex plugin list
293
- codex plugin add semantic-js-mcp@elnonathan
294
- codex plugin list
295
- ```
764
+ The installation is incomplete, even if npm returned exit code `0` or the
765
+ version command works.
296
766
 
297
- Confirm the offered version before `plugin add`. Start a new Codex session,
298
- then complete Verify The Installation.
767
+ Stop. Do not run doctor and do not edit the host configuration.
299
768
 
300
- For another host, replace `X.Y.Z` and run:
769
+ With the user's approval, remove the incomplete global installation:
301
770
 
302
771
  ```bash
303
- npm install --global semantic-js-mcp@X.Y.Z
772
+ npm uninstall --global semantic-js-mcp
304
773
  ```
305
774
 
306
- Repeat the executable check, doctor, required restart, and Verify The
307
- Installation. Keep an existing host entry when it is already correct.
775
+ When the user must run commands, give only that command and wait for its
776
+ complete output. After removal succeeds, ask the user to run the exact
777
+ installation command from Section 5.2 outside the blocked agent. Wait for the
778
+ complete npm output again.
779
+
780
+ Only an uninstall followed by an error-free reinstall clears the incomplete
781
+ installation.
782
+
783
+ #### 7.2 If A Command Works For The User But Not For The Agent
784
+
785
+ The agent may be blocked from files or directories outside its allowed area.
786
+ This does not prove that the user's operating-system permissions are wrong.
787
+
788
+ Ask the user to run the command. Give one command, explain what it checks, and
789
+ wait for its complete output.
790
+
791
+ Do not use `sudo`, `chmod`, or `chown`. Do not ask the user to disable the
792
+ sandbox. Do not change `HOME`, `TMPDIR`, the npm prefix, the npm cache, or the
793
+ installation directory to retry inside the agent.
794
+
795
+ #### 7.3 If The Version Command Works But Doctor Fails
796
+
797
+ The executable exists, but Semantic JS MCP is not ready to register.
798
+
799
+ - If npm previously reported an error from Section 7.1, return to Section 7.1.
800
+ - Otherwise, read the complete doctor output and report the failed check.
801
+
802
+ Stop before editing the host configuration. Correct only the reported problem
803
+ and only with the user's approval.
804
+
805
+ #### 7.4 If A Temporary Directory Cannot Be Created
806
+
807
+ If the error contains a temporary path and `EPERM` or `Operation not permitted`,
808
+ the agent may be unable to write to that location.
809
+
810
+ Ask the user to run the same failing check in a normal terminal and wait for
811
+ the complete output.
812
+
813
+ Do not invent another temporary path. Use one only after the user confirms it
814
+ is writable and the host's configuration schema confirms how to provide it.
815
+
816
+ #### 7.5 If The Installed Version Is Different
817
+
818
+ Stop. Do not configure or verify the different version.
819
+
820
+ - If the recorded host route is `Codex direct`, return to Section 4.4 and
821
+ refresh the marketplace.
822
+ - If the recorded host route is `generic stdio`, obtain approval to remove the
823
+ incorrect global version, then return to Section 5.2 with the recorded
824
+ numeric version.
825
+
826
+ #### 7.6 If Doctor Says Untrusted
827
+
828
+ `untrusted` means doctor completed but could not fully confirm some semantic
829
+ evidence. It is not the same as `pass`, and it is not the same as `fail`.
830
+
831
+ Continue only when installation was clean. Record the uncertainty and continue
832
+ at Section 5.5 or Section 6.2, whichever sent you here.
833
+
834
+ #### 7.7 If The MCP Tools Do Not Appear
835
+
836
+ A host status of `failed` is a failure, not an expected pre-restart state. Do
837
+ not describe it as pending restart unless current host documentation explicitly
838
+ says that its status command cannot connect before restart.
839
+
840
+ Confirm, in this order:
841
+
842
+ 1. the exact add-command grammar from current help or official documentation;
843
+ 2. the saved server entry;
844
+ 3. the transport, command, and arguments;
845
+ 4. the enabled value, if the host uses one; and
846
+ 5. the required restart.
847
+
848
+ Perform and evaluate one check at a time. Do not start the server manually and
849
+ do not invent a URL or port.
850
+
851
+ #### 7.8 If A Configuration File Cannot Be Changed
852
+
853
+ Stop the attempted edit. Do not change file permissions and do not replace the
854
+ whole file.
855
+
856
+ Ask the user to use the host's official settings screen, configuration command,
857
+ or documented file format. Give the user one action and wait for the result.
858
+
859
+ #### 7.9 If Command Output Is Incomplete
860
+
861
+ Do not infer the result. Ask for the complete output without `head`, filtering,
862
+ or omitted lines. Wait before continuing.
863
+
864
+ #### 7.10 If Repeated Attempts Produce Different Errors
865
+
866
+ Stop retrying. Inspect the current installation and configuration again. Do
867
+ not assume that an earlier result still describes the machine.
868
+
869
+ Return to the numbered step that first failed and continue only after its
870
+ failure condition has been cleared.
871
+
872
+ ## Update
873
+
874
+ ### 8. Update An Existing Installation
875
+
876
+ #### 8.1 Record The Current State
877
+
878
+ Record the installed version, the existing Semantic JS MCP host entry, and the
879
+ server source. Preserve every unrelated setting.
880
+
881
+ Continue at Section 3 to resolve the exact target version.
882
+
883
+ #### 8.2 Follow The Recorded Host Route
884
+
885
+ - If the recorded host route is `Codex direct`, continue at Section 4.2.
886
+ Refresh the marketplace, confirm the offered version, install, restart, and
887
+ verify.
888
+ - If the recorded host route is `generic stdio` and the server source is
889
+ `global npm package`, continue at Section 5.2. Keep the existing entry when
890
+ its command and arguments are already correct.
891
+ - If the server source is `source checkout`, do not choose or change a source
892
+ revision. Ask the user to place the checkout at the intended revision, then
893
+ continue at Section 11.1. If that revision is unknown, report `blocked`.
894
+
895
+ Do not remove the working version before the replacement command is ready.
308
896
 
309
897
  ## Rollback
310
898
 
311
- Record the previously known working version and Semantic JS MCP entry. Do not
312
- replace that version with the current registry version.
899
+ ### 9. Restore A Previous Version
313
900
 
314
- For another host, replace `X.Y.Z` with the previous numeric version:
901
+ #### 9.1 Record The Previous Version
315
902
 
316
- ```bash
317
- npm install --global semantic-js-mcp@X.Y.Z
318
- ```
903
+ Use the exact numeric version that was previously known to work. Do not replace
904
+ it with the registry's current version.
905
+
906
+ #### 9.2 Follow The Host Route
319
907
 
320
- Restore only the recorded Semantic JS MCP entry. Restart the host and complete
321
- Verify The Installation.
908
+ - If the recorded host route is `generic stdio` and the server source is
909
+ `global npm package`, return to Section 5.2 using the recorded previous
910
+ version. Restore only the recorded Semantic JS MCP entry, restart, and verify.
911
+ - If the server source is `source checkout`, do not choose or change a source
912
+ revision. Ask the user to restore the previously known working revision, then
913
+ continue at Section 11.1. If that revision is unknown, report `blocked`.
914
+ - If the recorded host route is `Codex direct`, inspect the offered marketplace
915
+ version. If it does not offer the requested previous version, stop and report
916
+ `blocked`.
322
917
 
323
- A Codex marketplace can install only the version it currently offers. If it
324
- does not offer the requested rollback version, report `blocked`; do not
325
- substitute another version or edit the marketplace cache.
918
+ Do not edit the Codex marketplace cache or substitute another version.
326
919
 
327
920
  ## Removal
328
921
 
329
- Record the installed version and current Semantic JS MCP entry before making a
330
- change.
922
+ ### 10. Remove Semantic JS MCP
923
+
924
+ #### 10.1 Record The Current State
925
+
926
+ Record the installed version, the existing Semantic JS MCP entry, and the
927
+ server source before changing anything.
331
928
 
332
- For Codex, run:
929
+ Use only evidence from the recorded route. Do not inspect Codex when the route
930
+ is `generic stdio`. Do not search source directories during removal. When the
931
+ server source is `source checkout`, use the absolute `server.mjs` path from the
932
+ recorded host entry.
933
+
934
+ A similarly named file is not evidence of a Semantic JS MCP installation.
935
+
936
+ - If the recorded host route is `Codex direct`, continue at Section 10.2.
937
+ - If the recorded host route is `generic stdio`, continue at Section 10.3.
938
+
939
+ Do not use both removal routes.
940
+
941
+ #### 10.2 Remove It From Codex
942
+
943
+ Use this section only when the recorded host route is `Codex direct`. Run:
333
944
 
334
945
  ```bash
335
946
  codex plugin remove semantic-js-mcp@elnonathan
336
947
  ```
337
948
 
338
- Remove marketplace `elnonathan` only when no other installed plugin uses it
339
- and the user approves:
949
+ Remove marketplace `elnonathan` only when no other plugin uses it and the user
950
+ approves:
340
951
 
341
952
  ```bash
342
953
  codex plugin marketplace remove elnonathan
343
954
  ```
344
955
 
345
- For another host:
956
+ Run those commands separately. Restart Codex and confirm the tools are absent.
957
+ The removal ends here. Do not continue at Section 10.3.
958
+
959
+ #### 10.3 Remove It From Another Host
960
+
961
+ Use this section only when the recorded host route is `generic stdio`.
962
+
963
+ Before constructing a removal command, confirm the exact remove subcommand
964
+ grammar from complete current help or official documentation. If the host does
965
+ not provide a removal command, use only its documented settings or file-editing
966
+ method.
346
967
 
347
- 1. Remove only the `semanticjsmcp` entry from the documented host
348
- configuration.
349
- 2. Preserve every unrelated server and setting.
350
- 3. Run:
968
+ Then ask the user to remove only the recorded `semanticjsmcp` entry using that
969
+ documented method. Preserve every unrelated entry. Wait for confirmation.
970
+
971
+ If the recorded server source is `global npm package`, then ask the user to run:
351
972
 
352
973
  ```bash
353
974
  npm uninstall --global semantic-js-mcp
354
975
  ```
355
976
 
356
- Restart or reload the host. Confirm that Semantic JS MCP tools are no longer
357
- registered.
977
+ Wait for the complete output.
978
+
979
+ If the recorded server source is `source checkout`, do not run the global npm
980
+ uninstall. Do not delete the checkout. Removing source files is a separate
981
+ filesystem operation and requires an explicit request.
982
+
983
+ Restart the host and confirm that Semantic JS MCP tools are absent.
358
984
 
359
985
  ## Source Checkout
360
986
 
361
- Use this section for repository development or when the user explicitly asks
362
- to run a source checkout. Do not combine it with a registry or Codex plugin
987
+ ### 11. Use A Source Checkout
988
+
989
+ Use this section only for repository development or when the user explicitly
990
+ requests a source checkout. Do not combine it with a registry or Codex plugin
363
991
  installation.
364
992
 
993
+ The source checkout must already exist. If its root is not the current working
994
+ directory and the user did not provide it, ask for the root and wait. Do not
995
+ search the user's home directory or unrelated directories for a checkout.
996
+
997
+ #### 11.1 Install The Locked Dependencies
998
+
365
999
  From the repository root, run:
366
1000
 
367
1001
  ```bash
368
1002
  npm ci
1003
+ ```
1004
+
1005
+ - If it succeeds without installation errors, continue at Section 11.2.
1006
+ - If it fails, stop and report `blocked`.
1007
+
1008
+ #### 11.2 Check The Source Runtime
1009
+
1010
+ Run:
1011
+
1012
+ ```bash
369
1013
  npm run check:runtime
1014
+ ```
1015
+
1016
+ - If it succeeds, continue at Section 11.3.
1017
+ - If it fails, stop and report `blocked`.
1018
+
1019
+ #### 11.3 Run The Source Doctor
1020
+
1021
+ Run:
1022
+
1023
+ ```bash
370
1024
  npm run doctor
371
1025
  ```
372
1026
 
373
- For a non-Codex host that supports direct stdio commands, use its documented
1027
+ - If it reports `pass` or `untrusted` and the recorded host route is
1028
+ `no host`,
1029
+ report that the source checkout is ready and stop.
1030
+ - If it reports `pass` or `untrusted` and the recorded host route is
1031
+ `generic stdio`, continue at Section 11.4.
1032
+ - If the recorded host route is `Codex direct`, stop and report `blocked`.
1033
+ - If it reports `fail` or `blocked`, stop.
1034
+
1035
+ #### 11.4 Register The Source Server
1036
+
1037
+ For a non-Codex host that supports direct `stdio` commands, use its documented
374
1038
  schema and these values:
375
1039
 
376
1040
  - server name: `semanticjsmcp`
@@ -378,36 +1042,37 @@ schema and these values:
378
1042
  - executable or command: `node`
379
1043
  - arguments: the absolute path to the checkout's `server.mjs`
380
1044
 
381
- Preserve every unrelated host entry. Restart or reload the host and complete
382
- the source-checkout verification below. Do not run the global executable checks
383
- for this route.
1045
+ Before constructing a source-checkout registration command, confirm the exact
1046
+ add subcommand grammar from complete current help or official documentation.
1047
+ Do not reuse grammar recorded for another application.
384
1048
 
385
- After restart, confirm that the host still contains the `semanticjsmcp` entry
386
- with the recorded `node` command and absolute `server.mjs` argument. Open the
387
- host's MCP tool list and apply the outcomes under
388
- [Expected Result](#expected-result). Do not call an `lsp_*` tool unless the
389
- user separately requests a functional test or explicitly approves the target
390
- file.
1049
+ Preserve every unrelated host entry. Restart or reload the host. Do not run the
1050
+ global executable checks for this route.
391
1051
 
392
- The repository's `.mcp.json` is the relative-path configuration bundled by the
393
- Codex plugin. It is not a universal configuration file for other MCP hosts.
1052
+ After restart, confirm the recorded `node` command and absolute `server.mjs`
1053
+ argument, then open the host's MCP tool list. Apply the outcomes in Section
1054
+ 6.3. Do not call an `lsp_` tool unless the user separately requests a
1055
+ functional test.
1056
+
1057
+ The repository's `.mcp.json` is used by the Codex plugin. It is not a universal
1058
+ configuration file for other hosts.
394
1059
 
395
1060
  ## Background
396
1061
 
397
- An MCP host is the application that starts the server and exposes its tools.
398
- Installing an npm package places files and an executable on the machine, but it
399
- does not register that executable with an MCP host.
1062
+ ### 12. Why These Steps Exist
1063
+
1064
+ An MCP host is the application that starts Semantic JS MCP and exposes its
1065
+ tools. Installing the npm package places files and an executable on the
1066
+ machine. It does not register the server with an application.
400
1067
 
401
- A generic stdio host starts `semantic-js-mcp serve` as a child process and
402
- communicates through standard input and standard output. The host owns that
403
- process lifecycle, which is why manually starting the command does not make
404
- tools appear in the host.
1068
+ A generic host starts `semantic-js-mcp serve` and communicates with it through
1069
+ standard input and standard output. The host owns that process, so starting it
1070
+ manually does not make tools appear.
405
1071
 
406
- The Codex plugin route supplies both MCP configuration and the
407
- semantic-navigation skill. Codex plugin state and tool discovery verify that
408
- route, so it does not need a separate global npm installation or doctor run.
1072
+ The Codex plugin provides both server configuration and agent instructions.
1073
+ That is why the Codex route does not need a separate global npm installation.
409
1074
 
410
1075
  This procedure does not override system, developer, organization, repository,
411
- or host security policy. Its authority is limited to the requested Semantic JS
412
- MCP operation and never includes unrelated configuration, credentials, or
413
- source-code analysis.
1076
+ or host security policy. It is limited to the Semantic JS MCP operation the
1077
+ user requested. It does not authorize unrelated configuration changes,
1078
+ credentials access, or source-code analysis.