@sota-io/mcp 1.5.0 → 1.6.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/README.md +8 -2
- package/dist/auth/token-bridge.d.ts +16 -0
- package/dist/auth/token-bridge.d.ts.map +1 -1
- package/dist/auth/token-bridge.js +49 -9
- package/dist/auth/token-bridge.js.map +1 -1
- package/dist/auth/verify-jwt.js +6 -6
- package/dist/auth/verify-jwt.js.map +1 -1
- package/dist/http-app.d.ts +27 -0
- package/dist/http-app.d.ts.map +1 -0
- package/dist/http-app.js +310 -0
- package/dist/http-app.js.map +1 -0
- package/dist/http.d.ts +3 -15
- package/dist/http.d.ts.map +1 -1
- package/dist/http.js +13 -251
- package/dist/http.js.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/archive-builder.d.ts +25 -5
- package/dist/lib/archive-builder.d.ts.map +1 -1
- package/dist/lib/archive-builder.js +105 -34
- package/dist/lib/archive-builder.js.map +1 -1
- package/dist/lib/auth-config.d.ts +37 -0
- package/dist/lib/auth-config.d.ts.map +1 -0
- package/dist/lib/auth-config.js +95 -0
- package/dist/lib/auth-config.js.map +1 -0
- package/dist/lib/hosted-guard.d.ts +26 -0
- package/dist/lib/hosted-guard.d.ts.map +1 -0
- package/dist/lib/hosted-guard.js +48 -0
- package/dist/lib/hosted-guard.js.map +1 -0
- package/dist/lib/log.d.ts +17 -0
- package/dist/lib/log.d.ts.map +1 -0
- package/dist/lib/log.js +41 -0
- package/dist/lib/log.js.map +1 -0
- package/dist/lib/version.d.ts +22 -0
- package/dist/lib/version.d.ts.map +1 -0
- package/dist/lib/version.js +36 -0
- package/dist/lib/version.js.map +1 -0
- package/dist/oauth-proxy.d.ts +31 -0
- package/dist/oauth-proxy.d.ts.map +1 -0
- package/dist/oauth-proxy.js +212 -0
- package/dist/oauth-proxy.js.map +1 -0
- package/dist/tools/create-account.d.ts.map +1 -1
- package/dist/tools/create-account.js +23 -1
- package/dist/tools/create-account.js.map +1 -1
- package/dist/tools/deploy.d.ts +11 -1
- package/dist/tools/deploy.d.ts.map +1 -1
- package/dist/tools/deploy.js +92 -74
- package/dist/tools/deploy.js.map +1 -1
- package/dist/tools/env.js +1 -1
- package/dist/tools/env.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -147,7 +147,7 @@ Edit `~/.codeium/windsurf/mcp_config.json`:
|
|
|
147
147
|
|
|
148
148
|
| Tool | Description | Parameters |
|
|
149
149
|
|------|-------------|------------|
|
|
150
|
-
| `deploy` | Deploy an app | `project_id`, `directory
|
|
150
|
+
| `deploy` | Deploy an app | `project_id`, one of `files` / `git_url` / `directory` |
|
|
151
151
|
| `get-logs` | Get build/runtime logs | `project_id`, `deployment_id?` |
|
|
152
152
|
| `set-env` | Set environment variable | `project_id`, `key`, `value` |
|
|
153
153
|
| `get-env` | List environment variables | `project_id` |
|
|
@@ -163,13 +163,19 @@ Edit `~/.codeium/windsurf/mcp_config.json`:
|
|
|
163
163
|
|
|
164
164
|
### `deploy`
|
|
165
165
|
|
|
166
|
-
Deploy an application to sota.io.
|
|
166
|
+
Deploy an application to sota.io. Builds a tar.gz archive from one source and uploads it.
|
|
167
167
|
|
|
168
168
|
| Parameter | Type | Required | Description |
|
|
169
169
|
|-----------|------|----------|-------------|
|
|
170
170
|
| `project_id` | string | Yes | Project ID to deploy to |
|
|
171
|
+
| `files` | object | No | Map of relative path to UTF-8 content (inline source) |
|
|
172
|
+
| `git_url` | string | No | Public git repository to shallow-clone with the local `git` (`git_branch` optional) |
|
|
171
173
|
| `directory` | string | No | Directory to deploy (defaults to current working directory) |
|
|
172
174
|
|
|
175
|
+
`.git/`, `node_modules/`, `.DS_Store` and the local/secret env files `.env`, `.env.local`, `.env.*.local` and `.envrc` (any depth, any case) are never archived; set runtime secrets with `set-env`. Committed variants such as `.env.production`, `.env.development`, `.env.test` and `.env.example` are kept, because builds do not see `set-env` values (e.g. `NEXT_PUBLIC_*`).
|
|
176
|
+
|
|
177
|
+
The hosted server (`https://mcp.sota.io/mcp`) accepts `files` only: it has no access to your filesystem, and it rejects `directory` and `git_url`. Use this local server or `sota deploy` for those.
|
|
178
|
+
|
|
173
179
|
```
|
|
174
180
|
"Deploy my app in the current directory to sota.io"
|
|
175
181
|
```
|
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TLS settings for the pg pool from DATABASE_URL.
|
|
3
|
+
*
|
|
4
|
+
* - `sslmode=verify-full&sslrootcert=<file>` (the self-hosted platform DB,
|
|
5
|
+
* GDPR-3): the server certificate must chain to <file> and name the URL's
|
|
6
|
+
* host (an IP address is checked against the certificate's IP SANs; pg
|
|
7
|
+
* itself sends no SNI for an IP, so the check is done here explicitly).
|
|
8
|
+
* - anything else (the Supabase pooler, whose CA chain pg cannot verify by
|
|
9
|
+
* default): encrypted, not verified, as before.
|
|
10
|
+
* Both parameters are removed from the connection string: the ssl object is
|
|
11
|
+
* the only TLS input pg gets.
|
|
12
|
+
*/
|
|
13
|
+
export declare function poolTls(url: string, readFile?: (p: string) => string): {
|
|
14
|
+
connectionString: string;
|
|
15
|
+
ssl: Record<string, unknown>;
|
|
16
|
+
};
|
|
1
17
|
export interface BridgeResult {
|
|
2
18
|
/** The sota_xxx key plaintext to forward to sota-api on this request */
|
|
3
19
|
apiKey: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token-bridge.d.ts","sourceRoot":"","sources":["../../src/auth/token-bridge.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"token-bridge.d.ts","sourceRoot":"","sources":["../../src/auth/token-bridge.ts"],"names":[],"mappings":"AA6CA;;;;;;;;;;;GAWG;AACH,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,GAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAA0C,GAAG;IACzG,gBAAgB,EAAE,MAAM,CAAC;IACzB,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC9B,CAsBA;AAoDD,MAAM,WAAW,YAAY;IAC3B,wEAAwE;IACxE,MAAM,EAAE,MAAM,CAAC;IACf,2EAA2E;IAC3E,OAAO,EAAE,OAAO,CAAC;IACjB,yFAAyF;IACzF,OAAO,EAAE,OAAO,CAAC;CAClB;AAED;;;;;;;;GAQG;AACH,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,YAAY,CAAC,CAyBvB;AAED;;;;;;;GAOG;AACH,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,YAAY,CAAC,CAqCvB"}
|
|
@@ -36,28 +36,64 @@
|
|
|
36
36
|
* key is current.
|
|
37
37
|
*/
|
|
38
38
|
import crypto from "node:crypto";
|
|
39
|
+
import fs from "node:fs";
|
|
40
|
+
import tls from "node:tls";
|
|
39
41
|
import { Pool } from "pg";
|
|
42
|
+
import { errorMessage, logEvent } from "../lib/log.js";
|
|
40
43
|
const DATABASE_URL = process.env.DATABASE_URL ?? "";
|
|
44
|
+
/**
|
|
45
|
+
* TLS settings for the pg pool from DATABASE_URL.
|
|
46
|
+
*
|
|
47
|
+
* - `sslmode=verify-full&sslrootcert=<file>` (the self-hosted platform DB,
|
|
48
|
+
* GDPR-3): the server certificate must chain to <file> and name the URL's
|
|
49
|
+
* host (an IP address is checked against the certificate's IP SANs; pg
|
|
50
|
+
* itself sends no SNI for an IP, so the check is done here explicitly).
|
|
51
|
+
* - anything else (the Supabase pooler, whose CA chain pg cannot verify by
|
|
52
|
+
* default): encrypted, not verified, as before.
|
|
53
|
+
* Both parameters are removed from the connection string: the ssl object is
|
|
54
|
+
* the only TLS input pg gets.
|
|
55
|
+
*/
|
|
56
|
+
export function poolTls(url, readFile = (p) => fs.readFileSync(p, "utf8")) {
|
|
57
|
+
const permissive = { rejectUnauthorized: false, require: true };
|
|
58
|
+
let u;
|
|
59
|
+
try {
|
|
60
|
+
u = new URL(url);
|
|
61
|
+
}
|
|
62
|
+
catch {
|
|
63
|
+
return { connectionString: url.replace(/[?&]sslmode=[^&]*/i, ""), ssl: permissive };
|
|
64
|
+
}
|
|
65
|
+
const mode = u.searchParams.get("sslmode");
|
|
66
|
+
const rootcert = u.searchParams.get("sslrootcert");
|
|
67
|
+
u.searchParams.delete("sslmode");
|
|
68
|
+
u.searchParams.delete("sslrootcert");
|
|
69
|
+
const connectionString = u.toString();
|
|
70
|
+
if (mode === "verify-full" || mode === "verify-ca") {
|
|
71
|
+
if (!rootcert)
|
|
72
|
+
throw new Error(`DATABASE_URL: sslmode=${mode} needs sslrootcert=<file>`);
|
|
73
|
+
const host = u.hostname.replace(/^\[|\]$/g, "");
|
|
74
|
+
const ssl = { ca: readFile(rootcert), rejectUnauthorized: true };
|
|
75
|
+
ssl.checkServerIdentity =
|
|
76
|
+
mode === "verify-full" ? (_h, cert) => tls.checkServerIdentity(host, cert) : () => undefined;
|
|
77
|
+
return { connectionString, ssl };
|
|
78
|
+
}
|
|
79
|
+
return { connectionString, ssl: permissive };
|
|
80
|
+
}
|
|
41
81
|
let pool = null;
|
|
42
82
|
function getPool() {
|
|
43
83
|
if (!pool) {
|
|
44
84
|
if (!DATABASE_URL) {
|
|
45
85
|
throw new Error("DATABASE_URL not configured — sota-mcp cannot bridge tokens to API keys");
|
|
46
86
|
}
|
|
47
|
-
|
|
48
|
-
// ?sslmode= from the URL and force a permissive TLS config explicitly,
|
|
49
|
-
// matching what the rest of the sota.io stack does.
|
|
50
|
-
const cleanUrl = DATABASE_URL.replace(/[?&]sslmode=[^&]*/i, "");
|
|
87
|
+
const { connectionString, ssl } = poolTls(DATABASE_URL);
|
|
51
88
|
pool = new Pool({
|
|
52
|
-
connectionString
|
|
89
|
+
connectionString,
|
|
53
90
|
max: 5,
|
|
54
91
|
idleTimeoutMillis: 30_000,
|
|
55
|
-
ssl:
|
|
92
|
+
ssl: ssl,
|
|
56
93
|
});
|
|
57
94
|
pool.on("error", (err) => {
|
|
58
95
|
// Best-effort logging; pool keeps working across single-conn errors
|
|
59
|
-
|
|
60
|
-
console.error("pg pool error:", err.message);
|
|
96
|
+
logEvent("error", { event: "pg_pool_error", error_message: errorMessage(err) });
|
|
61
97
|
});
|
|
62
98
|
}
|
|
63
99
|
return pool;
|
|
@@ -98,7 +134,11 @@ function generateKey() {
|
|
|
98
134
|
export async function provisionPlanAndKey(userId) {
|
|
99
135
|
const client = await getPool().connect();
|
|
100
136
|
try {
|
|
101
|
-
// Free-tier defaults (mirrors
|
|
137
|
+
// Free-tier defaults (mirrors the free row of the API's plans catalog,
|
|
138
|
+
// migration 039 / model.DefaultPlans).
|
|
139
|
+
// TODO(BILL-3 PR 3 / MCP-2): this insert goes away when the bridge stops
|
|
140
|
+
// writing plans; until then a change of the free row's limits must be
|
|
141
|
+
// mirrored here.
|
|
102
142
|
await client.query(`INSERT INTO user_plans (
|
|
103
143
|
user_id, plan, max_projects, max_memory_mb, max_cpu_millicores,
|
|
104
144
|
max_databases, max_custom_domains, max_builds_per_day,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token-bridge.js","sourceRoot":"","sources":["../../src/auth/token-bridge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"token-bridge.js","sourceRoot":"","sources":["../../src/auth/token-bridge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,GAAG,MAAM,UAAU,CAAC;AAC3B,OAAO,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAC1B,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,e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E,MAAM,MAAM,CAAC,KAAK,CAChB;;qBAEe,EACf,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,MAAM,CAAC,CACpC,CAAC;QACF,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;QAC5B,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAC9D,CAAC;YAAS,CAAC;QACT,MAAM,CAAC,OAAO,EAAE,CAAC;IACnB,CAAC;AACH,CAAC"}
|
package/dist/auth/verify-jwt.js
CHANGED
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
* Acceptance criteria for a valid token (RFC 8707 audience binding partially):
|
|
9
9
|
* - signature verifies with the configured HS256 secret
|
|
10
10
|
* - exp not in the past, nbf not in the future
|
|
11
|
-
* - iss
|
|
12
|
-
*
|
|
11
|
+
* - iss is one of the accepted issuers (env SUPABASE_JWT_ISSUERS + the
|
|
12
|
+
* AUTH_SERVER upstream; default: we accept BOTH the project-ref URL and the custom-domain URL — Supabase
|
|
13
13
|
* Custom Domain doesn't rewrite the iss claim in May 2026, see Phase 56
|
|
14
14
|
* SUMMARY.md "Caveats" section)
|
|
15
15
|
* - sub is a non-empty UUID-shaped string
|
|
@@ -21,11 +21,11 @@
|
|
|
21
21
|
* block every incoming token)
|
|
22
22
|
*/
|
|
23
23
|
import { jwtVerify, errors as joseErrors } from "jose";
|
|
24
|
+
import { resolveAcceptedIssuers } from "../lib/auth-config.js";
|
|
24
25
|
const SUPABASE_JWT_SECRET = process.env.SUPABASE_JWT_SECRET ?? "";
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
];
|
|
26
|
+
// SUPABASE_JWT_ISSUERS (default: the two prod issuers) plus the AUTH_SERVER
|
|
27
|
+
// upstream; see lib/auth-config.ts. Invalid values throw = fail at startup.
|
|
28
|
+
const ACCEPTED_ISSUERS = resolveAcceptedIssuers();
|
|
29
29
|
if (!SUPABASE_JWT_SECRET) {
|
|
30
30
|
// Server still boots, but every incoming token will fail validation.
|
|
31
31
|
// This keeps health checks alive while signalling a missing config.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verify-jwt.js","sourceRoot":"","sources":["../../src/auth/verify-jwt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"verify-jwt.js","sourceRoot":"","sources":["../../src/auth/verify-jwt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,MAAM,CAAC;AACvD,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAE/D,MAAM,mBAAmB,GAAG,OAAO,CAAC,GAAG,CAAC,mBAAmB,IAAI,EAAE,CAAC;AAClE,4EAA4E;AAC5E,4EAA4E;AAC5E,MAAM,gBAAgB,GAAG,sBAAsB,EAAE,CAAC;AAElD,IAAI,CAAC,mBAAmB,EAAE,CAAC;IACzB,qEAAqE;IACrE,oEAAoE;IACpE,sCAAsC;IACtC,OAAO,CAAC,IAAI,CACV,6EAA6E,CAC9E,CAAC;AACJ,CAAC;AAED,MAAM,SAAS,GAAG,mBAAmB;IACnC,CAAC,CAAC,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,mBAAmB,CAAC;IAC/C,CAAC,CAAC,IAAI,CAAC;AAUT,MAAM,OAAO,oBAAqB,SAAQ,KAAK;IACA;IAA7C,YAAY,OAAe,EAAkB,IAAY;QACvD,KAAK,CAAC,OAAO,CAAC,CAAC;QAD4B,SAAI,GAAJ,IAAI,CAAQ;IAEzD,CAAC;CACF;AAED,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,QAAgB;IA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,EAAE,CAAC;YACzC,MAAM,IAAI,oBAAoB,CAAC,eAAe,EAAE,eAAe,CAAC,CAAC;QACnE,CAAC;QACD,IAAI,GAAG,YAAY,UAAU,CAAC,UAAU,EAAE,CAAC;YACzC,MAAM,IAAI,oBAAoB,CAAC,eAAe,EAAE,eAAe,CAAC,CAAC;QACnE,CAAC;QACD,IAAI,GAAG,YAAY,UAAU,CAAC,8BAA8B,EAAE,CAAC;YAC7D,MAAM,IAAI,oBAAoB,CAC5B,uBAAuB,EACvB,mBAAmB,CACpB,CAAC;QACJ,CAAC;QACD,MAAM,IAAI,oBAAoB,CAC5B,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAChD,SAAS,CACV,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* sota.io MCP Server — HTTP Transport (remote)
|
|
3
|
+
*
|
|
4
|
+
* Streamable HTTP variant of the existing stdio MCP server, exposed via
|
|
5
|
+
* mcp.sota.io/mcp for one-click installation from Claude Desktop and
|
|
6
|
+
* Claude.ai. The entry point is http.ts; this module builds the Express app
|
|
7
|
+
* so tests can run it on an ephemeral port.
|
|
8
|
+
*
|
|
9
|
+
* Hosted differences from stdio (MCP-1): `deploy` accepts inline `files`
|
|
10
|
+
* only (no `directory`, no `git_url`), enforced by the tool schema, by
|
|
11
|
+
* hostedDeployRejection() before any tool runs and by the tool itself. Logs
|
|
12
|
+
* carry user ids, never emails.
|
|
13
|
+
*
|
|
14
|
+
* Phase 57-01 (this file): scaffold + transport + RFC 9728 metadata.
|
|
15
|
+
* Auth is currently a pass-through Bearer API key — clients send their
|
|
16
|
+
* existing sota_xxx key as `Authorization: Bearer <key>` and it gets
|
|
17
|
+
* forwarded to sota-api. No OAuth validation yet.
|
|
18
|
+
*
|
|
19
|
+
* Phase 57-02 (next): OAuth 2.1 + JWT validation against Supabase JWKS,
|
|
20
|
+
* token-to-API-key bridge with `source=claude` audit tagging.
|
|
21
|
+
*
|
|
22
|
+
* Phase 57-03 (next): `create_account` tool for net-new user signup from
|
|
23
|
+
* inside Claude + plan-based capability gating.
|
|
24
|
+
*/
|
|
25
|
+
export declare const PUBLIC_ORIGIN: string;
|
|
26
|
+
export declare const app: import("express-serve-static-core").Express;
|
|
27
|
+
//# sourceMappingURL=http-app.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-app.d.ts","sourceRoot":"","sources":["../src/http-app.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAgDH,eAAO,MAAM,aAAa,QAAqD,CAAC;AAKhF,eAAO,MAAM,GAAG,6CAAY,CAAC"}
|
package/dist/http-app.js
ADDED
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* sota.io MCP Server — HTTP Transport (remote)
|
|
3
|
+
*
|
|
4
|
+
* Streamable HTTP variant of the existing stdio MCP server, exposed via
|
|
5
|
+
* mcp.sota.io/mcp for one-click installation from Claude Desktop and
|
|
6
|
+
* Claude.ai. The entry point is http.ts; this module builds the Express app
|
|
7
|
+
* so tests can run it on an ephemeral port.
|
|
8
|
+
*
|
|
9
|
+
* Hosted differences from stdio (MCP-1): `deploy` accepts inline `files`
|
|
10
|
+
* only (no `directory`, no `git_url`), enforced by the tool schema, by
|
|
11
|
+
* hostedDeployRejection() before any tool runs and by the tool itself. Logs
|
|
12
|
+
* carry user ids, never emails.
|
|
13
|
+
*
|
|
14
|
+
* Phase 57-01 (this file): scaffold + transport + RFC 9728 metadata.
|
|
15
|
+
* Auth is currently a pass-through Bearer API key — clients send their
|
|
16
|
+
* existing sota_xxx key as `Authorization: Bearer <key>` and it gets
|
|
17
|
+
* forwarded to sota-api. No OAuth validation yet.
|
|
18
|
+
*
|
|
19
|
+
* Phase 57-02 (next): OAuth 2.1 + JWT validation against Supabase JWKS,
|
|
20
|
+
* token-to-API-key bridge with `source=claude` audit tagging.
|
|
21
|
+
*
|
|
22
|
+
* Phase 57-03 (next): `create_account` tool for net-new user signup from
|
|
23
|
+
* inside Claude + plan-based capability gating.
|
|
24
|
+
*/
|
|
25
|
+
import crypto from 'node:crypto';
|
|
26
|
+
import express from 'express';
|
|
27
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
28
|
+
import { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js';
|
|
29
|
+
import { SotaClient } from '@sota-io/sdk';
|
|
30
|
+
import { registerProjectTools } from './tools/projects.js';
|
|
31
|
+
import { registerDeployTool } from './tools/deploy.js';
|
|
32
|
+
import { registerLogsTool } from './tools/logs.js';
|
|
33
|
+
import { registerEnvTools } from './tools/env.js';
|
|
34
|
+
import { registerRollbackTool } from './tools/rollback.js';
|
|
35
|
+
import { registerStatusTool } from './tools/status.js';
|
|
36
|
+
import { registerDomainTools } from './tools/domains.js';
|
|
37
|
+
import { verifyJwt, JwtVerificationError } from './auth/verify-jwt.js';
|
|
38
|
+
import { getOrProvisionApiKey } from './auth/token-bridge.js';
|
|
39
|
+
import { registerCreateAccountTool } from './tools/create-account.js';
|
|
40
|
+
import { mountOAuthProxy } from './oauth-proxy.js';
|
|
41
|
+
import { hostedDeployRejection } from './lib/hosted-guard.js';
|
|
42
|
+
import { errorMessage, logEvent } from './lib/log.js';
|
|
43
|
+
import { BUILD_TIME, GIT_SHA, PACKAGE_VERSION } from './lib/version.js';
|
|
44
|
+
// Tools that may be invoked WITHOUT authentication. Currently only
|
|
45
|
+
// create_account — net-new users obviously don't have an API key yet.
|
|
46
|
+
// Discovery requests (initialize, tools/list) are also allowed
|
|
47
|
+
// unauthenticated so Claude can fetch capabilities before OAuth.
|
|
48
|
+
const UNAUTHENTICATED_TOOLS = new Set(['create_account']);
|
|
49
|
+
// MCP handshake + tools/list are reachable without auth so Claude.ai's
|
|
50
|
+
// connector UI can render the tool catalogue (it shows "Konnektor hat keine
|
|
51
|
+
// Tools verfügbar" otherwise — a dead-end state for the user). The
|
|
52
|
+
// per-tool-call 401 + WWW-Authenticate is the actual OAuth trigger.
|
|
53
|
+
const UNAUTHENTICATED_METHODS = new Set(['initialize', 'notifications/initialized', 'tools/list']);
|
|
54
|
+
function isUnauthenticatedAllowed(body) {
|
|
55
|
+
if (!body || typeof body !== 'object')
|
|
56
|
+
return false;
|
|
57
|
+
const b = body;
|
|
58
|
+
const method = typeof b.method === 'string' ? b.method : '';
|
|
59
|
+
if (UNAUTHENTICATED_METHODS.has(method))
|
|
60
|
+
return true;
|
|
61
|
+
if (method === 'tools/call') {
|
|
62
|
+
const params = (b.params ?? {});
|
|
63
|
+
const name = typeof params.name === 'string' ? params.name : '';
|
|
64
|
+
return UNAUTHENTICATED_TOOLS.has(name);
|
|
65
|
+
}
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
const SOTA_API_URL = process.env.SOTA_API_URL ?? 'https://api.sota.io';
|
|
69
|
+
export const PUBLIC_ORIGIN = process.env.PUBLIC_ORIGIN ?? 'https://mcp.sota.io';
|
|
70
|
+
// Always the version of the running package (package.json), never an env
|
|
71
|
+
// override: /health must say which code is deployed.
|
|
72
|
+
const VERSION = PACKAGE_VERSION;
|
|
73
|
+
export const app = express();
|
|
74
|
+
app.use(express.json({ limit: '4mb' }));
|
|
75
|
+
// Required for the /auth/v1/oauth/token proxy passthrough — Supabase's
|
|
76
|
+
// token endpoint expects application/x-www-form-urlencoded bodies.
|
|
77
|
+
app.use(express.urlencoded({ extended: true, limit: '64kb' }));
|
|
78
|
+
// Phase-65/Pattern-A precursor: transparent reverse proxy in front of
|
|
79
|
+
// Supabase OAuth Server that strips the `openid` scope before forwarding.
|
|
80
|
+
// Activated regardless of metadata-advertised scopes — see oauth-proxy.ts.
|
|
81
|
+
mountOAuthProxy(app, PUBLIC_ORIGIN);
|
|
82
|
+
// ───────────────────────────────────────────────────────────────────────────
|
|
83
|
+
// /health — Traefik / Docker healthcheck target
|
|
84
|
+
// ───────────────────────────────────────────────────────────────────────────
|
|
85
|
+
app.get('/health', (_req, res) => {
|
|
86
|
+
res.json({
|
|
87
|
+
ok: true,
|
|
88
|
+
service: 'sota-mcp',
|
|
89
|
+
version: VERSION,
|
|
90
|
+
// DEVX-4: which commit this image was built from ("unknown" without the
|
|
91
|
+
// GIT_SHA/BUILD_TIME build args). `version` stays the package version.
|
|
92
|
+
commit: GIT_SHA,
|
|
93
|
+
built_at: BUILD_TIME,
|
|
94
|
+
transport: 'streamable-http',
|
|
95
|
+
ts: new Date().toISOString(),
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
// ───────────────────────────────────────────────────────────────────────────
|
|
99
|
+
// RFC 9728 Protected Resource Metadata
|
|
100
|
+
// ───────────────────────────────────────────────────────────────────────────
|
|
101
|
+
// MCP clients fetch this BEFORE attempting auth. It points them at the
|
|
102
|
+
// Authorization Server (Supabase) and declares the audience binding.
|
|
103
|
+
// Spec: https://datatracker.ietf.org/doc/html/rfc9728
|
|
104
|
+
// MCP requirement: https://modelcontextprotocol.io/specification/2025-06-18/basic/authorization
|
|
105
|
+
app.get('/.well-known/oauth-protected-resource', (_req, res) => {
|
|
106
|
+
res.json({
|
|
107
|
+
resource: PUBLIC_ORIGIN,
|
|
108
|
+
// Point clients at OUR proxy instead of auth.sota.io directly. The
|
|
109
|
+
// proxy strips `openid` from /authorize requests so Supabase never
|
|
110
|
+
// sees it — works around the Supabase OAuth Server 500 bug regardless
|
|
111
|
+
// of whether the client respects scopes_supported. The token is still
|
|
112
|
+
// signed by Supabase (we don't mint our own) so existing JWT
|
|
113
|
+
// validation against the Supabase issuer keeps working.
|
|
114
|
+
authorization_servers: [`${PUBLIC_ORIGIN}/auth/v1`],
|
|
115
|
+
bearer_methods_supported: ['header'],
|
|
116
|
+
resource_documentation: 'https://sota.io/docs/integrations/claude',
|
|
117
|
+
// 'openid' deliberately omitted: Supabase OAuth Server (May 2026)
|
|
118
|
+
// returns a 500 "Error generating ID token" on /oauth/token when the
|
|
119
|
+
// openid scope is requested. Without openid we get a working access
|
|
120
|
+
// token (HS256-signed JWT, iss=supabase, aud=authenticated) and the
|
|
121
|
+
// MCP flow completes end-to-end. Re-add openid once Supabase fixes
|
|
122
|
+
// their OIDC implementation; for now, identity claims (email, sub)
|
|
123
|
+
// ride along on the access token without an explicit ID token.
|
|
124
|
+
scopes_supported: ['profile', 'email'],
|
|
125
|
+
resource_signing_alg_values_supported: ['RS256', 'ES256'],
|
|
126
|
+
});
|
|
127
|
+
});
|
|
128
|
+
// ───────────────────────────────────────────────────────────────────────────
|
|
129
|
+
// /mcp — Streamable HTTP transport endpoint
|
|
130
|
+
// ───────────────────────────────────────────────────────────────────────────
|
|
131
|
+
// Stateless mode: every request gets a fresh McpServer + transport instance.
|
|
132
|
+
// Adequate for low-traffic; revisit if we see > 100 RPS sustained.
|
|
133
|
+
function unauthorized(res, reason, detail) {
|
|
134
|
+
res
|
|
135
|
+
.status(401)
|
|
136
|
+
.header('WWW-Authenticate', `Bearer realm="${PUBLIC_ORIGIN}", error="${reason}", resource_metadata="${PUBLIC_ORIGIN}/.well-known/oauth-protected-resource"`)
|
|
137
|
+
.json({ error: 'unauthorized', reason, detail });
|
|
138
|
+
}
|
|
139
|
+
async function handleMcpRequest(req, res) {
|
|
140
|
+
// ── MCP-1: the hosted deploy tool never takes directory / git_url ──
|
|
141
|
+
// Checked before auth and before the SDK parses the call, so no tool code
|
|
142
|
+
// runs for such a request whatever the token or the SDK's argument
|
|
143
|
+
// handling. JSON-RPC "invalid params" in an HTTP 400.
|
|
144
|
+
const rejection = hostedDeployRejection(req.body);
|
|
145
|
+
if (rejection) {
|
|
146
|
+
logEvent('warn', { event: 'hosted_deploy_mode_rejected', request_id: crypto.randomUUID() });
|
|
147
|
+
res.status(400).json({
|
|
148
|
+
jsonrpc: '2.0',
|
|
149
|
+
error: { code: -32602, message: rejection.message },
|
|
150
|
+
id: rejection.id,
|
|
151
|
+
});
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
// ── 57-02 Auth: OAuth JWT validation + token-to-key bridge ──
|
|
155
|
+
// Accept Bearer <jwt> (Claude/MCP path) OR Bearer <sota_xxx> (testing/CLI path).
|
|
156
|
+
// sota_-prefixed tokens skip JWT validation and pass through directly.
|
|
157
|
+
const authHeader = req.headers.authorization ?? '';
|
|
158
|
+
const rawToken = authHeader.startsWith('Bearer ')
|
|
159
|
+
? authHeader.slice('Bearer '.length).trim()
|
|
160
|
+
: '';
|
|
161
|
+
const startedAt = Date.now();
|
|
162
|
+
const auditMeta = {
|
|
163
|
+
request_id: crypto.randomUUID(),
|
|
164
|
+
started_at: new Date(startedAt).toISOString(),
|
|
165
|
+
};
|
|
166
|
+
// Anonymous path for discovery + create_account. The MCP server is still
|
|
167
|
+
// constructed, but with a "phantom" apiKey that never reaches sota-api
|
|
168
|
+
// (only the create_account tool is registered and it doesn't use SotaClient).
|
|
169
|
+
let apiKey = '';
|
|
170
|
+
const allowAnonymous = !rawToken && isUnauthenticatedAllowed(req.body);
|
|
171
|
+
if (!rawToken && !allowAnonymous) {
|
|
172
|
+
unauthorized(res, 'missing_token', 'Pass Authorization: Bearer <jwt>');
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
if (allowAnonymous) {
|
|
176
|
+
auditMeta.auth_path = 'anonymous';
|
|
177
|
+
apiKey = 'anonymous';
|
|
178
|
+
}
|
|
179
|
+
else if (rawToken.startsWith('sota_')) {
|
|
180
|
+
// Direct API-key path — legacy testing + CLI use, no OAuth involved.
|
|
181
|
+
apiKey = rawToken;
|
|
182
|
+
auditMeta.auth_path = 'direct_api_key';
|
|
183
|
+
auditMeta.key_prefix = rawToken.slice(0, 13);
|
|
184
|
+
}
|
|
185
|
+
else {
|
|
186
|
+
// JWT path — Claude OAuth
|
|
187
|
+
try {
|
|
188
|
+
const claims = await verifyJwt(rawToken);
|
|
189
|
+
auditMeta.auth_path = 'jwt';
|
|
190
|
+
auditMeta.user_id = claims.sub;
|
|
191
|
+
auditMeta.iss = claims.iss;
|
|
192
|
+
const bridge = await getOrProvisionApiKey(claims.sub);
|
|
193
|
+
apiKey = bridge.apiKey;
|
|
194
|
+
auditMeta.key_provisioned = bridge.created;
|
|
195
|
+
auditMeta.key_rotated = bridge.rotated;
|
|
196
|
+
}
|
|
197
|
+
catch (err) {
|
|
198
|
+
if (err instanceof JwtVerificationError) {
|
|
199
|
+
logEvent('info', {
|
|
200
|
+
...auditMeta,
|
|
201
|
+
event: 'auth_failed',
|
|
202
|
+
error_code: err.code,
|
|
203
|
+
error_message: errorMessage(err),
|
|
204
|
+
});
|
|
205
|
+
unauthorized(res, err.code, err.message);
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
// Database / network problem during bridge — surface as 503, not 401
|
|
209
|
+
logEvent('error', {
|
|
210
|
+
...auditMeta,
|
|
211
|
+
event: 'bridge_error',
|
|
212
|
+
error_message: errorMessage(err),
|
|
213
|
+
});
|
|
214
|
+
res.status(503).json({
|
|
215
|
+
error: 'bridge_unavailable',
|
|
216
|
+
message: 'Could not provision an API key for this Claude session — try again in a moment.',
|
|
217
|
+
});
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
// Build a fresh MCP server per request (stateless mode).
|
|
222
|
+
const server = new McpServer({
|
|
223
|
+
name: 'sota',
|
|
224
|
+
version: VERSION,
|
|
225
|
+
title: 'sota.io',
|
|
226
|
+
});
|
|
227
|
+
// ALL tools are always registered so they show up in tools/list, regardless
|
|
228
|
+
// of whether the current request is authenticated. Why: when a client like
|
|
229
|
+
// Claude.ai discovers an MCP connector, it asks tools/list once. If we hide
|
|
230
|
+
// the 13 authenticated tools from that listing, the LLM only sees
|
|
231
|
+
// create_account and never tries to call deploy/list-projects/etc — which
|
|
232
|
+
// means the per-tool 401 → OAuth-redirect dance never triggers. The user
|
|
233
|
+
// is then stuck with one tool and no way to elevate.
|
|
234
|
+
//
|
|
235
|
+
// With all tools registered, the LLM sees the full catalog. When the user
|
|
236
|
+
// asks for any non-create_account tool, the tools/call middleware (above)
|
|
237
|
+
// returns 401 with WWW-Authenticate — that's the signal Claude.ai needs to
|
|
238
|
+
// open the OAuth popup. After OAuth completes, the retry has a valid token
|
|
239
|
+
// and the tool runs against api.sota.io with the user's real key.
|
|
240
|
+
//
|
|
241
|
+
// The phantom apiKey "anonymous" passed to SotaClient never actually hits
|
|
242
|
+
// api.sota.io because the middleware rejects unauthenticated tools/call
|
|
243
|
+
// for non-create_account before reaching the handler.
|
|
244
|
+
registerCreateAccountTool(server);
|
|
245
|
+
const client = new SotaClient({ apiKey: apiKey || 'anonymous', baseUrl: SOTA_API_URL });
|
|
246
|
+
registerProjectTools(server, client);
|
|
247
|
+
registerDeployTool(server, client, { hosted: true });
|
|
248
|
+
registerLogsTool(server, client);
|
|
249
|
+
registerEnvTools(server, client);
|
|
250
|
+
registerRollbackTool(server, client);
|
|
251
|
+
registerStatusTool(server, client);
|
|
252
|
+
registerDomainTools(server, client);
|
|
253
|
+
// Stateless transport — no session header required.
|
|
254
|
+
const transport = new StreamableHTTPServerTransport({
|
|
255
|
+
sessionIdGenerator: undefined,
|
|
256
|
+
});
|
|
257
|
+
res.on('close', () => {
|
|
258
|
+
transport.close().catch(() => { });
|
|
259
|
+
server.close().catch(() => { });
|
|
260
|
+
});
|
|
261
|
+
try {
|
|
262
|
+
await server.connect(transport);
|
|
263
|
+
await transport.handleRequest(req, res, req.body);
|
|
264
|
+
// Structured audit log per request: user id (JWT sub), never the email.
|
|
265
|
+
logEvent('info', {
|
|
266
|
+
...auditMeta,
|
|
267
|
+
event: 'mcp_request',
|
|
268
|
+
method: req.body?.method,
|
|
269
|
+
duration_ms: Date.now() - startedAt,
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
catch (err) {
|
|
273
|
+
logEvent('error', {
|
|
274
|
+
...auditMeta,
|
|
275
|
+
event: 'mcp_error',
|
|
276
|
+
error_message: errorMessage(err),
|
|
277
|
+
duration_ms: Date.now() - startedAt,
|
|
278
|
+
});
|
|
279
|
+
if (!res.headersSent) {
|
|
280
|
+
res.status(500).json({
|
|
281
|
+
jsonrpc: '2.0',
|
|
282
|
+
error: { code: -32603, message: err instanceof Error ? err.message : String(err) },
|
|
283
|
+
id: null,
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
app.post('/mcp', handleMcpRequest);
|
|
289
|
+
app.get('/mcp', (_req, res) => {
|
|
290
|
+
// GET on /mcp without an active session = 405 Method Not Allowed.
|
|
291
|
+
// (Stateful mode would use GET for the SSE response stream; we're stateless.)
|
|
292
|
+
res.status(405).json({ error: 'method_not_allowed', allowed: 'POST' });
|
|
293
|
+
});
|
|
294
|
+
// ───────────────────────────────────────────────────────────────────────────
|
|
295
|
+
// Root index for humans hitting mcp.sota.io directly
|
|
296
|
+
// ───────────────────────────────────────────────────────────────────────────
|
|
297
|
+
app.get('/', (_req, res) => {
|
|
298
|
+
res.json({
|
|
299
|
+
service: 'sota-mcp',
|
|
300
|
+
version: VERSION,
|
|
301
|
+
description: 'MCP server for sota.io — EU-native PaaS. Use the Streamable HTTP transport at /mcp.',
|
|
302
|
+
docs: 'https://sota.io/docs/integrations/claude',
|
|
303
|
+
endpoints: {
|
|
304
|
+
health: `${PUBLIC_ORIGIN}/health`,
|
|
305
|
+
mcp: `${PUBLIC_ORIGIN}/mcp`,
|
|
306
|
+
protected_resource_metadata: `${PUBLIC_ORIGIN}/.well-known/oauth-protected-resource`,
|
|
307
|
+
},
|
|
308
|
+
});
|
|
309
|
+
});
|
|
310
|
+
//# sourceMappingURL=http-app.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-app.js","sourceRoot":"","sources":["../src/http-app.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,OAAO,MAAM,SAA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AAG,aAAa,SAAS;YACjC,GAAG,EAAE,GAAG,aAAa,MAAM;YAC3B,2BAA2B,EAAE,GAAG,aAAa,uCAAuC;SACrF;KACF,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/dist/http.d.ts
CHANGED
|
@@ -1,21 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
* sota.io MCP Server — HTTP
|
|
3
|
+
* sota.io MCP Server — HTTP entry point (mcp.sota.io).
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* and Claude.ai.
|
|
8
|
-
*
|
|
9
|
-
* Phase 57-01 (this file): scaffold + transport + RFC 9728 metadata.
|
|
10
|
-
* Auth is currently a pass-through Bearer API key — clients send their
|
|
11
|
-
* existing sota_xxx key as `Authorization: Bearer <key>` and it gets
|
|
12
|
-
* forwarded to sota-api. No OAuth validation yet.
|
|
13
|
-
*
|
|
14
|
-
* Phase 57-02 (next): OAuth 2.1 + JWT validation against Supabase JWKS,
|
|
15
|
-
* token-to-API-key bridge with `source=claude` audit tagging.
|
|
16
|
-
*
|
|
17
|
-
* Phase 57-03 (next): `create_account` tool for net-new user signup from
|
|
18
|
-
* inside Claude + plan-based capability gating.
|
|
5
|
+
* The Express app lives in http-app.ts so tests can start it on an
|
|
6
|
+
* ephemeral port; this file only binds it.
|
|
19
7
|
*/
|
|
20
8
|
export {};
|
|
21
9
|
//# sourceMappingURL=http.d.ts.map
|
package/dist/http.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":";AAEA
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":";AAEA;;;;;GAKG"}
|