@codetelemetry/mcp 0.3.14 → 0.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/README.md +87 -1
- package/dist/src/client/bin.js +8 -1
- package/dist/src/client/bootstrap.d.ts +28 -0
- package/dist/src/client/bootstrap.js +585 -0
- package/dist/src/client/bootstrapGitHub.d.ts +21 -0
- package/dist/src/client/bootstrapGitHub.js +157 -0
- package/dist/src/client/cli.js +58 -0
- package/dist/src/client/graderArtifact.js +2 -2
- package/dist/src/client/index.d.ts +2 -0
- package/dist/src/client/index.js +2 -0
- package/dist/src/client/repositoryHook.d.ts +1 -0
- package/dist/src/client/repositoryHook.js +31 -0
- package/dist/src/client/workspaces.d.ts +44 -0
- package/dist/src/client/workspaces.js +366 -0
- package/dist/src/mcpServer.js +1 -1
- package/dist/src/session.d.ts +1 -1
- package/dist/src/tools.d.ts +4 -0
- package/dist/src/tools.js +24 -1
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/dist/src/workspaceRuntime.d.ts +5 -0
- package/dist/src/workspaceRuntime.js +187 -0
- package/package.json +1 -1
- package/tool-manifest.json +126 -3
package/README.md
CHANGED
|
@@ -31,19 +31,105 @@ deterministic (see [Releases & discovery](#releases--discovery)):
|
|
|
31
31
|
```json
|
|
32
32
|
{
|
|
33
33
|
"mcpServers": {
|
|
34
|
-
"codetelemetry": { "command": "npx", "args": ["-y", "--package=@codetelemetry/mcp@0.
|
|
34
|
+
"codetelemetry": { "command": "npx", "args": ["-y", "--package=@codetelemetry/mcp@0.4.0", "codetelemetry-mcp"] }
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
```
|
|
38
38
|
|
|
39
39
|
Then just ask the agent: **"Connect me to CodeTelemetry."**
|
|
40
40
|
|
|
41
|
+
## Persistent organization workspaces
|
|
42
|
+
|
|
43
|
+
Ask the agent: **Create a Acme workspace for this repository and configure its Grader.**
|
|
44
|
+
It calls `bootstrap_workspace` with a stable local context name, the repository path,
|
|
45
|
+
and either `organizationName` (new) or `organizationId` (existing). Select checks
|
|
46
|
+
with `seed_grader_config` and pass the reviewed `checks` and `features`; `publish`
|
|
47
|
+
explicitly publishes them, and `terraform` leaves an IaC artifact.
|
|
48
|
+
|
|
49
|
+
The first call returns one browser approval URL. The page identifies the signed-in
|
|
50
|
+
account and destination, supports changing account, and creates a requested new
|
|
51
|
+
organization. Resume with just the same `name`. The private checkpoint survives
|
|
52
|
+
MCP restarts, expired device codes and interrupted responses. Creation uses the
|
|
53
|
+
same operation ID on retries; existing organizations are selected by ID, never name.
|
|
54
|
+
|
|
55
|
+
```sh
|
|
56
|
+
npx -y @codetelemetry/connect bootstrap acme \
|
|
57
|
+
--organization-name "Acme" --client codex --project /path/to/repository
|
|
58
|
+
# After approval (or funding), resume the exact saved plan:
|
|
59
|
+
npx -y @codetelemetry/connect bootstrap acme
|
|
60
|
+
npx -y @codetelemetry/connect workspace list
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
`--plan file.json` supplies the same bootstrap fields as the MCP tool, including
|
|
64
|
+
selected Grader checks. CLI exit 2 means setup is waiting for the returned action;
|
|
65
|
+
exit 0 means the requested checks completed. Funding is checked before client
|
|
66
|
+
configuration. No credits or seats are purchased. Content and repository observation
|
|
67
|
+
remain separate explicit opt-ins.
|
|
68
|
+
|
|
69
|
+
Credentials are private version-1 JSON files under
|
|
70
|
+
`$CODETELEMETRY_CONTEXT_HOME/<name>.json`, defaulting to
|
|
71
|
+
`$XDG_CONFIG_HOME/codetelemetry/workspaces` or
|
|
72
|
+
`~/.config/codetelemetry/workspaces`. Files are owned, mode 0600 on POSIX, atomically
|
|
73
|
+
replaced, and bounded to 64 KiB. There are at most 64 contexts and 192 directory
|
|
74
|
+
entries including checkpoints/locks. Unsafe versions, symlinks, mismatched account,
|
|
75
|
+
organization, billing account or origin fail closed. Failed authorization never
|
|
76
|
+
falls back to personal scope. Expired credentials can be replaced with
|
|
77
|
+
`bootstrap_workspace` using `reauthorize: true`; the replacement must attest the
|
|
78
|
+
same identity. Remove an unused named context/checkpoint explicitly to free capacity.
|
|
79
|
+
|
|
80
|
+
The repository's `.codetelemetry/workspace.json` contains only the context name,
|
|
81
|
+
service origin and scope. It can be committed; never commit the private context,
|
|
82
|
+
client config, Terraform state or plan. Bindings are found from subdirectories up
|
|
83
|
+
to the repository root. `CODETELEMETRY_WORKSPACE` selects a context explicitly but
|
|
84
|
+
must agree with an existing repository binding. MCP verifies scope at restore and
|
|
85
|
+
before use; governance requests also carry the expected scope so a key rescope
|
|
86
|
+
cannot race a check and change personal configuration.
|
|
87
|
+
|
|
88
|
+
For existing auth, call `workspace_context` with `action: "save"`, a name and
|
|
89
|
+
`repositoryPath`. `action: "use"` selects an already-saved context. Rebinding a
|
|
90
|
+
repository requires explicitly removing its previous binding. Unbound clients
|
|
91
|
+
retain the legacy login behavior.
|
|
92
|
+
|
|
93
|
+
Bootstrap writes Claude settings inside the repository. Codex ignores project-local
|
|
94
|
+
`otel`, so bootstrap writes a dedicated user-level profile
|
|
95
|
+
`$CODEX_HOME/codetelemetry-<name>.config.toml` (or the default `~/.codex` directory).
|
|
96
|
+
Launch with `codetelemetry-connect run <name> -- <arguments>` or
|
|
97
|
+
`codex --profile codetelemetry-<name>` in the bound repository. The profile retains
|
|
98
|
+
your base sign-in/settings while overriding telemetry and its explicit content
|
|
99
|
+
opt-in. It does not rewrite the base config or copy auth tokens. The profile also registers the version-pinned workspace MCP server and disables
|
|
100
|
+
the standard global CodeTelemetry MCP entry for that profile. Claude receives a
|
|
101
|
+
project `.mcp.json` entry bound to the same context. Optional Codex observation
|
|
102
|
+
hooks live in the profile and run only when it is selected.
|
|
103
|
+
Codex combines global and profile hooks. Bootstrap upgrades recognized older
|
|
104
|
+
CodeTelemetry observation helpers so they abstain in named workspaces; global
|
|
105
|
+
hook definitions and personal reporting are preserved. Modified helpers require
|
|
106
|
+
review before configuration continues. When opting into new observation hooks,
|
|
107
|
+
review and trust them in Codex's `/hooks` interface before expecting observations.
|
|
108
|
+
See [OpenAI configuration reference](https://learn.chatgpt.com/docs/config-file/config-reference)
|
|
109
|
+
and [hooks](https://learn.chatgpt.com/docs/hooks).
|
|
110
|
+
Secret-bearing project paths are added to `.gitignore` before configuration.
|
|
111
|
+
|
|
112
|
+
A requested GitHub gate produces its generated workflow locally. Bootstrap then
|
|
113
|
+
reads GitHub through the existing `gh` authentication and checks the default-branch
|
|
114
|
+
workflow, required check, and a real organization-scoped PR decision for the local
|
|
115
|
+
HEAD and published policy after setup started. It reports pending repository
|
|
116
|
+
work explicitly. It does not claim a PR passed merely because a probe landed.
|
|
117
|
+
A verified gate decision retains its actual success/failure verdict and score.
|
|
118
|
+
Terraform artifact generation is reported separately from applying Terraform.
|
|
119
|
+
|
|
120
|
+
The public service must deploy `/api/device/code/bootstrap-v1` and the matching
|
|
121
|
+
approval route before clients use new-organization creation. Older deployments
|
|
122
|
+
refuse the versioned request rather than creating a personal key. Existing-org
|
|
123
|
+
contexts use the established scope-v1 device flow.
|
|
124
|
+
|
|
41
125
|
## Tools
|
|
42
126
|
|
|
43
127
|
| Tool | What it does |
|
|
44
128
|
| --- | --- |
|
|
45
129
|
| `count_reply_phrases` | Count how often your own phrases appear in your Claude model replies, per day or week and per model (turns, turns with a match, per-phrase counts). Plain-text phrases with `{a|b}` / `[a|b]` groups, whole-word and case-insensitive; main-thread replies only; counts and session references, never reply text. |
|
|
46
130
|
| `import_history` | Import this machine's past Claude Code / Codex sessions (`~/.claude/projects`, `~/.codex/sessions`) through the normal ingest, tagged as imported. Dry run by default; skips sessions captured live or already imported; resumes interrupted imports; pages with `remaining`. Content defaults to `live` (what your live exporters send); `none` opts out. |
|
|
131
|
+
| `workspace_context` | Save, list or select persistent verified workspace contexts. Repository bindings contain no credentials; cold MCP processes restore the bound context. |
|
|
132
|
+
| `bootstrap_workspace` | Create or select an organization, authorize once, and resume funding, repository-local telemetry, Grader publication, Terraform artifacts and GitHub gate verification. |
|
|
47
133
|
| `authenticate` | Start device-code auth; returns a URL + short code for the human to approve. Optional `organizationId` connects one of the user's organizations; optional `workspaceUrl` picks a CodeTelemetry server (codetelemetry.com hosts only). |
|
|
48
134
|
| `auth_status` | Poll the approval; on success captures the key into the session (masked-only to the model). |
|
|
49
135
|
| `get_ingest_key` | Record a pasted key (fast path) or report the authenticated one — masked + hash only. |
|
package/dist/src/client/bin.js
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { run } from "./cli.js";
|
|
3
|
-
|
|
3
|
+
import { scrub } from "./keys.js";
|
|
4
|
+
try {
|
|
5
|
+
process.exitCode = await run(process.argv.slice(2));
|
|
6
|
+
}
|
|
7
|
+
catch (error) {
|
|
8
|
+
process.stderr.write(scrub(`CodeTelemetry: ${String(error.message)}\n`));
|
|
9
|
+
process.exitCode = 1;
|
|
10
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type FetchLike } from "./otlp.ts";
|
|
2
|
+
export type BootstrapOptions = {
|
|
3
|
+
name: string;
|
|
4
|
+
repositoryPath?: string;
|
|
5
|
+
organizationName?: string;
|
|
6
|
+
organizationId?: string;
|
|
7
|
+
client?: "claude" | "codex";
|
|
8
|
+
configPath?: string;
|
|
9
|
+
features?: string;
|
|
10
|
+
checks?: Record<string, unknown>[];
|
|
11
|
+
publish?: boolean;
|
|
12
|
+
githubRepository?: string;
|
|
13
|
+
terraform?: boolean;
|
|
14
|
+
enrich?: boolean;
|
|
15
|
+
repositoryObservation?: boolean;
|
|
16
|
+
reauthorize?: boolean;
|
|
17
|
+
};
|
|
18
|
+
export declare function bootstrapWorkspace(options: BootstrapOptions, environment?: {
|
|
19
|
+
apiBase?: string;
|
|
20
|
+
fetchImpl?: FetchLike;
|
|
21
|
+
timeoutMs?: number;
|
|
22
|
+
}): Promise<{
|
|
23
|
+
nextAction?: string | undefined;
|
|
24
|
+
ok: boolean;
|
|
25
|
+
status: string;
|
|
26
|
+
workspace: string;
|
|
27
|
+
steps: Record<string, string>;
|
|
28
|
+
}>;
|