@debugg-ai/debugg-ai-mcp 2.3.1 → 2.4.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/dist/config/index.js +24 -1
- package/dist/index.js +11 -2
- package/package.json +1 -1
package/dist/config/index.js
CHANGED
|
@@ -22,6 +22,29 @@ function findPackageVersion() {
|
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
const _version = findPackageVersion();
|
|
25
|
+
/**
|
|
26
|
+
* Public PostHog project key (write-only). Embedded so every MCP install
|
|
27
|
+
* sends telemetry by default — lets the team observe cache hit rates,
|
|
28
|
+
* poll cadence, tunnel reliability, etc. across the whole install base
|
|
29
|
+
* without requiring users to configure anything.
|
|
30
|
+
*
|
|
31
|
+
* Safe to embed: this is a `phc_*` project key (PostHog's client-side
|
|
32
|
+
* convention), not a personal API key. It can only write events, not
|
|
33
|
+
* read them.
|
|
34
|
+
*
|
|
35
|
+
* Override with POSTHOG_API_KEY (e.g. for a private fork pointing at a
|
|
36
|
+
* different PostHog project). Disable with DEBUGGAI_TELEMETRY_DISABLED=1.
|
|
37
|
+
*/
|
|
38
|
+
const DEBUGGAI_DEFAULT_POSTHOG_KEY = 'phc_4h2Yov2P0Vc9UMqfKf3dYKSQ6THOs7N6LZR0VKYopZN';
|
|
39
|
+
function isTelemetryDisabled() {
|
|
40
|
+
const v = (process.env.DEBUGGAI_TELEMETRY_DISABLED || '').toLowerCase();
|
|
41
|
+
return v === '1' || v === 'true' || v === 'yes' || v === 'on';
|
|
42
|
+
}
|
|
43
|
+
function resolvePosthogKey() {
|
|
44
|
+
if (isTelemetryDisabled())
|
|
45
|
+
return undefined;
|
|
46
|
+
return process.env.POSTHOG_API_KEY || DEBUGGAI_DEFAULT_POSTHOG_KEY;
|
|
47
|
+
}
|
|
25
48
|
const configSchema = z.object({
|
|
26
49
|
server: z.object({
|
|
27
50
|
name: z.string().default('DebuggAI MCP Server'),
|
|
@@ -63,7 +86,7 @@ export function loadConfig() {
|
|
|
63
86
|
format: process.env.LOG_FORMAT || 'simple',
|
|
64
87
|
},
|
|
65
88
|
telemetry: {
|
|
66
|
-
posthogApiKey:
|
|
89
|
+
posthogApiKey: resolvePosthogKey(),
|
|
67
90
|
posthogHost: process.env.POSTHOG_HOST || undefined,
|
|
68
91
|
},
|
|
69
92
|
};
|
package/dist/index.js
CHANGED
|
@@ -158,14 +158,23 @@ async function main() {
|
|
|
158
158
|
if (!config.api.key) {
|
|
159
159
|
logger.warn('DEBUGGAI_API_KEY is not set. Server will boot but every tool call will return a ConfigurationError until the env var is configured.');
|
|
160
160
|
}
|
|
161
|
-
// Initialize telemetry
|
|
161
|
+
// Initialize telemetry: PostHog by default (public project key embedded
|
|
162
|
+
// in config so the team can observe cache hit rates, poll cadence, etc.
|
|
163
|
+
// across all installs). Falls back to Noop when DEBUGGAI_TELEMETRY_DISABLED
|
|
164
|
+
// is set. Distinct ID is SHA-256(apiKey) — never the raw key.
|
|
162
165
|
Telemetry.setDistinctId(config.api.key);
|
|
163
166
|
if (config.telemetry.posthogApiKey) {
|
|
164
167
|
const { PostHogProvider } = await import('./services/posthogProvider.js');
|
|
165
168
|
Telemetry.configure(new PostHogProvider(config.telemetry.posthogApiKey, {
|
|
166
169
|
host: config.telemetry.posthogHost,
|
|
167
170
|
}));
|
|
168
|
-
|
|
171
|
+
const usingDefault = !process.env.POSTHOG_API_KEY;
|
|
172
|
+
logger.info(usingDefault
|
|
173
|
+
? 'Telemetry enabled (PostHog, DebuggAI default project). Set DEBUGGAI_TELEMETRY_DISABLED=1 to opt out.'
|
|
174
|
+
: 'Telemetry enabled (PostHog, custom POSTHOG_API_KEY)');
|
|
175
|
+
}
|
|
176
|
+
else {
|
|
177
|
+
logger.info('Telemetry disabled (DEBUGGAI_TELEMETRY_DISABLED is set)');
|
|
169
178
|
}
|
|
170
179
|
// No API calls at boot. Project context is resolved lazily on first tool
|
|
171
180
|
// invocation (list_environments / list_credentials / check_app_in_browser).
|