@rebasepro/mcp 0.25.1 → 0.27.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/dist/index.d.ts CHANGED
@@ -40,6 +40,17 @@ export interface ProjectConfig {
40
40
  baseUrl: string;
41
41
  /** Auth token — a service key, API key, or JWT. */
42
42
  token: string;
43
+ /**
44
+ * A Rebase Cloud project reached through the console's Studio proxy, set by
45
+ * `rebase_project_use_cloud`. Its `baseUrl` is the proxy, and its bearer is
46
+ * the CLI's own credential (`rebase cloud access-token`), read when a call
47
+ * is made and never stored: the control plane swaps in the project's
48
+ * service key on its side, so the key never reaches this machine.
49
+ */
50
+ cloud?: {
51
+ host: string;
52
+ projectId: string;
53
+ };
43
54
  /** ISO timestamp when the project was registered. */
44
55
  addedAt: string;
45
56
  }
@@ -85,6 +96,19 @@ export declare function autoDiscoverLocal(project: ProjectConfig, devState?: Ret
85
96
  * changed since the load.
86
97
  */
87
98
  export declare function childProcessEnv(env?: NodeJS.ProcessEnv, startupDotenv?: ReadonlyMap<string, string>): NodeJS.ProcessEnv;
99
+ /**
100
+ * The app's key from the environment: `REBASE_API_TOKEN`, and nothing else.
101
+ *
102
+ * `REBASE_TOKEN` used to stand in for it. It is the CLI's control-plane token
103
+ * — a deploy token on the person's real projects — and the app this server
104
+ * talks to may be a cloud tenant running agent-written code (`rebase cloud
105
+ * init --claim` points `REBASE_BASE_URL` at one), so a control-plane
106
+ * credential sent there is a credential handed to that code. It is no longer
107
+ * sent to the app. It still reaches the CLI the cloud tools spawn, which sends
108
+ * it only to the control plane. Said once per process when it is the only
109
+ * token set, since setups that relied on the alias stop authenticating.
110
+ */
111
+ export declare function envAppToken(env?: NodeJS.ProcessEnv, note?: (message: string) => void): string | undefined;
88
112
  /**
89
113
  * The env vars that describe a `default` project, or `null` when the client
90
114
  * declared none of them.
@@ -104,6 +128,8 @@ export declare function envDeclaredProject(env?: NodeJS.ProcessEnv): {
104
128
  * because a stored value would then outrank the dev server discovery is for.
105
129
  */
106
130
  export declare const DEFAULT_BASE_URL = "http://localhost:3001";
131
+ /** Where the console's Studio proxy serves a project's own API: the SDK appends `/api/...`. */
132
+ export declare function studioProxyBaseUrl(host: string, projectId: string): string;
107
133
  /**
108
134
  * Tools that only read from the target environment.
109
135
  *
@@ -119,6 +145,23 @@ export declare const DEFAULT_BASE_URL = "http://localhost:3001";
119
145
  * auditable at a glance and a new tool now arrives protected.
120
146
  */
121
147
  export declare const READ_ONLY_TOOLS: Set<string>;
148
+ /**
149
+ * Rebase Cloud tools that act on the control plane: provisioning a project, and
150
+ * changing the linked one with a deploy, a variable or a rollback.
151
+ *
152
+ * Not gated, and not because they are harmless — each one changes a
153
+ * production project. The gate asks whether the app's `baseUrl` or the CLI's
154
+ * `DATABASE_URL` is local, and these use neither: they spawn `rebase cloud`,
155
+ * which acts on the project `.rebase/cloud.json` links, with the credential the
156
+ * CLI resolves (`REBASE_TOKEN`, the token `init --claim` stored, or the
157
+ * person's login) and the control plane's own permission checks. Gating them
158
+ * on `baseUrl` would test a value they never read — and after
159
+ * `rebase_cloud_provision` points `REBASE_BASE_URL` at the new project,
160
+ * would refuse the very deploy that journey needs. The accident the gate
161
+ * exists for — an agent that thinks it is local — cannot happen to a tool
162
+ * whose name says "cloud".
163
+ */
164
+ export declare const CLOUD_CONTROL_PLANE_TOOLS: Set<string>;
122
165
  /**
123
166
  * Tools whose effect lands on this machine only — the local registry, local
124
167
  * source files, a local child process. They have no remote target to classify,
@@ -259,8 +302,51 @@ interface ToolDef {
259
302
  type: "object";
260
303
  properties: Record<string, unknown>;
261
304
  required?: string[];
305
+ additionalProperties?: boolean;
262
306
  };
263
307
  }
308
+ /** What `rebase cloud init --claim --json` prints, the fields this tool hands on. */
309
+ export interface CloudProvisionResult {
310
+ projectUrl: string;
311
+ adminUrl: string | null;
312
+ claimUrl: string;
313
+ expiresAt: string;
314
+ slug: string;
315
+ deployed: boolean;
316
+ /** Whether REBASE_API_TOKEN, a key minted on the app, was written into .env. The key itself is never printed. */
317
+ apiTokenInEnv: boolean;
318
+ }
319
+ /** The arguments `rebase_cloud_provision` passes to the CLI, validated. Throws on a value argv must not carry. */
320
+ export declare function cloudProvisionArgv(args: {
321
+ name?: unknown;
322
+ deploy?: unknown;
323
+ }): string[];
324
+ /** The code of a refusal `rebase cloud init --claim --json` printed (`{ error: { code, … } }`), or null. */
325
+ export declare function cloudProvisionRefusalCode(stdout: string): string | null;
326
+ /**
327
+ * The way forward after a provision refusal this server recognises by its
328
+ * code, or null. Written here, so it is trusted text; the refusal's own message
329
+ * stays fenced as untrusted data beside it.
330
+ *
331
+ * A control plane that has not switched provisioning on answers
332
+ * `not_configured`. The tool stays listed — whether provisioning is on is the
333
+ * control plane's to say, and it can change — so the refusal has to carry the
334
+ * way forward on its own.
335
+ */
336
+ export declare function cloudProvisionRefusalNext(code: string): string | null;
337
+ /** Read the CLI's one JSON result, keeping only fields of the expected shape. Null when it printed none. */
338
+ export declare function parseCloudProvisionResult(stdout: string): CloudProvisionResult | null;
339
+ /**
340
+ * The validated CLI call a cloud tool makes, from its arguments: what the
341
+ * dispatcher runs, and what the schema-against-handler test drives. Throws a
342
+ * `ToolArgumentError` before anything is spawned.
343
+ */
344
+ export declare function parseCloudToolArgs(name: string, args: unknown): {
345
+ argv: string[];
346
+ stdin?: string;
347
+ secrets: string[];
348
+ tailLines: number;
349
+ };
264
350
  export declare const ALL_TOOLS: ToolDef[];
265
351
  /** The last `count` lines of a blob of output, without its trailing blank. */
266
352
  export declare function lastLines(text: string, count: number): string;