@sota-io/mcp 1.6.0 → 1.7.1
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/CLAUDE.md +19 -4
- package/README.md +15 -2
- package/dist/auth/token-bridge.d.ts +2 -2
- package/dist/auth/token-bridge.js +4 -4
- package/dist/auth/token-bridge.js.map +1 -1
- package/dist/auth/verify-jwt.d.ts.map +1 -1
- package/dist/auth/verify-jwt.js +4 -8
- package/dist/auth/verify-jwt.js.map +1 -1
- package/dist/http-app.d.ts +5 -11
- package/dist/http-app.d.ts.map +1 -1
- package/dist/http-app.js +27 -19
- package/dist/http-app.js.map +1 -1
- package/dist/index.js +9 -3
- package/dist/index.js.map +1 -1
- package/dist/lib/account.d.ts +63 -0
- package/dist/lib/account.d.ts.map +1 -0
- package/dist/lib/account.js +64 -0
- package/dist/lib/account.js.map +1 -0
- package/dist/lib/archive-builder.d.ts +15 -1
- package/dist/lib/archive-builder.d.ts.map +1 -1
- package/dist/lib/archive-builder.js +31 -8
- package/dist/lib/archive-builder.js.map +1 -1
- package/dist/lib/auth-config.d.ts +3 -3
- package/dist/lib/auth-config.d.ts.map +1 -1
- package/dist/lib/auth-config.js +3 -4
- package/dist/lib/auth-config.js.map +1 -1
- package/dist/lib/guide.d.ts +33 -0
- package/dist/lib/guide.d.ts.map +1 -0
- package/dist/lib/guide.js +82 -0
- package/dist/lib/guide.js.map +1 -0
- package/dist/lib/ignore.d.ts +16 -0
- package/dist/lib/ignore.d.ts.map +1 -0
- package/dist/lib/ignore.js +130 -0
- package/dist/lib/ignore.js.map +1 -0
- package/dist/lib/project-url.d.ts +14 -0
- package/dist/lib/project-url.d.ts.map +1 -0
- package/dist/lib/project-url.js +16 -0
- package/dist/lib/project-url.js.map +1 -0
- package/dist/lib/version.d.ts +1 -1
- package/dist/lib/version.js +1 -1
- package/dist/oauth-proxy.d.ts +1 -1
- package/dist/oauth-proxy.js +1 -1
- package/dist/tools/account.d.ts +10 -0
- package/dist/tools/account.d.ts.map +1 -0
- package/dist/tools/account.js +104 -0
- package/dist/tools/account.js.map +1 -0
- package/dist/tools/create-account.d.ts +1 -1
- package/dist/tools/deploy.d.ts +8 -0
- package/dist/tools/deploy.d.ts.map +1 -1
- package/dist/tools/deploy.js +56 -22
- package/dist/tools/deploy.js.map +1 -1
- package/dist/tools/env.js +1 -1
- package/dist/tools/env.js.map +1 -1
- package/dist/tools/logs.js +1 -1
- package/dist/tools/logs.js.map +1 -1
- package/dist/tools/projects.d.ts +8 -1
- package/dist/tools/projects.d.ts.map +1 -1
- package/dist/tools/projects.js +13 -5
- package/dist/tools/projects.js.map +1 -1
- package/dist/tools/status.d.ts.map +1 -1
- package/dist/tools/status.js +8 -3
- package/dist/tools/status.js.map +1 -1
- package/package.json +2 -1
package/dist/lib/version.js
CHANGED
|
@@ -21,7 +21,7 @@ export function readPackageVersion() {
|
|
|
21
21
|
}
|
|
22
22
|
export const PACKAGE_VERSION = readPackageVersion();
|
|
23
23
|
/**
|
|
24
|
-
* Commit and build time of the hosted image
|
|
24
|
+
* Commit and build time of the hosted image. The Dockerfile turns
|
|
25
25
|
* the GIT_SHA and BUILD_TIME build args into environment variables of the
|
|
26
26
|
* runtime stage. Anything built without them (npm package, local checkout,
|
|
27
27
|
* a plain `docker compose build`) reports "unknown".
|
package/dist/oauth-proxy.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* oauth-proxy.ts —
|
|
2
|
+
* oauth-proxy.ts — transparent reverse proxy
|
|
3
3
|
* in front of Supabase OAuth Server that strips `openid` from the scope
|
|
4
4
|
* parameter on /authorize requests, working around the Supabase OIDC bug
|
|
5
5
|
* (HTTP 500 "Error generating ID token" — error_id 019e41f7-…).
|
package/dist/oauth-proxy.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* oauth-proxy.ts —
|
|
2
|
+
* oauth-proxy.ts — transparent reverse proxy
|
|
3
3
|
* in front of Supabase OAuth Server that strips `openid` from the scope
|
|
4
4
|
* parameter on /authorize requests, working around the Supabase OIDC bug
|
|
5
5
|
* (HTTP 500 "Error generating ID token" — error_id 019e41f7-…).
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import type { Account, AccountReader } from '../lib/account.js';
|
|
3
|
+
/** The Enterprise next steps for the human, with this account's links. */
|
|
4
|
+
export declare function enterpriseNextSteps(account: Account, appUrl?: string): string;
|
|
5
|
+
/** get-account output. */
|
|
6
|
+
export declare function renderAccount(account: Account | null): string;
|
|
7
|
+
export declare function registerAccountTool(server: McpServer, readAccount: AccountReader): void;
|
|
8
|
+
/** Static checklist prompt; needs no account and no API call. */
|
|
9
|
+
export declare function registerChecklistPrompt(server: McpServer): void;
|
|
10
|
+
//# sourceMappingURL=account.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account.d.ts","sourceRoot":"","sources":["../../src/tools/account.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAsBhE,0EAA0E;AAC1E,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAe7E;AAED,0BAA0B;AAC1B,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,GAAG,MAAM,CAwC7D;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,aAAa,QAyBhF;AAED,iEAAiE;AACjE,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,SAAS,QAoBxD"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { BUILD_CONTRACT, DOCS, ENTERPRISE_ACCESS_STEPS, ENTERPRISE_CONTRACT, bullets, enterpriseChecklist, numbered, } from '../lib/guide.js';
|
|
2
|
+
const SIGN_IN_STATE_TEXT = {
|
|
3
|
+
verified: 'verified (people can sign in)',
|
|
4
|
+
saved_untested: 'saved but not tested yet: the owner must run "Test sign-in" in the dashboard before anyone can sign in',
|
|
5
|
+
not_set_up: 'not set up: nobody can sign in until the owner sets it up in the dashboard',
|
|
6
|
+
unknown: 'unknown (could not be read right now)',
|
|
7
|
+
};
|
|
8
|
+
function mb(bytes) {
|
|
9
|
+
return `${Math.round(bytes / 1024 / 1024)} MB`;
|
|
10
|
+
}
|
|
11
|
+
/** The Enterprise next steps for the human, with this account's links. */
|
|
12
|
+
export function enterpriseNextSteps(account, appUrl) {
|
|
13
|
+
const ent = account.enterprise;
|
|
14
|
+
if (!ent)
|
|
15
|
+
return '';
|
|
16
|
+
const lines = [
|
|
17
|
+
'Next steps for the human (sota Enterprise):',
|
|
18
|
+
numbered(ENTERPRISE_ACCESS_STEPS),
|
|
19
|
+
`App URL: ${appUrl ?? `https://${ent.app_host_pattern}`}`,
|
|
20
|
+
`Users & access: ${ent.users_and_access_url}`,
|
|
21
|
+
];
|
|
22
|
+
if (ent.sign_in_state !== 'verified') {
|
|
23
|
+
lines.push(`Sign-in connection: ${SIGN_IN_STATE_TEXT[ent.sign_in_state] ?? ent.sign_in_state} (${ent.sign_in_setup_url}).`);
|
|
24
|
+
}
|
|
25
|
+
return lines.join('\n');
|
|
26
|
+
}
|
|
27
|
+
/** get-account output. */
|
|
28
|
+
export function renderAccount(account) {
|
|
29
|
+
const parts = [];
|
|
30
|
+
if (!account) {
|
|
31
|
+
parts.push('Account details are not available from this API version. Assume an ordinary account unless project URLs look like https://<app>.<label>.sota.io (then it is sota Enterprise).');
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
const p = account.plan;
|
|
35
|
+
const u = account.usage;
|
|
36
|
+
parts.push([
|
|
37
|
+
'# Account',
|
|
38
|
+
`Plan: ${p.name}`,
|
|
39
|
+
`Projects: ${u ? `${u.projects} of ${p.max_projects}` : `max ${p.max_projects}`}; databases: ${u ? `${u.databases} of ${p.max_databases}` : `max ${p.max_databases}`}`,
|
|
40
|
+
`Memory per app: ${p.max_memory_mb} MB; deploy upload: max ${mb(p.max_deploy_bytes)} (hosted connector: 200 files / 10 MB inline)`,
|
|
41
|
+
].join('\n'));
|
|
42
|
+
const ent = account.enterprise;
|
|
43
|
+
if (ent) {
|
|
44
|
+
parts.push([
|
|
45
|
+
'# sota Enterprise account',
|
|
46
|
+
`Company label: ${ent.customer_label}`,
|
|
47
|
+
`App URLs: https://${ent.app_host_pattern} (a project named "app" gets the slug "${ent.customer_label}-app")`,
|
|
48
|
+
`Apps: ${ent.apps_used ?? 'unknown'} of ${ent.app_limit}, all on the company's own server (status: ${ent.server_status || 'unknown'})`,
|
|
49
|
+
`Sign-in connection (Microsoft 365): ${SIGN_IN_STATE_TEXT[ent.sign_in_state] ?? ent.sign_in_state}`,
|
|
50
|
+
`Users & access (owner, dashboard only): ${ent.users_and_access_url}`,
|
|
51
|
+
].join('\n'));
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
parts.push('# Not an Enterprise account\nApps are public at https://<slug>.sota.io; build your own login if the app needs one.');
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
parts.push(`# Build contract (every app)\n${bullets(BUILD_CONTRACT)}`);
|
|
58
|
+
if (!account || account.enterprise) {
|
|
59
|
+
parts.push(`# Enterprise contract\n${bullets(ENTERPRISE_CONTRACT)}`);
|
|
60
|
+
parts.push(`# After the deploy: who can open the app\n${numbered(ENTERPRISE_ACCESS_STEPS)}`);
|
|
61
|
+
}
|
|
62
|
+
parts.push(`Docs: ${DOCS.buildWithAi} · identity headers ${DOCS.identity} · limits ${DOCS.limits}`);
|
|
63
|
+
return parts.join('\n\n');
|
|
64
|
+
}
|
|
65
|
+
export function registerAccountTool(server, readAccount) {
|
|
66
|
+
server.registerTool('get-account', {
|
|
67
|
+
description: 'Call this FIRST, before writing or deploying code. Returns the signed-in sota.io account: plan limits (projects, databases, memory per app, upload size), whether it is a sota Enterprise account (company label, app URL scheme https://<app>.<label>.sota.io, own server, sign-in connection status, the dashboard page where the owner grants access) and the build contract the app must follow: one container, PORT, health gate, database through PgBouncer, upload rules, and for Enterprise the identity headers, fail-closed rule, health-without-identity rule and what the human must do before anyone can open the app. Read-only.',
|
|
68
|
+
annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
69
|
+
}, async () => {
|
|
70
|
+
try {
|
|
71
|
+
const account = await readAccount();
|
|
72
|
+
return { content: [{ type: 'text', text: renderAccount(account) }] };
|
|
73
|
+
}
|
|
74
|
+
catch (error) {
|
|
75
|
+
return {
|
|
76
|
+
content: [
|
|
77
|
+
{
|
|
78
|
+
type: 'text',
|
|
79
|
+
text: `Failed to read the account: ${error instanceof Error ? error.message : String(error)}\n\n${renderAccount(null)}`,
|
|
80
|
+
},
|
|
81
|
+
],
|
|
82
|
+
isError: true,
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
/** Static checklist prompt; needs no account and no API call. */
|
|
88
|
+
export function registerChecklistPrompt(server) {
|
|
89
|
+
server.registerPrompt('enterprise-app-checklist', {
|
|
90
|
+
title: 'Enterprise app checklist',
|
|
91
|
+
description: 'The rules an app must follow to deploy and behave correctly on sota.io, including sota Enterprise (company sign-in, identity headers, health without identity, who can open the app).',
|
|
92
|
+
}, () => ({
|
|
93
|
+
messages: [
|
|
94
|
+
{
|
|
95
|
+
role: 'user',
|
|
96
|
+
content: {
|
|
97
|
+
type: 'text',
|
|
98
|
+
text: `${enterpriseChecklist()}\n\nFollow this checklist for the app we build. Call get-account first to learn this account's label and limits.`,
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
],
|
|
102
|
+
}));
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=account.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1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AAO,aAAa,CAAC,IAAI,CAAC,EAAE;qBACxH;iBACF;gBACD,OAAO,EAAE,IAAI;aACd,CAAC;QACJ,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC;AAED,iEAAiE;AACjE,MAAM,UAAU,uBAAuB,CAAC,MAAiB;IACvD,MAAM,CAAC,cAAc,CACnB,0BAA0B,EAC1B;QACE,KAAK,EAAE,0BAA0B;QACjC,WAAW,EACT,uLAAuL;KAC1L,EACD,GAAG,EAAE,CAAC,CAAC;QACL,QAAQ,EAAE;YACR;gBACE,IAAI,EAAE,MAAe;gBACrB,OAAO,EAAE;oBACP,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,GAAG,mBAAmB,EAAE,kHAAkH;iBACjJ;aACF;SACF;KACF,CAAC,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* via Claude tool calls.
|
|
12
12
|
*
|
|
13
13
|
* Why this is OK from a security perspective:
|
|
14
|
-
* - Disposable-email blocking
|
|
14
|
+
* - Disposable-email blocking filters obvious abuse
|
|
15
15
|
* - Supabase has its own per-email OTP rate limits (default 30/h)
|
|
16
16
|
* - The tool ONLY hits Supabase's public OTP endpoints + our own DB
|
|
17
17
|
* via the bridge — no sota-api access without authentication
|
package/dist/tools/deploy.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
2
|
import { SotaClient } from '@sota-io/sdk';
|
|
3
|
+
import { type AccountReader } from '../lib/account.js';
|
|
3
4
|
export interface DeployToolOptions {
|
|
4
5
|
/**
|
|
5
6
|
* true for the hosted server (mcp.sota.io): only inline `files` are
|
|
@@ -9,6 +10,13 @@ export interface DeployToolOptions {
|
|
|
9
10
|
* false (default) for the local stdio server: files, git_url, directory.
|
|
10
11
|
*/
|
|
11
12
|
hosted?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Reads GET /v1/account; when it says Enterprise, the result tells the
|
|
15
|
+
* agent what the human must do before anyone can open the app.
|
|
16
|
+
*/
|
|
17
|
+
readAccount?: AccountReader;
|
|
18
|
+
/** Bound for the account and project lookups after the upload (default 3 s). */
|
|
19
|
+
lookupTimeoutMs?: number;
|
|
12
20
|
}
|
|
13
21
|
export declare function registerDeployTool(server: McpServer, client: SotaClient, options?: DeployToolOptions): void;
|
|
14
22
|
//# sourceMappingURL=deploy.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../src/tools/deploy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEpE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../src/tools/deploy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEpE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAW1C,OAAO,EAAE,KAAK,aAAa,EAAmD,MAAM,mBAAmB,CAAC;AAIxG,MAAM,WAAW,iBAAiB;IAChC;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;OAGG;IACH,WAAW,CAAC,EAAE,aAAa,CAAC;IAC5B,gFAAgF;IAChF,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AA2DD,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,GAAE,iBAAsB,QAMxG"}
|
package/dist/tools/deploy.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import {
|
|
2
|
+
import { archiveDirectoryWithReport, archiveFromFiles, archiveFromGitUrl, ArchiveBuilderError, MAX_INLINE_FILES, MAX_INLINE_TOTAL_BYTES, MAX_CLONE_BYTES, } from '../lib/archive-builder.js';
|
|
3
3
|
import { HOSTED_FILES_ONLY_HINT } from '../lib/hosted-guard.js';
|
|
4
|
+
import { LOOKUP_TIMEOUT_MS, settleWithin, tryReadAccount } from '../lib/account.js';
|
|
5
|
+
import { projectUrl } from '../lib/project-url.js';
|
|
6
|
+
import { enterpriseNextSteps } from './account.js';
|
|
4
7
|
const INTRO = `Deploy an application to sota.io. The platform auto-detects your framework and builds a Docker image automatically:
|
|
5
8
|
|
|
6
9
|
- Next.js: Detected via next.config.js/ts. Add output: 'standalone' to next.config for optimal builds.
|
|
@@ -25,39 +28,65 @@ const LOCAL_MODES = `THREE WAYS to supply the source code — pick EXACTLY ONE:
|
|
|
25
28
|
|
|
26
29
|
3. **directory** (local filesystem):
|
|
27
30
|
Pass an absolute path. Defaults to the current working directory when
|
|
28
|
-
no other mode is given
|
|
31
|
+
no other mode is given. A .sotaignore in that directory is honoured
|
|
32
|
+
(an empty one uploads everything else); without one, its .gitignore is
|
|
33
|
+
used, except that .env.production and .env.example are always kept.
|
|
34
|
+
Without either file, every file except the exclusions below is
|
|
35
|
+
uploaded, so add a .sotaignore before deploying a folder with notes or
|
|
36
|
+
credentials. git_url uploads the tracked files and reads only a
|
|
37
|
+
.sotaignore.`;
|
|
29
38
|
const HOSTED_MODES = `Supply the source code as **files** (inline source from AI):
|
|
30
39
|
${FILES_MODE}
|
|
31
40
|
|
|
32
41
|
This hosted server only accepts inline files. ${HOSTED_FILES_ONLY_HINT}`;
|
|
33
|
-
const OUTRO = `
|
|
42
|
+
const OUTRO = `BEFORE the first deploy, call get-account: it says whether this is a sota Enterprise account and returns the full contract. The rules that make a deploy fail:
|
|
34
43
|
|
|
35
|
-
|
|
44
|
+
- Listen on 0.0.0.0 and the PORT environment variable: 8080 for auto-detected frameworks, the EXPOSE port of a Dockerfile.
|
|
45
|
+
- Health gate: sota calls GET /health inside the container (GET / when /health answers 404) WITHOUT identity headers; it must answer 2xx or 3xx within 60 seconds, otherwise the deploy fails and the previous version keeps running.
|
|
46
|
+
- One container, one web process, no persistent disk (files are lost on every deploy), no second service.
|
|
47
|
+
- sota Enterprise: never build a login; read the X-Sota-Access-* headers and fail closed without them, EXCEPT GET /health (200) and GET / (2xx/3xx, no data), which the health gate and the edge check call without identity. An app answering 401 on / is marked down.
|
|
36
48
|
|
|
37
|
-
|
|
49
|
+
The first deploy creates a PostgreSQL 17 database and injects DATABASE_URL (through PgBouncer in transaction mode: no LISTEN/NOTIFY, no session state, no named prepared statements) plus PGHOST, PGPORT, PGUSER, PGPASSWORD and PGDATABASE. Run migrations at start.
|
|
50
|
+
|
|
51
|
+
The deploy runs in the background: this tool returns at once. Poll get-status every 10-15 seconds until the deployment is running or failed; on failed, get-status shows the reason and get-logs the build log. Blue-green: the old container keeps serving until the new one passes the health gate. .git/, node_modules/, .DS_Store and the local/secret env files .env, .env.local, .env.*.local and .envrc (any directory, any case) are excluded from the archive; set runtime secrets with set-env instead. .env.production is kept (set-env values are not available at build time): put public build-time values such as NEXT_PUBLIC_* there, never secrets.`;
|
|
38
52
|
const FILES_DESCRIPTION = 'Map of relative file paths to UTF-8 text content. Use when generating an app inline (e.g. from a Claude.ai web conversation). Include a framework manifest so auto-detection works.';
|
|
39
53
|
function errorResult(text) {
|
|
40
54
|
return { content: [{ type: 'text', text }], isError: true };
|
|
41
55
|
}
|
|
42
56
|
export function registerDeployTool(server, client, options = {}) {
|
|
43
57
|
if (options.hosted === true) {
|
|
44
|
-
registerHostedDeployTool(server, client);
|
|
58
|
+
registerHostedDeployTool(server, client, options);
|
|
45
59
|
}
|
|
46
60
|
else {
|
|
47
|
-
registerLocalDeployTool(server, client);
|
|
61
|
+
registerLocalDeployTool(server, client, options);
|
|
48
62
|
}
|
|
49
63
|
}
|
|
50
|
-
async function uploadArchive(client, projectId, archive, modeDescription) {
|
|
64
|
+
async function uploadArchive(client, projectId, archive, modeDescription, options, note) {
|
|
51
65
|
try {
|
|
52
66
|
const deployment = await client.deploy(projectId, archive);
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
67
|
+
// The app URL is known before the deployment runs (deployment.url is
|
|
68
|
+
// only set once it is live). Best effort: older clients or a failed
|
|
69
|
+
// lookup just leave it out.
|
|
70
|
+
const timeoutMs = options.lookupTimeoutMs ?? LOOKUP_TIMEOUT_MS;
|
|
71
|
+
let appUrl;
|
|
72
|
+
if (typeof client.getProject === 'function') {
|
|
73
|
+
const project = await settleWithin(client.getProject(projectId), timeoutMs);
|
|
74
|
+
appUrl = project ? projectUrl(project) : undefined;
|
|
75
|
+
}
|
|
76
|
+
const lines = [
|
|
77
|
+
`Deployment started (${modeDescription}):`,
|
|
78
|
+
` ID: ${deployment.id}`,
|
|
79
|
+
` Status: ${deployment.status}`,
|
|
80
|
+
` App URL: ${appUrl ?? deployment.url ?? 'pending'}`,
|
|
81
|
+
];
|
|
82
|
+
if (note)
|
|
83
|
+
lines.push('', note);
|
|
84
|
+
lines.push('', 'The build runs in the background. Poll get-status every 10-15 seconds until the status is running or failed (get-status shows the reason of a failure; get-logs shows the build log).');
|
|
85
|
+
const account = await tryReadAccount(options.readAccount, timeoutMs);
|
|
86
|
+
if (account?.enterprise) {
|
|
87
|
+
lines.push('', enterpriseNextSteps(account, appUrl));
|
|
88
|
+
}
|
|
89
|
+
return { content: [{ type: 'text', text: lines.join('\n') }] };
|
|
61
90
|
}
|
|
62
91
|
catch (error) {
|
|
63
92
|
return errorResult(`Deploy failed during upload: ${error instanceof Error ? error.message : String(error)}`);
|
|
@@ -69,7 +98,7 @@ function archiveError(error) {
|
|
|
69
98
|
return errorResult(`Deploy failed during archive construction${code}: ${detail}`);
|
|
70
99
|
}
|
|
71
100
|
/** Hosted (mcp.sota.io): inline files only. */
|
|
72
|
-
function registerHostedDeployTool(server, client) {
|
|
101
|
+
function registerHostedDeployTool(server, client, options) {
|
|
73
102
|
server.registerTool('deploy', {
|
|
74
103
|
description: `${INTRO}\n\n${HOSTED_MODES}\n\n${OUTRO}`,
|
|
75
104
|
inputSchema: {
|
|
@@ -92,11 +121,11 @@ function registerHostedDeployTool(server, client) {
|
|
|
92
121
|
catch (error) {
|
|
93
122
|
return archiveError(error);
|
|
94
123
|
}
|
|
95
|
-
return uploadArchive(client, project_id, archive, `inline files (${Object.keys(files).length} entries)
|
|
124
|
+
return uploadArchive(client, project_id, archive, `inline files (${Object.keys(files).length} entries)`, options);
|
|
96
125
|
});
|
|
97
126
|
}
|
|
98
127
|
/** Local stdio server (npx @sota-io/mcp): files, git_url or directory. */
|
|
99
|
-
function registerLocalDeployTool(server, client) {
|
|
128
|
+
function registerLocalDeployTool(server, client, options) {
|
|
100
129
|
server.registerTool('deploy', {
|
|
101
130
|
description: `${INTRO}\n\n${LOCAL_MODES}\n\n${OUTRO}`,
|
|
102
131
|
inputSchema: {
|
|
@@ -131,6 +160,7 @@ function registerLocalDeployTool(server, client) {
|
|
|
131
160
|
}
|
|
132
161
|
let archive;
|
|
133
162
|
let modeDescription;
|
|
163
|
+
let note;
|
|
134
164
|
try {
|
|
135
165
|
if (files !== undefined) {
|
|
136
166
|
archive = archiveFromFiles(files);
|
|
@@ -142,14 +172,18 @@ function registerLocalDeployTool(server, client) {
|
|
|
142
172
|
}
|
|
143
173
|
else {
|
|
144
174
|
const dir = directory || process.cwd();
|
|
145
|
-
|
|
146
|
-
|
|
175
|
+
const packed = archiveDirectoryWithReport(dir);
|
|
176
|
+
archive = packed.archive;
|
|
177
|
+
modeDescription = `directory (${dir}), ${packed.files} files`;
|
|
178
|
+
note = packed.ignoreFile
|
|
179
|
+
? `Ignore rules: ${packed.ignoreFile}.`
|
|
180
|
+
: 'Ignore rules: none (no .sotaignore or .gitignore in the directory). Every file except .git, node_modules, .DS_Store and local .env files was uploaded. If the folder holds notes, credentials or data that must not leave the machine, add a .sotaignore and deploy again.';
|
|
147
181
|
}
|
|
148
182
|
}
|
|
149
183
|
catch (error) {
|
|
150
184
|
return archiveError(error);
|
|
151
185
|
}
|
|
152
|
-
return uploadArchive(client, project_id, archive, modeDescription);
|
|
186
|
+
return uploadArchive(client, project_id, archive, modeDescription, options, note);
|
|
153
187
|
});
|
|
154
188
|
}
|
|
155
189
|
//# sourceMappingURL=deploy.js.map
|
package/dist/tools/deploy.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy.js","sourceRoot":"","sources":["../../src/tools/deploy.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"deploy.js","sourceRoot":"","sources":["../../src/tools/deploy.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACL,0BAA0B,EAC1B,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,EAChB,sBAAsB,EACtB,eAAe,GAChB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAsB,iBAAiB,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACxG,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAoBnD,MAAM,KAAK,GAAG;;;;;iPAKmO,CAAC;AAElP,MAAM,UAAU,GAAG;;gCAEa,gBAAgB,WAAW,sBAAsB,GAAG,IAAI,GAAG,IAAI;;4BAEnE,CAAC;AAE7B,MAAM,WAAW,GAAG;;;KAGf,UAAU;;;;;;aAMF,eAAe,GAAG,IAAI,GAAG,IAAI;;;;;;;;;;gBAU1B,CAAC;AAEjB,MAAM,YAAY,GAAG;KAChB,UAAU;;gDAEiC,sBAAsB,EAAE,CAAC;AAEzE,MAAM,KAAK,GAAG;;;;;;;;;qoBASunB,CAAC;AAEtoB,MAAM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
2
|
export function registerEnvTools(server, client) {
|
|
3
3
|
server.registerTool('set-env', {
|
|
4
|
-
description: 'Set an environment variable for a project. Variables are encrypted at rest (AES-256-GCM) and injected at container runtime. NOTE: DATABASE_URL, PGHOST, PGPORT, PGUSER, PGPASSWORD, and PGDATABASE are all auto-injected for the managed PostgreSQL database — you do NOT need to set any of them manually. The PORT variable is auto-managed: 8080 for auto-detected frameworks (Next.js, Node.js, Python), or auto-detected from the Dockerfile EXPOSE directive for custom Dockerfile builds. IMPORTANT: Changing env vars does NOT auto-redeploy.
|
|
4
|
+
description: 'Set an environment variable for a project. Variables are encrypted at rest (AES-256-GCM) and injected at container runtime. NOTE: DATABASE_URL, PGHOST, PGPORT, PGUSER, PGPASSWORD, and PGDATABASE are all auto-injected for the managed PostgreSQL database — you do NOT need to set any of them manually. The PORT variable is auto-managed: 8080 for auto-detected frameworks (Next.js, Node.js, Python), or auto-detected from the Dockerfile EXPOSE directive for custom Dockerfile builds. IMPORTANT: Changing env vars does NOT auto-redeploy: call deploy again to apply them. Values set here are only available at runtime, never at build time: build-time values such as Next.js NEXT_PUBLIC_* belong in a committed file such as .env.production. On a sota Enterprise account do not set login or session secrets for your own sign-in: sota Access does the sign-in.',
|
|
5
5
|
inputSchema: {
|
|
6
6
|
project_id: z.string().describe('Project ID (UUID)'),
|
|
7
7
|
key: z.string().describe('Environment variable name (e.g., REDIS_URL, API_SECRET). Do NOT set DATABASE_URL — it is auto-managed'),
|
package/dist/tools/env.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env.js","sourceRoot":"","sources":["../../src/tools/env.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,UAAU,gBAAgB,CAAC,MAAiB,EAAE,MAAkB;IACpE,MAAM,CAAC,YAAY,CAAC,SAAS,EAAE;QAC7B,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"env.js","sourceRoot":"","sources":["../../src/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HANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export function registerLogsTool(server, client) {
|
|
3
3
|
server.registerTool('get-logs', {
|
|
4
|
-
description: 'Get build and
|
|
4
|
+
description: 'Get the build and deploy log of a deployment (logs of the running app are not available yet). If no deployment_id is provided, returns the log of the latest deployment. Use this after calling deploy to follow the build and diagnose build failures: framework detection, dependency installation and build steps. The reason of a failed health check is shown by get-status. If a deployment fails, check the logs for error details — common issues include missing dependencies, build errors, or the app not listening on the correct PORT (check the PORT env var — 8080 for auto-detected frameworks, or the EXPOSE value from Dockerfile).',
|
|
5
5
|
inputSchema: {
|
|
6
6
|
project_id: z.string().describe('Project ID (UUID) to get logs for'),
|
|
7
7
|
deployment_id: z.string().optional().describe('Specific deployment ID (optional, defaults to latest). Use get-status to see recent deployment IDs'),
|
package/dist/tools/logs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logs.js","sourceRoot":"","sources":["../../src/tools/logs.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,UAAU,gBAAgB,CAAC,MAAiB,EAAE,MAAkB;IACpE,MAAM,CAAC,YAAY,CAAC,UAAU,EAAE;QAC9B,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"logs.js","sourceRoot":"","sources":["../../src/tools/logs.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,UAAU,gBAAgB,CAAC,MAAiB,EAAE,MAAkB;IACpE,MAAM,CAAC,YAAY,CAAC,UAAU,EAAE;QAC9B,WAAW,EAAE,unBAAunB;QACpoB,WAAW,EAAE;YACX,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,mCAAmC,CAAC;YACpE,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,C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@ -1,4 +1,11 @@
|
|
|
1
1
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
2
|
import { SotaClient } from '@sota-io/sdk';
|
|
3
|
-
|
|
3
|
+
import { type AccountReader } from '../lib/account.js';
|
|
4
|
+
export interface ProjectToolOptions {
|
|
5
|
+
/** GET /v1/account, for the Enterprise next steps in create-project. */
|
|
6
|
+
readAccount?: AccountReader;
|
|
7
|
+
/** Bound for the account lookup after the project exists (default 3 s). */
|
|
8
|
+
lookupTimeoutMs?: number;
|
|
9
|
+
}
|
|
10
|
+
export declare function registerProjectTools(server: McpServer, client: SotaClient, options?: ProjectToolOptions): void;
|
|
4
11
|
//# sourceMappingURL=projects.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"projects.d.ts","sourceRoot":"","sources":["../../src/tools/projects.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEpE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"projects.d.ts","sourceRoot":"","sources":["../../src/tools/projects.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEpE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,EAAE,KAAK,aAAa,EAAkB,MAAM,mBAAmB,CAAC;AAGvE,MAAM,WAAW,kBAAkB;IACjC,wEAAwE;IACxE,WAAW,CAAC,EAAE,aAAa,CAAC;IAC5B,2EAA2E;IAC3E,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,GAAE,kBAAuB,QAkF3G"}
|
package/dist/tools/projects.js
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
|
|
2
|
+
import { projectUrl } from '../lib/project-url.js';
|
|
3
|
+
import { tryReadAccount } from '../lib/account.js';
|
|
4
|
+
import { enterpriseNextSteps } from './account.js';
|
|
5
|
+
export function registerProjectTools(server, client, options = {}) {
|
|
3
6
|
server.registerTool('list-projects', {
|
|
4
|
-
description: 'List all projects on your sota.io account. sota.io is an EU-native DevOps PaaS hosted in Germany (GDPR-compliant). Each project gets
|
|
7
|
+
description: 'List all projects on your sota.io account. sota.io is an EU-native DevOps PaaS hosted in Germany (GDPR-compliant). Each project gets one live URL with automatic HTTPS (https://{slug}.sota.io, or https://{app}.{label}.sota.io behind the company sign-in on a sota Enterprise account; always show the URL this tool returns), a managed PostgreSQL 17 database created on the first deploy (DATABASE_URL auto-injected), PgBouncer connection pooling, daily backups, zero-downtime blue-green deployments, gVisor container isolation, and custom domain support (up to 5 per project with automatic HTTPS).',
|
|
5
8
|
annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
6
9
|
}, async () => {
|
|
7
10
|
const { projects } = await client.listProjects();
|
|
8
|
-
const lines = projects.map((p) => `${p.name} (${p.slug}) - ID: ${p.id}`);
|
|
11
|
+
const lines = projects.map((p) => `${p.name} (${p.slug}) - ID: ${p.id} - ${projectUrl(p)}`);
|
|
9
12
|
return {
|
|
10
13
|
content: [
|
|
11
14
|
{
|
|
@@ -18,7 +21,7 @@ export function registerProjectTools(server, client) {
|
|
|
18
21
|
};
|
|
19
22
|
});
|
|
20
23
|
server.registerTool('create-project', {
|
|
21
|
-
description: 'Create a new project on sota.io.
|
|
24
|
+
description: 'Create a new project on sota.io. Call get-account first: on a sota Enterprise account the project gets the slug "<label>-<name>" and the one URL https://<name>.<label>.sota.io behind the company\'s Microsoft 365 sign-in, counts against the account\'s app limit and runs on the company\'s own server; otherwise the URL is https://{slug}.sota.io and the app is public. The slug is generated from the name (lowercase, hyphens, max 63 chars) and cannot be changed. The first deploy creates a managed PostgreSQL 17 database (DATABASE_URL auto-injected, through PgBouncer in transaction mode) with daily backups kept 7 days. Supported: Next.js, Node.js, Python, or any language with a Dockerfile. Custom domains (not on Enterprise yet): up to 5 per project via the domain tools.\n\nOptionally associate the project with a public git repository at create-time by passing `git_url` (and optional `git_branch`). The association is informational: it shows up in the dashboard and the `sota deploy --git` CLI flag can default to it, but it does NOT deploy on push.',
|
|
22
25
|
inputSchema: {
|
|
23
26
|
name: z.string().describe('Name for the new project. A URL slug will be auto-generated (e.g. "My Cool App" becomes my-cool-app.sota.io)'),
|
|
24
27
|
git_url: z.string().optional().describe('Optional git repository URL to associate with this project (https://, git://, ssh://, or git@host:path). Informational only — does not trigger an automatic deploy.'),
|
|
@@ -34,11 +37,16 @@ export function registerProjectTools(server, client) {
|
|
|
34
37
|
const gitLine = project.git_url
|
|
35
38
|
? `\n Git: ${project.git_url}${project.git_branch ? ` @ ${project.git_branch}` : ''}`
|
|
36
39
|
: '';
|
|
40
|
+
let text = `Project created:\n Name: ${project.name}\n Slug: ${project.slug}\n ID: ${project.id}\n URL: ${projectUrl(project)}${gitLine}`;
|
|
41
|
+
const account = await tryReadAccount(options.readAccount, options.lookupTimeoutMs);
|
|
42
|
+
if (account?.enterprise) {
|
|
43
|
+
text += `\n\nThis is a sota Enterprise app: follow the Enterprise contract from get-account (no own login, identity headers, GET /health and GET / answer without identity).\n\n${enterpriseNextSteps(account, projectUrl(project))}`;
|
|
44
|
+
}
|
|
37
45
|
return {
|
|
38
46
|
content: [
|
|
39
47
|
{
|
|
40
48
|
type: 'text',
|
|
41
|
-
text
|
|
49
|
+
text,
|
|
42
50
|
},
|
|
43
51
|
],
|
|
44
52
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"projects.js","sourceRoot":"","sources":["../../src/tools/projects.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3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C,CAAC,CAAC;IAEH,MAAM,CAAC,YAAY,CAAC,gBAAgB,EAAE;QACpC,WAAW,EAAE,+QAA+Q;QAC5R,WAAW,EAAE;YACX,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,+DAA+D,CAAC;SACjG;QACD,WAAW,EAAE,EAAE,YAAY,EAAE,KAAK,EAAE,eAAe,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE;KACxG,EAAE,KAAK,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE;QAC1B,IAAI,CAAC;YACH,MAAM,MAAM,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;YACvC,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAe;wBACrB,IAAI,EAAE,WAAW,UAAU,wBAAwB;qBACpD;iBACF;aACF,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAe;wBACrB,IAAI,EAAE,kBAAkB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;qBACjF;iBACF;gBACD,OAAO,EAAE,IAAI;aACd,CAAC;QACJ,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../src/tools/status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEpE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../src/tools/status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEpE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,QAwEvE"}
|
package/dist/tools/status.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export function registerStatusTool(server, client) {
|
|
3
3
|
server.registerTool('get-status', {
|
|
4
|
-
description: 'Get the current deployment status for a project, including the live URL
|
|
4
|
+
description: 'Get the current deployment status for a project, including the live host (the project URL from list-projects: https://{slug}.sota.io, or https://{app}.{label}.sota.io on a sota Enterprise account), detected framework, the reason of a failed deployment, and recent deployment history. Deployment statuses: pending (queued), building (build in progress), built (image ready), deploying (starting container + health checks), running (live and healthy), failed (build or health check error), stopped (replaced by newer deployment). Use this to verify a deployment succeeded after calling deploy.',
|
|
5
5
|
inputSchema: {
|
|
6
6
|
project_id: z.string().describe('Project ID (UUID) to check status for. Use list-projects to find the ID'),
|
|
7
7
|
},
|
|
@@ -30,8 +30,13 @@ export function registerStatusTool(server, client) {
|
|
|
30
30
|
if (latest.framework) {
|
|
31
31
|
lines.push(` Framework: ${latest.framework}`);
|
|
32
32
|
}
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
// The API sends error_message; older SDK types call it error.
|
|
34
|
+
const failure = latest.error_message ?? latest.error;
|
|
35
|
+
if (failure) {
|
|
36
|
+
lines.push(` Error: ${failure}`);
|
|
37
|
+
}
|
|
38
|
+
if (latest.status === 'failed' && failure && /health check/i.test(failure)) {
|
|
39
|
+
lines.push(' Hint: the app did not answer GET /health (or GET / when /health is 404) with 2xx/3xx within 60 s. It must listen on 0.0.0.0:$PORT and answer these paths WITHOUT identity headers (sota Enterprise: do not return 401 there). The previous version, if any, keeps running.');
|
|
35
40
|
}
|
|
36
41
|
if (deployments.length > 1) {
|
|
37
42
|
lines.push('', 'Recent deployments:');
|
package/dist/tools/status.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status.js","sourceRoot":"","sources":["../../src/tools/status.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,UAAU,kBAAkB,CAAC,MAAiB,EAAE,MAAkB;IACtE,MAAM,CAAC,YAAY,CAAC,YAAY,EAAE;QAChC,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"status.js","sourceRoot":"","sources":["../../src/tools/status.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,UAAU,kBAAkB,CAAC,MAAiB,EAAE,MAAkB;IACtE,MAAM,CAAC,YAAY,CAAC,YAAY,EAAE;QAChC,WAAW,EAAE,ilBAAilB;QAC9lB,WAAW,EAAE;YACX,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,yEAAyE,CAAC;SAC3G;QACD,WAAW,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,eAAe,EAAE,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE;KACxG,EAAE,KAAK,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE;QAC1B,IAAI,CAAC;YACH,MAAM,WAAW,GAAG,MAAM,MAAM,CAAC,eAAe,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC;YAEnE,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBAC7B,OAAO;oBACL,OAAO,EAAE;wBACP;4BACE,IAAI,EAAE,MAAe;4BACrB,IAAI,EAAE,+DAA+D;yBACtE;qBACF;iBACF,CAAC;YACJ,CAAC;YAED,MAAM,MAAM,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;YAC9B,MAAM,KAAK,GAAG;gBACZ,qBAAqB;gBACrB,SAAS,MAAM,CAAC,EAAE,EAAE;gBACpB,a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oBACP;wBACE,IAAI,EAAE,MAAe;wBACrB,IAAI,EAAE,yBAAyB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;qBACxF;iBACF;gBACD,OAAO,EAAE,IAAI;aACd,CAAC;QACJ,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sota-io/mcp",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.1",
|
|
4
4
|
"mcpName": "io.sota/mcp",
|
|
5
5
|
"description": "MCP server for sota.io — EU-native DevOps PaaS. Deploy web apps via AI agents with managed PostgreSQL, zero-downtime deploys, and automatic HTTPS. Supports Next.js, Node.js, Python, and custom Dockerfiles.",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "dist/index.js",
|
|
8
8
|
"bin": {
|
|
9
|
+
"mcp": "dist/index.js",
|
|
9
10
|
"sota-mcp": "dist/index.js",
|
|
10
11
|
"sota-mcp-http": "dist/http.js"
|
|
11
12
|
},
|