securenow 7.4.0 → 7.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/NPM_README.md CHANGED
@@ -23,6 +23,7 @@ OpenTelemetry instrumentation library for Node.js, Next.js, and Nuxt application
23
23
  - [Installation](#installation)
24
24
  - [Quick Start](#quick-start)
25
25
  - [CLI -- Command Line Interface](#cli--command-line-interface)
26
+ - [MCP for Codex and Claude](#mcp-for-codex-and-claude)
26
27
  - [Framework-Specific Setup](#framework-specific-setup)
27
28
  - [Express.js](#expressjs)
28
29
  - [Next.js](#nextjs)
@@ -59,13 +60,13 @@ yarn add securenow
59
60
 
60
61
  ### 1. Automatic Setup (Recommended)
61
62
 
62
- Run login — it's a browser flow that picks an app and, since v7.1.0, also offers one-click firewall onboarding:
63
+ Run login — it's a browser flow that picks or creates an app and connects the firewall automatically:
63
64
 
64
65
  ```bash
65
66
  npx securenow login
66
67
  ```
67
68
 
68
- During the browser step you can choose **Enable the Firewall?** if you accept, the dashboard mints an API key (scoped `firewall:read + blocklist:read + allowlist:read`) and the CLI writes it into `.securenow/credentials.json`. No env vars, no copy-pasting keys.
69
+ During the browser step, the dashboard enables the selected app's firewall toggle, mints an API key (scoped `firewall:read + blocklist:read + allowlist:read`), and the CLI writes it into `.securenow/credentials.json`. Traces, logs, POST body capture, multipart metadata capture, and firewall protection are enabled by default. No env vars, no copy-pasting keys.
69
70
 
70
71
  For framework scaffolding (Next.js `instrumentation.ts`, etc.) use:
71
72
 
@@ -153,9 +154,8 @@ The `securenow` CLI gives you full access to the SecureNow platform from the ter
153
154
 
154
155
  ```bash
155
156
  # Log in (opens browser for OAuth + app picker)
156
- # Since v7.1.0 the browser flow also offers one-click firewall onboarding
157
- # accept "Enable the Firewall?" to have the CLI mint and store the API key
158
- # in .securenow/credentials.json automatically (no env var needed).
157
+ # The browser flow mints and stores the firewall API key automatically in
158
+ # .securenow/credentials.json (no env var needed).
159
159
  npx securenow login
160
160
 
161
161
  # Or use a token for CI/headless environments
@@ -185,6 +185,21 @@ npx securenow init --key snk_live_abc123...
185
185
 
186
186
  For Next.js projects, `init` creates `instrumentation.ts` (or `.js` if no TypeScript) and tells you how to update `next.config.js` with `withSecureNow()`. For Nuxt, it suggests adding `securenow/nuxt` to your modules. For Express/Node, it shows the `-r securenow/register` flag.
187
187
 
188
+ ### MCP for Codex and Claude
189
+
190
+ SecureNow includes a local stdio MCP server that uses the same credentials and API client as the CLI:
191
+
192
+ ```bash
193
+ npx securenow login
194
+ codex mcp add securenow -- npx securenow mcp
195
+ # or
196
+ npx -p securenow securenow-mcp
197
+ ```
198
+
199
+ The MCP surface exposes tools for applications, traces, logs, firewall, IP intelligence, forensics, notifications, blocklist, allowlist, trusted IPs, and docs-backed prompts/resources. Write actions require `confirm:true` and a reason.
200
+
201
+ For hosted clients, SecureNow can expose the same surface at `https://api.securenow.ai/mcp`. The hosted endpoint uses the same API authentication and scope checks as the rest of SecureNow.
202
+
188
203
  ### Managing Applications
189
204
 
190
205
  ```bash
@@ -626,7 +641,7 @@ fastify.listen({ port: 3000 }, (err) => {
626
641
  });
627
642
  ```
628
643
 
629
- > **Important:** Set `SECURENOW_CAPTURE_BODY=0` with Fastify -- the body capture hook conflicts with Fastify's internal stream handling.
644
+ > **Default:** Traces, logs, POST body capture, multipart metadata capture, and firewall protection are on. If a specific Fastify version or plugin stack reports request-stream conflicts, set `SECURENOW_CAPTURE_BODY=0` as a local override.
630
645
 
631
646
  ---
632
647
 
@@ -749,7 +764,7 @@ const init = async () => {
749
764
  init().catch((err) => { console.error(err); process.exit(1); });
750
765
  ```
751
766
 
752
- > **Important:** Set `SECURENOW_CAPTURE_BODY=0` with Hapi -- the body capture hook consumes the request stream before Hapi's payload parser.
767
+ > **Default:** Traces, logs, POST body capture, multipart metadata capture, and firewall protection are on. If a specific Hapi version or payload plugin reports request-stream conflicts, set `SECURENOW_CAPTURE_BODY=0` as a local override.
753
768
 
754
769
  ---
755
770
 
@@ -893,7 +908,7 @@ serve({ fetch: app.fetch, port: 3000 }, () => console.log('Hono running on port
893
908
  node -r securenow/register app.mjs
894
909
  ```
895
910
 
896
- > **Important:** Set `SECURENOW_CAPTURE_BODY=0` with Hono. Do **not** add `require('securenow/register')` inside `.mjs` files.
911
+ > **Default:** Traces, logs, POST body capture, multipart metadata capture, and firewall protection are on. For Hono ESM apps, keep using the `node -r securenow/register app.mjs` preload instead of adding `require('securenow/register')` inside `.mjs` files.
897
912
 
898
913
  ---
899
914
 
@@ -1079,14 +1094,14 @@ The Nuxt server plugin (v5.13.0+) initializes the firewall independently from Op
1079
1094
  | Framework | Traces | Logs | Body Capture | Firewall | Notes |
1080
1095
  |-----------|--------|------|--------------|----------|-------|
1081
1096
  | Express | Yes | Yes | Yes | Yes | Fully compatible |
1082
- | Fastify | Yes | Yes | **No** | Yes | `SECURENOW_CAPTURE_BODY=0` required |
1097
+ | Fastify | Yes | Yes | Yes | Yes | Default on; use `SECURENOW_CAPTURE_BODY=0` only for local stream conflicts |
1083
1098
  | Koa | Yes | Yes | Yes | Yes | Needs `koa-bodyparser` |
1084
1099
  | NestJS | Yes | Yes | Yes | Yes | Use `-r ts-node/register` |
1085
- | Hapi | Yes | Yes | **No** | Yes | `SECURENOW_CAPTURE_BODY=0` required |
1100
+ | Hapi | Yes | Yes | Yes | Yes | Default on; use `SECURENOW_CAPTURE_BODY=0` only for local stream conflicts |
1086
1101
  | h3 | Yes | Yes | Yes | Yes | Uses `toNodeListener()` |
1087
1102
  | Polka | Yes | Yes | Yes | Yes | Needs manual body parser |
1088
1103
  | Micro/HTTP | Yes | Yes | Yes | Yes | Full control |
1089
- | Hono | Yes | Yes | **No** | Yes | `SECURENOW_CAPTURE_BODY=0`; ESM `-r` flag |
1104
+ | Hono | Yes | Yes | Yes | Yes | Use ESM `-r` preload |
1090
1105
  | Feathers | Yes | Yes | Yes | Yes | Uses Express transport |
1091
1106
  | Next.js | Yes | Yes | Yes | Yes | Use `instrumentation.ts` + `withSecureNow()` |
1092
1107
  | Nuxt 3 | Yes | Yes | Yes | Yes | Use `securenow/nuxt` module |
@@ -1097,12 +1112,12 @@ The Nuxt server plugin (v5.13.0+) initializes the firewall independently from Op
1097
1112
 
1098
1113
  SecureNow can automatically block IPs from your blocklist at the application layer. No code changes -- just provide an API key (via `securenow login`, the `api-key` CLI, or env var) and the firewall activates.
1099
1114
 
1100
- ### Enable the Firewall
1115
+ ### Firewall Is Enabled by Default
1101
1116
 
1102
1117
  Pick whichever fits your environment:
1103
1118
 
1104
1119
  ```bash
1105
- # (a) Zero-config (v7.1+): login + opt in to the firewall in the browser.
1120
+ # (a) Zero-config (v7.4+): login picks/creates an app and connects the firewall.
1106
1121
  # Key is minted and written to .securenow/credentials.json automatically.
1107
1122
  npx securenow login
1108
1123
 
@@ -1237,16 +1252,16 @@ See the [Firewall Guide](./docs/FIREWALL-GUIDE.md) for the full reference.
1237
1252
 
1238
1253
  | Variable | Description | Default |
1239
1254
  |----------|-------------|---------|
1240
- | `SECURENOW_LOGGING_ENABLED` | Enable automatic logging to OTLP backend. Set to `1` to enable, `0` to disable. | `1` |
1255
+ | `SECURENOW_LOGGING_ENABLED` | Enable automatic logging to OTLP backend. Set to `0` to disable. | `1` |
1241
1256
 
1242
1257
  #### Request Body Capture
1243
1258
 
1244
1259
  | Variable | Description | Default |
1245
1260
  |----------|-------------|---------|
1246
- | `SECURENOW_CAPTURE_BODY` | Enable request body capture in traces. Set to `1` to enable. | `0` |
1261
+ | `SECURENOW_CAPTURE_BODY` | Capture request bodies in traces. Set to `0` to disable. | `1` |
1247
1262
  | `SECURENOW_MAX_BODY_SIZE` | Maximum body size to capture in bytes. Bodies larger than this are truncated. | `10240` (10KB) |
1248
1263
  | `SECURENOW_SENSITIVE_FIELDS` | Comma-separated list of additional field names to redact. | - |
1249
- | `SECURENOW_CAPTURE_MULTIPART` | Enable multipart/form-data capture. Streams through the request to extract text field values and file metadata (name, filename, content-type, size) without buffering file content. Set to `1` to enable. | `0` |
1264
+ | `SECURENOW_CAPTURE_MULTIPART` | Capture multipart/form-data metadata. Streams through the request to extract text field values and file metadata (name, filename, content-type, size) without buffering file content. Set to `0` to disable. | `1` |
1250
1265
 
1251
1266
  **Default sensitive fields (auto-redacted):** `password`, `passwd`, `pwd`, `secret`, `token`, `api_key`, `apikey`, `access_token`, `auth`, `credentials`, `mysql_pwd`, `stripeToken`, `card`, `cardnumber`, `ccv`, `cvc`, `cvv`, `ssn`, `pin`
1252
1267
 
@@ -1384,13 +1399,13 @@ node app.js
1384
1399
 
1385
1400
  ## Request Body Capture
1386
1401
 
1387
- SecureNow can capture HTTP request bodies in traces for debugging purposes. This is disabled by default.
1402
+ SecureNow captures HTTP request bodies in traces by default, with sensitive fields automatically redacted. Set `SECURENOW_CAPTURE_BODY=0` only when you need a local opt-out.
1388
1403
 
1389
- ### Enable Body Capture
1404
+ ### Body Capture Defaults
1390
1405
 
1391
1406
  ```bash
1392
- export SECURENOW_CAPTURE_BODY=1
1393
1407
  export SECURENOW_MAX_BODY_SIZE=10240 # 10KB (optional)
1408
+ # export SECURENOW_CAPTURE_BODY=0 # optional opt-out
1394
1409
  ```
1395
1410
 
1396
1411
  ### Supported Content Types
@@ -1398,11 +1413,11 @@ export SECURENOW_MAX_BODY_SIZE=10240 # 10KB (optional)
1398
1413
  - `application/json`
1399
1414
  - `application/x-www-form-urlencoded`
1400
1415
  - `application/graphql`
1401
- - `multipart/form-data` (requires `SECURENOW_CAPTURE_MULTIPART=1`)
1416
+ - `multipart/form-data` (metadata capture is on unless `SECURENOW_CAPTURE_MULTIPART=0`)
1402
1417
 
1403
1418
  ### Multipart Body Capture (v5.8.0+)
1404
1419
 
1405
- Enable with `SECURENOW_CAPTURE_MULTIPART=1` to capture multipart/form-data requests. Uses a streaming parser that never buffers file content -- memory stays at ~few KB regardless of upload size.
1420
+ Multipart/form-data metadata capture is enabled by default. Set `SECURENOW_CAPTURE_MULTIPART=0` to disable it. Uses a streaming parser that never buffers file content -- memory stays at ~few KB regardless of upload size.
1406
1421
 
1407
1422
  **What gets captured:**
1408
1423
  - **Text fields** -- field name and value (up to 1000 chars), with sensitive fields auto-redacted
@@ -1731,10 +1746,11 @@ curl http://localhost:4318/v1/logs
1731
1746
 
1732
1747
  ### Request Body Not Captured
1733
1748
 
1734
- **Check 1: Is body capture enabled?**
1749
+ **Check 1: Make sure body capture was not explicitly disabled**
1735
1750
 
1736
1751
  ```bash
1737
- export SECURENOW_CAPTURE_BODY=1
1752
+ echo $SECURENOW_CAPTURE_BODY
1753
+ # Should be empty, 1, or true. Remove SECURENOW_CAPTURE_BODY=0 to re-enable defaults.
1738
1754
  ```
1739
1755
 
1740
1756
  **Check 2: Verify content type**
@@ -1915,7 +1931,7 @@ const dbLogger = getLogger('database', '1.0.0');
1915
1931
  const apiLogger = getLogger('api', '1.0.0');
1916
1932
  ```
1917
1933
 
1918
- ### 6. Enable Body Capture Only in Development
1934
+ ### 6. Disable Body Capture Outside Development
1919
1935
 
1920
1936
  ```bash
1921
1937
  # .env.development
package/README.md CHANGED
@@ -12,9 +12,9 @@ Zero-config OpenTelemetry for Node.js, Next.js, and Nuxt — traces, logs, body
12
12
  # 1. Install
13
13
  npm install securenow
14
14
 
15
- # 2. Pick (or create) your app in the browser writes .securenow/ locally.
16
- # Since v7.1.0, the browser step also offers one-click firewall onboarding:
17
- # say yes and the CLI stores a scoped API key in the same file no env vars.
15
+ # 2. Pick (or create) your app in the browser - writes .securenow/ locally.
16
+ # Since v7.4.0, the browser step enables the app firewall and stores
17
+ # a scoped firewall API key in the same file - no env vars.
18
18
  npx securenow login
19
19
 
20
20
  # 3. Start your app — one flag is all it takes
@@ -137,7 +137,7 @@ Resolution order (first non-empty wins):
137
137
 
138
138
  ```bash
139
139
  # Setup
140
- npx securenow login # browser auth + app picker + firewall onboarding (saves to ./.securenow/)
140
+ npx securenow login # browser auth + app picker + firewall enabled by default
141
141
  npx securenow login --global # save to ~/.securenow/ instead
142
142
  npx securenow login --token <TOKEN> # headless (CI)
143
143
  npx securenow init # scaffold Next.js instrumentation files
@@ -168,6 +168,21 @@ Full reference: run `npx securenow help` or see [CLI Reference](#cli-reference)
168
168
 
169
169
  ---
170
170
 
171
+ ## MCP for Codex and Claude
172
+
173
+ SecureNow ships a local stdio MCP server for agent clients:
174
+
175
+ ```bash
176
+ npx securenow login
177
+ codex mcp add securenow -- npx securenow mcp
178
+ # or run directly:
179
+ npx -p securenow securenow-mcp
180
+ ```
181
+
182
+ The MCP server reuses the same project-local `.securenow/credentials.json` as the CLI and SDK. It exposes tools for apps, traces, logs, firewall, IP intelligence, forensics, blocklist/allowlist/trusted IPs, plus resources for the bundled SecureNow docs and setup prompts.
183
+
184
+ ---
185
+
171
186
  ## Environment variables (optional)
172
187
 
173
188
  Only set these if you want to override the zero-config defaults.
@@ -178,7 +193,7 @@ Only set these if you want to override the zero-config defaults.
178
193
  | `SECURENOW_INSTANCE` | `https://freetrial.securenow.ai:4318` | OTLP collector endpoint |
179
194
  | `SECURENOW_API_KEY` | from credentials file | Enables firewall + collector routing |
180
195
  | `SECURENOW_LOGGING_ENABLED` | `1` (on) | Forward `console.*` as OTLP logs. Set to `0` to disable. |
181
- | `SECURENOW_CAPTURE_BODY` | `1` (on) | Capture JSON / form request bodies. Set to `0` for Fastify/Hapi/Hono. |
196
+ | `SECURENOW_CAPTURE_BODY` | `1` (on) | Capture JSON / form request bodies. Set to `0` only for a local stream conflict. |
182
197
  | `SECURENOW_CAPTURE_MULTIPART` | `1` (on) | Capture multipart metadata (not content). |
183
198
  | `SECURENOW_MAX_BODY_SIZE` | `10240` | Max bytes captured per body. |
184
199
  | `SECURENOW_SENSITIVE_FIELDS` | `password,token,authorization,...` | Extra fields to redact (comma-separated). |
@@ -218,6 +233,7 @@ HTTP/HTTPS · GraphQL · gRPC · and many more via [@opentelemetry/auto-instrume
218
233
  ### Complete Guides
219
234
  - [Firewall](./docs/FIREWALL-GUIDE.md)
220
235
  - [API Keys](./docs/API-KEYS-GUIDE.md)
236
+ - [MCP](./docs/MCP-GUIDE.md)
221
237
  - [Next.js Complete](./docs/NEXTJS-GUIDE.md)
222
238
  - [Nuxt 3 Complete](./docs/NUXT-GUIDE.md)
223
239
  - [Logging Complete](./docs/LOGGING-GUIDE.md)
@@ -244,7 +260,7 @@ After install, the `securenow` CLI is available via `npx securenow` or globally
244
260
 
245
261
  | Command | Description |
246
262
  |---|---|
247
- | `securenow login` | Browser auth + pick app + optional firewall key onboarding (writes ./.securenow/ by default) |
263
+ | `securenow login` | Browser auth + pick app; firewall key is minted automatically (writes ./.securenow/ by default) |
248
264
  | `securenow login --global` | Save to ~/.securenow/ instead |
249
265
  | `securenow login --token <TOKEN>` | Headless (CI/servers) |
250
266
  | `securenow logout` | Clear project-local credentials |
package/SKILL-API.md CHANGED
@@ -2,7 +2,9 @@
2
2
 
3
3
  Instrument any Node.js application with OpenTelemetry tracing, structured logging, request body capture, and a multi-layer IP firewall. Supports Express, Fastify, NestJS, Koa, Hapi, Next.js, Nuxt 3, Vite (browser), and raw `http.createServer` — with zero code changes for most setups.
4
4
 
5
- **CLI parity:** every capability exposed below (redaction, CIDR matching, log/span emission, firewall preload, config inspection) has an equivalent `securenow` CLI command. See [SKILL-CLI.md](./SKILL-CLI.md) for the terminal surface.
5
+ **CLI parity:** every capability exposed below (redaction, CIDR matching, log/span emission, firewall preload, config inspection) has an equivalent `securenow` CLI command. See [SKILL-CLI.md](./SKILL-CLI.md) for the terminal surface.
6
+
7
+ **MCP parity (v7.5+):** `npx securenow mcp` starts a local stdio MCP server for Codex, Claude, and other MCP clients. It reuses the same `.securenow/credentials.json` file as the CLI/SDK and exposes SecureNow tools, bundled docs resources, and setup prompts to agents.
6
8
 
7
9
  ## Installation
8
10
 
@@ -46,17 +48,19 @@ npx securenow init --key snk_live_...
46
48
 
47
49
  That's it. Traces and logs flow to your OTLP collector. No code changes for Express, Fastify, NestJS, Koa, Hapi, and raw Node.
48
50
 
49
- ### 3. Enable the Firewall (Optional)
51
+ ### 3. Firewall Is Enabled by Default
50
52
 
51
- Since v7.1.0 the firewall key lives in your credentials file — no env var required:
53
+ Since v7.4.0, the browser login flow connects the firewall automatically after
54
+ the user picks or creates an app. The firewall key lives in your credentials
55
+ file — no env var required:
52
56
 
53
57
  ```bash
54
- npx securenow login # pick app + click "Enable firewall" in browser
55
- # or, if you already have one:
56
- npx securenow api-key set snk_live_abc123...
58
+ npx securenow login # pick/create app; firewall key is minted automatically
59
+ # or, if you already have one:
60
+ npx securenow api-key set snk_live_abc123...
57
61
  ```
58
62
 
59
- Both paths write the key to `.securenow/credentials.json` (auto-gitignored) and the firewall activates on next start. Setting `SECURENOW_API_KEY=snk_live_...` in the environment still works and takes precedence.
63
+ Both paths write the key to `.securenow/credentials.json` (auto-gitignored) and the firewall activates on next start. Setting `SECURENOW_API_KEY=snk_live_...` in the environment still works and takes precedence.
60
64
 
61
65
  The firewall syncs your blocklist and enforces it on every request — zero code changes.
62
66
 
@@ -263,7 +267,7 @@ Instruments document load, fetch, XMLHttpRequest, and user interactions with bro
263
267
 
264
268
  ## Firewall — Multi-Layer IP Blocking
265
269
 
266
- The firewall auto-activates once an API key is resolvable. Since **v7.1.0** the key is read from `.securenow/credentials.json` (written by `npx securenow login` or `securenow api-key set`), so the `SECURENOW_API_KEY` env var is optional. Resolution order: env (must start with `snk_live_`) → project `./.securenow/credentials.json` → global `~/.securenow/credentials.json`.
270
+ The firewall auto-activates once an API key is resolvable and the app firewall toggle is on. Since **v7.4.0**, `npx securenow login` enables the selected app firewall and writes the key to `.securenow/credentials.json`; `securenow api-key set` can still write/rotate the key later. The `SECURENOW_API_KEY` env var is optional. Resolution order: env (must start with `snk_live_`) → project `./.securenow/credentials.json` → global `~/.securenow/credentials.json`.
267
271
 
268
272
  ```
269
273
  Layer 4: Cloud/Edge WAF → blocked at CDN (Cloudflare, AWS WAF, GCP Cloud Armor)
@@ -275,8 +279,8 @@ Layer 1: HTTP Handler → 403 JSON response (always active)
275
279
  ### Activate
276
280
 
277
281
  ```bash
278
- # Zero-config (recommended) — writes the key to .securenow/credentials.json
279
- npx securenow login # pick app + click "Enable firewall"
282
+ # Zero-config (recommended) — writes the key to .securenow/credentials.json
283
+ npx securenow login # pick/create app; firewall connects automatically
280
284
  # or, if you already have a key:
281
285
  npx securenow api-key set snk_live_abc123...
282
286
 
@@ -478,9 +482,9 @@ securenow redact @request.json --fields internal_id,sessionHash
478
482
  | Variable | Description | Default |
479
483
  |----------|-------------|---------|
480
484
  | `SECURENOW_LOGGING_ENABLED` | Enable OTLP log export | `1` |
481
- | `SECURENOW_CAPTURE_BODY` | Capture HTTP request bodies | `0` |
485
+ | `SECURENOW_CAPTURE_BODY` | Capture HTTP request bodies | `1` |
482
486
  | `SECURENOW_MAX_BODY_SIZE` | Max body size in bytes | `10240` |
483
- | `SECURENOW_CAPTURE_MULTIPART` | Capture multipart/form-data (streaming, metadata only) | `0` |
487
+ | `SECURENOW_CAPTURE_MULTIPART` | Capture multipart/form-data (streaming, metadata only) | `1` |
484
488
  | `SECURENOW_SENSITIVE_FIELDS` | Comma-separated extra fields to redact | — |
485
489
  | `SECURENOW_DISABLE_INSTRUMENTATIONS` | Comma-separated packages to skip (e.g. `fs,dns`) | — |
486
490
  | `SECURENOW_TEST_SPAN` | `1` to emit a test span on startup | `0` |
@@ -551,16 +555,15 @@ No code changes to the application needed.
551
555
 
552
556
  ```bash
553
557
  npm install securenow
554
- npx securenow login # pick app + "Enable firewall" in browser
558
+ npx securenow login # pick/create app; firewall key is minted automatically
555
559
  ```
556
560
 
557
- `securenow login` writes session, app, and firewall key to `.securenow/credentials.json` (auto-gitignored). The `init` command still works for manual setup — it creates `instrumentation.ts` and suggests `next.config` changes. Most users only need this `.env.local`:
561
+ `securenow login` enables the selected app's firewall toggle and writes session, app, and firewall key to `.securenow/credentials.json` (auto-gitignored). Traces, logs, request body capture, multipart metadata capture, and firewall enforcement are enabled by default. The `init` command still works for manual setup — it creates `instrumentation.ts` and suggests `next.config` changes. Most users only need this `.env.local`:
558
562
 
559
563
  ```
560
564
  SECURENOW_APPID=my-nextjs-app
561
565
  SECURENOW_INSTANCE=https://your-collector:4318
562
- SECURENOW_CAPTURE_BODY=1
563
- # SECURENOW_API_KEY=snk_live_... (otherwise lives in .securenow/credentials.json)
566
+ # SECURENOW_API_KEY=snk_live_... (otherwise lives in .securenow/credentials.json)
564
567
  ```
565
568
 
566
569
  ### Enable Firewall With Zero Tracing Overhead
package/SKILL-CLI.md CHANGED
@@ -13,7 +13,18 @@ npm install securenow
13
13
  npx securenow <command>
14
14
  ```
15
15
 
16
- **Full parity with the SDK:** every capability the `securenow` Node SDK exposes has a CLI counterpart — redaction, CIDR matching, log/span emission, firewall preload, config inspection. If you can do it in code, you can do it from the terminal.
16
+ **Full parity with the SDK:** every capability the `securenow` Node SDK exposes has a CLI counterpart — redaction, CIDR matching, log/span emission, firewall preload, config inspection. If you can do it in code, you can do it from the terminal.
17
+
18
+ **MCP parity (v7.5+):** the same package also ships a local stdio MCP server for Codex, Claude, and other MCP clients:
19
+
20
+ ```bash
21
+ npx securenow login
22
+ codex mcp add securenow -- npx securenow mcp
23
+ # or
24
+ npx -p securenow securenow-mcp
25
+ ```
26
+
27
+ The MCP server reuses `.securenow/credentials.json` and exposes apps, traces, logs, firewall, IP intelligence, forensics, notifications, remediation tools, bundled docs resources, and setup prompts. Write tools require `confirm:true` plus a reason.
17
28
 
18
29
  ### Authenticate
19
30
 
@@ -24,9 +35,9 @@ securenow login --token <JWT> # headless / CI login (get token from dashboard
24
35
  securenow whoami # verify session (shows email, app, auth source)
25
36
  ```
26
37
 
27
- **Zero-config flow (v7+):** the browser step lets the user pick (or create) an app. The CLI stores the app's **key (UUID)**, **name**, and **instance URL** in `.securenow/credentials.json`. The SDK reads this file at boot and sends traces/logs to the right app bucket — **no env vars required for local dev**.
28
-
29
- **Firewall onboarding (v7.1+):** after picking the app, `securenow login` asks "Enable the Firewall?" in the browser. If you accept, the dashboard mints an API key with `firewall:read + blocklist:read + allowlist:read` scopes and the CLI writes it into `.securenow/credentials.json` automatically no `SECURENOW_API_KEY` env var needed. To add or rotate a key later without re-running login, use `securenow api-key set snk_live_...` (see [API Key Management](#api-key-management) below).
38
+ **Zero-config flow (v7+):** the browser step lets the user pick (or create) an app. The CLI stores the app's **key (UUID)**, **name**, and **instance URL** in `.securenow/credentials.json`. The SDK reads this file at boot and sends traces/logs to the right app bucket — **no env vars required for local dev**.
39
+
40
+ **Default-on security (v7.4+):** after picking or creating the app, `securenow login` turns on that app's firewall toggle, mints an API key with `firewall:read + blocklist:read + allowlist:read` scopes, and writes it into `.securenow/credentials.json`. Traces, logs, POST body capture, multipart metadata capture, and the firewall are enabled by default. No `SECURENOW_API_KEY` env var is needed. To add or rotate a key later without re-running login, use `securenow api-key set snk_live_...` (see [API Key Management](#api-key-management) below).
30
41
 
31
42
  Credentials resolve in order: `SECURENOW_TOKEN` env var → project `.securenow/credentials.json` → global `~/.securenow/credentials.json`.
32
43
 
@@ -245,7 +256,7 @@ securenow firewall status # layers, sync time, blocked count,
245
256
  securenow firewall test-ip <ip> # check if IP would be blocked
246
257
  ```
247
258
 
248
- **Zero-config setup (v7.1+):** running `securenow login` and opting into "Enable the Firewall?" in the browser auto-mints an API key (scoped `firewall:read + blocklist:read + allowlist:read`) and writes it to the credentials file. No `SECURENOW_API_KEY` env var needed. If the user already has a key, `securenow api-key set snk_live_...` achieves the same thing. See [the landing firewall page](https://securenow.ai/firewall) for an overview.
259
+ **Zero-config setup (v7.4+):** running `securenow login` enables the selected app's firewall toggle, auto-mints an API key (scoped `firewall:read + blocklist:read + allowlist:read`), and writes it to the credentials file after the app is selected. No `SECURENOW_API_KEY` env var needed. If the user already has a key, `securenow api-key set snk_live_...` achieves the same thing. See [the landing firewall page](https://securenow.ai/firewall) for an overview.
249
260
 
250
261
  ### Blocklist — Block Malicious IPs
251
262
 
package/cli.js CHANGED
@@ -365,14 +365,19 @@ const COMMANDS = {
365
365
  usage: 'securenow doctor [--json]',
366
366
  run: (a, f) => require('./cli/diagnostics').doctor(a, f),
367
367
  },
368
- env: {
369
- desc: 'Show resolved SecureNow configuration (service name, endpoints, env vars)',
370
- usage: 'securenow env [--json]',
371
- run: (a, f) => require('./cli/diagnostics').env(a, f),
372
- },
373
- version: {
374
- desc: 'Show CLI version',
375
- run: () => {
368
+ env: {
369
+ desc: 'Show resolved SecureNow configuration (service name, endpoints, env vars)',
370
+ usage: 'securenow env [--json]',
371
+ run: (a, f) => require('./cli/diagnostics').env(a, f),
372
+ },
373
+ mcp: {
374
+ desc: 'Start the SecureNow MCP server over stdio',
375
+ usage: 'securenow mcp',
376
+ run: () => require('./mcp/server'),
377
+ },
378
+ version: {
379
+ desc: 'Show CLI version',
380
+ run: () => {
376
381
  try {
377
382
  const pkg = require('./package.json');
378
383
  console.log(`securenow v${pkg.version}`);
@@ -437,7 +442,7 @@ function showHelp(commandName) {
437
442
  'Firewall': ['firewall'],
438
443
  'Remediation': ['blocklist', 'allowlist', 'trusted'],
439
444
  'Telemetry': ['log', 'test-span'],
440
- 'Utilities': ['redact', 'cidr', 'doctor', 'env'],
445
+ 'Utilities': ['redact', 'cidr', 'doctor', 'env', 'mcp'],
441
446
  'Settings': ['instances', 'config', 'version'],
442
447
  };
443
448
 
@@ -119,9 +119,10 @@ SECURENOW_NO_UUID=1
119
119
  |----------|---------|---------|
120
120
  | `SECURENOW_APPID` | Your app key (from `securenow apps create`) | **Required** |
121
121
  | `SECURENOW_INSTANCE` | OTLP collector endpoint | `https://freetrial.securenow.ai:4318` |
122
- | `SECURENOW_LOGGING_ENABLED` | Auto-forward all `console.*` calls as OTLP logs | `0` |
122
+ | `SECURENOW_LOGGING_ENABLED` | Auto-forward all `console.*` calls as OTLP logs | `1` |
123
123
  | `SECURENOW_NO_UUID` | Keep `service.name` equal to your app key (no UUID suffix) | `0` |
124
- | `SECURENOW_CAPTURE_BODY` | Capture request/response bodies in traces | `0` |
124
+ | `SECURENOW_CAPTURE_BODY` | Capture request/response bodies in traces | `1` |
125
+ | `SECURENOW_CAPTURE_MULTIPART` | Capture multipart field/file metadata | `1` |
125
126
  | `SECURENOW_MAX_BODY_SIZE` | Max captured body size in bytes | `10240` |
126
127
  | `SECURENOW_SENSITIVE_FIELDS` | Extra field names to auto-redact (comma-separated) | — |
127
128
  | `SECURENOW_TRUSTED_PROXIES` | Comma-separated proxy IPs for X-Forwarded-For | — |
@@ -137,7 +138,8 @@ SECURENOW_APPID=my-app-prod
137
138
  SECURENOW_INSTANCE=https://collector.yourcompany.com:4318
138
139
  SECURENOW_LOGGING_ENABLED=1
139
140
  SECURENOW_NO_UUID=1
140
- SECURENOW_CAPTURE_BODY=0
141
+ SECURENOW_CAPTURE_BODY=1
142
+ SECURENOW_CAPTURE_MULTIPART=1
141
143
  SECURENOW_TRUSTED_PROXIES=10.0.0.1,10.0.0.2
142
144
  NODE_ENV=production
143
145
  ```
@@ -203,7 +205,7 @@ node app.js
203
205
  |---------|-----------|
204
206
  | Traces | Yes |
205
207
  | Logs | Yes |
206
- | Body Capture | Yes set `SECURENOW_CAPTURE_BODY=1` |
208
+ | Body Capture | Yes - default on |
207
209
 
208
210
  ---
209
211
 
@@ -249,7 +251,7 @@ node app.js
249
251
  |---------|-----------|
250
252
  | Traces | Yes |
251
253
  | Logs | Yes |
252
- | Body Capture | **No** set `SECURENOW_CAPTURE_BODY=0` (stream conflict) |
254
+ | Body Capture | Yes - default on; set `SECURENOW_CAPTURE_BODY=0` only for a local stream conflict |
253
255
 
254
256
  ---
255
257
 
@@ -299,7 +301,7 @@ node app.js
299
301
  |---------|-----------|
300
302
  | Traces | Yes |
301
303
  | Logs | Yes |
302
- | Body Capture | Yes set `SECURENOW_CAPTURE_BODY=1` |
304
+ | Body Capture | Yes - default on |
303
305
 
304
306
  ---
305
307
 
@@ -376,7 +378,7 @@ Add both to your `package.json`:
376
378
  |---------|-----------|
377
379
  | Traces | Yes |
378
380
  | Logs | Yes |
379
- | Body Capture | Yes set `SECURENOW_CAPTURE_BODY=1` |
381
+ | Body Capture | Yes - default on |
380
382
 
381
383
  ---
382
384
 
@@ -426,7 +428,7 @@ node app.js
426
428
  |---------|-----------|
427
429
  | Traces | Yes |
428
430
  | Logs | Yes |
429
- | Body Capture | **No** set `SECURENOW_CAPTURE_BODY=0` (payload stream conflict) |
431
+ | Body Capture | Yes - default on; set `SECURENOW_CAPTURE_BODY=0` only for a local stream conflict |
430
432
 
431
433
  ---
432
434
 
@@ -473,7 +475,7 @@ node app.js
473
475
  |---------|-----------|
474
476
  | Traces | Yes |
475
477
  | Logs | Yes |
476
- | Body Capture | Yes set `SECURENOW_CAPTURE_BODY=1` |
478
+ | Body Capture | Yes - default on |
477
479
 
478
480
  ---
479
481
 
@@ -528,7 +530,7 @@ node app.js
528
530
  |---------|-----------|
529
531
  | Traces | Yes |
530
532
  | Logs | Yes |
531
- | Body Capture | Yes set `SECURENOW_CAPTURE_BODY=1` |
533
+ | Body Capture | Yes - default on |
532
534
 
533
535
  ---
534
536
 
@@ -591,7 +593,7 @@ node app.js
591
593
  |---------|-----------|
592
594
  | Traces | Yes |
593
595
  | Logs | Yes |
594
- | Body Capture | Yes set `SECURENOW_CAPTURE_BODY=1` |
596
+ | Body Capture | Yes - default on |
595
597
 
596
598
  ---
597
599
 
@@ -632,7 +634,7 @@ node -r securenow/register app.mjs
632
634
  |---------|-----------|
633
635
  | Traces | Yes |
634
636
  | Logs | Yes |
635
- | Body Capture | **No** set `SECURENOW_CAPTURE_BODY=0` (stream conflict) |
637
+ | Body Capture | Yes - default on; set `SECURENOW_CAPTURE_BODY=0` only for a local stream conflict |
636
638
 
637
639
  ---
638
640
 
@@ -687,7 +689,7 @@ node app.js
687
689
  |---------|-----------|
688
690
  | Traces | Yes |
689
691
  | Logs | Yes |
690
- | Body Capture | Yes set `SECURENOW_CAPTURE_BODY=1` |
692
+ | Body Capture | Yes - default on |
691
693
 
692
694
  ---
693
695
 
@@ -1284,7 +1286,8 @@ pm2 start ecosystem.config.cjs
1284
1286
  script: 'app.mjs',
1285
1287
  node_args: '-r securenow/register',
1286
1288
  env: {
1287
- SECURENOW_CAPTURE_BODY: '0', // Required for Hono
1289
+ SECURENOW_CAPTURE_BODY: '1',
1290
+ SECURENOW_CAPTURE_MULTIPART: '1',
1288
1291
  /* ... other vars ... */
1289
1292
  }
1290
1293
  }
@@ -1315,14 +1318,14 @@ CMD ["node", "-r", "securenow/register", "app.js"]
1315
1318
  | Framework | Traces | Logs | Body Capture | Init Method | Notes |
1316
1319
  |-----------|--------|------|--------------|-------------|-------|
1317
1320
  | Express | Yes | Yes | Yes | `require()` or `-r` | Fully compatible |
1318
- | Fastify | Yes | Yes | **No** | `require()` or `-r` | Set `SECURENOW_CAPTURE_BODY=0` |
1321
+ | Fastify | Yes | Yes | Yes | `require()` or `-r` | Default on; set `SECURENOW_CAPTURE_BODY=0` only for a local stream conflict |
1319
1322
  | Koa | Yes | Yes | Yes | `require()` or `-r` | Needs `koa-bodyparser` |
1320
1323
  | NestJS | Yes | Yes | Yes | `instrument.js` + `-r ./instrument.js` | Create `instrument.js` with `require('securenow/register')` |
1321
- | Hapi | Yes | Yes | **No** | `require()` or `-r` | Set `SECURENOW_CAPTURE_BODY=0` |
1324
+ | Hapi | Yes | Yes | Yes | `require()` or `-r` | Default on; set `SECURENOW_CAPTURE_BODY=0` only for a local stream conflict |
1322
1325
  | h3 | Yes | Yes | Yes | `require()` or `-r` | Uses `toNodeListener()` |
1323
1326
  | Polka | Yes | Yes | Yes | `require()` or `-r` | Needs manual body parser |
1324
1327
  | Micro/HTTP | Yes | Yes | Yes | `require()` or `-r` | Raw `http.createServer` |
1325
- | Hono | Yes | Yes | **No** | `-r` flag only (ESM) | Set `SECURENOW_CAPTURE_BODY=0` |
1328
+ | Hono | Yes | Yes | Yes | `-r` flag only (ESM) | Default on; set `SECURENOW_CAPTURE_BODY=0` only for a local stream conflict |
1326
1329
  | Feathers | Yes | Yes | Yes | `require()` or `-r` | Express transport |
1327
1330
  | Next.js | Yes | Yes | Yes | `instrumentation.ts` | Use `securenow init` |
1328
1331
 
@@ -1349,7 +1352,7 @@ Do **not** add `require('securenow/register')` inside `.mjs` files.
1349
1352
 
1350
1353
  ### Body capture crashes / empty payloads
1351
1354
 
1352
- Set `SECURENOW_CAPTURE_BODY=0` for Fastify, Hapi, and Hono. These frameworks use custom stream handling that conflicts with the body capture hook.
1355
+ Body capture is on by default. If a specific framework version or plugin stack reports request-stream conflicts, set `SECURENOW_CAPTURE_BODY=0` as a local override for that app.
1353
1356
 
1354
1357
  ### CLI says "Not logged in"
1355
1358
 
@@ -54,8 +54,8 @@ Since v7.1.0, the firewall reads its API key from `.securenow/credentials.json`
54
54
  ### Writing the key to the credentials file
55
55
 
56
56
  ```bash
57
- # Interactive onboarding picks/creates an app and, if you opt in,
58
- # mints a key scoped firewall:read + blocklist:read + allowlist:read
57
+ # Interactive onboarding - picks/creates an app, enables that app's firewall,
58
+ # and mints a key scoped firewall:read + blocklist:read + allowlist:read
59
59
  # (the "firewall" preset, used by default for CLI firewall onboarding)
60
60
  # and writes it to ./.securenow/credentials.json automatically.
61
61
  npx securenow login