@codetelemetry/mcp 0.3.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.
Files changed (38) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +242 -0
  3. package/dist/src/client/agent.d.ts +379 -0
  4. package/dist/src/client/agent.js +204 -0
  5. package/dist/src/client/codexConfig.d.ts +23 -0
  6. package/dist/src/client/codexConfig.js +265 -0
  7. package/dist/src/client/config.d.ts +26 -0
  8. package/dist/src/client/config.js +32 -0
  9. package/dist/src/client/connectivity.d.ts +27 -0
  10. package/dist/src/client/connectivity.js +54 -0
  11. package/dist/src/client/deviceClient.d.ts +32 -0
  12. package/dist/src/client/deviceClient.js +112 -0
  13. package/dist/src/client/keys.d.ts +5 -0
  14. package/dist/src/client/keys.js +24 -0
  15. package/dist/src/client/onboard.d.ts +47 -0
  16. package/dist/src/client/onboard.js +84 -0
  17. package/dist/src/client/otlp.d.ts +18 -0
  18. package/dist/src/client/otlp.js +60 -0
  19. package/dist/src/client/repositoryHook.d.ts +17 -0
  20. package/dist/src/client/repositoryHook.js +631 -0
  21. package/dist/src/client/settings.d.ts +28 -0
  22. package/dist/src/client/settings.js +97 -0
  23. package/dist/src/index.d.ts +2 -0
  24. package/dist/src/index.js +2 -0
  25. package/dist/src/manifest.d.ts +29 -0
  26. package/dist/src/manifest.js +93 -0
  27. package/dist/src/mcpServer.d.ts +3 -0
  28. package/dist/src/mcpServer.js +18 -0
  29. package/dist/src/server.d.ts +2 -0
  30. package/dist/src/server.js +16 -0
  31. package/dist/src/session.d.ts +21 -0
  32. package/dist/src/session.js +44 -0
  33. package/dist/src/tools.d.ts +28 -0
  34. package/dist/src/tools.js +697 -0
  35. package/dist/src/version.d.ts +2 -0
  36. package/dist/src/version.js +2 -0
  37. package/package.json +55 -0
  38. package/tool-manifest.json +474 -0
