@armature-tech/mcp-analytics 0.6.18 → 0.6.19

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.
Files changed (51) hide show
  1. package/README.md +99 -4
  2. package/SKILL.md +29 -4
  3. package/dist/cjs/cli.d.ts +2 -0
  4. package/dist/cjs/cli.js +62 -0
  5. package/dist/cjs/doctor-args.d.ts +2 -0
  6. package/dist/cjs/doctor-args.js +101 -0
  7. package/dist/cjs/doctor.d.ts +63 -0
  8. package/dist/cjs/doctor.js +325 -0
  9. package/dist/cjs/emit.d.ts +3 -0
  10. package/dist/cjs/emit.js +18 -3
  11. package/dist/cjs/events.d.ts +18 -5
  12. package/dist/cjs/events.js +127 -41
  13. package/dist/cjs/index.d.ts +6 -4
  14. package/dist/cjs/index.js +15 -1
  15. package/dist/cjs/mastra.js +42 -0
  16. package/dist/cjs/queue.d.ts +9 -0
  17. package/dist/cjs/queue.js +116 -0
  18. package/dist/cjs/recorder.js +157 -70
  19. package/dist/cjs/redact-secrets.d.ts +10 -0
  20. package/dist/cjs/redact-secrets.js +121 -0
  21. package/dist/cjs/request-capability.d.ts +12 -0
  22. package/dist/cjs/request-capability.js +50 -0
  23. package/dist/cjs/sanitize.d.ts +5 -1
  24. package/dist/cjs/sanitize.js +51 -37
  25. package/dist/cjs/server.js +20 -0
  26. package/dist/cjs/types.d.ts +25 -1
  27. package/dist/esm/cli.d.ts +2 -0
  28. package/dist/esm/cli.js +60 -0
  29. package/dist/esm/doctor-args.d.ts +2 -0
  30. package/dist/esm/doctor-args.js +97 -0
  31. package/dist/esm/doctor.d.ts +63 -0
  32. package/dist/esm/doctor.js +315 -0
  33. package/dist/esm/emit.d.ts +3 -0
  34. package/dist/esm/emit.js +14 -1
  35. package/dist/esm/events.d.ts +18 -5
  36. package/dist/esm/events.js +124 -40
  37. package/dist/esm/index.d.ts +6 -4
  38. package/dist/esm/index.js +5 -3
  39. package/dist/esm/mastra.js +42 -0
  40. package/dist/esm/queue.d.ts +9 -0
  41. package/dist/esm/queue.js +112 -0
  42. package/dist/esm/recorder.js +159 -72
  43. package/dist/esm/redact-secrets.d.ts +10 -0
  44. package/dist/esm/redact-secrets.js +115 -0
  45. package/dist/esm/request-capability.d.ts +12 -0
  46. package/dist/esm/request-capability.js +45 -0
  47. package/dist/esm/sanitize.d.ts +5 -1
  48. package/dist/esm/sanitize.js +50 -36
  49. package/dist/esm/server.js +20 -0
  50. package/dist/esm/types.d.ts +25 -1
  51. package/package.json +6 -1
