semantic-js-mcp 0.10.2 → 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 ADDED
@@ -0,0 +1,1078 @@
1
+ # Setup Instructions
2
+
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.
5
+
6
+ ## Guards
7
+
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.
306
+
307
+ Setup does not authorize source-code analysis. No source-code call is required
308
+ to verify installation unless the user separately requests a functional test.
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
+
317
+ ## Prerequisites
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
+
331
+ Run:
332
+
333
+ ```bash
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
348
+ rg --version
349
+ ```
350
+
351
+ - If the command succeeds, continue at Section 3.
352
+ - If it fails, stop and report `blocked`.
353
+
354
+ Installing ripgrep is a separate system change and requires the user's
355
+ approval.
356
+
357
+ ## Choose A Version
358
+
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.
376
+
377
+ Run:
378
+
379
+ ```bash
380
+ npm view semantic-js-mcp version
381
+ ```
382
+
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.
388
+
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.
394
+
395
+ ## Install With Codex
396
+
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.
403
+
404
+ #### 4.1 Check The Codex Version
405
+
406
+ Run:
407
+
408
+ ```bash
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
420
+ codex plugin marketplace list
421
+ ```
422
+
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
+ ```
432
+
433
+ Record the offered and installed Semantic JS MCP versions, when present.
434
+ Continue at Section 4.4.
435
+
436
+ #### 4.4 Add Or Refresh The Marketplace
437
+
438
+ If marketplace `elnonathan` is absent, run:
439
+
440
+ ```bash
441
+ codex plugin marketplace add elnonathan/semantic-js-mcp
442
+ ```
443
+
444
+ If marketplace `elnonathan` is present, run instead:
445
+
446
+ ```bash
447
+ codex plugin marketplace upgrade elnonathan
448
+ ```
449
+
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
454
+
455
+ Run:
456
+
457
+ ```bash
458
+ codex plugin list
459
+ ```
460
+
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`.
464
+
465
+ #### 4.6 Install The Plugin
466
+
467
+ Run:
468
+
469
+ ```bash
470
+ codex plugin add semantic-js-mcp@elnonathan
471
+ ```
472
+
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
+ ```
485
+
486
+ - If the requested version is `installed, enabled`, continue at Section 4.8.
487
+ - Otherwise, stop and report `blocked`.
488
+
489
+ #### 4.8 Restart Codex
490
+
491
+ Start a new Codex session. An agent cannot restart its own active session.
492
+
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.
495
+
496
+ ## Install With Another MCP Host
497
+
498
+ ### 5. Install In Another MCP Host
499
+
500
+ Use this section only for the application recorded in Section 1.2.
501
+
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.
506
+
507
+ #### 5.1 Confirm The Host Configuration
508
+
509
+ If the host application name is not already known, ask:
510
+
511
+ > I cannot identify the current host application. Which application should I configure?
512
+
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.
517
+
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.
554
+
555
+ Treat `EPERM`, `EACCES`, `TAR_ENTRY_ERROR`, or a missing-file error as a partial installation.
556
+
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.
560
+
561
+ #### 5.3 Check The Installed Version
562
+
563
+ Ask the user to run:
564
+
565
+ ```bash
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
583
+ semantic-js-mcp doctor
584
+ ```
585
+
586
+ Wait for the complete output.
587
+
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.
592
+
593
+ Do not shorten or filter the doctor output.
594
+
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:
599
+
600
+ - server name: `semanticjsmcp`
601
+ - transport: `stdio`
602
+ - executable or command: `semantic-js-mcp`
603
+ - arguments: one argument, `serve`
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`.
617
+
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.
623
+
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.
629
+
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.
634
+
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.
647
+
648
+ ## Verify The Installation
649
+
650
+ ### 6. Verify The Current State
651
+
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.
655
+
656
+ #### 6.1 Verify Codex
657
+
658
+ Use this section only when the recorded host route is `Codex direct`.
659
+
660
+ Run:
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
+
684
+ ```bash
685
+ semantic-js-mcp --version
686
+ ```
687
+
688
+ ```bash
689
+ semantic-js-mcp doctor
690
+ ```
691
+
692
+ The version must match. Doctor must report `pass` or `untrusted`.
693
+
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:
696
+
697
+ ```bash
698
+ npm run check:runtime
699
+ ```
700
+
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.
710
+
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.
714
+
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
720
+ available;
721
+ - `pending-restart`: installation and configuration succeeded, but a new host
722
+ session is still needed; or
723
+ - `blocked`: a prerequisite, installation, configuration, doctor, version, or
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.
732
+
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.
735
+
736
+ #### 6.4 Run An Optional Functional Test
737
+
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.
751
+
752
+ ## Troubleshooting
753
+
754
+ ### 7. When Something Goes Wrong
755
+
756
+ Troubleshooting identifies the next safe step. It does not authorize bypassing
757
+ a security control or ignoring an earlier error.
758
+
759
+ #### 7.1 If npm Shows A Permission Or Extraction Error
760
+
761
+ This includes `EPERM`, `EACCES`, `TAR_ENTRY_ERROR`, `Operation not permitted`,
762
+ or a missing-file error.
763
+
764
+ The installation is incomplete, even if npm returned exit code `0` or the
765
+ version command works.
766
+
767
+ Stop. Do not run doctor and do not edit the host configuration.
768
+
769
+ With the user's approval, remove the incomplete global installation:
770
+
771
+ ```bash
772
+ npm uninstall --global semantic-js-mcp
773
+ ```
774
+
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.
896
+
897
+ ## Rollback
898
+
899
+ ### 9. Restore A Previous Version
900
+
901
+ #### 9.1 Record The Previous Version
902
+
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
907
+
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`.
917
+
918
+ Do not edit the Codex marketplace cache or substitute another version.
919
+
920
+ ## Removal
921
+
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.
928
+
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:
944
+
945
+ ```bash
946
+ codex plugin remove semantic-js-mcp@elnonathan
947
+ ```
948
+
949
+ Remove marketplace `elnonathan` only when no other plugin uses it and the user
950
+ approves:
951
+
952
+ ```bash
953
+ codex plugin marketplace remove elnonathan
954
+ ```
955
+
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.
967
+
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:
972
+
973
+ ```bash
974
+ npm uninstall --global semantic-js-mcp
975
+ ```
976
+
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.
984
+
985
+ ## Source Checkout
986
+
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
991
+ installation.
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
+
999
+ From the repository root, run:
1000
+
1001
+ ```bash
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
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
1024
+ npm run doctor
1025
+ ```
1026
+
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
1038
+ schema and these values:
1039
+
1040
+ - server name: `semanticjsmcp`
1041
+ - transport: `stdio`
1042
+ - executable or command: `node`
1043
+ - arguments: the absolute path to the checkout's `server.mjs`
1044
+
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.
1048
+
1049
+ Preserve every unrelated host entry. Restart or reload the host. Do not run the
1050
+ global executable checks for this route.
1051
+
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.
1059
+
1060
+ ## Background
1061
+
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.
1067
+
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.
1071
+
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.
1074
+
1075
+ This procedure does not override system, developer, organization, repository,
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.