@@ -0,0 +1,2 @@
1
+ export declare const MCP_SERVER_NAME = "codetelemetry";
2
+ export declare const MCP_SERVER_VERSION = "0.3.0";
@@ -0,0 +1,2 @@
1
+ export const MCP_SERVER_NAME = "codetelemetry";
2
+ export const MCP_SERVER_VERSION = "0.3.0";
package/package.json ADDED
@@ -0,0 +1,55 @@
1
+ {
2
+ "name": "@codetelemetry/mcp",
3
+ "version": "0.3.0",
4
+ "description": "CodeTelemetry MCP server — lets a coding agent onboard a user end to end: authenticate (device code), obtain an ingest key, write the Claude Code OTEL config, send a test event, and confirm telemetry landed — then size tasks and Linear issues from the user's own history. The plaintext key never enters the model's context.",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "homepage": "https://codetelemetry.com/docs/onboarding/mcp-server",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/ElliotGardiner/codetelemetry-mcp.git"
11
+ },
12
+ "bugs": {
13
+ "url": "https://github.com/ElliotGardiner/codetelemetry-mcp/issues"
14
+ },
15
+ "bin": {
16
+ "codetelemetry-mcp": "./dist/src/server.js"
17
+ },
18
+ "exports": {
19
+ ".": {
20
+ "types": "./dist/src/index.d.ts",
21
+ "default": "./dist/src/index.js"
22
+ }
23
+ },
24
+ "files": [
25
+ "dist",
26
+ "tool-manifest.json"
27
+ ],
28
+ "publishConfig": {
29
+ "access": "public"
30
+ },
31
+ "scripts": {
32
+ "build": "node scripts/cleanDist.ts && tsc -p tsconfig.build.json",
33
+ "test": "node --test test/tools.test.ts test/cost.test.ts test/performance.test.ts test/taskSize.test.ts test/estimateLinearIssue.test.ts test/manifest.test.ts test/clientEdgeCases.test.ts",
34
+ "test:protocol": "node --test test/protocol.smoke.ts",
35
+ "test:e2e": "node test/e2e.smoke.ts",
36
+ "test:packaged": "node --test test/packaged.smoke.ts",
37
+ "manifest:write": "node scripts/writeManifest.ts",
38
+ "verify:registry": "node scripts/verifyRegistry.ts",
39
+ "audit:package": "node scripts/auditPackage.ts",
40
+ "verify:publish-order": "node scripts/checkPublishOrder.ts",
41
+ "smoke": "node scripts/mcpSmoke.ts",
42
+ "typecheck": "tsc --noEmit",
43
+ "prepack": "npm run build && node scripts/verifyRegistry.ts --source"
44
+ },
45
+ "engines": {
46
+ "node": ">=22.6"
47
+ },
48
+ "dependencies": {
49
+ "@modelcontextprotocol/sdk": "^1.30.0"
50
+ },
51
+ "devDependencies": {
52
+ "@types/node": "^22.10.0",
53
+ "typescript": "^5.9.3"
54
+ }
55
+ }
@@ -0,0 +1,474 @@
1
+ {
2
+ "serverName": "codetelemetry",
3
+ "serverVersion": "0.3.0",
4
+ "registryHash": "270a779b8b7d1fca3344a99a49226fd2086c5a310df1e64d4e041179ab07449a",
5
+ "toolCount": 14,
6
+ "tools": [
7
+ {
8
+ "name": "authenticate",
9
+ "title": "Authenticate (device code)",
10
+ "description": "Begin device-code authentication. Returns a verification URL and a short user code; show them to the human and ask them to approve in a browser, then call auth_status. No password or browser automation is needed.",
11
+ "inputSchema": {
12
+ "type": "object",
13
+ "properties": {},
14
+ "additionalProperties": false
15
+ }
16
+ },
17
+ {
18
+ "name": "auth_status",
19
+ "title": "Check authentication status",
20
+ "description": "Poll the pending device authorization once. Returns 'pending' until the user approves, then 'authorized' (the ingest key is captured into the session — its plaintext is never returned).",
21
+ "inputSchema": {
22
+ "type": "object",
23
+ "properties": {},
24
+ "additionalProperties": false
25
+ }
26
+ },
27
+ {
28
+ "name": "get_ingest_key",
29
+ "title": "Get / set the ingest key",
30
+ "description": "Record an ingest key for this session. Pass `key` to use a key the user already has (one-time reveal from the dashboard), or omit it to use the key obtained via authenticate/auth_status. Returns only a masked preview + hash — never the plaintext.",
31
+ "inputSchema": {
32
+ "type": "object",
33
+ "properties": {
34
+ "key": {
35
+ "type": "string",
36
+ "description": "A cot_… ingest key (optional if already authenticated)."
37
+ }
38
+ },
39
+ "additionalProperties": false
40
+ }
41
+ },
42
+ {
43
+ "name": "write_local_config",
44
+ "title": "Write local OTEL config (Claude Code or Codex)",
45
+ "description": "Write the OpenTelemetry exporter config (and the ingest key) into a recognized local client config — Claude Code's user or current-project settings.json, or Codex's active ~/.codex/config.toml (`client: \"codex\"`). Preserves existing settings and backs up the file first. Content telemetry and repository-path observation are separate, explicit opt-ins. Returns the path and the KEYS written (never values).",
46
+ "inputSchema": {
47
+ "type": "object",
48
+ "properties": {
49
+ "client": {
50
+ "type": "string",
51
+ "enum": [
52
+ "claude",
53
+ "codex"
54
+ ],
55
+ "description": "Which coding client to configure: claude → settings.json env block (default); codex → the [otel] section of ~/.codex/config.toml (Codex needs the literal key in the file — it does not expand ${VAR} placeholders)."
56
+ },
57
+ "scope": {
58
+ "type": "string",
59
+ "enum": [
60
+ "user",
61
+ "project"
62
+ ],
63
+ "description": "Claude only: user → ~/.claude/settings.json (default); project → ./.claude/settings.json."
64
+ },
65
+ "enrich": {
66
+ "type": "boolean",
67
+ "description": "Opt in to content telemetry (default false). Claude Code uploads prompt text, tool details/content, and raw API request/response bodies; Codex uploads prompt text. These can contain source code, commands, file contents, secrets, or other sensitive data."
68
+ },
69
+ "repositoryObservation": {
70
+ "type": "boolean",
71
+ "description": "Install repository-observation hooks (default false). The hooks send the absolute repository root and working-directory paths, repository name, a hashed repository id, session id, and hook event to CodeTelemetry when a session starts/resumes or its workspace changes."
72
+ }
73
+ },
74
+ "additionalProperties": false
75
+ }
76
+ },
77
+ {
78
+ "name": "send_test_event",
79
+ "title": "Send a test telemetry event",
80
+ "description": "Fire one synthetic OTLP log carrying a unique probe id, so we can prove the pipe works before the user starts a real session. Returns the probe id and the ingest HTTP status.",
81
+ "inputSchema": {
82
+ "type": "object",
83
+ "properties": {},
84
+ "additionalProperties": false
85
+ }
86
+ },
87
+ {
88
+ "name": "verify_telemetry",
89
+ "title": "Confirm telemetry landed",
90
+ "description": "Poll the connectivity check until the last test event's probe id is seen in the tenant's data (or a timeout). Confirms the user's telemetry is flowing end to end.",
91
+ "inputSchema": {
92
+ "type": "object",
93
+ "properties": {
94
+ "timeoutMs": {
95
+ "type": "number",
96
+ "description": "Max time to wait (default 30000)."
97
+ }
98
+ },
99
+ "additionalProperties": false
100
+ }
101
+ },
102
+ {
103
+ "name": "onboard",
104
+ "title": "Onboard (one shot)",
105
+ "description": "Do the whole onboarding in one call: use the session key (or a `key` you pass), write a recognized local client config, send a test event, and confirm it landed. Content telemetry and repository-path observation are separate, explicit opt-ins. Returns a step-by-step checklist. Run authenticate + auth_status first if you don't already have a key.",
106
+ "inputSchema": {
107
+ "type": "object",
108
+ "properties": {
109
+ "key": {
110
+ "type": "string",
111
+ "description": "A cot_… ingest key (optional if already authenticated)."
112
+ },
113
+ "client": {
114
+ "type": "string",
115
+ "enum": [
116
+ "claude",
117
+ "codex"
118
+ ],
119
+ "description": "Which coding client to configure: claude → settings.json env block (default); codex → the [otel] section of ~/.codex/config.toml (Codex needs the literal key in the file — it does not expand ${VAR} placeholders)."
120
+ },
121
+ "scope": {
122
+ "type": "string",
123
+ "enum": [
124
+ "user",
125
+ "project"
126
+ ],
127
+ "description": "Claude only: which settings.json to write (default user)."
128
+ },
129
+ "enrich": {
130
+ "type": "boolean",
131
+ "description": "Opt in to content telemetry (default false). Claude Code uploads prompt text, tool details/content, and raw API request/response bodies; Codex uploads prompt text. These can contain source code, commands, file contents, secrets, or other sensitive data."
132
+ },
133
+ "repositoryObservation": {
134
+ "type": "boolean",
135
+ "description": "Install repository-observation hooks (default false). The hooks send the absolute repository root and working-directory paths, repository name, a hashed repository id, session id, and hook event to CodeTelemetry when a session starts/resumes or its workspace changes."
136
+ },
137
+ "timeoutMs": {
138
+ "type": "number",
139
+ "description": "Verify timeout (default 30000)."
140
+ }
141
+ },
142
+ "additionalProperties": false
143
+ }
144
+ },
145
+ {
146
+ "name": "status",
147
+ "title": "Onboarding status",
148
+ "description": "Read-only diagnostics for a recognized client config: whether a key is held (masked), whether Claude Code's user/current-project settings.json or Codex's active ~/.codex/config.toml has the OTEL config, the resolved endpoints, any pending authorization, and `server` — the MCP build and tool-inventory hash. No secrets.",
149
+ "inputSchema": {
150
+ "type": "object",
151
+ "properties": {
152
+ "client": {
153
+ "type": "string",
154
+ "enum": [
155
+ "claude",
156
+ "codex"
157
+ ],
158
+ "description": "Which coding client to configure: claude → settings.json env block (default); codex → the [otel] section of ~/.codex/config.toml (Codex needs the literal key in the file — it does not expand ${VAR} placeholders)."
159
+ },
160
+ "scope": {
161
+ "type": "string",
162
+ "enum": [
163
+ "user",
164
+ "project"
165
+ ],
166
+ "description": "Claude only: which settings.json to inspect (default user)."
167
+ }
168
+ },
169
+ "additionalProperties": false
170
+ }
171
+ },
172
+ {
173
+ "name": "get_cost_signal",
174
+ "title": "Get cost signal",
175
+ "description": "Read this workspace's recent observed model cost — totals, by model, and top repo. `observedCostUsd` is what your model provider charges; CodeTelemetry's fee is 10% of it (`feeUsd`), which is what draws down the credit balance — they're labeled separately. Personal-scope (your own usage). Requires an ingest key (run authenticate/auth_status or pass one to get_ingest_key first).",
176
+ "inputSchema": {
177
+ "type": "object",
178
+ "properties": {},
179
+ "additionalProperties": false
180
+ }
181
+ },
182
+ {
183
+ "name": "search_sessions",
184
+ "title": "Search coding sessions",
185
+ "description": "Find coding sessions using the same bounded query and filters as the Sessions UI: free text across titles, accepted prompt samples, ids, repos, models, members, and assistants, plus explicit assistant/model/duration filters. Returns metadata and match-field provenance only; raw prompt text is never returned through the ingest-key-authenticated MCP surface.",
186
+ "inputSchema": {
187
+ "type": "object",
188
+ "properties": {
189
+ "q": {
190
+ "type": "string",
191
+ "maxLength": 200,
192
+ "description": "Whitespace-separated terms; every term must match somewhere in the indexed session fields."
193
+ },
194
+ "repo": {
195
+ "type": "string",
196
+ "maxLength": 200,
197
+ "description": "Exact repository filter."
198
+ },
199
+ "model": {
200
+ "type": "string",
201
+ "maxLength": 200,
202
+ "description": "Model-name fragment, such as sol or opus."
203
+ },
204
+ "assistant": {
205
+ "type": "string",
206
+ "enum": [
207
+ "all",
208
+ "claude",
209
+ "codex"
210
+ ],
211
+ "description": "Assistant filter (default all)."
212
+ },
213
+ "minDurationMs": {
214
+ "type": "integer",
215
+ "minimum": 0,
216
+ "maximum": 31536000000,
217
+ "description": "Inclusive minimum elapsed session span in milliseconds."
218
+ },
219
+ "maxDurationMs": {
220
+ "type": "integer",
221
+ "minimum": 0,
222
+ "maximum": 31536000000,
223
+ "description": "Inclusive maximum elapsed session span in milliseconds."
224
+ },
225
+ "sort": {
226
+ "type": "string",
227
+ "enum": [
228
+ "session",
229
+ "assistant",
230
+ "member",
231
+ "repo",
232
+ "models",
233
+ "prompts",
234
+ "invocations",
235
+ "tools",
236
+ "tokens",
237
+ "cost",
238
+ "output",
239
+ "costPerCommit",
240
+ "duration",
241
+ "lastSeen"
242
+ ],
243
+ "description": "Sort column (default lastSeen)."
244
+ },
245
+ "direction": {
246
+ "type": "string",
247
+ "enum": [
248
+ "asc",
249
+ "desc"
250
+ ],
251
+ "description": "Sort direction (default desc)."
252
+ },
253
+ "limit": {
254
+ "type": "integer",
255
+ "minimum": 1,
256
+ "maximum": 100,
257
+ "description": "Page size (default 25, max 100)."
258
+ },
259
+ "offset": {
260
+ "type": "integer",
261
+ "minimum": 0,
262
+ "maximum": 100000,
263
+ "description": "Page offset."
264
+ }
265
+ },
266
+ "additionalProperties": false
267
+ }
268
+ },
269
+ {
270
+ "name": "get_session_performance",
271
+ "title": "Measure session read performance",
272
+ "description": "Run the same bounded session-timeline read used by the UI and report cache status, query phases, rows, bytes, and latency. Returns counts only, never prompts, commands, outputs, or other raw content. Personal-scope and ingest-key authenticated.",
273
+ "inputSchema": {
274
+ "type": "object",
275
+ "properties": {
276
+ "sessionId": {
277
+ "type": "string",
278
+ "minLength": 1,
279
+ "maxLength": 200,
280
+ "description": "Session id to measure."
281
+ },
282
+ "includeFresh": {
283
+ "type": "boolean",
284
+ "description": "Also bypass the dashboard cache once to measure a fresh read (default false)."
285
+ },
286
+ "cacheSamples": {
287
+ "type": "integer",
288
+ "minimum": 1,
289
+ "maximum": 3,
290
+ "description": "Number of real dashboard-cache reads to sample (default 2)."
291
+ }
292
+ },
293
+ "required": [
294
+ "sessionId"
295
+ ],
296
+ "additionalProperties": false
297
+ }
298
+ },
299
+ {
300
+ "name": "find_similar_session_errors",
301
+ "title": "Find sessions with similar errors",
302
+ "description": "Answer 'any other sessions with similar errors?' by matching normalized exact and family signatures within your telemetry. Raw failure text remains inside ClickHouse; results contain safe categories, hash prefixes, counts, session ids, similarity, and query performance only.",
303
+ "inputSchema": {
304
+ "type": "object",
305
+ "properties": {
306
+ "sessionId": {
307
+ "type": "string",
308
+ "minLength": 1,
309
+ "maxLength": 200,
310
+ "description": "Session whose failures should be matched."
311
+ },
312
+ "lookbackDays": {
313
+ "type": "integer",
314
+ "minimum": 1,
315
+ "maximum": 30,
316
+ "description": "Bounded history window (default 30 days)."
317
+ },
318
+ "limit": {
319
+ "type": "integer",
320
+ "minimum": 1,
321
+ "maximum": 20,
322
+ "description": "Maximum matching sessions (default 10)."
323
+ }
324
+ },
325
+ "required": [
326
+ "sessionId"
327
+ ],
328
+ "additionalProperties": false
329
+ }
330
+ },
331
+ {
332
+ "name": "estimate_task_size",
333
+ "title": "T-shirt size a task from your history",
334
+ "description": "Estimate the effort of a proposed task — t-shirt size, predicted token range, and confidence — from YOUR similar past coding sessions rather than a generic complexity guess. Pass free-form text and/or a Linear issue's fields (identifier/title/description/labels) resolved by your Linear connector. The prediction comes from matched past sessions and is sized against a ladder calibrated from that same history; when confidence is low the result carries a small confidence-building task instead of a falsely precise number.",
335
+ "inputSchema": {
336
+ "type": "object",
337
+ "properties": {
338
+ "taskText": {
339
+ "type": "string",
340
+ "minLength": 1,
341
+ "maxLength": 4000,
342
+ "description": "Free-form description of the task to size."
343
+ },
344
+ "issue": {
345
+ "type": "object",
346
+ "description": "A Linear (or Linear-shaped) issue. Combined with taskText when both are given.",
347
+ "properties": {
348
+ "identifier": {
349
+ "type": "string",
350
+ "maxLength": 64,
351
+ "description": "Issue key, e.g. ELL-8."
352
+ },
353
+ "title": {
354
+ "type": "string",
355
+ "maxLength": 512
356
+ },
357
+ "description": {
358
+ "type": "string",
359
+ "maxLength": 4000
360
+ },
361
+ "labels": {
362
+ "type": "array",
363
+ "maxItems": 20,
364
+ "items": {
365
+ "type": "string",
366
+ "maxLength": 64
367
+ }
368
+ }
369
+ },
370
+ "additionalProperties": false
371
+ },
372
+ "issueKey": {
373
+ "type": "string",
374
+ "maxLength": 64,
375
+ "description": "Linear issue key (e.g. ELL-8) to look up in the connected workspace and size. Resolved through the tenant's DEFAULT connection — an issue key is only unique within a workspace, so prefer `estimate_linear_issue` (which accepts a URL and disambiguates connected workspaces explicitly) when more than one workspace may be connected."
376
+ },
377
+ "repo": {
378
+ "type": "string",
379
+ "maxLength": 200,
380
+ "description": "Repo the work will land in, when known. Selects that repo's calibrated ladder if one exists."
381
+ },
382
+ "linearScale": {
383
+ "type": "string",
384
+ "enum": [
385
+ "exponential",
386
+ "fibonacci",
387
+ "linear",
388
+ "tShirt"
389
+ ],
390
+ "description": "Also project the size onto this Linear estimate scale. Sizing by issueKey uses the issue's own team scale by default."
391
+ },
392
+ "linearScaleExtended": {
393
+ "type": "boolean",
394
+ "description": "True when that scale is Linear's extended variant (different point values)."
395
+ },
396
+ "lookbackDays": {
397
+ "type": "integer",
398
+ "minimum": 1,
399
+ "maximum": 365,
400
+ "description": "History window to size against (default 90 days)."
401
+ },
402
+ "limit": {
403
+ "type": "integer",
404
+ "minimum": 1,
405
+ "maximum": 5000,
406
+ "description": "Maximum historical sessions to load (default 1000)."
407
+ }
408
+ },
409
+ "additionalProperties": false
410
+ }
411
+ },
412
+ {
413
+ "name": "estimate_linear_issue",
414
+ "title": "T-shirt size an existing Linear issue",
415
+ "description": "Estimate the effort of an EXISTING Linear issue — t-shirt size, predicted token range, and confidence — from YOUR similar past coding sessions. Pass the issue's URL or identifier (e.g. ELL-44); CodeTelemetry resolves it through the Linear workspace the user already connected, so you never paste the issue's contents in and never supply a Linear token. The number predicts CODING-ASSISTANT TOKEN EFFORT, not elapsed time or human engineering hours. When the matched history is weak or contradictory the result is low confidence and carries a small calibration task instead of a falsely precise number. READ-ONLY: it never changes the issue's estimate, description, labels, state, or comments. If more than one connected workspace could hold that identifier the call fails with `ambiguous_connection` and lists them — retry naming one via `workspace` or `connectionId`.",
416
+ "inputSchema": {
417
+ "type": "object",
418
+ "properties": {
419
+ "reference": {
420
+ "type": "string",
421
+ "minLength": 1,
422
+ "maxLength": 512,
423
+ "description": "The Linear issue to size: an identifier like \"ELL-44\", or a linear.app issue URL. Free-text search is not accepted — resolve the issue first."
424
+ },
425
+ "workspace": {
426
+ "type": "string",
427
+ "maxLength": 200,
428
+ "description": "Which connected Linear workspace to resolve the issue through: its url key, name, or id. Needed only when several connections could match (the failure lists them)."
429
+ },
430
+ "connectionId": {
431
+ "type": "string",
432
+ "maxLength": 128,
433
+ "description": "A specific CodeTelemetry Linear connection id (as returned in a `connections` list), when you already know which one to use. It does NOT override `workspace` or the workspace named by an issue URL — every hint you give must agree, or the call fails with `conflicting_selection`. Normally pass either this or `workspace`, not both."
434
+ },
435
+ "repo": {
436
+ "type": "string",
437
+ "maxLength": 200,
438
+ "description": "Repo the work will land in, when known. Selects that repo's calibrated ladder if one exists."
439
+ },
440
+ "linearScale": {
441
+ "type": "string",
442
+ "enum": [
443
+ "exponential",
444
+ "fibonacci",
445
+ "linear",
446
+ "tShirt"
447
+ ],
448
+ "description": "Project the size onto this Linear estimate scale. Defaults to the issue's own team scale."
449
+ },
450
+ "linearScaleExtended": {
451
+ "type": "boolean",
452
+ "description": "True when that scale is Linear's extended variant (different point values)."
453
+ },
454
+ "lookbackDays": {
455
+ "type": "integer",
456
+ "minimum": 1,
457
+ "maximum": 365,
458
+ "description": "History window to size against (default 90 days)."
459
+ },
460
+ "limit": {
461
+ "type": "integer",
462
+ "minimum": 1,
463
+ "maximum": 5000,
464
+ "description": "Maximum historical sessions to load (default 1000)."
465
+ }
466
+ },
467
+ "required": [
468
+ "reference"
469
+ ],
470
+ "additionalProperties": false
471
+ }
472
+ }
473
+ ]
474
+ }