capix-mcp 2.1.0 → 2.2.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 (49) hide show
  1. package/README.md +51 -72
  2. package/dist/client.d.ts.map +1 -1
  3. package/dist/client.js +18 -8
  4. package/dist/client.js.map +1 -1
  5. package/dist/index.d.ts +1 -1
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js +130 -6
  8. package/dist/index.js.map +1 -1
  9. package/dist/prompts.d.ts +6 -1
  10. package/dist/prompts.d.ts.map +1 -1
  11. package/dist/prompts.js +41 -75
  12. package/dist/prompts.js.map +1 -1
  13. package/dist/route-families.d.ts +47 -0
  14. package/dist/route-families.d.ts.map +1 -0
  15. package/dist/route-families.js +96 -0
  16. package/dist/route-families.js.map +1 -0
  17. package/dist/server.d.ts +36 -6
  18. package/dist/server.d.ts.map +1 -1
  19. package/dist/server.js +67 -11
  20. package/dist/server.js.map +1 -1
  21. package/dist/tools/define-tool.d.ts +33 -0
  22. package/dist/tools/define-tool.d.ts.map +1 -0
  23. package/dist/tools/define-tool.js +28 -0
  24. package/dist/tools/define-tool.js.map +1 -0
  25. package/dist/tools/factory.d.ts +42 -0
  26. package/dist/tools/factory.d.ts.map +1 -0
  27. package/dist/tools/factory.js +363 -0
  28. package/dist/tools/factory.js.map +1 -0
  29. package/dist/tools/generate.d.ts +108 -0
  30. package/dist/tools/generate.d.ts.map +1 -0
  31. package/dist/tools/generate.js +149 -0
  32. package/dist/tools/generate.js.map +1 -0
  33. package/dist/tools/infra-context.d.ts +28 -0
  34. package/dist/tools/infra-context.d.ts.map +1 -0
  35. package/dist/tools/infra-context.js +90 -0
  36. package/dist/tools/infra-context.js.map +1 -0
  37. package/dist/tools/memes.d.ts +31 -0
  38. package/dist/tools/memes.d.ts.map +1 -0
  39. package/dist/tools/memes.js +175 -0
  40. package/dist/tools/memes.js.map +1 -0
  41. package/dist/tools.d.ts +48 -7
  42. package/dist/tools.d.ts.map +1 -1
  43. package/dist/tools.js +346 -911
  44. package/dist/tools.js.map +1 -1
  45. package/dist/types.d.ts +17 -2
  46. package/dist/types.d.ts.map +1 -1
  47. package/dist/types.js +1 -2
  48. package/dist/types.js.map +1 -1
  49. package/package.json +4 -3
package/dist/prompts.js CHANGED
@@ -4,48 +4,44 @@
4
4
  * Prompts are parameterised, server-side message templates the MCP client can
5
5
  * list and instantiate. Each prompt returns a short multi-message transcript
6
6
  * that guides an agent through a common Capix workflow (deploy, diagnose,
7
- * preview, plan, cleanup) — always ending with an assistant reminder that
7
+ * ship a website, cleanup) — always ending with an assistant reminder that
8
8
  * billable tools require a bound approval token before they will execute.
9
+ *
10
+ * 2026-07 repair: every prompt references only tools that exist in the
11
+ * post-repair registry. The plan_stack prompt was removed (no stack backend)
12
+ * and create_preview became ship_website (website previews are implicit per
13
+ * release; there is no preview-trigger route).
9
14
  */
10
15
  import { z } from "zod";
11
16
  export const CAPIX_PROMPTS = [
12
17
  {
13
18
  name: "deploy_repository",
14
- description: "Plan, quote, and deploy a repository as a Capix workload (compute or website).",
19
+ description: "Quote and deploy a workload on Capix compute, then track the operation.",
15
20
  arguments: [
16
- { name: "repoUrl", description: "Git repository URL.", required: true },
17
- { name: "branch", description: "Branch to deploy (default: main)." },
18
- { name: "region", description: "Preferred region." },
19
- { name: "workloadType", description: "Workload type, e.g. replicated_service.v1." },
21
+ { name: "workloadType", description: "Workload type, e.g. replicated_service.v1.", required: true },
22
+ { name: "region", description: "Preferred region (eu | us | asia | global)." },
20
23
  ],
21
24
  },
22
25
  {
23
26
  name: "diagnose_deployment",
24
- description: "Diagnose a failing deployment: pull logs, metrics, and health checks.",
27
+ description: "Diagnose a failing deployment: inspect phase, placement receipt, and settlement.",
25
28
  arguments: [
26
29
  { name: "deploymentId", description: "Deployment to diagnose.", required: true },
27
30
  ],
28
31
  },
29
32
  {
30
- name: "create_preview",
31
- description: "Create a preview deployment of a website from a branch.",
33
+ name: "ship_website",
34
+ description: "Create a website from a source ref, wait for the build, and promote it to production.",
32
35
  arguments: [
33
- { name: "siteId", description: "Website project id.", required: true },
34
- { name: "branch", description: "Branch to preview.", required: true },
35
- ],
36
- },
37
- {
38
- name: "plan_stack",
39
- description: "Validate and plan a multi-service stack from a manifest URL or inline spec.",
40
- arguments: [
41
- { name: "manifestUrl", description: "Stack manifest URL or inline spec.", required: true },
36
+ { name: "name", description: "Site name.", required: true },
37
+ { name: "sourceRef", description: "Source reference (repository/archive URL).", required: true },
42
38
  ],
43
39
  },
44
40
  {
45
41
  name: "cleanup_task",
46
- description: "Destroy all resources scoped to a completed task (§18 cleanup gate).",
42
+ description: "Destroy the resources created for a completed task (§18 cleanup gate).",
47
43
  arguments: [
48
- { name: "taskId", description: "Task-scoped resource id.", required: true },
44
+ { name: "taskId", description: "Task label for the cleanup summary.", required: true },
49
45
  ],
50
46
  },
51
47
  ];
