@sota-io/mcp 1.5.0 → 1.7.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/CLAUDE.md +19 -4
- package/README.md +11 -4
- 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 +324 -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 +11 -4
- 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 +39 -5
- package/dist/lib/archive-builder.d.ts.map +1 -1
- package/dist/lib/archive-builder.js +131 -37
- 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/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/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/ignore.d.ts +16 -0
- package/dist/lib/ignore.d.ts.map +1 -0
- package/dist/lib/ignore.js +131 -0
- package/dist/lib/ignore.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/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 +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/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.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 +19 -1
- package/dist/tools/deploy.d.ts.map +1 -1
- package/dist/tools/deploy.js +129 -77
- package/dist/tools/deploy.js.map +1 -1
- package/dist/tools/env.js +2 -2
- 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 +1 -1
|
@@ -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
|
+
{"version":3,"file":"account.js","sourceRoot":"","sources":["../../src/tools/account.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,cAAc,EACd,IAAI,EACJ,uBAAuB,EACvB,mBAAmB,EACnB,OAAO,EACP,mBAAmB,EACnB,QAAQ,GACT,MAAM,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B;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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-account.d.ts","sourceRoot":"","sources":["../../src/tools/create-account.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAcpE,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,SAAS,
|
|
1
|
+
{"version":3,"file":"create-account.d.ts","sourceRoot":"","sources":["../../src/tools/create-account.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAcpE,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,SAAS,QAqM1D"}
|
|
@@ -146,13 +146,35 @@ sota.io is an EU-native PaaS hosted in Germany — GDPR-compliant by default, no
|
|
|
146
146
|
}
|
|
147
147
|
// Provision: user_plans (Free tier) + sota_xxx key tagged source=claude
|
|
148
148
|
const result = await provisionPlanAndKey(session.user.id);
|
|
149
|
+
// Deliberately neutral, descriptive content with no instructions
|
|
150
|
+
// directing the LLM or the user to modify any client configuration.
|
|
151
|
+
// Tool responses that prescribe config changes look like prompt-
|
|
152
|
+
// injection attempts and are (correctly) flagged by Claude.ai's
|
|
153
|
+
// safety layer. The user-facing setup guide lives at the docs URL.
|
|
149
154
|
return {
|
|
150
155
|
content: [
|
|
151
156
|
{
|
|
152
157
|
type: "text",
|
|
153
|
-
text:
|
|
158
|
+
text: `Account created on sota.io.
|
|
159
|
+
|
|
160
|
+
- Email: ${session.user.email}
|
|
161
|
+
- Plan: Free tier (3 projects, EU-hosted, no credit card)
|
|
162
|
+
- Region: Germany (Hetzner Cloud)
|
|
163
|
+
- API key (save this — shown once): \`${result.apiKey}\`
|
|
164
|
+
|
|
165
|
+
The API key authenticates the sota.io REST API (api.sota.io) and the sota CLI directly.
|
|
166
|
+
|
|
167
|
+
For Claude connector usage and tool activation, see https://sota.io/docs/integrations/claude .`,
|
|
154
168
|
},
|
|
155
169
|
],
|
|
170
|
+
_meta: {
|
|
171
|
+
// Forward-looking hint per MCP spec — Claude.ai doesn't render
|
|
172
|
+
// a UI for this yet, but if/when it does, sota.io users will
|
|
173
|
+
// get a "Reconnect" affordance automatically. Carries no
|
|
174
|
+
// imperative content directed at the LLM.
|
|
175
|
+
"anthropic.com/connector_reauthentication_suggested": true,
|
|
176
|
+
"anthropic.com/reauth_email": session.user.email,
|
|
177
|
+
},
|
|
156
178
|
};
|
|
157
179
|
}
|
|
158
180
|
catch (err) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-account.js","sourceRoot":"","sources":["../../src/tools/create-account.ts"],"names":[],"mappings":"AAqBA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAE9D,MAAM,YAAY,GAAG,OAAO,CAAC,GAAG,CAAC,YAAY,IAAI,8BAA8B,CAAC;AAChF,MAAM,iBAAiB,GAAG,OAAO,CAAC,GAAG,CAAC,iBAAiB,IAAI,EAAE,CAAC;AAC9D,MAAM,yBAAyB,GAAG,OAAO,CAAC,GAAG,CAAC,yBAAyB,IAAI,EAAE,CAAC;AAO9E,MAAM,UAAU,yBAAyB,CAAC,MAAiB;IACzD,MAAM,CAAC,YAAY,CACjB,gBAAgB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ACb,KAAK,EAAE,eAAe;oBACtB,KAAK,EAAE,IAAI,CAAC,IAAI,EAAE;iBACnB,CAAC;aACH,CAAC,CAAC;YACH,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,CAAC;gBAClB,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,IAAI,EAAE,CAAC;gBACtC,OAAO;oBACL,OAAO,EAAE,IAAI;oBACb,OAAO,EAAE;wBACP;4BACE,IAAI,EAAE,MAAe;4BACrB,IAAI,EAAE,oCAAoC,SAAS,CAAC,MAAM,wJAAwJ,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE;yBACzO;qBACF;iBACF,CAAC;YACJ,CAAC;YACD,MAAM,OAAO,GAAG,CAAC,MAAM,SAAS,CAAC,IAAI,EAAE,CAA4B,CAAC;YACpE,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC;gBAC9C,OAAO;oBACL,OAAO,EAAE,IAAI;oBACb,OAAO,EAAE;wBACP;4BACE,IAAI,EAAE,MAAe;4BACrB,IAAI,EAAE,oFAAoF;yBAC3F;qBACF;iBACF,CAAC;YACJ,CAAC;YAED,wEAAwE;YACxE,MAAM,MAAM,GAAG,MAAM,mBAAmB,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YAE1D,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAe;wBACrB,IAAI,EAAE,
|
|
1
|
+
{"version":3,"file":"create-account.js","sourceRoot":"","sources":["../../src/tools/create-account.ts"],"names":[],"mappings":"AAqBA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAE9D,MAAM,YAAY,GAAG,OAAO,CAAC,GAAG,CAAC,YAAY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,IAAI,EAAE,MAAe;wBACrB,IAAI,EAAE;;WAET,OAAO,CAAC,IAAI,CAAC,KAAK;;;wCAGW,MAAM,CAAC,MAAM;;;;+FAI0C;qBAClF;iBACF;gBACD,KAAK,EAAE;oBACL,+DAA+D;oBAC/D,6DAA6D;oBAC7D,yDAAyD;oBACzD,0CAA0C;oBAC1C,oDAAoD,EAAE,IAAI;oBAC1D,4BAA4B,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK;iBACjD;aACF,CAAC;QACJ,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO;gBACL,OAAO,EAAE,IAAI;gBACb,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAe;wBACrB,IAAI,EAAE,uBAAuB,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,2CAA2C;qBACzH;iBACF;aACF,CAAC;QACJ,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
|
package/dist/tools/deploy.d.ts
CHANGED
|
@@ -1,4 +1,22 @@
|
|
|
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 DeployToolOptions {
|
|
5
|
+
/**
|
|
6
|
+
* true for the hosted server (mcp.sota.io): only inline `files` are
|
|
7
|
+
* advertised and accepted. A directory deploy there would pack the
|
|
8
|
+
* sota-mcp container's own filesystem into the caller's project, and a
|
|
9
|
+
* server-side git clone would fetch arbitrary URLs from our network.
|
|
10
|
+
* false (default) for the local stdio server: files, git_url, directory.
|
|
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;
|
|
20
|
+
}
|
|
21
|
+
export declare function registerDeployTool(server: McpServer, client: SotaClient, options?: DeployToolOptions): void;
|
|
4
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;AAW1C,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,
|
|
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,45 +1,139 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
import { archiveDirectoryWithReport, archiveFromFiles, archiveFromGitUrl, ArchiveBuilderError, MAX_INLINE_FILES, MAX_INLINE_TOTAL_BYTES, MAX_CLONE_BYTES, } from '../lib/archive-builder.js';
|
|
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';
|
|
7
|
+
const INTRO = `Deploy an application to sota.io. The platform auto-detects your framework and builds a Docker image automatically:
|
|
6
8
|
|
|
7
9
|
- Next.js: Detected via next.config.js/ts. Add output: 'standalone' to next.config for optimal builds.
|
|
8
10
|
- Node.js: Detected via package.json with a "start" script. Works with Express, Fastify, Koa, Hapi, etc.
|
|
9
11
|
- Python: Detected via requirements.txt or pyproject.toml. Works with Flask, FastAPI, Django.
|
|
10
|
-
- Custom Dockerfile: If a Dockerfile exists in the project root, it takes priority over auto-detection. Use this for Go, Rust, Java, or any other language. The EXPOSE directive in the Dockerfile is used to detect the app port automatically
|
|
11
|
-
|
|
12
|
-
THREE WAYS to supply the source code — pick EXACTLY ONE:
|
|
13
|
-
|
|
14
|
-
1. **files** (inline source from AI):
|
|
15
|
-
Pass a map of relative paths to UTF-8 text content. Best when you've just
|
|
12
|
+
- Custom Dockerfile: If a Dockerfile exists in the project root, it takes priority over auto-detection. Use this for Go, Rust, Java, or any other language. The EXPOSE directive in the Dockerfile is used to detect the app port automatically.`;
|
|
13
|
+
const FILES_MODE = `Pass a map of relative paths to UTF-8 text content. Best when you've just
|
|
16
14
|
generated a small app in this conversation and want to deploy it without
|
|
17
15
|
any filesystem step. Up to ${MAX_INLINE_FILES} files, ${MAX_INLINE_TOTAL_BYTES / 1024 / 1024} MB total. Include
|
|
18
16
|
the framework manifest (package.json, requirements.txt, or Dockerfile)
|
|
19
|
-
so auto-detection works
|
|
17
|
+
so auto-detection works.`;
|
|
18
|
+
const LOCAL_MODES = `THREE WAYS to supply the source code — pick EXACTLY ONE:
|
|
19
|
+
|
|
20
|
+
1. **files** (inline source from AI):
|
|
21
|
+
${FILES_MODE}
|
|
20
22
|
|
|
21
23
|
2. **git_url** (clone a public repo):
|
|
22
|
-
Pass an https://, git://, ssh://, or git@host:path URL.
|
|
23
|
-
|
|
24
|
+
Pass an https://, git://, ssh://, or git@host:path URL. It is shallow-cloned
|
|
25
|
+
(--depth=1 --single-branch) with the local git and deployed. Optional
|
|
24
26
|
git_branch picks a non-default branch. Only public repos are supported in
|
|
25
27
|
v1. Max ${MAX_CLONE_BYTES / 1024 / 1024} MB after clone.
|
|
26
28
|
|
|
27
29
|
3. **directory** (local filesystem):
|
|
28
|
-
Pass an absolute path.
|
|
29
|
-
|
|
30
|
-
|
|
30
|
+
Pass an absolute path. Defaults to the current working directory when
|
|
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.`;
|
|
38
|
+
const HOSTED_MODES = `Supply the source code as **files** (inline source from AI):
|
|
39
|
+
${FILES_MODE}
|
|
31
40
|
|
|
32
|
-
|
|
41
|
+
This hosted server only accepts inline files. ${HOSTED_FILES_ONLY_HINT}`;
|
|
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:
|
|
33
43
|
|
|
34
|
-
|
|
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.
|
|
35
48
|
|
|
36
|
-
|
|
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.`;
|
|
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.';
|
|
53
|
+
function errorResult(text) {
|
|
54
|
+
return { content: [{ type: 'text', text }], isError: true };
|
|
55
|
+
}
|
|
56
|
+
export function registerDeployTool(server, client, options = {}) {
|
|
57
|
+
if (options.hosted === true) {
|
|
58
|
+
registerHostedDeployTool(server, client, options);
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
registerLocalDeployTool(server, client, options);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
async function uploadArchive(client, projectId, archive, modeDescription, options, note) {
|
|
65
|
+
try {
|
|
66
|
+
const deployment = await client.deploy(projectId, archive);
|
|
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') }] };
|
|
90
|
+
}
|
|
91
|
+
catch (error) {
|
|
92
|
+
return errorResult(`Deploy failed during upload: ${error instanceof Error ? error.message : String(error)}`);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
function archiveError(error) {
|
|
96
|
+
const detail = error instanceof Error ? error.message : String(error);
|
|
97
|
+
const code = error instanceof ArchiveBuilderError ? ` [${error.code}]` : '';
|
|
98
|
+
return errorResult(`Deploy failed during archive construction${code}: ${detail}`);
|
|
99
|
+
}
|
|
100
|
+
/** Hosted (mcp.sota.io): inline files only. */
|
|
101
|
+
function registerHostedDeployTool(server, client, options) {
|
|
102
|
+
server.registerTool('deploy', {
|
|
103
|
+
description: `${INTRO}\n\n${HOSTED_MODES}\n\n${OUTRO}`,
|
|
104
|
+
inputSchema: {
|
|
105
|
+
project_id: z.string().describe('Project ID (UUID) to deploy to. Use list-projects to find the ID.'),
|
|
106
|
+
files: z.record(z.string(), z.string()).describe(FILES_DESCRIPTION),
|
|
107
|
+
},
|
|
108
|
+
annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: false, openWorldHint: false },
|
|
109
|
+
}, async (args) => {
|
|
110
|
+
// Defence in depth: http.ts already rejects directory/git_url before the
|
|
111
|
+
// tool runs, and the schema requires files. Never fall back to a
|
|
112
|
+
// directory (process.cwd() is the sota-mcp container itself).
|
|
113
|
+
const { project_id, files } = args;
|
|
114
|
+
if (files === undefined || files === null || typeof files !== 'object') {
|
|
115
|
+
return errorResult(`Error: the hosted server needs \`files\`. ${HOSTED_FILES_ONLY_HINT}`);
|
|
116
|
+
}
|
|
117
|
+
let archive;
|
|
118
|
+
try {
|
|
119
|
+
archive = archiveFromFiles(files);
|
|
120
|
+
}
|
|
121
|
+
catch (error) {
|
|
122
|
+
return archiveError(error);
|
|
123
|
+
}
|
|
124
|
+
return uploadArchive(client, project_id, archive, `inline files (${Object.keys(files).length} entries)`, options);
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
/** Local stdio server (npx @sota-io/mcp): files, git_url or directory. */
|
|
128
|
+
function registerLocalDeployTool(server, client, options) {
|
|
129
|
+
server.registerTool('deploy', {
|
|
130
|
+
description: `${INTRO}\n\n${LOCAL_MODES}\n\n${OUTRO}`,
|
|
37
131
|
inputSchema: {
|
|
38
132
|
project_id: z.string().describe('Project ID (UUID) to deploy to. Use list-projects to find the ID.'),
|
|
39
133
|
files: z
|
|
40
134
|
.record(z.string(), z.string())
|
|
41
135
|
.optional()
|
|
42
|
-
.describe(
|
|
136
|
+
.describe(`${FILES_DESCRIPTION} Mutually exclusive with git_url and directory.`),
|
|
43
137
|
git_url: z
|
|
44
138
|
.string()
|
|
45
139
|
.optional()
|
|
@@ -51,7 +145,7 @@ Deployments use blue-green strategy for zero downtime. The old container keeps r
|
|
|
51
145
|
directory: z
|
|
52
146
|
.string()
|
|
53
147
|
.optional()
|
|
54
|
-
.describe('Absolute path to a local directory
|
|
148
|
+
.describe('Absolute path to a local directory. Defaults to the current working directory when no other mode is given. Mutually exclusive with files and git_url.'),
|
|
55
149
|
},
|
|
56
150
|
annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: false, openWorldHint: false },
|
|
57
151
|
}, async ({ project_id, files, git_url, git_branch, directory }) => {
|
|
@@ -59,79 +153,37 @@ Deployments use blue-green strategy for zero downtime. The old container keeps r
|
|
|
59
153
|
// fall back to directory mode with cwd (legacy CLI behaviour).
|
|
60
154
|
const modesSet = [files !== undefined, git_url !== undefined, directory !== undefined].filter(Boolean).length;
|
|
61
155
|
if (modesSet > 1) {
|
|
62
|
-
return
|
|
63
|
-
content: [
|
|
64
|
-
{
|
|
65
|
-
type: 'text',
|
|
66
|
-
text: 'Error: deploy accepts exactly one of `files`, `git_url`, or `directory`. Pick the mode that matches your environment (files for inline AI-generated code, git_url for a public repo, directory for a local path).',
|
|
67
|
-
},
|
|
68
|
-
],
|
|
69
|
-
isError: true,
|
|
70
|
-
};
|
|
156
|
+
return errorResult('Error: deploy accepts exactly one of `files`, `git_url`, or `directory`. Pick the mode that matches your environment (files for inline AI-generated code, git_url for a public repo, directory for a local path).');
|
|
71
157
|
}
|
|
72
158
|
if (git_branch && !git_url) {
|
|
73
|
-
return
|
|
74
|
-
content: [
|
|
75
|
-
{
|
|
76
|
-
type: 'text',
|
|
77
|
-
text: 'Error: `git_branch` only makes sense together with `git_url`.',
|
|
78
|
-
},
|
|
79
|
-
],
|
|
80
|
-
isError: true,
|
|
81
|
-
};
|
|
159
|
+
return errorResult('Error: `git_branch` only makes sense together with `git_url`.');
|
|
82
160
|
}
|
|
83
|
-
let
|
|
161
|
+
let archive;
|
|
84
162
|
let modeDescription;
|
|
163
|
+
let note;
|
|
85
164
|
try {
|
|
86
165
|
if (files !== undefined) {
|
|
87
|
-
|
|
166
|
+
archive = archiveFromFiles(files);
|
|
88
167
|
modeDescription = `inline files (${Object.keys(files).length} entries)`;
|
|
89
168
|
}
|
|
90
169
|
else if (git_url !== undefined) {
|
|
91
|
-
|
|
170
|
+
archive = archiveFromGitUrl(git_url, git_branch);
|
|
92
171
|
modeDescription = `git clone (${git_url}${git_branch ? ` @ ${git_branch}` : ''})`;
|
|
93
172
|
}
|
|
94
173
|
else {
|
|
95
174
|
const dir = directory || process.cwd();
|
|
96
|
-
|
|
97
|
-
|
|
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.';
|
|
98
181
|
}
|
|
99
182
|
}
|
|
100
183
|
catch (error) {
|
|
101
|
-
|
|
102
|
-
const code = error instanceof ArchiveBuilderError ? ` [${error.code}]` : '';
|
|
103
|
-
return {
|
|
104
|
-
content: [
|
|
105
|
-
{
|
|
106
|
-
type: 'text',
|
|
107
|
-
text: `Deploy failed during archive construction${code}: ${detail}`,
|
|
108
|
-
},
|
|
109
|
-
],
|
|
110
|
-
isError: true,
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
try {
|
|
114
|
-
const deployment = await client.deploy(project_id, archiveBuffer);
|
|
115
|
-
return {
|
|
116
|
-
content: [
|
|
117
|
-
{
|
|
118
|
-
type: 'text',
|
|
119
|
-
text: `Deployment started (${modeDescription}):\n ID: ${deployment.id}\n Status: ${deployment.status}\n URL: ${deployment.url || 'pending'}\n\nUse get-logs to check build progress.`,
|
|
120
|
-
},
|
|
121
|
-
],
|
|
122
|
-
};
|
|
123
|
-
}
|
|
124
|
-
catch (error) {
|
|
125
|
-
return {
|
|
126
|
-
content: [
|
|
127
|
-
{
|
|
128
|
-
type: 'text',
|
|
129
|
-
text: `Deploy failed during upload: ${error instanceof Error ? error.message : String(error)}`,
|
|
130
|
-
},
|
|
131
|
-
],
|
|
132
|
-
isError: true,
|
|
133
|
-
};
|
|
184
|
+
return archiveError(error);
|
|
134
185
|
}
|
|
186
|
+
return uploadArchive(client, project_id, archive, modeDescription, options, note);
|
|
135
187
|
});
|
|
136
188
|
}
|
|
137
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;AAEt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';
|
|
2
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
|
-
key: z.string().describe('Environment variable name (e.g.,
|
|
7
|
+
key: z.string().describe('Environment variable name (e.g., REDIS_URL, API_SECRET). Do NOT set DATABASE_URL — it is auto-managed'),
|
|
8
8
|
value: z.string().describe('Environment variable value. Will be encrypted at rest'),
|
|
9
9
|
},
|
|
10
10
|
annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },
|
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,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,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;qBAC3F;iBACF;gBACD,OAAO,EAAE,IAAI;aACd,CAAC;QACJ,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/dist/tools/logs.js
CHANGED
|
@@ -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,unBAAun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,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;qBACtF;iBACF;gBACD,OAAO,EAAE,IAAI;aACd,CAAC;QACJ,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/dist/tools/projects.d.ts
CHANGED
|
@@ -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"}
|