loopctl-mcp-server 3.42.2 → 3.43.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 CHANGED
@@ -405,6 +405,7 @@ it is enforced server-side and a no-op for a non-superadmin key — see below.)
405
405
  | `set_llm_config` | **First-time setup (do once).** Set/rotate the tenant's OWN **Anthropic `api_key`** (powers ingest) AND **OpenAI `embedding_api_key`** (powers semantic search) — both stored encrypted, never returned — plus the per-operation models (`extraction_model`/`classification_model`/`merge_model`/`embedding_model`). Any subset; partial-merge (omitting a key leaves it untouched). **Private tier (US-41.3):** also sets `chat_provider` (`anthropic` | `openai_compatible`), `chat_base_url`, `extraction_model` (required on that provider) and `chat_api_key` (optional — omit it for a keyless local server) so ingest extraction / classification / merge / memory promotion run against YOUR OWN OpenAI-compatible endpoint and document text never leaves your boundary. Every model the config resolves to is PROBED with a trivial completion before it is saved (a 422 persists nothing); the probe re-runs on any chat-surface change (provider, base_url, key rotation, model), a private-range host is refused by the SSRF guard, and moving to a NEW host needs a matching `chat_api_key` or `acknowledge_key_transmission: true`. See [First-time setup](#first-time-setup--provision-your-byo-llm-keys). Requires **user** key. |
