@rebasepro/server 0.28.0 → 0.28.2
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/auth/platform-token.d.ts +24 -8
- package/dist/backend/options.d.ts +21 -0
- package/dist/{dist-DVqwVrBQ.js → dist-CT9HJehq.js} +2 -2
- package/dist/{dist-DVqwVrBQ.js.map → dist-CT9HJehq.js.map} +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.es.js +414 -89
- package/dist/index.es.js.map +1 -1
- package/dist/mcp/confirmation.d.ts +84 -0
- package/dist/mcp/consent-page.d.ts +17 -3
- package/dist/mcp/mcp-routes.d.ts +32 -0
- package/dist/mcp/mcp-tools.d.ts +40 -6
- package/dist/mcp/oauth-metadata.d.ts +25 -3
- package/dist/mcp/oauth-routes.d.ts +4 -1
- package/dist/mcp/oauth-store.d.ts +7 -1
- package/dist/mcp/platform-mcp.d.ts +37 -0
- package/package.json +5 -5
|
@@ -30,9 +30,14 @@
|
|
|
30
30
|
* - **Reach another project.** One platform key signs for every tenant, so the
|
|
31
31
|
* audience is what binds a token to this one: `aud` must equal
|
|
32
32
|
* `REBASE_PLATFORM_TOKEN_AUDIENCE`.
|
|
33
|
-
* - **Act as a person of this app.** The caller is `platform:<sub
|
|
34
|
-
*
|
|
35
|
-
*
|
|
33
|
+
* - **Act as a person of this app.** The caller is `platform:<sub>`: row-level
|
|
34
|
+
* security sees nobody it knows by that uid, and every surface that checks a
|
|
35
|
+
* scope other than the granted ones refuses it. On the admin surfaces it
|
|
36
|
+
* holds no role. On the platform's MCP endpoint (`/api/admin/mcp`,
|
|
37
|
+
* `mcp/platform-mcp.ts`) — and nowhere else — a token holding `data:*` runs
|
|
38
|
+
* the app's MCP data tools with the `admin` role, under RLS: the reach the
|
|
39
|
+
* platform's own Studio has, which the platform grants only to the project's
|
|
40
|
+
* owners and admins.
|
|
36
41
|
*
|
|
37
42
|
* ## Wire format
|
|
38
43
|
*
|
|
@@ -50,13 +55,22 @@ export declare const PLATFORM_TOKEN_PREFIX = "rpt_";
|
|
|
50
55
|
/** The `iss` every platform token carries. */
|
|
51
56
|
export declare const PLATFORM_TOKEN_ISSUER = "rebase-cloud";
|
|
52
57
|
/**
|
|
53
|
-
* Everything a platform token can be granted on this server.
|
|
58
|
+
* Everything a platform token can be granted on this server's admin surfaces.
|
|
54
59
|
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
60
|
+
* Adding a scope here is a decision about what the platform may do inside a
|
|
61
|
+
* customer's app on a person's behalf, and belongs in its own change.
|
|
62
|
+
* `cron:write` (run a job, switch one on or off) was added with the hosted
|
|
63
|
+
* Rebase connector (docs/hosted-mcp-connector.md), whose `cron` tool takes a
|
|
64
|
+
* confirmed second call before it sends one.
|
|
58
65
|
*/
|
|
59
66
|
export declare const PLATFORM_TOKEN_SCOPES: readonly AdminScope[];
|
|
67
|
+
/**
|
|
68
|
+
* What a platform token can be granted on the platform's MCP endpoint, and
|
|
69
|
+
* only there: the app's own MCP data tools. Never on `/api/data`, the socket,
|
|
70
|
+
* the public `/mcp`, or an admin surface. Added with the hosted connector, in
|
|
71
|
+
* the same review as `cron:write`.
|
|
72
|
+
*/
|
|
73
|
+
export declare const PLATFORM_MCP_SCOPES: readonly string[];
|
|
60
74
|
/** The longest `exp - iat` a platform token may declare. */
|
|
61
75
|
export declare const PLATFORM_TOKEN_MAX_LIFETIME_SECONDS = 600;
|
|
62
76
|
/** The environment variables a platform sets to turn platform tokens on. */
|
|
@@ -105,7 +119,9 @@ export declare function platformTokensFromEnv(env: Record<string, string | undef
|
|
|
105
119
|
* Verify a presented platform token: signature, issuer, audience, lifetime, and
|
|
106
120
|
* the scopes it may be granted here.
|
|
107
121
|
*/
|
|
108
|
-
export declare function verifyPlatformToken(token: string, config: PlatformTokenConfig, nowSeconds?: number
|
|
122
|
+
export declare function verifyPlatformToken(token: string, config: PlatformTokenConfig, nowSeconds?: number,
|
|
123
|
+
/** The scopes this door grants: the admin surfaces' unless it says otherwise. */
|
|
124
|
+
grantable?: readonly string[]): Promise<PlatformCaller | PlatformTokenRefusal>;
|
|
109
125
|
/**
|
|
110
126
|
* Authenticate an `rpt_` bearer token ahead of an admin gate.
|
|
111
127
|
*
|
|
@@ -21,6 +21,8 @@ import type { RlsAuditConfig } from "../rls-audit/index.js";
|
|
|
21
21
|
import type { BackendStorageConfig, StorageController } from "../storage/index.js";
|
|
22
22
|
import type { SchemaEditPolicy, RemoteRepositoryConfig } from "../schema-edit/schema-edit-permissions.js";
|
|
23
23
|
import type { RuntimeOwnershipOptions, RuntimeSurfaceOptions } from "../init/surfaces.js";
|
|
24
|
+
import type { McpToolDefinition } from "../mcp/mcp-tools.js";
|
|
25
|
+
import type { McpScopeVocabulary } from "../mcp/oauth-metadata.js";
|
|
24
26
|
/**
|
|
25
27
|
* Who may change this project's schema through a running backend.
|
|
26
28
|
*
|
|
@@ -856,6 +858,25 @@ export interface RebaseBackendOptions {
|
|
|
856
858
|
* whole file.
|
|
857
859
|
*/
|
|
858
860
|
maxBodySize?: number;
|
|
861
|
+
/**
|
|
862
|
+
* What `/mcp` serves, for a backend that brings its own tools instead of
|
|
863
|
+
* the data tools — the Rebase Cloud control plane serves its projects and
|
|
864
|
+
* their operations this way. The surface is still switched on by
|
|
865
|
+
* `REBASE_MCP_ENABLED` and `REBASE_PUBLIC_URL`; this only decides what is
|
|
866
|
+
* on it. Omitted, `/mcp` serves the data tools under `data:*` scopes.
|
|
867
|
+
*
|
|
868
|
+
* The OAuth server, its consent screen and its token checks are the same
|
|
869
|
+
* either way: a tool runs as the account that consented, with the scopes
|
|
870
|
+
* it consented to (`McpToolContext.caller`).
|
|
871
|
+
*/
|
|
872
|
+
mcp?: {
|
|
873
|
+
/** The tools, in place of the data tools. Each is offered to a grant holding its `requiredScope`. */
|
|
874
|
+
tools: readonly McpToolDefinition[];
|
|
875
|
+
/** The scopes a grant may hold, with the consent screen's wording for each. */
|
|
876
|
+
scopes: McpScopeVocabulary;
|
|
877
|
+
/** What `initialize` tells the client about the tools. */
|
|
878
|
+
instructions: string;
|
|
879
|
+
};
|
|
859
880
|
/**
|
|
860
881
|
* Response compression for API routes. **Enabled by default.**
|
|
861
882
|
*
|