@integrity-labs/cloud-broker 0.7.9 → 0.7.10

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 (2) hide show
  1. package/dist/index.js +52 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -21364,6 +21364,22 @@ var BrokerClient = class {
21364
21364
  { query: this.agentId ? { agent_id: this.agentId } : void 0 }
21365
21365
  );
21366
21366
  }
21367
+ // ENG-7326 Phase 1: capability tools. Server-side scoped execution - the
21368
+ // agent never receives a database credential.
21369
+ supabaseQuery(args) {
21370
+ return this.request(
21371
+ "POST",
21372
+ `/supabase/grants/${encodeURIComponent(args.grant_id)}/query`,
21373
+ { query: this.agentId ? { agent_id: this.agentId } : void 0, body: { sql: args.sql } }
21374
+ );
21375
+ }
21376
+ supabaseDescribe(args) {
21377
+ return this.request(
21378
+ "GET",
21379
+ `/supabase/grants/${encodeURIComponent(args.grant_id)}/describe`,
21380
+ { query: this.agentId ? { agent_id: this.agentId } : void 0 }
21381
+ );
21382
+ }
21367
21383
  };
21368
21384
 
21369
21385
  // src/inventory.ts
@@ -21590,6 +21606,13 @@ var supabaseCheckApprovalChannelSchema = external_exports.object({
21590
21606
  project_ref: supabaseProjectRefSchema
21591
21607
  });
21592
21608
  var supabaseListProjectsSchema = external_exports.object({});
21609
+ var supabaseQuerySchema = external_exports.object({
21610
+ grant_id: external_exports.string().uuid("grant_id must be a UUID"),
21611
+ sql: external_exports.string().min(1, "sql is required").describe("Read-only SQL to run server-side under your granted scope.")
21612
+ });
21613
+ var supabaseDescribeSchema = external_exports.object({
21614
+ grant_id: external_exports.string().uuid("grant_id must be a UUID")
21615
+ });
21593
21616
  var supabaseDescribeScopeShape = supabaseDescribeScopeSchema.shape;
21594
21617
  var supabasePreviewRequestShape = supabasePreviewRequestSchema.shape;
21595
21618
  var supabaseRequestAccessShape = supabaseRequestAccessSchema.shape;
@@ -21598,11 +21621,13 @@ var supabaseReleaseAccessShape = supabaseReleaseAccessSchema.shape;
21598
21621
  var supabaseGetCredentialsShape = supabaseGetCredentialsSchema.shape;
21599
21622
  var supabaseCheckApprovalChannelShape = supabaseCheckApprovalChannelSchema.shape;
21600
21623
  var supabaseListProjectsShape = supabaseListProjectsSchema.shape;
21624
+ var supabaseQueryShape = supabaseQuerySchema.shape;
21625
+ var supabaseDescribeShape = supabaseDescribeSchema.shape;
21601
21626
 
21602
21627
  // package.json
21603
21628
  var package_default = {
21604
21629
  name: "@integrity-labs/cloud-broker",
21605
- version: "0.7.9",
21630
+ version: "0.7.10",
21606
21631
  description: "Cloud Access Broker \u2014 MCP server that mints scoped, TTL-bounded cloud credentials per agent task. Ships AWS support (aws_request_access, aws_poll_grant, aws_release_access, aws_describe_scope, aws_preview_request, aws_get_credentials \u2014 STS AssumeRole under the hood); GCP, Azure, and Cloudflare land alongside in the same package as the broker grows.",
21607
21632
  type: "module",
21608
21633
  bin: {
@@ -22080,6 +22105,32 @@ server.tool(
22080
22105
  }
22081
22106
  }
22082
22107
  );
22108
+ server.tool(
22109
+ "supabase_describe",
22110
+ "Inspect what an ACTIVE Supabase grant can actually do, BEFORE you run a query - so you never probe blindly. Takes a grant_id (from supabase_request_access). Returns { grant_id, status, project_ref, role, allowed_schemas, allowed_tables, read_only, expires_at, sql_query: { available, read_only_enforced, note } }. `sql_query.available` tells you whether server-side SQL is enabled for this project (an operator must have enrolled a scoped database credential); if false, supabase_query will 409 and you should tell the user the project is not set up for SQL access. Call this once after a grant goes active to learn your scope, then use supabase_query." + NO_DIRECT_SUPABASE_HTTP_BLOCK,
22111
+ supabaseDescribeShape,
22112
+ async (args) => {
22113
+ try {
22114
+ const result = await broker.supabaseDescribe(args);
22115
+ return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
22116
+ } catch (err) {
22117
+ return { content: [{ type: "text", text: formatBrokerError(err) }], isError: true };
22118
+ }
22119
+ }
22120
+ );
22121
+ server.tool(
22122
+ "supabase_query",
22123
+ "Run READ-ONLY SQL against a Supabase project for an ACTIVE grant. THIS is how you query Supabase - you do NOT get or hold a database credential, and the supabase_get_credentials JWT cannot run SQL. The broker executes your SQL server-side under the grant's scoped database role, inside a READ ONLY transaction with a statement timeout, and returns rows. Args: { grant_id, sql }. Returns on success { grant_id, ok: true, rows, row_count, truncated } (truncated=true means the row cap was hit - add LIMIT/aggregate). On failure returns { ok: false, error_code, error } where error_code is one of READ_ONLY (you attempted a write - this capability is read-only), SCOPE_DENIED (your grant's role can't access that object - try supabase_describe to see your scope), OBJECT_NOT_FOUND (no such relation/schema, or not visible to your grant), TIMEOUT (query too slow), SYNTAX_ERROR, UNREACHABLE, SQL_NOT_CONFIGURED (no scoped DB credential enrolled - tell the user to ask their operator to configure it), or a grant-state code GRANT_NOT_ACTIVE / GRANT_EXPIRED / GRANT_RELEASED (re-request access). Writes are always rejected. Call supabase_describe first if unsure what you can read. All of these come back in the { ok:false, error_code } envelope on a normal response - branch on error_code, do not treat them as tool failures." + NO_DIRECT_SUPABASE_HTTP_BLOCK,
22124
+ supabaseQueryShape,
22125
+ async (args) => {
22126
+ try {
22127
+ const result = await broker.supabaseQuery(args);
22128
+ return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
22129
+ } catch (err) {
22130
+ return { content: [{ type: "text", text: formatBrokerError(err) }], isError: true };
22131
+ }
22132
+ }
22133
+ );
22083
22134
  var transport = new StdioServerTransport();
22084
22135
  await server.connect(transport);
22085
22136
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@integrity-labs/cloud-broker",
3
- "version": "0.7.9",
3
+ "version": "0.7.10",
4
4
  "description": "Cloud Access Broker — MCP server that mints scoped, TTL-bounded cloud credentials per agent task. Ships AWS support (aws_request_access, aws_poll_grant, aws_release_access, aws_describe_scope, aws_preview_request, aws_get_credentials — STS AssumeRole under the hood); GCP, Azure, and Cloudflare land alongside in the same package as the broker grows.",
5
5
  "type": "module",
6
6
  "bin": {