From 10e8e8deaabf86dfa46c48c7aaa4735f93ce1d1f Mon Sep 17 00:00:00 2001 From: Addison Waldow Date: Wed, 11 Feb 2026 18:52:58 -0700 Subject: [PATCH] fix: standardize shx dependency format in package.json --- .github/PULL_REQUEST_TEMPLATE/mcpcat.md | 11 ++++++++++- src/generator/package-json.ts | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/PULL_REQUEST_TEMPLATE/mcpcat.md b/.github/PULL_REQUEST_TEMPLATE/mcpcat.md index d3c1a4f..8c76063 100644 --- a/.github/PULL_REQUEST_TEMPLATE/mcpcat.md +++ b/.github/PULL_REQUEST_TEMPLATE/mcpcat.md @@ -3,22 +3,28 @@ > **TL;DR**: This PR adds an **opt-in** flag to scaffold privacy-safe analytics wiring for MCPcat in projects generated by `openapi-mcp-generator`. ## Summary + This PR introduces a `--with-mcpcat` CLI flag that scaffolds: + - A tiny analytics shim to emit initialize/tool-call events. - A default **local redaction** helper to scrub sensitive data before export. - Minimal config via environment variables. -No behavior changes unless the flag and env vars are set. + No behavior changes unless the flag and env vars are set. ## Motivation + - Make freshly generated MCP servers **observable in minutes**. - Encourage **privacy-by-default** analytics patterns. - Reduce copy/paste wiring; standardize event shape (operationId, path, duration, status). ## Changes + ### CLI + - `generate` accepts `--with-mcpcat` (default: off). ### Template files (added conditionally) + - `src/analytics/mcpcat.ts` – lazy import + safe no-op if SDK absent. - `src/analytics/redact.ts` – OpenAPI-aware heuristics (e.g., `*token*`, `password`, `apiKey`, `authorization`, `email`). - `src/analytics/config.ts` – reads env: @@ -28,6 +34,7 @@ No behavior changes unless the flag and env vars are set. - `MCPCAT_SAMPLE_RATE=1.0` (0–1) ### Server wiring + - Hooks server `.initialize` and each tool invocation to record: - `operationId`, HTTP `method`, `path` - redacted `args` @@ -35,9 +42,11 @@ No behavior changes unless the flag and env vars are set. - `duration_ms` ### Docs + - Adds a “Enable analytics (MCPcat)” section to generated README with privacy notes and quickstart. ## Implementation Notes + - **Compile-time optional**: no imports unless flag is used. - **Runtime safe**: try/catch around SDK import → graceful no-op if not installed. - **Transport-agnostic**: compatible with stdio, SSE/web, and StreamableHTTP templates. diff --git a/src/generator/package-json.ts b/src/generator/package-json.ts index 7766eec..20443a1 100644 --- a/src/generator/package-json.ts +++ b/src/generator/package-json.ts @@ -40,7 +40,7 @@ export function generatePackageJson( devDependencies: { '@types/node': '^22.15.2', typescript: '^5.8.3', - "shx": "^0.4.0", + shx: '^0.4.0', }, };