@@ -0,0 +1,115 @@
1
+ import { isRecord } from "./utils.js";
2
+ // Contract order is significant. Keep these expressions RE2-compatible so
3
+ // the TypeScript, Python, and Go implementations continue to agree.
4
+ export const SECRET_PATTERN_RULES = [
5
+ {
6
+ id: "pem",
7
+ pattern: /-----BEGIN [A-Z0-9 ]*PRIVATE KEY-----[\s\S]*?-----END [A-Z0-9 ]*PRIVATE KEY-----/g,
8
+ replacement: "[redacted:pem]",
9
+ },
10
+ {
11
+ id: "sensitive-kv",
12
+ pattern: /\b(password|passwd|pwd|secret|api[_-]?key|access[_-]?token|refresh[_-]?token|client[_-]?secret|private[_-]?key|authorization)([=:])([^\s"'`,;&]{4,})/gi,
13
+ replacement: "$1$2[redacted:sensitive-kv]",
14
+ },
15
+ {
16
+ id: "aws-access-key-id",
17
+ pattern: /\b(?:AKIA|ASIA|ABIA|ACCA|AGPA|AIDA|AIPA|ANPA|ANVA|AROA)[A-Z0-9]{16}\b/g,
18
+ replacement: "[redacted:aws-access-key-id]",
19
+ },
20
+ {
21
+ id: "github-token",
22
+ pattern: /\b(?:gh[pousr]_[A-Za-z0-9]{36}|github_pat_[A-Za-z0-9_]{22,255})\b/g,
23
+ replacement: "[redacted:github-token]",
24
+ },
25
+ {
26
+ id: "google-api-key",
27
+ pattern: /\bAIza[0-9A-Za-z_-]{35}\b/g,
28
+ replacement: "[redacted:google-api-key]",
29
+ },
30
+ {
31
+ id: "slack-token",
32
+ pattern: /\bxox[abprs]-[A-Za-z0-9-]{10,}\b/g,
33
+ replacement: "[redacted:slack-token]",
34
+ },
35
+ {
36
+ id: "stripe-key",
37
+ pattern: /\b[rs]k_(?:live|test)_[A-Za-z0-9]{16,}\b/g,
38
+ replacement: "[redacted:stripe-key]",
39
+ },
40
+ {
41
+ id: "anthropic-api-key",
42
+ pattern: /\bsk-ant-[A-Za-z0-9_-]{16,}\b/g,
43
+ replacement: "[redacted:anthropic-api-key]",
44
+ },
45
+ {
46
+ id: "openai-api-key",
47
+ pattern: /\bsk-[A-Za-z0-9_-]{20,}\b/g,
48
+ replacement: "[redacted:openai-api-key]",
49
+ },
50
+ {
51
+ id: "jwt",
52
+ pattern: /\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{6,}\.[A-Za-z0-9_-]{10,}\b/g,
53
+ replacement: "[redacted:jwt]",
54
+ },
55
+ {
56
+ id: "connection-string",
57
+ pattern: /\b([a-zA-Z][a-zA-Z0-9+.-]*:\/\/[^\s:/@]+):([^\s@]+)@/g,
58
+ replacement: "$1:[redacted:connection-string]@",
59
+ },
60
+ {
61
+ id: "bearer",
62
+ pattern: /\b[Bb]earer +[A-Za-z0-9._~+/=-]{16,}/g,
63
+ replacement: "Bearer [redacted:bearer]",
64
+ },
65
+ {
66
+ id: "basic",
67
+ pattern: /\b[Bb]asic +[A-Za-z0-9+/=]{16,}/g,
68
+ replacement: "Basic [redacted:basic]",
69
+ },
70
+ ];
71
+ export const SENSITIVE_FIELD_NAMES = new Set([
72
+ "password", "passwd", "pwd", "secret", "apikey", "accesskey",
73
+ "secretkey", "secretaccesskey", "token", "accesstoken", "refreshtoken",
74
+ "idtoken", "sessiontoken", "authorization", "auth", "clientsecret",
75
+ "privatekey", "credential", "credentials", "connectionstring",
76
+ "databaseurl", "dsn",
77
+ ]);
78
+ export const normalizeSensitiveFieldName = (key) => {
79
+ return key.toLowerCase().replace(/[_-]/g, "");
80
+ };
81
+ export const redactSecretsInString = (value) => {
82
+ let redacted = value;
83
+ for (const rule of SECRET_PATTERN_RULES) {
84
+ redacted = redacted.replace(rule.pattern, rule.replacement);
85
+ }
86
+ return redacted;
87
+ };
88
+ export const redactSecretsInValue = (value, seen) => {
89
+ if (typeof value === "string")
90
+ return redactSecretsInString(value);
91
+ if (typeof value !== "object" || value === null)
92
+ return value;
93
+ const tracked = seen ?? new WeakSet();
94
+ if (tracked.has(value))
95
+ return "[circular]";
96
+ tracked.add(value);
97
+ try {
98
+ if (Array.isArray(value)) {
99
+ return value.map((item) => redactSecretsInValue(item, tracked));
100
+ }
101
+ if (!isRecord(value))
102
+ return value;
103
+ const out = {};
104
+ for (const [key, entry] of Object.entries(value)) {
105
+ out[key] = typeof entry === "string"
106
+ && SENSITIVE_FIELD_NAMES.has(normalizeSensitiveFieldName(key))
107
+ ? "[redacted:sensitive-field]"
108
+ : redactSecretsInValue(entry, tracked);
109
+ }
110
+ return out;
111
+ }
112
+ finally {
113
+ tracked.delete(value);
114
+ }
115
+ };
@@ -0,0 +1,12 @@
1
+ import { z } from "zod";
2
+ import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
3
+ import type { JsonObjectSchema, McpAnalyticsConfig } from "./types.js";
4
+ export declare const REQUEST_CAPABILITY_TOOL_NAME = "request_capability";
5
+ export declare const REQUEST_CAPABILITY_DESCRIPTION = "Request a capability that is not provided by the currently available tools. Use this when a capability is required to complete the user\u2019s request and no existing tool can perform it.";
6
+ export declare const REQUEST_CAPABILITY_ARGUMENT_DESCRIPTION = "The capability required to complete the user's request. Omit argument values, PII, and secrets. Use English.";
7
+ export declare const REQUEST_CAPABILITY_INPUT_SCHEMA: JsonObjectSchema;
8
+ export declare const REQUEST_CAPABILITY_ZOD_SHAPE: {
9
+ capability: z.ZodString;
10
+ };
11
+ export declare const isRequestCapabilityEnabled: (config: McpAnalyticsConfig) => boolean;
12
+ export declare const handleRequestCapability: (args: unknown) => CallToolResult;
@@ -0,0 +1,45 @@
1
+ import { z } from "zod";
2
+ import { resolveApiKey } from "./emit.js";
3
+ import { isRecord } from "./utils.js";
4
+ export const REQUEST_CAPABILITY_TOOL_NAME = "request_capability";
5
+ export const REQUEST_CAPABILITY_DESCRIPTION = "Request a capability that is not provided by the currently available tools. Use this when a capability is required to complete the user’s request and no existing tool can perform it.";
6
+ export const REQUEST_CAPABILITY_ARGUMENT_DESCRIPTION = "The capability required to complete the user's request. Omit argument values, PII, and secrets. Use English.";
7
+ export const REQUEST_CAPABILITY_INPUT_SCHEMA = {
8
+ type: "object",
9
+ properties: {
10
+ capability: {
11
+ type: "string",
12
+ description: REQUEST_CAPABILITY_ARGUMENT_DESCRIPTION,
13
+ minLength: 1,
14
+ maxLength: 1000,
15
+ },
16
+ },
17
+ required: ["capability"],
18
+ additionalProperties: false,
19
+ };
20
+ // McpServer.registerTool accepts a Zod raw shape, while custom dispatchers
21
+ // consume the JSON Schema above from recorder.toolDefinitions().
22
+ export const REQUEST_CAPABILITY_ZOD_SHAPE = {
23
+ capability: z
24
+ .string()
25
+ .min(1)
26
+ .max(1000)
27
+ .describe(REQUEST_CAPABILITY_ARGUMENT_DESCRIPTION),
28
+ };
29
+ export const isRequestCapabilityEnabled = (config) => config.armature?.requestCapability === true
30
+ && config.armature?.enabled !== false
31
+ && (typeof config.armature?.emit === "function" || Boolean(resolveApiKey(config)));
32
+ export const handleRequestCapability = (args) => {
33
+ if (!isRecord(args)
34
+ || typeof args.capability !== "string"
35
+ || args.capability.trim().length === 0
36
+ || args.capability.length > 1000) {
37
+ return {
38
+ isError: true,
39
+ content: [{ type: "text", text: "capability must be a non-empty string" }],
40
+ };
41
+ }
42
+ return {
43
+ content: [{ type: "text", text: "Capability request acknowledged." }],
44
+ };
45
+ };
@@ -2,5 +2,9 @@ import type { RedactFunction } from "./types.js";
2
2
  export declare const BINARY_REMOVED_PLACEHOLDER = "[binary removed]";
3
3
  export declare const BASE64_REMOVED_PLACEHOLDER = "[base64 removed]";
4
4
  export declare const REDACTION_FAILED_PLACEHOLDER = "[redaction failed]";
5
+ export declare const SANITIZATION_BUDGET = 65536;
5
6
  export declare const sanitizeValue: (value: unknown, seen?: WeakSet<object>) => unknown;
6
- export declare const prepareForPreview: (value: unknown, redact: RedactFunction | undefined) => unknown;
7
+ export type PrepareForPreviewOptions = {
8
+ redactSecrets?: boolean;
9
+ };
10
+ export declare const prepareForPreview: (value: unknown, redact?: RedactFunction, options?: PrepareForPreviewOptions) => unknown;
@@ -1,18 +1,11 @@
1
+ import { redactSecretsInValue } from "./redact-secrets.js";
1
2
  import { isRecord } from "./utils.js";
2
- // Placeholder strings are part of the cross-SDK contract
3
- // (packages/TELEMETRY-CONTRACT.md) — golden tests in all three SDKs assert
4
- // them byte-for-byte.
5
3
  export const BINARY_REMOVED_PLACEHOLDER = "[binary removed]";
6
4
  export const BASE64_REMOVED_PLACEHOLDER = "[base64 removed]";
7
5
  export const REDACTION_FAILED_PLACEHOLDER = "[redaction failed]";
8
- // A data: URI with a base64 payload is binary at any plausible size; plain
9
- // strings need the higher bar (length + strict charset) so prose, ids, and
10
- // hashes below half a KB pass through untouched. Both thresholds are contract
11
- // values — keep in sync with the Python and Go SDKs.
6
+ export const SANITIZATION_BUDGET = 65_536;
12
7
  const DATA_URI_MIN_CHARS = 64;
13
8
  const BASE64_MIN_CHARS = 512;
14
- // Strict charset on purpose: no whitespace, so long prose (letters + spaces)
15
- // never matches. Covers standard base64 and base64url, with optional padding.
16
9
  const BASE64_RE = /^[A-Za-z0-9+/_-]+={0,2}$/;
17
10
  const isBase64Payload = (value) => {
18
11
  if (value.length >= DATA_URI_MIN_CHARS && value.startsWith("data:") && value.includes(";base64,")) {
@@ -23,59 +16,80 @@ const isBase64Payload = (value) => {
23
16
  const sanitizeString = (value) => {
24
17
  return isBase64Payload(value) ? BASE64_REMOVED_PLACEHOLDER : value;
25
18
  };
26
- // Recursively strips binary and base64 payloads from a tool input/output
27
- // value before it is serialized into previews (gap #1). MCP image/audio
28
- // content blocks lose their `data`, resource blobs lose their `blob`, and
29
- // long base64 strings are replaced wholesale. Cycle-safe: the tracker holds
30
- // only the CURRENT descent path (entries are removed on the way back up), so
31
- // content legitimately shared between two branches is sanitized in both
32
- // places while a true cycle serializes as "[circular]" instead of
33
- // overflowing. Matches the Python and Go sanitizers.
34
- export const sanitizeValue = (value, seen) => {
35
- if (typeof value === "string")
36
- return sanitizeString(value);
19
+ const charge = (budget, units) => {
20
+ if (budget.remaining < units) {
21
+ budget.remaining = 0;
22
+ return false;
23
+ }
24
+ budget.remaining -= units;
25
+ return true;
26
+ };
27
+ const sanitizeValueBounded = (value, seen, budget) => {
28
+ if (typeof value === "string") {
29
+ const sanitized = sanitizeString(value);
30
+ if (sanitized.length <= budget.remaining) {
31
+ budget.remaining -= sanitized.length;
32
+ return sanitized;
33
+ }
34
+ const sliced = sanitized.slice(0, budget.remaining);
35
+ budget.remaining = 0;
36
+ return sliced;
37
+ }
37
38
  if (typeof value !== "object" || value === null)
38
39
  return value;
39
- const tracked = seen ?? new WeakSet();
40
- if (tracked.has(value))
41
- return "[circular]";
42
- tracked.add(value);
40
+ if (seen.has(value))
41
+ return sanitizeValueBounded("[circular]", seen, budget);
42
+ seen.add(value);
43
43
  try {
44
44
  if (Array.isArray(value)) {
45
- return value.map((item) => sanitizeValue(item, tracked));
45
+ const out = [];
46
+ for (const item of value) {
47
+ if (!charge(budget, 2))
48
+ break;
49
+ out.push(sanitizeValueBounded(item, seen, budget));
50
+ if (budget.remaining === 0)
51
+ break;
52
+ }
53
+ return out;
46
54
  }
47
55
  if (!isRecord(value))
48
56
  return value;
49
57
  const out = {};
50
58
  for (const [key, entry] of Object.entries(value)) {
59
+ if (!charge(budget, key.length + 2))
60
+ break;
51
61
  if (key === "data"
52
62
  && typeof entry === "string"
53
63
  && (value.type === "image" || value.type === "audio")) {
54
- out[key] = BINARY_REMOVED_PLACEHOLDER;
64
+ out[key] = sanitizeValueBounded(BINARY_REMOVED_PLACEHOLDER, seen, budget);
55
65
  }
56
66
  else if (key === "blob" && typeof entry === "string") {
57
- out[key] = BINARY_REMOVED_PLACEHOLDER;
67
+ out[key] = sanitizeValueBounded(BINARY_REMOVED_PLACEHOLDER, seen, budget);
58
68
  }
59
69
  else {
60
- out[key] = sanitizeValue(entry, tracked);
70
+ out[key] = sanitizeValueBounded(entry, seen, budget);
61
71
  }
72
+ if (budget.remaining === 0)
73
+ break;
62
74
  }
63
75
  return out;
64
76
  }
65
77
  finally {
66
- tracked.delete(value);
78
+ seen.delete(value);
67
79
  }
68
80
  };
69
- // sanitize → customer redact, failing closed: a throwing hook replaces the
70
- // whole payload with the placeholder rather than shipping unredacted data.
71
- // The event itself still ships — losing a preview is recoverable, silently
72
- // dropping calls from analytics is not.
73
- export const prepareForPreview = (value, redact) => {
81
+ export const sanitizeValue = (value, seen) => {
82
+ return sanitizeValueBounded(value, seen ?? new WeakSet(), { remaining: SANITIZATION_BUDGET });
83
+ };
84
+ export const prepareForPreview = (value, redact, options = {}) => {
74
85
  const sanitized = sanitizeValue(value);
86
+ const protectedValue = options.redactSecrets === false
87
+ ? sanitized
88
+ : redactSecretsInValue(sanitized);
75
89
  if (!redact)
76
- return sanitized;
90
+ return protectedValue;
77
91
  try {
78
- return redact(sanitized);
92
+ return redact(protectedValue);
79
93
  }
80
94
  catch {
81
95
  return REDACTION_FAILED_PLACEHOLDER;
@@ -5,6 +5,7 @@ import { createAnalyticsRecorder } from "./recorder.js";
5
5
  import { planToolTelemetry } from "./schema.js";
6
6
  import { defaultMcpAnalyticsConfig } from "./emit.js";
7
7
  import { deriveToolResultError, isRecord } from "./utils.js";
8
+ import { isRequestCapabilityEnabled } from "./request-capability.js";
8
9
  const withAnalyticsStorage = new AsyncLocalStorage();
9
10
  let prototypePatchInstalled = false;
10
11
  // Mirrors the SDK's `isZodTypeLike`/`isZodRawShapeCompat` checks closely enough
@@ -151,6 +152,25 @@ export const withMcpAnalytics = (config, createServer) => {
151
152
  const recorder = createAnalyticsRecorder(config);
152
153
  installPrototypePatchOnce();
153
154
  const result = withAnalyticsStorage.run({ config, recorder }, createServer);
155
+ // Customer tools registered inside the factory are handled by the
156
+ // prototype patch above. The opt-in SDK-owned tool lives in the recorder's
157
+ // private registry, so attach only after leaving AsyncLocalStorage: this
158
+ // registers it once without adding telemetry fields or mutating its exact
159
+ // description.
160
+ if (isRequestCapabilityEnabled(config) && !(result instanceof McpServer)) {
161
+ throw new Error("armature.requestCapability requires the server factory to return an McpServer instance.");
162
+ }
163
+ if (isRequestCapabilityEnabled(config) && result instanceof McpServer) {
164
+ try {
165
+ recorder.attachToMcpServer(result);
166
+ }
167
+ catch (error) {
168
+ if (error instanceof Error && /already registered/i.test(error.message)) {
169
+ throw new Error('Tool name "request_capability" is reserved while armature.requestCapability is enabled.', { cause: error });
170
+ }
171
+ throw error;
172
+ }
173
+ }
154
174
  return { result, recorder };
155
175
  };
156
176
  export const createMcpAnalyticsServer = (createServer, config = defaultMcpAnalyticsConfig) => {
@@ -39,7 +39,20 @@ export type ActorIdResolverInput = {
39
39
  telemetry?: TelemetryArgs;
40
40
  };
41
41
  export type ActorIdResolver = (input: ActorIdResolverInput) => string | Promise<string>;
42
+ export type ActorIdentifierResolver = (input: ActorIdResolverInput) => string | Promise<string>;
42
43
  export type RedactFunction = (value: unknown) => unknown;
44
+ export type RedactableToolCall = {
45
+ kind: "tool_call";
46
+ toolName: string;
47
+ status: "ok" | "error";
48
+ durationMs: number;
49
+ sessionId?: string;
50
+ input: unknown;
51
+ output?: unknown;
52
+ errorMessage?: string;
53
+ telemetry?: TelemetryArgs;
54
+ };
55
+ export type RedactEventHook = (event: RedactableToolCall) => RedactableToolCall | null | Promise<RedactableToolCall | null>;
43
56
  export type TelemetryFieldMap = {
44
57
  /** @deprecated `user_turn` is no longer collected; this mapping is ignored. */
45
58
  user_turn?: string;
@@ -52,14 +65,23 @@ export type McpAnalyticsConfig = {
52
65
  endpointUrl?: string;
53
66
  apiKey?: string;
54
67
  actorId?: string | ActorIdResolver;
68
+ /** Optional caller-provided identifier stored verbatim. */
69
+ actorIdentifier?: string | ActorIdentifierResolver;
55
70
  enabled?: boolean;
56
71
  delivery?: "background" | "await";
57
72
  emit?: TelemetryEmitter;
58
73
  onError?: (error: unknown, batch: AnalyticsIngestBatch) => void;
59
74
  timeoutMs?: number;
60
75
  captureTelemetry?: boolean;
76
+ /** Built-in high-confidence secret detection. Enabled by default. */
77
+ redactSecrets?: boolean;
78
+ /** @deprecated Prefer redactEvent for event context and async support. */
61
79
  redact?: RedactFunction;
80
+ redactEvent?: RedactEventHook;
81
+ /** Register background work with a platform lifecycle primitive (for example waitUntil). */
82
+ schedule?: (work: Promise<void>) => void;
62
83
  telemetryFieldMap?: TelemetryFieldMap;
84
+ requestCapability?: boolean;
63
85
  };
64
86
  };
65
87
  export type TelemetryMode = "injected" | "owned" | "scrub";
@@ -127,6 +149,7 @@ export type RecordToolCallEvent = {
127
149
  error?: unknown;
128
150
  clientInfo?: McpClientInfo;
129
151
  workflowRunId?: string;
152
+ capabilityRequest?: boolean;
130
153
  };
131
154
  export type InstrumentToolCallEvent = {
132
155
  name: string;
@@ -140,6 +163,7 @@ export type InstrumentToolCallEvent = {
140
163
  clientInfo?: McpClientInfo;
141
164
  workflowRunId?: string;
142
165
  telemetryMode?: TelemetryMode;
166
+ capabilityRequest?: boolean;
143
167
  };
144
168
  export type ToolCallHandler<T> = (args: unknown) => T | Promise<T>;
145
169
  export type ToolHandlerContext = {
@@ -178,7 +202,7 @@ export type AnalyticsRecorder = {
178
202
  createMcpServer: (info: McpServerInfo) => McpServer;
179
203
  flush: () => Promise<void>;
180
204
  };
181
- export type AnalyticsEventKind = "tool_call" | "session_init";
205
+ export type AnalyticsEventKind = "tool_call" | "session_init" | "actor_identity";
182
206
  export type AnalyticsIngestEvent = {
183
207
  event_id: string;
184
208
  kind: AnalyticsEventKind;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@armature-tech/mcp-analytics",
3
- "version": "0.6.18",
3
+ "version": "0.6.19",
4
4
  "type": "module",
5
5
  "description": "MCP analytics wrapper SDK that instruments MCP tool declarations with telemetry.",
6
6
  "license": "Apache-2.0",
@@ -25,6 +25,9 @@
25
25
  ],
26
26
  "main": "./dist/cjs/index.js",
27
27
  "types": "./dist/cjs/index.d.ts",
28
+ "bin": {
29
+ "mcp-analytics": "./dist/esm/cli.js"
30
+ },
28
31
  "exports": {
29
32
  ".": {
30
33
  "import": {
@@ -60,9 +63,11 @@
60
63
  "dev:server": "tsx experimental/mock-env/mock-example-mcp-server.ts",
61
64
  "demo": "tsx experimental/mock-env/demo-client.ts",
62
65
  "demo:instrumented": "tsx experimental/mock-env/instrumented-demo-client.ts",
66
+ "benchmark:redaction": "tsx scripts/benchmark-redaction.ts",
63
67
  "test": "tsx --test tests/*.test.ts",
64
68
  "test:artifact-canary": "npm run build && node scripts/run-publish-canary.mjs",
65
69
  "test:platform-canary": "node scripts/run-publish-canary.mjs --require-platform",
70
+ "doctor": "tsx src/cli.ts doctor",
66
71
  "typecheck": "tsc --noEmit",
67
72
  "typecheck:all": "tsc --noEmit -p tsconfig.test.json",
68
73
  "check": "npm run typecheck:all && npm test",