@@ -60,10 +56,8 @@ export function registerPrompts(server) {
60
56
  server.registerPrompt("deploy_repository", {
61
57
  description: CAPIX_PROMPTS[0].description,
62
58
  argsSchema: {
63
- repoUrl: z.string().describe("Git repository URL."),
64
- branch: z.string().optional().describe("Branch to deploy (default: main)."),
65
- region: z.string().optional().describe("Preferred region."),
66
- workloadType: z.string().optional().describe("Workload type, e.g. replicated_service.v1."),
59
+ workloadType: z.string().describe("Workload type, e.g. replicated_service.v1."),
60
+ region: z.string().optional().describe("Preferred region (eu | us | asia | global)."),
67
61
  },
68
62
  }, async (args) => ({
69
63
  messages: [
@@ -72,15 +66,14 @@ export function registerPrompts(server) {
72
66
  content: {
73
67
  type: "text",
74
68
  text: [
75
- `Deploy the repository ${args.repoUrl} (branch ${args.branch ?? "main"}) as a Capix workload.`,
69
+ `Deploy a ${args.workloadType} workload on Capix.`,
76
70
  args.region ? `Target region: ${args.region}.` : "Region: auto-select cheapest feasible.",
77
- args.workloadType ? `Workload type: ${args.workloadType}.` : "",
78
71
  "Steps:",
79
- "1. capix_compute_planplan the deployment shape.",
80
- "2. capix_compute_quote — obtain a canonical quote.",
72
+ "1. capix_compute_catalogconfirm the workload type is enabled and pick a provider/region.",
73
+ "2. capix_compute_quote — obtain a canonical quote (15-minute TTL).",
81
74
  "3. capix_deploy — provision against the quote (requires approvalToken).",
82
- "4. capix_run_health_checksverify readiness.",
83
- ].filter(Boolean).join("\n"),
75
+ "4. capix_deploymentstrack the deployment phase until ready.",
76
+ ].join("\n"),
84
77
  },
85
78
  },
86
79
  {
@@ -103,10 +96,10 @@ export function registerPrompts(server) {
103
96
  type: "text",
104
97
  text: [
105
98
  `Diagnose deployment ${args.deploymentId}:`,
106
- "1. capix_inspect_logsrecent log lines.",
107
- "2. capix_inspect_metricsresource metrics.",
108
- "3. capix_run_health_checksprobe results.",
109
- "Summarise the failure mode and propose remediation (restart vs redeploy vs rollback).",
99
+ "1. capix_deploymentslocate the deployment, its phase, and its allocations.",
100
+ "2. capix_inspect_receiptreview the signed route receipt (placement + pricing evidence) behind it.",
101
+ "3. capix_receiptscheck the account's work receipts for related failures.",
102
+ "Summarise the failure mode and propose remediation (redeploy vs terminate).",
110
103
  ].join("\n"),
111
104
  },
112
105
  },
@@ -119,12 +112,12 @@ export function registerPrompts(server) {
119
112
  },
120
113
  ],
121
114
  }));