406
406
  | `github_credential` | **Is there a GitHub credential for this tenant?** (#936, `GET /api/v1/tenants/me/github-credential`) `has_token`, a masked last-4 `token_hint`, `updated_at`, and `operator_repositories`: the repositories the operator's token is lent for (`VERIFICATION_OPERATOR_TOKEN_TENANTS`) while the tenant has no token. Never returns the token. Reach for it when the merge gate refuses `{pull_request_unavailable, credential_unavailable}` or verification records `credential_unavailable`. Requires **user** key. |
407
407
  | `set_github_credential` | **Set or replace the tenant's own GitHub token** (#936, `PUT /api/v1/tenants/me/github-credential`). Every GitHub call loopctl makes for the tenant — merge gate, story and post-deploy verification, issue closing — then uses it for EVERY repository, replacing the operator's token even where the operator lent it. A fine-grained token on your own repositories with read access to Contents, Pull requests, Actions, Commit statuses and Deployments (plus Issues: write for issue closing). Stored encrypted, never returned, and not checked against GitHub on the way in: a token that cannot read a repository shows up as that repository's forge refusal. 422 when blank, over the server's length bound or containing anything but letters, digits and underscores; `403 custody_tier_required` on an agent-rooted tenant. Required: `token`. Requires **user** key. |
408
+ | `bootstrap_audit_key` | **Generate the first audit signing keypair** for a tenant created before Chain of Custody v2 (#873, `POST /api/v1/tenants/:id/bootstrap-audit-key`). Takes `tenant_id`; returns the public key. Refuses `409 key_already_exists` (rotation is the WebAuthn ceremony) and `403` for a key that is not user role or not the tenant's. Requires **user** key. |
408
409
  | `clear_github_credential` | **Remove the tenant's GitHub token** (#936, `DELETE /api/v1/tenants/me/github-credential`). Calls then use the operator's token only for `operator_repositories` and are refused `credential_unavailable` everywhere else, so a pr-mode repository outside that list stops merging. Idempotent. Requires **user** key. |
409
410
  | `knowledge_llm_usage` | Per-tenant LLM token-usage summary, grouped by operation + model + source_type + day over an optional `from`/`to` range (defaults to a 90-day lookback; effective window echoed in `meta.from`/`meta.to`), with `limit`/`offset` pagination. Record-only (no budget enforcement). Requires orchestrator key. |
410
411
 
package/index.js CHANGED
@@ -158,6 +158,7 @@ import {
158
158
  setGithubCredential as setGithubCredentialRequest,
159
159
  } from "./lib/github-credential.js";
160
160
  import { updateProject as updateProjectRequest } from "./lib/project-update.js";
161
+ import { bootstrapAuditKey as bootstrapAuditKeyRequest } from "./lib/audit-key-bootstrap.js";
161
162
  import { mergeProject as mergeProjectRequest } from "./lib/project-merge.js";
162
163
  import {
163
164
  createEpic as createEpicRequest,
@@ -2650,6 +2651,11 @@ async function clearGithubCredential(args) {
2650
2651
  return toContent(await clearGithubCredentialRequest(args, userKeyApi()));
2651
2652
  }
2652
2653
 
2654
+ // #873: a tenant's first audit key, user role, so the exact user key as above.
2655
+ async function bootstrapAuditKey(args) {
2656
+ return toContent(await bootstrapAuditKeyRequest(args, userKeyApi()));
2657
+ }
2658
+
2653
2659
  // --- US-41.4: fail-closed no-egress guard -----------------------------------
2654
2660
  //
2655
2661
  // egress_posture is a READ available at AGENT role: an agent must be able to
@@ -8078,6 +8084,25 @@ const TOOLS = [
8078
8084
  "stops merging. Idempotent. Requires LOOPCTL_USER_KEY (403 for any other role).",
8079
8085
  inputSchema: { type: "object", properties: {}, required: [] },
8080
8086
  },
8087
+ {
8088
+ name: "bootstrap_audit_key",
8089
+ description:
8090
+ "GENERATE the first audit signing keypair for a tenant created before Chain of Custody " +
8091
+ "v2 (#873, POST /api/v1/tenants/:id/bootstrap-audit-key). A tenant with no key cannot " +
8092
+ "sign capability tokens, so L1 is off for it until this runs. The private half stays on " +
8093
+ "the server; the reply is the public key (base64). Refuses: 409 `key_already_exists` " +
8094
+ "(every tenant signed up since v2 has one; rotation is the WebAuthn rotate-audit-key " +
8095
+ "ceremony), 403 when the key is not user role or `tenant_id` is not the key's own " +
8096
+ "tenant (a mistyped or unknown id answers 403 too, so check the id first). " +
8097
+ "Requires LOOPCTL_USER_KEY.",
8098
+ inputSchema: {
8099
+ type: "object",
8100
+ properties: {
8101
+ tenant_id: { type: "string", description: "Your tenant's UUID (get_tenant shows it)." },
8102
+ },
8103
+ required: ["tenant_id"],
8104
+ },
8105
+ },
8081
8106
  {
8082
8107
  name: "llm_config",
8083
8108
  description:
@@ -12365,6 +12390,8 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
12365
12390
 
12366
12391
  case "clear_github_credential":
12367
12392
  return await clearGithubCredential(args);
12393
+ case "bootstrap_audit_key":
12394
+ return await bootstrapAuditKey(args);
12368
12395
 
12369
12396
  case "knowledge_llm_usage":
12370
12397
  return await knowledgeLlmUsage(args);
@@ -0,0 +1,21 @@
1
+ // #873: POST /api/v1/tenants/:id/bootstrap-audit-key.
2
+ //
3
+ // Generates the first ed25519 audit keypair for a tenant created before Chain of
4
+ // Custody v2, which has none. The private half stays on the server; the reply
5
+ // carries the public half. A tenant that already has a key gets 409
6
+ // `key_already_exists` (rotation is the WebAuthn ceremony, not this). The
7
+ // caller's key must be user role and belong to the tenant named.
8
+
9
+ export async function bootstrapAuditKey(args = {}, { apiCall } = {}) {
10
+ const tenantId = args.tenant_id;
11
+
12
+ if (typeof tenantId !== "string" || tenantId.trim() === "") {
13
+ return { error: { message: "tenant_id is required", status: 400 } };
14
+ }
15
+
16
+ return apiCall(
17
+ "POST",
18
+ `/api/v1/tenants/${encodeURIComponent(tenantId)}/bootstrap-audit-key`,
19
+ {},
20
+ );
21
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "loopctl-mcp-server",
3
- "version": "3.42.2",
3
+ "version": "3.43.0",
4
4
  "description": "MCP server for loopctl — structural trust for AI development loops",
5
5
  "type": "module",
6
6
  "main": "index.js",