@plumpslabs/fennec-cli 1.13.4 → 1.13.6
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/README.md +204 -95
- package/dist/index.js +2469 -686
- package/dist/index.js.map +1 -1
- package/package.json +5 -2
package/README.md
CHANGED
|
@@ -21,14 +21,15 @@
|
|
|
21
21
|
|
|
22
22
|
## What is Fennec?
|
|
23
23
|
|
|
24
|
-
**Fennec** is an MCP (Model Context Protocol) server that bridges the gap between AI agents and your development environment. It gives your AI full-stack visibility
|
|
24
|
+
**Fennec** is an MCP (Model Context Protocol) server that bridges the gap between AI agents and your development environment. It gives your AI full-stack visibility — and, crucially, **full-stack control**:
|
|
25
25
|
|
|
26
26
|
- 🔍 **Observe** browser console logs, network requests, and performance metrics in real-time
|
|
27
|
-
- 🖥️ **
|
|
28
|
-
-
|
|
27
|
+
- 🖥️ **Run & watch** your apps as supervised background daemons (PM2-like) — logs, restart, health
|
|
28
|
+
- 🤝 **Adopt** processes an AI agent (or you) started via raw bash, so they're tracked instead of orphaned
|
|
29
29
|
- 🔐 **Persist** authentication sessions across conversations
|
|
30
30
|
- 🔗 **Correlate** events across layers to identify root causes automatically
|
|
31
31
|
- 🌐 **Cross-browser** support: Chromium, Firefox, WebKit
|
|
32
|
+
- 🪟 **Cross-platform**: Linux, macOS, and Windows
|
|
32
33
|
|
|
33
34
|
## Installation
|
|
34
35
|
|
|
@@ -63,124 +64,200 @@ npx playwright install chromium
|
|
|
63
64
|
|
|
64
65
|
## Quick Start
|
|
65
66
|
|
|
66
|
-
### 1.
|
|
67
|
+
### 1. Configure your MCP client
|
|
67
68
|
|
|
68
|
-
|
|
69
|
-
|
|
69
|
+
Add this to your MCP client's config file (e.g. `claude_desktop_config.json`, `~/.config/opencode/opencode.json`, Cline/Cursor settings):
|
|
70
|
+
|
|
71
|
+
```json
|
|
72
|
+
{
|
|
73
|
+
"mcpServers": {
|
|
74
|
+
"fennec": {
|
|
75
|
+
"command": "fennec",
|
|
76
|
+
"args": ["start"]
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
70
80
|
```
|
|
71
81
|
|
|
72
|
-
|
|
82
|
+
That's it — Fennec speaks **stdio** by default and needs no extra permissions to observe.
|
|
73
83
|
|
|
74
|
-
|
|
84
|
+
### 2. (Optional) Let the AI control processes
|
|
85
|
+
|
|
86
|
+
If you want your AI agent to **start, restart, and stop** apps for you, enable process
|
|
87
|
+
permissions. The recommended way is via environment variables in the MCP config:
|
|
75
88
|
|
|
76
89
|
```json
|
|
77
90
|
{
|
|
78
91
|
"mcpServers": {
|
|
79
92
|
"fennec": {
|
|
80
93
|
"command": "fennec",
|
|
81
|
-
"args": ["start"]
|
|
94
|
+
"args": ["start"],
|
|
95
|
+
"env": {
|
|
96
|
+
"FENNEC_SECURITY_ALLOW_PROCESS_SPAWN": "true",
|
|
97
|
+
"FENNEC_SECURITY_ALLOW_PROCESS_KILL": "true"
|
|
98
|
+
}
|
|
82
99
|
}
|
|
83
100
|
}
|
|
84
101
|
}
|
|
85
102
|
```
|
|
86
103
|
|
|
87
|
-
|
|
104
|
+
> Spawn is enabled by default; kill is off by default (safer). Set both to `true`
|
|
105
|
+
> only in trusted, local dev environments. See [Security & Environment Variables](#security--environment-variables).
|
|
88
106
|
|
|
89
|
-
|
|
90
|
-
|
|
107
|
+
### 3. (Optional) Run the server over SSE instead of stdio
|
|
108
|
+
|
|
109
|
+
```json
|
|
110
|
+
{
|
|
111
|
+
"mcpServers": {
|
|
112
|
+
"fennec": {
|
|
113
|
+
"command": "fennec",
|
|
114
|
+
"args": ["start", "--sse"],
|
|
115
|
+
"env": {
|
|
116
|
+
"FENNEC_SECURITY_ALLOW_PROCESS_SPAWN": "true",
|
|
117
|
+
"FENNEC_SECURITY_ALLOW_PROCESS_KILL": "true"
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
91
122
|
```
|
|
92
123
|
|
|
124
|
+
With `--sse`, Fennec starts an HTTP+SSE endpoint (default `http://127.0.0.1:3333/sse`).
|
|
125
|
+
Connect remote MCP clients with `{ "type": "remote", "url": "http://127.0.0.1:3333/sse" }`.
|
|
126
|
+
|
|
93
127
|
### 4. Ask your AI to diagnose issues
|
|
94
128
|
|
|
95
129
|
> *"Why is my app broken?"* — AI uses Fennec to check browser console, network, and server logs simultaneously.
|
|
96
130
|
|
|
97
|
-
##
|
|
131
|
+
## CLI Commands
|
|
98
132
|
|
|
99
|
-
|
|
100
|
-
Fennec's AI-Native API provides 7 observation-centric tools for AI agents:
|
|
101
|
-
- `observe()` — Multi-sensor observation with level-based detail
|
|
102
|
-
- `ai_diagnose()` — Full-stack diagnosis with root cause inference
|
|
103
|
-
- `correlate()` — Cross-layer event correlation with timeline
|
|
104
|
-
- `summarize()` — Token-efficient log/event/DOM compression
|
|
105
|
-
- `explain()` — Plain-language incident/state explanation
|
|
106
|
-
- `investigate()` — Deep dive with Lazy Context Level 2-3
|
|
107
|
-
- `predict()` — Pattern-based failure prediction
|
|
133
|
+
Fennec is both an MCP server **and** a CLI you can use directly in your terminal.
|
|
108
134
|
|
|
109
|
-
###
|
|
110
|
-
Information delivered in levels, config-driven:
|
|
111
|
-
```
|
|
112
|
-
Level 0 (Pulse): Always sent ~5 tokens
|
|
113
|
-
Level 1 (Summary): On error ~50 tokens
|
|
114
|
-
Level 2 (Detail): On expand ~200 tokens
|
|
115
|
-
Level 3 (Raw): On request ~2000+ tokens
|
|
116
|
-
```
|
|
117
|
-
### 🚀 Zero-Dependency Browser Mode
|
|
118
|
-
Fennec auto-detects the best browser adapter:
|
|
119
|
-
- **CDP Observer** (default, zero deps) — lightweight observation
|
|
120
|
-
- **Playwright** (optional) — full automation (click, type, upload)
|
|
135
|
+
### Server
|
|
121
136
|
|
|
122
|
-
|
|
137
|
+
| Command | Description |
|
|
138
|
+
|---------|-------------|
|
|
139
|
+
| `fennec start` | Start the MCP server (stdio transport). Default when no app command is given. |
|
|
140
|
+
| `fennec start --sse` | Start the MCP server over HTTP+SSE (experimental). |
|
|
141
|
+
| `fennec start --transport sse` | Alias of `--sse`. |
|
|
123
142
|
|
|
124
|
-
|
|
143
|
+
### Apps & Processes (PM2-like control plane)
|
|
125
144
|
|
|
126
145
|
| Command | Description |
|
|
127
146
|
|---------|-------------|
|
|
128
|
-
| `fennec start` |
|
|
129
|
-
| `fennec
|
|
130
|
-
| `fennec
|
|
131
|
-
| `fennec
|
|
132
|
-
| `fennec
|
|
133
|
-
| `fennec
|
|
134
|
-
| `fennec
|
|
135
|
-
| `fennec
|
|
136
|
-
| `fennec
|
|
137
|
-
| `fennec
|
|
138
|
-
| `fennec
|
|
147
|
+
| `fennec start <command> --name <name> [options]` | Launch an app as a supervised background daemon. Alias: `run`. |
|
|
148
|
+
| `fennec ps [options]` | List Fennec-tracked apps with live status. |
|
|
149
|
+
| `fennec status [name]` | System overview + top processes (tracked and system). |
|
|
150
|
+
| `fennec log <name\|pid> [options]` | Show (and follow) logs for a tracked app. |
|
|
151
|
+
| `fennec spawn [name] [--all]` | Re-spawn a stopped tracked app from its saved config. |
|
|
152
|
+
| `fennec stop <name\|--all>` | Stop (pause) a tracked app but keep it in the registry. Add `-y/--yes` to skip the confirmation prompt. |
|
|
153
|
+
| `fennec restart <name\|pid>` | Stop and re-spawn a tracked app from its saved config. |
|
|
154
|
+
| `fennec kill <pid\|name\|all>` | Kill a process and remove it from the registry. Add `-y/--yes` to skip the confirmation prompt. |
|
|
155
|
+
| `fennec adopt <pid> [--name <name>] [--port <port>]` | Adopt an externally-started process into Fennec tracking. |
|
|
156
|
+
| `fennec supervisor <start\|stop\|restart\|status>` | Manage the background supervisor that keeps `--restart` apps alive. |
|
|
157
|
+
| `fennec persist <enable\|disable\|status>` | Survive reboots — auto-start tracked apps after login (systemd/launchd/Windows). |
|
|
158
|
+
| `fennec dev <up\|down\|status\|restart <app>>` | Orchestrate a whole dev stack from `fennec.config.yaml`. |
|
|
159
|
+
| `fennec inspect <name\|pid>` | Compact, AI-safe snapshot (status + recent logs + error scan). |
|
|
160
|
+
| `fennec info <name>` | Detailed info for a tracked app. |
|
|
161
|
+
| `fennec rename <old> <new>` | Rename a tracked app. |
|
|
139
162
|
|
|
140
|
-
|
|
163
|
+
**`start` / `run` options:** `--name <name>` (recommended), `--port <port>` (Fennec waits until it accepts connections), `--cwd <dir>`, `--restart` (auto-restart on crash / port-down, survives terminal close), `--jsonl` (structured JSON-lines logs).
|
|
141
164
|
|
|
142
|
-
|
|
165
|
+
**`ps` options:** `-w/--watch` (live refresh), `--system/-a/--all` (include non-Fennec system processes), `--json`, `--name <filter>`, `--sort <cpu|mem|pid|name>`.
|
|
143
166
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
167
|
+
**`log` options:** `-f/--follow`, `--lines N`, `--since 10m|1h|2d`, `--level error|warn|info|debug`, `--json` (bounded, redacted, machine-readable for AI), `--no-redact`, `--clear`.
|
|
168
|
+
|
|
169
|
+
**`inspect` options:** `--plain` (short human summary), `--tail N`, `--since 10m`.
|
|
170
|
+
|
|
171
|
+
### Observation
|
|
172
|
+
|
|
173
|
+
| Command | Description |
|
|
174
|
+
|---------|-------------|
|
|
175
|
+
| `fennec attach <port>` | Observe a running process by the port it listens on. |
|
|
176
|
+
| `fennec attach-pid <pid>` | Attach to and observe a process by its PID. |
|
|
177
|
+
| `fennec attach-port <port>` | Attach to and observe a process by its port. |
|
|
178
|
+
| `fennec pipe --name <name>` | Pipe stdin into a Fennec log watcher. |
|
|
179
|
+
| `fennec watch --file <path>` | Watch an existing log file. |
|
|
180
|
+
|
|
181
|
+
### Data
|
|
148
182
|
|
|
149
|
-
|
|
183
|
+
| Command | Description |
|
|
184
|
+
|---------|-------------|
|
|
185
|
+
| `fennec export --file <path>` | Export tracked apps to a file. |
|
|
186
|
+
| `fennec import <file>` | Import tracked apps from a file. |
|
|
187
|
+
| `fennec cleanup` | Remove dead/stale entries from the tracked registry. |
|
|
188
|
+
|
|
189
|
+
### Configuration & Misc
|
|
190
|
+
|
|
191
|
+
| Command | Description |
|
|
192
|
+
|---------|-------------|
|
|
193
|
+
| `fennec init` | Generate a `fennec.config.yaml` in the current directory. |
|
|
194
|
+
| `fennec setup` | Interactively configure your MCP client for Fennec. |
|
|
195
|
+
| `fennec install-browsers` | Install Playwright browser engines. |
|
|
196
|
+
| `fennec sessions` | List saved browser auth sessions. |
|
|
197
|
+
| `fennec health` | Health check of the Fennec environment. |
|
|
198
|
+
| `fennec help [command]` | Show help, or detailed help for a command. |
|
|
199
|
+
|
|
200
|
+
## Usage Examples
|
|
201
|
+
|
|
202
|
+
### Run an app as a supervised daemon
|
|
150
203
|
|
|
151
204
|
```bash
|
|
152
|
-
#
|
|
153
|
-
|
|
205
|
+
# Launch and immediately return to your shell — logs go to ~/.fennec/logs/web.log
|
|
206
|
+
fennec start "npm run dev" --name web --port 3000
|
|
207
|
+
|
|
208
|
+
# Auto-restart if it crashes or its port stops answering (survives terminal close)
|
|
209
|
+
fennec start node server.js --name api --cwd ./backend --restart
|
|
154
210
|
|
|
155
|
-
#
|
|
156
|
-
fennec
|
|
211
|
+
# Watch it
|
|
212
|
+
fennec ps
|
|
213
|
+
fennec log web -f
|
|
157
214
|
```
|
|
158
215
|
|
|
159
|
-
###
|
|
216
|
+
### Idiot-proof `dev up` (idempotent)
|
|
217
|
+
|
|
218
|
+
`fennec dev up` reads `fennec.config.yaml` and brings the whole stack up. It is
|
|
219
|
+
**idempotent**: already-running apps with unchanged config are skipped, apps whose
|
|
220
|
+
config changed are restarted, and an app whose port is already taken by *another*
|
|
221
|
+
process is **adopted** instead of spawning a conflicting duplicate.
|
|
160
222
|
|
|
161
223
|
```bash
|
|
162
|
-
#
|
|
163
|
-
fennec
|
|
224
|
+
fennec dev up # bring the stack up (skips what's already running)
|
|
225
|
+
fennec dev status # see every app's health
|
|
226
|
+
fennec dev restart web # restart just one app
|
|
227
|
+
fennec dev down # stop everything (keeps it in the registry)
|
|
164
228
|
```
|
|
165
229
|
|
|
166
|
-
###
|
|
230
|
+
### Adopt a process an AI agent started via raw bash
|
|
231
|
+
|
|
232
|
+
An AI agent (or you) sometimes launches a server with plain bash. Fennec can take
|
|
233
|
+
ownership instead of leaving it orphaned:
|
|
167
234
|
|
|
168
235
|
```bash
|
|
169
|
-
#
|
|
170
|
-
|
|
236
|
+
# Fennec finds whatever is listening on :8130 and tracks it as "svc"
|
|
237
|
+
fennec adopt $(lsof -ti :8130) --name svc --port 8130
|
|
171
238
|
|
|
172
|
-
#
|
|
173
|
-
fennec start
|
|
239
|
+
# Or let Fennec discover the PID by port:
|
|
240
|
+
fennec start node server.js --name svc --port 8130 # adopts the existing one
|
|
174
241
|
```
|
|
175
242
|
|
|
176
|
-
|
|
243
|
+
Adopted processes appear in `fennec ps` and gain supervised logging. (Fennec-spawned
|
|
244
|
+
processes auto-restart on crash; adopted external processes are tracked but not
|
|
245
|
+
respawned, since Fennec doesn't know their original command.)
|
|
246
|
+
|
|
247
|
+
### Inspect & observe
|
|
177
248
|
|
|
178
249
|
```bash
|
|
179
|
-
#
|
|
180
|
-
|
|
250
|
+
fennec inspect web --plain # one-line human summary
|
|
251
|
+
fennec inspect web --since 10m # recent logs + error scan (AI-friendly)
|
|
252
|
+
fennec log web --json --since 10m # bounded, redacted, machine-readable for AI
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
### Survive reboots (persist)
|
|
181
256
|
|
|
182
|
-
|
|
183
|
-
#
|
|
257
|
+
```bash
|
|
258
|
+
fennec persist enable # auto-start tracked apps after login (uses systemd user
|
|
259
|
+
# service / launchd / Windows startup; enables linger on Linux)
|
|
260
|
+
fennec persist status
|
|
184
261
|
```
|
|
185
262
|
|
|
186
263
|
## Configuration
|
|
@@ -191,7 +268,7 @@ Fennec works with zero config, but supports customization:
|
|
|
191
268
|
fennec init # Creates fennec.config.yaml
|
|
192
269
|
```
|
|
193
270
|
|
|
194
|
-
Key configuration options (see [full reference](docs/configuration.md)):
|
|
271
|
+
Key configuration options (see [full reference](../../docs/configuration.md)):
|
|
195
272
|
|
|
196
273
|
```yaml
|
|
197
274
|
browser:
|
|
@@ -202,40 +279,55 @@ browser:
|
|
|
202
279
|
width: 1280
|
|
203
280
|
height: 720
|
|
204
281
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
282
|
+
process:
|
|
283
|
+
maxProcesses: 10
|
|
284
|
+
spawnAllowlist: # only these commands may be spawned
|
|
285
|
+
- npm
|
|
286
|
+
- node
|
|
287
|
+
- pnpm
|
|
288
|
+
- yarn
|
|
289
|
+
- bun
|
|
290
|
+
- python
|
|
291
|
+
- python3
|
|
209
292
|
|
|
210
293
|
security:
|
|
211
294
|
sandbox: true
|
|
212
295
|
allowProcessSpawn: true
|
|
296
|
+
allowProcessKill: false # off by default — opt in explicitly
|
|
213
297
|
allowJSEvaluation: true
|
|
214
298
|
|
|
299
|
+
lazyContext:
|
|
300
|
+
level1: true # Auto-attach summary on errors
|
|
301
|
+
level2: false # Attach detail on expand
|
|
302
|
+
level3: false # Attach raw data on request
|
|
303
|
+
|
|
215
304
|
correlation:
|
|
216
305
|
windowMs: 500
|
|
217
306
|
enableRootCauseInference: true
|
|
218
307
|
minConfidence: 0.7
|
|
219
308
|
```
|
|
220
309
|
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
## Cross-Browser Support
|
|
224
|
-
|
|
225
|
-
Fennec supports all three major browser engines via Playwright:
|
|
226
|
-
|
|
227
|
-
```bash
|
|
228
|
-
# Set via config
|
|
229
|
-
fennec init # then edit browser.type
|
|
310
|
+
## Security & Environment Variables
|
|
230
311
|
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
FENNEC_BROWSER_TYPE=webkit fennec start
|
|
234
|
-
```
|
|
312
|
+
Fennec ships with **sandbox mode enabled by default** and conservative process
|
|
313
|
+
permissions. Environment variables override the config file:
|
|
235
314
|
|
|
236
|
-
|
|
315
|
+
| Variable | Effect |
|
|
316
|
+
|----------|--------|
|
|
317
|
+
| `FENNEC_DATA_DIR` | Override where Fennec stores tracked state & logs (default `~/.fennec`). |
|
|
318
|
+
| `FENNEC_SANDBOX` | `false` disables the sandbox (permits more operations). |
|
|
319
|
+
| `FENNEC_SECURITY_ALLOW_PROCESS_SPAWN` | `true` allows the AI to spawn new processes. |
|
|
320
|
+
| `FENNEC_SECURITY_ALLOW_PROCESS_KILL` | `true` allows the AI to kill processes. |
|
|
321
|
+
| `FENNEC_SECURITY_ALLOW_JS_EVALUATION` | `true` allows in-page JS evaluation. |
|
|
322
|
+
| `FENNEC_TRANSPORT_TYPE` | `stdio` (default) or `sse`. |
|
|
323
|
+
| `FENNEC_PORT` | Port for SSE transport (default `3333`). |
|
|
324
|
+
| `FENNEC_BROWSER_TYPE` | `chromium` \| `firefox` \| `webkit`. |
|
|
325
|
+
| `FENNEC_HEADLESS` | `false` to run headed. |
|
|
326
|
+
| `FENNEC_DEFAULT_TIMEOUT` | Browser default timeout (ms). |
|
|
327
|
+
| `FENNEC_VIEWPORT_WIDTH` / `FENNEC_VIEWPORT_HEIGHT` | Viewport size. |
|
|
328
|
+
| `FENNEC_LOG_LEVEL` | `debug` \| `info` \| `warn` \| `error`. |
|
|
237
329
|
|
|
238
|
-
|
|
330
|
+
Security features:
|
|
239
331
|
|
|
240
332
|
- 🔒 Process spawn allowlist (only npm, node, pnpm, etc. allowed by default)
|
|
241
333
|
- 🔒 Domain allowlist/blocklist for browser navigation
|
|
@@ -243,16 +335,33 @@ Fennec ships with **sandbox mode enabled by default**. Key security features:
|
|
|
243
335
|
- 🔒 Audit logging of all tool calls
|
|
244
336
|
- 🔒 Session data export path confinement
|
|
245
337
|
|
|
246
|
-
See [Security Model](docs/security-model.md) for details.
|
|
338
|
+
See [Security Model](../../docs/security-model.md) for details.
|
|
339
|
+
|
|
340
|
+
## Cross-Platform
|
|
341
|
+
|
|
342
|
+
Fennec runs on **Linux, macOS, and Windows**:
|
|
343
|
+
|
|
344
|
+
- Process discovery (`findPidOnPort`, command-line/cwd resolution, `ps`) is
|
|
345
|
+
platform-aware: Linux uses `/proc`, macOS uses `lsof`/`ps`, Windows uses
|
|
346
|
+
`netstat`/`tasklist`/`wmic`.
|
|
347
|
+
- `attach`/`attach-port` rely on `lsof` on macOS/Linux (install it if missing).
|
|
348
|
+
- On Windows, an app's `cwd` isn't readable via built-ins, so it shows as empty.
|
|
349
|
+
|
|
350
|
+
## Cross-Browser Support
|
|
351
|
+
|
|
352
|
+
Fennec supports all three major browser engines via Playwright:
|
|
353
|
+
|
|
354
|
+
```bash
|
|
355
|
+
FENNEC_BROWSER_TYPE=firefox fennec start
|
|
356
|
+
FENNEC_BROWSER_TYPE=webkit fennec start
|
|
357
|
+
```
|
|
247
358
|
|
|
248
359
|
## Documentation
|
|
249
360
|
|
|
250
361
|
- [Getting Started Guide](https://github.com/plumpslabs/fennec/blob/main/docs/getting-started.md)
|
|
251
|
-
- [Full Tool Reference](https://github.com/plumpslabs/fennec/blob/main/docs/tools/README.md)
|
|
362
|
+
- [Full Tool Reference](https://github.com/plumpslabs/fennec/blob/main/docs/tools/README.md)
|
|
252
363
|
- [Configuration Reference](https://github.com/plumpslabs/fennec/blob/main/docs/configuration.md)
|
|
253
364
|
- [Security Model](https://github.com/plumpslabs/fennec/blob/main/docs/security-model.md)
|
|
254
|
-
- [Auth Flows Guide](https://github.com/plumpslabs/fennec/blob/main/docs/guides/auth-flows.md)
|
|
255
|
-
- [Full-Stack Debugging Guide](https://github.com/plumpslabs/fennec/blob/main/docs/guides/fullstack-debugging.md)
|
|
256
365
|
- [GitHub Repository](https://github.com/plumpslabs/fennec)
|
|
257
366
|
|
|
258
367
|
## License
|