smooth-operator-mcp 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,272 @@
1
+ # Harness installation
2
+
3
+ ## Interactive wizard (one-command)
4
+
5
+ `smooth-operator install <harness>` is interactive by default — it asks 6 curated questions (mode, headless, allowed/blocked domains, page JavaScript, data directory) with recommended defaults in brackets. Omitting `<harness>` is allowed too: on a TTY the installer prompts for the target first (default `opencode`), while piped or CI environments print usage and exit instead. Use `smooth-operator install opencode --yes` to skip prompts and use recommended defaults. The wizard saves its choices to `~/.smooth-operator/config.json` (0600, symlink-safe) — mode, headless, domains, and allowEval are written exactly as answered on every run — and then registers the harness.
6
+
7
+ ### Personal Chrome (connect) helper
8
+
9
+ When you pick “personal Chrome” (mode `connect`), the wizard finds Chrome via `discovery.ts`, spawns `chrome --remote-debugging-port=9222 --user-data-dir=~/.smooth-operator/personal-chrome --no-first-run --no-default-browser-check` detached, and polls `http://127.0.0.1:9222/json/version` (300ms × 33, ~10s) until `live`. On success it writes `SMOOTH_OPERATOR_BROWSER_MODE=connect` and `SMOOTH_OPERATOR_BROWSER_URL=http://127.0.0.1:9222` for you. No manual `9222` knowledge needed. Non-interactive environments (no TTY or `CI` set) skip prompts entirely and apply the same recommended defaults as `--yes`. The `chrome://inspect` toggle remains as an advanced opt-in (see `docs/mcp-server.md`).
10
+
11
+ SmoothOperator speaks MCP over stdio. The `smooth-operator install <target>`
12
+ command registers that stdio server with a supported client. It uses
13
+ structured argument arrays and never invokes a shell.
14
+
15
+ Build or install the package first:
16
+
17
+ ```sh
18
+ npm run build
19
+ npm install -g .
20
+ smooth-operator install --help
21
+ ```
22
+
23
+ The supported targets are `claude-code`, `opencode`, `copilot`, `codex`,
24
+ `gemini`, `vscode`, `cursor`, `windsurf`, and `claude-desktop`. Aliases such as
25
+ `claude`, `github-copilot`, `codex-cli`, `gemini-cli`, and `vs-code` are also
26
+ accepted.
27
+
28
+ ## How the installer chooses a server command
29
+
30
+ For CLI clients, the installer passes the client's documented MCP command an
31
+ argv equivalent of:
32
+
33
+ ```text
34
+ smooth-operator
35
+ ```
36
+
37
+ When the command is run from the published npm bundle, GUI-oriented JSON
38
+ entries use:
39
+
40
+ ```text
41
+ /absolute/path/to/node /absolute/path/to/dist/smooth-operator.mjs
42
+ ```
43
+
44
+ as two structured fields (`command` and `args`). This avoids relying on the
45
+ GUI application's PATH. If you create a config by hand, use the absolute form
46
+ when the client is launched outside your shell. A path containing spaces is
47
+ safe because it is stored as an argument, not a shell command string.
48
+
49
+ The installer does not include environment secrets in generated entries. Set
50
+ server settings in the harness environment or in the harness's documented
51
+ environment map as appropriate.
52
+
53
+ ## Claude Code
54
+
55
+ The current Claude Code CLI supports a non-interactive stdio command:
56
+
57
+ ```sh
58
+ claude mcp add --scope user SmoothOperator -- smooth-operator
59
+ ```
60
+
61
+ The installer runs that command with each token as a separate argument. Verify
62
+ the result with:
63
+
64
+ ```sh
65
+ claude mcp get SmoothOperator
66
+ claude mcp list
67
+ ```
68
+
69
+ `--scope user` stores the server in the user configuration for all projects.
70
+ Use the CLI directly with `--scope project` when the entry belongs in a
71
+ repository's `.mcp.json`, because the installer intentionally does not write
72
+ project files without an explicit project target.
73
+
74
+ Official reference: <https://code.claude.com/docs/en/mcp>.
75
+
76
+ ## OpenCode
77
+
78
+ The current OpenCode CLI's `opencode mcp add` command opens an interactive
79
+ form. Passing `opencode mcp add SmoothOperator -- smooth-operator` is not a stable
80
+ non-interactive interface, so the installer does not invoke it. Instead, it
81
+ edits the documented JSON/JSONC config atomically and reports the path:
82
+
83
+ ```sh
84
+ smooth-operator install opencode
85
+ ```
86
+
87
+ The default global path is `~/.config/opencode/opencode.json`. If
88
+ `OPENCODE_CONFIG` is set, that file is used. `OPENCODE_CONFIG_DIR` selects the
89
+ config directory; an existing `opencode.jsonc` is preferred when the default
90
+ `opencode.json` is absent.
91
+ An explicitly selected `OPENCODE_CONFIG` (or test/config-path override) is
92
+ always used exactly, even when a sibling `opencode.jsonc` exists.
93
+
94
+ For a new or current v2 config, the installer writes:
95
+
96
+ ```json
97
+ {
98
+ "$schema": "https://opencode.ai/config.json",
99
+ "mcp": {
100
+ "servers": {
101
+ "SmoothOperator": {
102
+ "type": "local",
103
+ "command": ["smooth-operator"]
104
+ }
105
+ }
106
+ }
107
+ }
108
+ ```
109
+
110
+ If an existing config has the older server-name-directly-under-`mcp` shape,
111
+ the installer preserves that shape and writes the compatible local entry with
112
+ `enabled: true`. In the v2 `mcp.servers` shape, `disabled` is optional and
113
+ defaults to `false`; a matching entry with `disabled: false` or no `disabled`
114
+ field is idempotent, while `disabled: true` is an explicit conflict. In the
115
+ legacy shape, `enabled` defaults to `true`; `enabled: false` is likewise an
116
+ explicit conflict. If it has malformed `mcp` or malformed `mcp.servers`,
117
+ installation fails closed rather than replacing user data.
118
+ Comments and trailing commas are accepted as JSONC; a successful update writes
119
+ normalized JSON and creates a unique owner-only backup first.
120
+
121
+ After editing, run `opencode mcp list` or restart OpenCode. OpenCode also
122
+ supports adding the server interactively with `opencode mcp add`; that is the
123
+ official fallback when an administrator requires OpenCode to own the write.
124
+
125
+ Official references: <https://opencode.ai/v2/docs/mcp-servers> and
126
+ <https://opencode.ai/docs/cli/>.
127
+
128
+ ## GitHub Copilot CLI
129
+
130
+ The current Copilot CLI accepts a non-interactive local stdio command:
131
+
132
+ ```sh
133
+ copilot mcp add SmoothOperator -- smooth-operator
134
+ copilot mcp get SmoothOperator
135
+ copilot mcp list
136
+ ```
137
+
138
+ The persistent user configuration is normally `~/.copilot/mcp-config.json`.
139
+ `COPILOT_HOME` changes that directory. Copilot's interactive `/mcp add` form
140
+ is available if you need environment variables, a tool filter, or a remote
141
+ HTTP server. The installer only adds the local server and does not guess at
142
+ those optional settings.
143
+
144
+ Official references: <https://docs.github.com/en/copilot/how-tos/copilot-cli/customize-copilot/add-mcp-servers>
145
+ and <https://docs.github.com/en/copilot/reference/copilot-cli-reference/cli-command-reference>.
146
+
147
+ ## Codex CLI
148
+
149
+ Codex's current command for a global local server is:
150
+
151
+ ```sh
152
+ codex mcp add SmoothOperator -- smooth-operator
153
+ codex mcp get SmoothOperator
154
+ codex mcp list
155
+ ```
156
+
157
+ The entry is written to the user's Codex configuration (normally
158
+ `~/.codex/config.toml`). The installer targets the global scope. For a project
159
+ configuration, run the command from the project using the Codex-supported
160
+ project configuration mechanism and review the resulting TOML before sharing
161
+ it.
162
+
163
+ Official reference: <https://developers.openai.com/codex/mcp>.
164
+
165
+ ## Gemini CLI
166
+
167
+ Gemini CLI's current command places the server name and command before the
168
+ scope option:
169
+
170
+ ```sh
171
+ gemini mcp add SmoothOperator smooth-operator --scope user
172
+ gemini mcp list
173
+ ```
174
+
175
+ The installer uses this positional form. Gemini stores user settings under its
176
+ user settings directory; use `gemini mcp list` to confirm the selected scope.
177
+ The interactive `/mcp` command can reload servers after a configuration change.
178
+
179
+ Official references: <https://github.com/google-gemini/gemini-cli/blob/main/docs/cli/cli-reference.md>
180
+ and <https://google-gemini.github.io/gemini-cli/docs/cli/tutorials.html>.
181
+
182
+ ## Visual Studio Code
183
+
184
+ VS Code's CLI accepts a JSON server definition:
185
+
186
+ ```sh
187
+ code --add-mcp '{"name":"SmoothOperator","command":"smooth-operator","args":[]}'
188
+ ```
189
+
190
+ The installer sends one JSON argument to `code --add-mcp`, not a shell-quoted
191
+ string assembled from user input. MCP server configuration is managed by
192
+ VS Code's MCP settings UI and command-line integration.
193
+
194
+ Official reference: <https://code.visualstudio.com/docs/copilot/chat/mcp-servers>.
195
+
196
+ ## Cursor, Windsurf, and Claude Desktop
197
+
198
+ These clients use JSON configuration files, so the installer performs a
199
+ careful merge and writes atomically.
200
+
201
+ | Target | Default path |
202
+ | --- | --- |
203
+ | Cursor | `~/.cursor/mcp.json` |
204
+ | Windsurf | `~/.codeium/windsurf/mcp_config.json` |
205
+ | Claude Desktop (macOS) | `~/Library/Application Support/Claude/claude_desktop_config.json` |
206
+ | Claude Desktop (Windows) | `%APPDATA%/Claude/claude_desktop_config.json` |
207
+ | Claude Desktop (Linux) | `${XDG_CONFIG_HOME:-~/.config}/Claude/claude_desktop_config.json` |
208
+
209
+ The generated shape for these clients is:
210
+
211
+ ```json
212
+ {
213
+ "mcpServers": {
214
+ "SmoothOperator": {
215
+ "command": "smooth-operator",
216
+ "args": []
217
+ }
218
+ }
219
+ }
220
+ ```
221
+
222
+ When run from the packaged executable, `command` is the absolute Node path and
223
+ `args` contains the absolute bundled entrypoint, which is more reliable for a
224
+ GUI launch environment. Existing unrelated server entries are preserved.
225
+
226
+ The installer accepts JSONC comments and trailing commas, rejects malformed
227
+ roots and non-object `mcpServers`, rejects a conflicting existing
228
+ `SmoothOperator` entry, and refuses symlinked config files/directories. For an
229
+ existing file it creates an exclusive backup named `.bak`, `.bak.1`, and so on;
230
+ it never overwrites an earlier backup. Config and backup files are written with
231
+ owner-only permissions where the platform supports them.
232
+
233
+ Restart the client after editing. Claude Desktop may require a full quit and
234
+ relaunch; Cursor and Windsurf can reload MCP settings from their respective
235
+ MCP panels.
236
+
237
+ ## Manual fallback and cleanup
238
+
239
+ If a harness is not listed or its CLI schema has changed, inspect its official
240
+ MCP documentation and add the same stdio entry manually. Do not paste a shell
241
+ string into a field that expects an executable plus an argument array.
242
+
243
+ To remove the server, use the harness's removal command when available:
244
+
245
+ ```sh
246
+ claude mcp remove SmoothOperator
247
+ copilot mcp remove SmoothOperator
248
+ codex mcp remove SmoothOperator
249
+ gemini mcp remove SmoothOperator
250
+ ```
251
+
252
+ For JSON clients, remove only the `SmoothOperator` property and leave unrelated
253
+ settings intact. Keep a backup until the client starts successfully without
254
+ the server. Uninstalling the npm package does not remove any harness config,
255
+ downloaded files, browser profile, or backup; clean those separately after
256
+ review.
257
+
258
+ ## Troubleshooting
259
+
260
+ - **`command not found`:** install the package globally or use an absolute
261
+ Node-plus-bundle entry. A GUI application may not inherit your shell PATH.
262
+ - **CLI rejects the command:** check the official client version and inspect
263
+ `--help`; use the exact argv printed by the installer error or edit the
264
+ config manually. OpenCode's add command is intentionally interactive.
265
+ - **Existing config is rejected:** inspect the file for malformed JSON,
266
+ non-object `mcpServers`/`mcp` values, a symlink, or a conflicting
267
+ `SmoothOperator` entry. The fail-closed behavior protects unrelated settings.
268
+ - **No tools after installation:** close and restart the harness, then list
269
+ its MCP servers. Run `smooth-operator --version` directly to verify the
270
+ executable before debugging the harness.
271
+ - **A backup already exists:** the installer uses `.bak.1`, `.bak.2`, and so on;
272
+ inspect the returned path instead of assuming `.bak` was replaced.