122
- // create_preview
123
- server.registerPrompt("create_preview", {
115
+ // ship_website
116
+ server.registerPrompt("ship_website", {
124
117
  description: CAPIX_PROMPTS[2].description,
125
118
  argsSchema: {
126
- siteId: z.string().describe("Website project id."),
127
- branch: z.string().describe("Branch to preview."),
119
+ name: z.string().describe("Site name."),
120
+ sourceRef: z.string().describe("Source reference (repository/archive URL)."),
128
121
  },
129
122
  }, async (args) => ({
130
123
  messages: [
@@ -133,9 +126,10 @@ export function registerPrompts(server) {
133
126
  content: {
134
127
  type: "text",
135
128
  text: [
136
- `Create a preview deployment for website ${args.siteId}, branch ${args.branch}.`,
137
- "1. capix_website_previewbuild a preview (requires approvalToken).",
138
- "2. Return the preview URL.",
129
+ `Ship the website ${args.name} from ${args.sourceRef}.`,
130
+ "1. capix_website_createcreate + build (requires approvalToken).",
131
+ "2. capix_website_get — poll until the latest release is built (check its status/step/logTail).",
132
+ "3. Return the preview URL, then capix_website_promote — promote to production (requires approvalToken).",
139
133
  ].join("\n"),
140
134
  },
141
135
  },
@@ -145,40 +139,11 @@ export function registerPrompts(server) {
145
139
  },
146
140
  ],
147
141
  }));
148
- // plan_stack
149
- server.registerPrompt("plan_stack", {
150
- description: CAPIX_PROMPTS[3].description,
151
- argsSchema: {
152
- manifestUrl: z.string().describe("Stack manifest URL or inline spec."),
153
- },
154
- }, async (args) => ({
155
- messages: [
156
- {
157
- role: "user",
158
- content: {
159
- type: "text",
160
- text: [
161
- `Validate and plan the stack manifest at ${args.manifestUrl}.`,
162
- "1. capix_stack_validate — check the manifest.",
163
- "2. capix_stack_plan — produce a service plan graph + aggregate quote.",
164
- "Report feasibility and per-service cost.",
165
- ].join("\n"),
166
- },
167
- },
168
- {
169
- role: "assistant",
170
- content: {
171
- type: "text",
172
- text: "Stack planning tools are read-only and may auto-run; no approval token required.",
173
- },
174
- },
175
- ],
176
- }));
177
142
  // cleanup_task
178
143
  server.registerPrompt("cleanup_task", {
179
- description: CAPIX_PROMPTS[4].description,
144
+ description: CAPIX_PROMPTS[3].description,
180
145
  argsSchema: {
181
- taskId: z.string().describe("Task-scoped resource id."),
146
+ taskId: z.string().describe("Task label for the cleanup summary."),
182
147
  },
183
148
  }, async (args) => ({
184
149
  messages: [
@@ -187,9 +152,10 @@ export function registerPrompts(server) {
187
152
  content: {
188
153
  type: "text",
189
154
  text: [
190
- `Destroy all task-scoped resources for ${args.taskId} (§18 cleanup gate).`,
191
- "1. capix_destroy_task_resourcesrelease allocations (requires approvalToken).",
192
- "2. capix_receiptsconfirm final settlement.",
155
+ `Destroy all resources created for ${args.taskId} (§18 cleanup gate).`,
156
+ "1. capix_deployments / capix_agent_list / capix_website_list enumerate what is still running.",
157
+ "2. capix_delete / capix_agent_destroy / capix_website_destroy release each one (requires approvalToken).",
158
+ "3. capix_receipts — confirm final settlement.",
193
159
  ].join("\n"),
194
160
  },
195
161
  },
@@ -1 +1 @@
1
- {"version":3,"file":"prompts.js","sourceRoot":"","sources":["../src/prompts.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAUxB,MAAM,CAAC,MAAM,aAAa,GAAkB;IAC1C;QACE,IAAI,EAAE,mBAAmB;QACzB,WAAW,EACT,gFAAgF;QAClF,SAAS,EAAE;YACT,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,qBAAqB,EAAE,QAAQ,EAAE,IAAI,EAAE;YACvE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,mCAAmC,EAAE;YACpE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,mBAAmB,EAAE;YACpD,EAAE,IAAI,EAAE,cAAc,EAAE,WAAW,EAAE,4CAA4C,EAAE;SACpF;KACF;IACD;QACE,IAAI,EAAE,qBAAqB;QAC3B,WAAW,EACT,uEAAuE;QACzE,SAAS,EAAE;YACT,EAAE,IAAI,EAAE,cAAc,EAAE,WAAW,EAAE,yBAAyB,EAAE,QAAQ,EAAE,IAAI,EAAE;SACjF;KACF;IACD;QACE,IAAI,EAAE,gBAAgB;QACtB,WAAW,EACT,yDAAyD;QAC3D,SAAS,EAAE;YACT,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,qBAAqB,EAAE,QAAQ,EAAE,IAAI,EAAE;YACtE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,oBAAoB,EAAE,QAAQ,EAAE,IAAI,EAAE;SACtE;KACF;IACD;QACE,IAAI,EAAE,YAAY;QAClB,WAAW,EACT,6EAA6E;QAC/E,SAAS,EAAE;YACT,EAAE,IAAI,EAAE,aAAa,EAAE,WAAW,EAAE,oCAAoC,EAAE,QAAQ,EAAE,IAAI,EAAE;SAC3F;KACF;IACD;QACE,IAAI,EAAE,cAAc;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wBAChG,yGAAyG;qBAC1G,CAAC,IAAI,CAAC,IAAI,CAAC;iBACb;aACF;YACD;gBACE,IAAI,EAAE,WAAoB;gBAC1B,OAAO,EAAE,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,iBAAiB,EAAE;aAC5D;SACF;KACF,CAAC,CACH,CAAC;IAEF,eAAe;IACf,MAAM,CAAC,cAAc,CACnB,cAAc,EACd;QACE,WAAW,EAAE,aAAa,CAAC,CAAC,CAAE,CAAC,WAAW;QAC1C,UAAU,EAAE;YACV,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,qCAAqC,CAAC;SACnE;KACF,EACD,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC;QACf,QAAQ,EAAE;YACR;gBACE,IAAI,EAAE,MAAe;gBACrB,OAAO,EAAE;oBACP,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE;wBACJ,qCAAqC,IAAI,CAAC,MAAM,sBAAsB;wBACtE,iGAAiG;wBACjG,4GAA4G;wBAC5G,+CAA+C;qBAChD,CAAC,IAAI,CAAC,IAAI,CAAC;iBACb;aACF;YACD;gBACE,IAAI,EAAE,WAAoB;gBAC1B,OAAO,EAAE,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,iBAAiB,EAAE;aAC5D;SACF;KACF,CAAC,CACH,CAAC;AACJ,CAAC"}
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Capix MCP Server — the allowlist of REAL control-plane route families.
3
+ *
4
+ * Encoded from the 2026-07 live audit of the protocol repo
5
+ * (app/api/v1/* in CapIX-Protocol): every entry below is backed by a route
6
+ * handler that exists in the control plane today. The registry gate
7
+ * (tools/registry.test.ts) asserts that every registered tool's `routePath`
8
+ * starts with one of these families — this is the anti-regression guard that
9
+ * keeps phantom tools (tools pointing at routes the backend never
10
+ * implemented) out of the MCP surface.
11
+ *
12
+ * When the control plane ships a new route family, add it here WITH the
13
+ * backend evidence (route file path) in the comment, then add the tool.
14
+ *
15
+ * Evidence pointers are relative to the protocol repo root.
16
+ */
17
+ export interface RouteFamily {
18
+ /** Canonical path prefix, e.g. "/api/v1/jobs". */
19
+ prefix: string;
20
+ /** Route file(s) in the protocol repo proving the family exists. */
21
+ evidence: string;
22
+ }
23
+ export declare const REAL_ROUTE_FAMILIES: readonly RouteFamily[];
24
+ /**
25
+ * Route families that were advertised by pre-repair tools but DO NOT EXIST
26
+ * in the control plane (verified 2026-07 against app/api/v1/). Tools were
27
+ * removed from the registry; they return when the backend ships. Listed here
28
+ * so the gate test can also assert no tool regresses onto them.
29
+ *
30
+ * /api/v1/website (singular) — real family is /api/v1/websites (plural)
31
+ * /api/v1/networking, /api/v1/vpc — networking roadmap N1–N5, not built
32
+ * /api/v1/verification, /api/v1/attestations — Secured Cloud (TEE/zkVM) deferred
33
+ * /api/v1/testing — disposable test envs, not built
34
+ * /api/v1/planning — superseded by /api/v1/quotes
35
+ * /api/v1/lifecycle — superseded by /api/v1/deployments (+PATCH)
36
+ * /api/v1/projects — no projects list route exists
37
+ * /api/v1/catalog/compute, /api/v1/catalog/models — real: catalog/capabilities, models
38
+ * /api/v1/network/status — real: /api/v1/health
39
+ * /api/v1/account/balance — real: /api/v1/billing
40
+ * /api/v1/nodes/status, /api/v1/earnings — only nodes/[id]/earnings exists
41
+ */
42
+ export declare const REMOVED_ROUTE_FAMILIES: readonly string[];
43
+ /** True when `path` (may contain :params) targets a real route family. */
44
+ export declare function isRealRoutePath(path: string): boolean;
45
+ /** True when `path` targets a family removed because the backend never existed. */
46
+ export declare function isRemovedRoutePath(path: string): boolean;
47
+ //# sourceMappingURL=route-families.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"route-families.d.ts","sourceRoot":"","sources":["../src/route-families.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,MAAM,WAAW,WAAW;IAC1B,kDAAkD;IAClD,MAAM,EAAE,MAAM,CAAC;IACf,oEAAoE;IACpE,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,eAAO,MAAM,mBAAmB,EAAE,SAAS,WAAW,EAmC5C,CAAC;AAEX;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,sBAAsB,EAAE,SAAS,MAAM,EAgB1C,CAAC;AAEX,0EAA0E;AAC1E,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAIrD;AAED,mFAAmF;AACnF,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAIxD"}
@@ -0,0 +1,96 @@
1
+ /**
2
+ * Capix MCP Server — the allowlist of REAL control-plane route families.
3
+ *
4
+ * Encoded from the 2026-07 live audit of the protocol repo
5
+ * (app/api/v1/* in CapIX-Protocol): every entry below is backed by a route
6
+ * handler that exists in the control plane today. The registry gate
7
+ * (tools/registry.test.ts) asserts that every registered tool's `routePath`
8
+ * starts with one of these families — this is the anti-regression guard that
9
+ * keeps phantom tools (tools pointing at routes the backend never
10
+ * implemented) out of the MCP surface.
11
+ *
12
+ * When the control plane ships a new route family, add it here WITH the
13
+ * backend evidence (route file path) in the comment, then add the tool.
14
+ *
15
+ * Evidence pointers are relative to the protocol repo root.
16
+ */
17
+ export const REAL_ROUTE_FAMILIES = [
18
+ // GET /api/v1/account re-exports GET /api/v1/me (account/route.ts).
19
+ { prefix: "/api/v1/account", evidence: "app/api/v1/account/route.ts" },
20
+ // GET /api/v1/billing — balances, valuation, transactions (billing/route.ts).
21
+ { prefix: "/api/v1/billing", evidence: "app/api/v1/billing/route.ts" },
22
+ // GET /api/v1/catalog/capabilities — workload types + providers (public).
23
+ { prefix: "/api/v1/catalog/capabilities", evidence: "app/api/v1/catalog/capabilities/route.ts" },
24
+ // GET/POST /api/v1/deployments, GET/PATCH/DELETE /api/v1/deployments/[id].
25
+ { prefix: "/api/v1/deployments", evidence: "app/api/v1/deployments/route.ts + [id]/route.ts" },
26
+ // GET /api/v1/health — service status + feature gates (public).
27
+ { prefix: "/api/v1/health", evidence: "app/api/v1/health/route.ts" },
28
+ // POST /api/v1/images — text-to-image (billable).
29
+ { prefix: "/api/v1/images", evidence: "app/api/v1/images/route.ts" },
30
+ // POST/GET /api/v1/jobs (+ [id]/cancel, [id]/logs, [id]/rerun).
31
+ { prefix: "/api/v1/jobs", evidence: "app/api/v1/jobs/route.ts + [id]/{cancel,logs,rerun}/route.ts" },
32
+ // GET /api/v1/marketplace/offers — provider-anonymized capacity offers (public).
33
+ { prefix: "/api/v1/marketplace/offers", evidence: "app/api/v1/marketplace/offers/route.ts" },
34
+ // GET/POST /api/v1/memes, GET /api/v1/memes/[id].
35
+ { prefix: "/api/v1/memes", evidence: "app/api/v1/memes/route.ts + [id]/route.ts" },
36
+ // GET /api/v1/models — public catalog + owned private endpoints.
37
+ { prefix: "/api/v1/models", evidence: "app/api/v1/models/route.ts" },
38
+ // GET/POST /api/v1/operations/[id] (POST = cancel), GET [id]/events.
39
+ { prefix: "/api/v1/operations", evidence: "app/api/v1/operations/[id]/route.ts" },
40
+ // GET/POST /api/v1/quotes (GET requires ?quoteId=).
41
+ { prefix: "/api/v1/quotes", evidence: "app/api/v1/quotes/route.ts" },
42
+ // GET/POST /api/v1/receipts — work receipts (list/create only; no [id] route).
43
+ { prefix: "/api/v1/receipts", evidence: "app/api/v1/receipts/route.ts" },
44
+ // GET /api/v1/route-receipts/[id] — signed placement receipt (by-id only).
45
+ { prefix: "/api/v1/route-receipts", evidence: "app/api/v1/route-receipts/[id]/route.ts" },
46
+ // POST/GET /api/v1/training, GET [id], POST [id]/deploy.
47
+ { prefix: "/api/v1/training", evidence: "app/api/v1/training/route.ts + [id]/{route,deploy/route}.ts" },
48
+ // POST/GET /api/v1/agent-deploys, GET/DELETE [id].
49
+ { prefix: "/api/v1/agent-deploys", evidence: "app/api/v1/agent-deploys/route.ts + [id]/route.ts" },
50
+ // POST/GET /api/v1/websites, GET/DELETE [id], POST [id]/promote|rollback.
51
+ { prefix: "/api/v1/websites", evidence: "app/api/v1/websites/route.ts + [id]/route.ts" },
52
+ ];
53
+ /**
54
+ * Route families that were advertised by pre-repair tools but DO NOT EXIST
55
+ * in the control plane (verified 2026-07 against app/api/v1/). Tools were
56
+ * removed from the registry; they return when the backend ships. Listed here
57
+ * so the gate test can also assert no tool regresses onto them.
58
+ *
59
+ * /api/v1/website (singular) — real family is /api/v1/websites (plural)
60
+ * /api/v1/networking, /api/v1/vpc — networking roadmap N1–N5, not built
61
+ * /api/v1/verification, /api/v1/attestations — Secured Cloud (TEE/zkVM) deferred
62
+ * /api/v1/testing — disposable test envs, not built
63
+ * /api/v1/planning — superseded by /api/v1/quotes
64
+ * /api/v1/lifecycle — superseded by /api/v1/deployments (+PATCH)
65
+ * /api/v1/projects — no projects list route exists
66
+ * /api/v1/catalog/compute, /api/v1/catalog/models — real: catalog/capabilities, models
67
+ * /api/v1/network/status — real: /api/v1/health
68
+ * /api/v1/account/balance — real: /api/v1/billing
69
+ * /api/v1/nodes/status, /api/v1/earnings — only nodes/[id]/earnings exists
70
+ */
71
+ export const REMOVED_ROUTE_FAMILIES = [
72
+ "/api/v1/website",
73
+ "/api/v1/networking",
74
+ "/api/v1/vpc",
75
+ "/api/v1/verification",
76
+ "/api/v1/attestations",
77
+ "/api/v1/testing",
78
+ "/api/v1/planning",
79
+ "/api/v1/lifecycle",
80
+ "/api/v1/projects",
81
+ "/api/v1/catalog/compute",
82
+ "/api/v1/catalog/models",
83
+ "/api/v1/network",
84
+ "/api/v1/account/balance",
85
+ "/api/v1/nodes",
86
+ "/api/v1/earnings",
87
+ ];
88
+ /** True when `path` (may contain :params) targets a real route family. */
89
+ export function isRealRoutePath(path) {
90
+ return REAL_ROUTE_FAMILIES.some(({ prefix }) => path === prefix || path.startsWith(`${prefix}/`));
91
+ }
92
+ /** True when `path` targets a family removed because the backend never existed. */
93
+ export function isRemovedRoutePath(path) {
94
+ return REMOVED_ROUTE_FAMILIES.some((prefix) => path === prefix || path.startsWith(`${prefix}/`));
95
+ }
96
+ //# sour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;IAC3E,EAAE,MAAM,EAAE,wBAAwB,EAAE,QAAQ,EAAE,yCAAyC,EAAE;IACzF,yDAAyD;IACzD,EAAE,MAAM,EAAE,kBAAkB,EAAE,QAAQ,EAAE,6DAA6D,EAAE;IACvG,mDAAmD;IACnD,EAAE,MAAM,EAAE,uBAAuB,EAAE,QAAQ,EAAE,mDAAmD,EAAE;IAClG,0EAA0E;IAC1E,EAAE,MAAM,EAAE,kBAAkB,EAAE,QAAQ,EAAE,8CAA8C,EAAE;CAChF,CAAC;AAEX;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAsB;IACvD,iBAAiB;IACjB,oBAAoB;IACpB,aAAa;IACb,sBAAsB;IACtB,sBAAsB;IACtB,iBAAiB;IACjB,kBAAkB;IAClB,mBAAmB;IACnB,kBAAkB;IAClB,yBAAyB;IACzB,wBAAwB;IACxB,iBAAiB;IACjB,yBAAyB;IACzB,eAAe;IACf,kBAAkB;CACV,CAAC;AAEX,0EAA0E;AAC1E,MAAM,UAAU,eAAe,CAAC,IAAY;IAC1C,OAAO,mBAAmB,CAAC,IAAI,CAC7B,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,IAAI,KAAK,MAAM,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,MAAM,GAAG,CAAC,CACjE,CAAC;AACJ,CAAC;AAED,mFAAmF;AACnF,MAAM,UAAU,kBAAkB,CAAC,IAAY;IAC7C,OAAO,sBAAsB,CAAC,IAAI,CAChC,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,KAAK,MAAM,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,MAAM,GAAG,CAAC,CAC7D,CAAC;AACJ,CAAC"}
package/dist/server.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * Capix MCP Server — the McpServer assembly + transport wiring.
3
3
  *
4
- * `createCapixMcpServer(client)` builds an {@link McpServer} with all 59
5
- * tools, the capix:// resources, and the guided prompts registered. Each tool
6
- * registration wires:
4
+ * `createCapixMcpServer(client)` builds an {@link McpServer} with every tool
5
+ * in the registry (TOOL_COUNT), the capix:// resources, and the guided
6
+ * prompts registered. Each tool registration wires:
7
7
  * - inputSchema → the tool's Zod raw shape (validated by the SDK)
8
8
  * - outputSchema → the tool's Zod raw output shape
9
9
  * - annotations → readOnlyHint / destructiveHint / idempotentHint derived
@@ -17,6 +17,13 @@
17
17
  * 3. every billable tool's cost is the canonical quote the agent obtained
18
18
  * upstream (no in-line price guess); the approval token binds that quote.
19
19
  *
20
+ * Auto-discovery: when run as `capix-mcp server --stdio`, the server checks
21
+ * for credentials in this order:
22
+ * 1. CAPIX_API_KEY in env (set by the IDE/CLI as a session token)
23
+ * 2. CAPIX_REFRESH_TOKEN in env -> attempt OAuth refresh via the broker
24
+ * 3. Stored broker credentials (~/.capix/credentials.json or OS keyring)
25
+ * If none are found, the server exits with a helpful message.
26
+ *
20
27
  * Transports:
21
28
  * - stdio : StdioServerTransport, for local agent integration
22
29
  * - streamable HTTP : StreamableHTTPServerTransport, for remote / hosted use
@@ -25,8 +32,8 @@ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
25
32
  import type { CapixClient } from "./client.js";
26
33
  import type { ToolDef, ToolScope } from "./types.js";
27
34
  /**
28
- * Build a fully-wired McpServer. All 59 tools, resources, and prompts are
29
- * registered before returning; the caller just attaches a transport.
35
+ * Build a fully-wired McpServer. All registered tools, resources, and prompts
36
+ * are wired before returning; the caller just attaches a transport.
30
37
  */
31
38
  export declare function createCapixMcpServer(client: CapixClient, opts?: {
32
39
  version?: string;
@@ -37,8 +44,31 @@ export interface CapixServerOptions {
37
44
  httpPort?: number;
38
45
  /** Bearer service token guarding the HTTP transport (required if httpPort>0). */
39
46
  httpServiceToken?: string;
47
+ /**
48
+ * When true (default for stdio), the server performs auto-discovery:
49
+ * checks CAPIX_API_KEY, then CAPIX_REFRESH_TOKEN, then the broker's
50
+ * stored credentials before starting. If none are found, it exits.
51
+ */
52
+ autoDiscover?: boolean;
40
53
  }
41
- /** Start the MCP server on stdio (the default for local agent integration). */
54
+ /**
55
+ * Resolve credentials via auto-discovery. Checks (in order):
56
+ * 1. CAPIX_API_KEY in env (session token set by the IDE/CLI)
57
+ * 2. CAPIX_REFRESH_TOKEN in env -> refresh via the broker
58
+ * 3. Stored broker credentials (OS keyring or ~/.capix/credentials.json)
59
+ * Returns the resolved API key (if using env), or null if the broker
60
+ * should be used.
61
+ */
62
+ export declare function resolveAutoDiscovery(): Promise<{
63
+ apiKey: string | null;
64
+ useBroker: boolean;
65
+ }>;
66
+ /**
67
+ * Start the MCP server on stdio (the default for local agent integration).
68
+ * Performs auto-discovery: checks CAPIX_API_KEY, then CAPIX_REFRESH_TOKEN,
69
+ * then stored broker credentials. If none are found, exits with a helpful
70
+ * message instead of starting an unauthenticated server.
71
+ */
42
72
  export declare function startStdioServer(client: CapixClient, opts?: CapixServerOptions): Promise<void>;
43
73
  /**
44
74
  * Start the MCP server on a streamable HTTP transport.
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAKpE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAK/C,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAsBrD;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,WAAW,EACnB,IAAI,CAAC,EAAE;IAAE,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,GAC1B,SAAS,CAmFX;AA8DD,MAAM,WAAW,kBAAkB;IACjC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,0EAA0E;IAC1E,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iFAAiF;IACjF,gBAAgB,CAAC,EAAE,MAAM,CAAC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C,EAAE,OAAO,CAAC;CACxB;AAED;;;;;;;GAOG;AACH,wBAAsB,oBAAoB,IAAI,OAAO,CAAC;IACpD,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,SAAS,EAAE,OAAO,CAAC;CACpB,CAAC,CAkBD;AAED;;;;;GAKG;AACH,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,WAAW,EACnB,IAAI,CAAC,EAAE,kBAAkB,GACxB,OAAO,CAAC,IAAI,CAAC,CA0Bf;AAED;;;;;;GAMG;AACH,wBAAsB,eAAe,CACnC,MAAM,EAAE,WAAW,EACnB,IAAI,EAAE,kBAAkB,GAAG;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,gBAAgB,EAAE,MAAM,CAAA;CAAE,GACxE,OAAO,CAAC,IAAI,CAAC,CA+Bf;AAMD,wBAAgB,cAAc,IAAI,KAAK,CAAC;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,SAAS,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;IAClB,gBAAgB,EAAE,OAAO,CAAC;CAC3B,CAAC,CAOD;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAE5D"}
package/dist/server.js CHANGED
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * Capix MCP Server — the McpServer assembly + transport wiring.
3
3
  *
4
- * `createCapixMcpServer(client)` builds an {@link McpServer} with all 59
5
- * tools, the capix:// resources, and the guided prompts registered. Each tool
6
- * registration wires:
4
+ * `createCapixMcpServer(client)` builds an {@link McpServer} with every tool
5
+ * in the registry (TOOL_COUNT), the capix:// resources, and the guided
6
+ * prompts registered. Each tool registration wires:
7
7
  * - inputSchema → the tool's Zod raw shape (validated by the SDK)
8
8
  * - outputSchema → the tool's Zod raw output shape
9
9
  * - annotations → readOnlyHint / destructiveHint / idempotentHint derived
@@ -17,6 +17,13 @@
17
17
  * 3. every billable tool's cost is the canonical quote the agent obtained
18
18
  * upstream (no in-line price guess); the approval token binds that quote.
19
19
  *
20
+ * Auto-discovery: when run as `capix-mcp server --stdio`, the server checks
21
+ * for credentials in this order:
22
+ * 1. CAPIX_API_KEY in env (set by the IDE/CLI as a session token)
23
+ * 2. CAPIX_REFRESH_TOKEN in env -> attempt OAuth refresh via the broker
24
+ * 3. Stored broker credentials (~/.capix/credentials.json or OS keyring)
25
+ * If none are found, the server exits with a helpful message.
26
+ *
20
27
  * Transports:
21
28
  * - stdio : StdioServerTransport, for local agent integration
22
29
  * - streamable HTTP : StreamableHTTPServerTransport, for remote / hosted use
@@ -26,16 +33,17 @@ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"
26
33
  import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
27
34
  import { randomUUID } from "node:crypto";
28
35
  import http from "node:http";
36
+ import { tryCreateBrokerAuthProvider } from "./client.js";
29
37
  import { TOOLS, TOOL_MAP, TOOL_COUNT } from "./tools.js";
30
38
  import { registerResources } from "./resources.js";
31
39
  import { registerPrompts } from "./prompts.js";
32
40
  import { CapixApiError } from "./types.js";
33
41
  /** MCP tool annotations derived from a tool's billing/approval/scope flags. */
34
42
  function annotationsFor(tool) {
35
- const isDestructive = (tool.scope === "lifecycle" && (tool.name === "capix_delete" || tool.name === "capix_cancel")) ||
36
- tool.name === "capix_destroy_task_resources" ||
43
+ const isDestructive = tool.name === "capix_delete" ||
44
+ tool.name === "capix_cancel" ||
37
45
  tool.name === "capix_website_destroy" ||
38
- tool.name === "capix_website_domain_remove";
46
+ tool.name === "capix_agent_destroy";
39
47
  return {
40
48
  readOnlyHint: !tool.billable && !tool.requiresApproval,
41
49
  destructiveHint: isDestructive,
@@ -44,13 +52,13 @@ function annotationsFor(tool) {
44
52
  };
45
53
  }
46
54
  /**
47
- * Build a fully-wired McpServer. All 59 tools, resources, and prompts are
48
- * registered before returning; the caller just attaches a transport.
55
+ * Build a fully-wired McpServer. All registered tools, resources, and prompts
56
+ * are wired before returning; the caller just attaches a transport.
49
57
  */
50
58
  export function createCapixMcpServer(client, opts) {
51
59
  const server = new McpServer({
52
60
  name: "capix-mcp",
53
- version: opts?.version ?? "2.0.0",
61
+ version: opts?.version ?? "2.1.0",
54
62
  });
55
63
  // ── Tools ───────────────────────────────────────────────────────────────
56
64
  for (const tool of TOOLS) {
@@ -168,8 +176,56 @@ function errorResult(err, toolName) {
168
176
  ],
169
177
  };
170
178
  }
171
- /** Start the MCP server on stdio (the default for local agent integration). */
179
+ /**
180
+ * Resolve credentials via auto-discovery. Checks (in order):
181
+ * 1. CAPIX_API_KEY in env (session token set by the IDE/CLI)
182
+ * 2. CAPIX_REFRESH_TOKEN in env -> refresh via the broker
183
+ * 3. Stored broker credentials (OS keyring or ~/.capix/credentials.json)
184
+ * Returns the resolved API key (if using env), or null if the broker
185
+ * should be used.
186
+ */
187
+ export async function resolveAutoDiscovery() {
188
+ // 1. Direct API key from environment (IDE/CLI sets this as a session token)
189
+ if (process.env.CAPIX_API_KEY) {
190
+ return { apiKey: process.env.CAPIX_API_KEY, useBroker: false };
191
+ }
192
+ // 2. Refresh token from environment -> use the broker to obtain an access token
193
+ if (process.env.CAPIX_REFRESH_TOKEN) {
194
+ return { apiKey: null, useBroker: true };
195
+ }
196
+ // 3. Fall back to stored broker credentials
197
+ const broker = await tryCreateBrokerAuthProvider();
198
+ if (broker && broker.isAuthenticated()) {
199
+ return { apiKey: null, useBroker: true };
200
+ }
201
+ return { apiKey: null, useBroker: false };
202
+ }
203
+ /**
204
+ * Start the MCP server on stdio (the default for local agent integration).
205
+ * Performs auto-discovery: checks CAPIX_API_KEY, then CAPIX_REFRESH_TOKEN,
206
+ * then stored broker credentials. If none are found, exits with a helpful
207
+ * message instead of starting an unauthenticated server.
208
+ */
172
209
  export async function startStdioServer(client, opts) {
210
+ // ── Auto-discovery: check env vars before starting ───────────────────
211
+ // If the client is not authenticated and auto-discovery is enabled,
212
+ // check for credentials in the standard order. If none are found, exit.
213
+ if (opts?.autoDiscover !== false && !client.isAuthenticated()) {
214
+ const discovery = await resolveAutoDiscovery();
215
+ if (!discovery.apiKey && !discovery.useBroker) {
216
+ process.stderr.write("Capix MCP Server: no credentials found.\n" +
217
+ "Auto-discovery checked:\n" +
218
+ " 1. CAPIX_API_KEY — not set\n" +
219
+ " 2. CAPIX_REFRESH_TOKEN — not set\n" +
220
+ " 3. Stored OAuth credentials — not found\n" +
221
+ "\n" +
222
+ "Options:\n" +
223
+ " • Run `capix-mcp login` to authenticate via OAuth\n" +
224
+ " • Set CAPIX_API_KEY with a session token from capix.network\n" +
225
+ " • Set CAPIX_REFRESH_TOKEN (the IDE sets this automatically when signed in)\n");
226
+ process.exit(1);
227
+ }
228
+ }
173
229
  const server = createCapixMcpServer(client, opts);
174
230
  const transport = new StdioServerTransport();
175
231
  await server.connect(transport);
@@ -194,7 +250,7 @@ export async function startHttpServer(client, opts) {
194
250
  res.end(JSON.stringify({
195
251
  ok: true,
196
252
  service: "capix-mcp",
197
- version: opts.version ?? "2.0.0",
253
+ version: opts.version ?? "2.1.0",
198
254
  tools: TOOL_COUNT,
199
255
  authenticated: client.isAuthenticated(),
200
256
  }));
@@ -1 +1 @@
1
- {"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,6BAA6B,EAAE,MAAM,oDAAoD,CAAC;AACnG,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,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