@exposify/supabase 0.3.9 → 0.3.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.
- package/README.md +6 -0
- package/dist/index.cjs +10 -4
- package/dist/index.js +11 -5
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -190,6 +190,12 @@ things:
|
|
|
190
190
|
`init` never sees the key, so you set that secret yourself.
|
|
191
191
|
Until you do, every request gets a 401.
|
|
192
192
|
|
|
193
|
+
Until the project has a sign-in method (the Supabase preset in the
|
|
194
|
+
dashboard), agents use the function signed out, as `anon`, with no sign-in
|
|
195
|
+
asked: there's nothing to sign in with. The log says which it is
|
|
196
|
+
(`[agentready] How agents sign in: ...`), and adding the method takes effect
|
|
197
|
+
within a minute.
|
|
198
|
+
|
|
193
199
|
MCP clients then click Connect and sign in through the broker (or send a
|
|
194
200
|
pasted `Authorization: Bearer extb_...`). Don't give the client the JWT that
|
|
195
201
|
`POST /resolve` returns. It's the short-lived Supabase token the function
|
package/dist/index.cjs
CHANGED
|
@@ -863,13 +863,19 @@ function aiReady(options = {}) {
|
|
|
863
863
|
const brokerGate = authRequired ? (0, import_core5.createBrokerGate)(auth) : null;
|
|
864
864
|
const functionUrl = supabaseUrl && functionName ? `${supabaseUrl.replace(/\/+$/, "")}/functions/v1/${functionName}` : null;
|
|
865
865
|
return async (req) => {
|
|
866
|
+
let open = false;
|
|
866
867
|
if (brokerGate) {
|
|
867
868
|
const own = (0, import_core5.publicRequestUrl)(req.url, req.headers);
|
|
868
869
|
const isPrm = own.endsWith(PRM_SUFFIX);
|
|
869
870
|
const resource = brokerGate.resourceFor(functionUrl ?? (isPrm ? own.slice(0, -PRM_SUFFIX.length) : own));
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
871
|
+
open = await (0, import_core5.reportAppLogin)(auth, resource, null, { stacks: ["@supabase/supabase-js"], why: "Supabase Auth sign-in for agents is the Supabase preset in the dashboard's sign-in methods.", log: logReady }) === "open";
|
|
872
|
+
if (open) {
|
|
873
|
+
if (isPrm) return new Response("not found", { status: 404 });
|
|
874
|
+
} else {
|
|
875
|
+
if (isPrm) return brokerGate.metadataResponse(req.method, resource);
|
|
876
|
+
const result = await brokerGate.check(req.headers, resource, `${resource}${PRM_SUFFIX}`);
|
|
877
|
+
if (!result.ok) return result.response;
|
|
878
|
+
}
|
|
873
879
|
}
|
|
874
880
|
let resolved;
|
|
875
881
|
try {
|
|
@@ -878,7 +884,7 @@ function aiReady(options = {}) {
|
|
|
878
884
|
console.error("exposify-supabase: auth resolver failed", err);
|
|
879
885
|
return Response.json({ error: "internal MCP server error" }, { status: 503 });
|
|
880
886
|
}
|
|
881
|
-
if (authRequired && !resolved.get("authorization")) {
|
|
887
|
+
if (authRequired && !open && !resolved.get("authorization")) {
|
|
882
888
|
return Response.json({ error: "unauthorized" }, { status: 401, headers: { "www-authenticate": "Bearer" } });
|
|
883
889
|
}
|
|
884
890
|
resolvedAuth.set(req, resolved);
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/index.ts
|
|
2
|
-
import { createBrokerGate, createWebMcpHandler, formatFailed as formatFailed2, publicRequestUrl, formatWarning as formatWarning2, hostedResolverFromEnv, isHostedResolver, readEnv, startupLogEnabled } from "@exposify/core";
|
|
2
|
+
import { createBrokerGate, createWebMcpHandler, formatFailed as formatFailed2, publicRequestUrl, formatWarning as formatWarning2, hostedResolverFromEnv, isHostedResolver, readEnv, reportAppLogin, startupLogEnabled } from "@exposify/core";
|
|
3
3
|
|
|
4
4
|
// src/kb.ts
|
|
5
5
|
import { KnowledgeBase } from "@exposify/core";
|
|
@@ -829,13 +829,19 @@ function aiReady(options = {}) {
|
|
|
829
829
|
const brokerGate = authRequired ? createBrokerGate(auth) : null;
|
|
830
830
|
const functionUrl = supabaseUrl && functionName ? `${supabaseUrl.replace(/\/+$/, "")}/functions/v1/${functionName}` : null;
|
|
831
831
|
return async (req) => {
|
|
832
|
+
let open = false;
|
|
832
833
|
if (brokerGate) {
|
|
833
834
|
const own = publicRequestUrl(req.url, req.headers);
|
|
834
835
|
const isPrm = own.endsWith(PRM_SUFFIX);
|
|
835
836
|
const resource = brokerGate.resourceFor(functionUrl ?? (isPrm ? own.slice(0, -PRM_SUFFIX.length) : own));
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
837
|
+
open = await reportAppLogin(auth, resource, null, { stacks: ["@supabase/supabase-js"], why: "Supabase Auth sign-in for agents is the Supabase preset in the dashboard's sign-in methods.", log: logReady }) === "open";
|
|
838
|
+
if (open) {
|
|
839
|
+
if (isPrm) return new Response("not found", { status: 404 });
|
|
840
|
+
} else {
|
|
841
|
+
if (isPrm) return brokerGate.metadataResponse(req.method, resource);
|
|
842
|
+
const result = await brokerGate.check(req.headers, resource, `${resource}${PRM_SUFFIX}`);
|
|
843
|
+
if (!result.ok) return result.response;
|
|
844
|
+
}
|
|
839
845
|
}
|
|
840
846
|
let resolved;
|
|
841
847
|
try {
|
|
@@ -844,7 +850,7 @@ function aiReady(options = {}) {
|
|
|
844
850
|
console.error("exposify-supabase: auth resolver failed", err);
|
|
845
851
|
return Response.json({ error: "internal MCP server error" }, { status: 503 });
|
|
846
852
|
}
|
|
847
|
-
if (authRequired && !resolved.get("authorization")) {
|
|
853
|
+
if (authRequired && !open && !resolved.get("authorization")) {
|
|
848
854
|
return Response.json({ error: "unauthorized" }, { status: 401, headers: { "www-authenticate": "Bearer" } });
|
|
849
855
|
}
|
|
850
856
|
resolvedAuth.set(req, resolved);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exposify/supabase",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.10",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"prepack": "yarn build"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@exposify/core": "0.3.
|
|
30
|
+
"@exposify/core": "0.3.14",
|
|
31
31
|
"@modelcontextprotocol/sdk": "^1.12.0",
|
|
32
32
|
"zod": "^3.24.0"
|
|
33
33
|
},
|