run402-mcp 0.1.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 +122 -0
- package/dist/client.d.ts +15 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +42 -0
- package/dist/client.js.map +1 -0
- package/dist/config.d.ts +3 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +10 -0
- package/dist/config.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +34 -0
- package/dist/index.js.map +1 -0
- package/dist/keystore.d.ts +14 -0
- package/dist/keystore.d.ts.map +1 -0
- package/dist/keystore.js +38 -0
- package/dist/keystore.js.map +1 -0
- package/dist/tools/deploy-function.d.ts +34 -0
- package/dist/tools/deploy-function.d.ts.map +1 -0
- package/dist/tools/deploy-function.js +87 -0
- package/dist/tools/deploy-function.js.map +1 -0
- package/dist/tools/deploy-site.d.ts +36 -0
- package/dist/tools/deploy-site.d.ts.map +1 -0
- package/dist/tools/deploy-site.js +88 -0
- package/dist/tools/deploy-site.js.map +1 -0
- package/dist/tools/get-function-logs.d.ts +18 -0
- package/dist/tools/get-function-logs.d.ts.map +1 -0
- package/dist/tools/get-function-logs.js +64 -0
- package/dist/tools/get-function-logs.js.map +1 -0
- package/dist/tools/invoke-function.d.ts +22 -0
- package/dist/tools/invoke-function.d.ts.map +1 -0
- package/dist/tools/invoke-function.js +82 -0
- package/dist/tools/invoke-function.js.map +1 -0
- package/dist/tools/provision.d.ts +16 -0
- package/dist/tools/provision.d.ts.map +1 -0
- package/dist/tools/provision.js +77 -0
- package/dist/tools/provision.js.map +1 -0
- package/dist/tools/renew.d.ts +16 -0
- package/dist/tools/renew.d.ts.map +1 -0
- package/dist/tools/renew.js +78 -0
- package/dist/tools/renew.js.map +1 -0
- package/dist/tools/rest-query.d.ts +24 -0
- package/dist/tools/rest-query.d.ts.map +1 -0
- package/dist/tools/rest-query.js +82 -0
- package/dist/tools/rest-query.js.map +1 -0
- package/dist/tools/run-sql.d.ts +16 -0
- package/dist/tools/run-sql.d.ts.map +1 -0
- package/dist/tools/run-sql.js +56 -0
- package/dist/tools/run-sql.js.map +1 -0
- package/dist/tools/set-secret.d.ts +18 -0
- package/dist/tools/set-secret.d.ts.map +1 -0
- package/dist/tools/set-secret.js +53 -0
- package/dist/tools/set-secret.js.map +1 -0
- package/dist/tools/subdomain.d.ts +32 -0
- package/dist/tools/subdomain.d.ts.map +1 -0
- package/dist/tools/subdomain.js +93 -0
- package/dist/tools/subdomain.js.map +1 -0
- package/dist/tools/upload-file.d.ts +22 -0
- package/dist/tools/upload-file.d.ts.map +1 -0
- package/dist/tools/upload-file.js +56 -0
- package/dist/tools/upload-file.js.map +1 -0
- package/package.json +56 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { apiRequest } from "../client.js";
|
|
3
|
+
import { getProject } from "../keystore.js";
|
|
4
|
+
export const setSecretSchema = {
|
|
5
|
+
project_id: z.string().describe("The project ID"),
|
|
6
|
+
key: z
|
|
7
|
+
.string()
|
|
8
|
+
.describe("Secret key (uppercase alphanumeric + underscores, e.g. 'STRIPE_SECRET_KEY')"),
|
|
9
|
+
value: z
|
|
10
|
+
.string()
|
|
11
|
+
.describe("Secret value (will be injected as process.env in functions)"),
|
|
12
|
+
};
|
|
13
|
+
export async function handleSetSecret(args) {
|
|
14
|
+
const project = getProject(args.project_id);
|
|
15
|
+
if (!project) {
|
|
16
|
+
return {
|
|
17
|
+
content: [
|
|
18
|
+
{
|
|
19
|
+
type: "text",
|
|
20
|
+
text: `Error: Project \`${args.project_id}\` not found in key store. Provision a project first with \`provision_postgres_project\`.`,
|
|
21
|
+
},
|
|
22
|
+
],
|
|
23
|
+
isError: true,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
const res = await apiRequest(`/admin/v1/projects/${args.project_id}/secrets`, {
|
|
27
|
+
method: "POST",
|
|
28
|
+
headers: {
|
|
29
|
+
Authorization: `Bearer ${project.service_key}`,
|
|
30
|
+
},
|
|
31
|
+
body: {
|
|
32
|
+
key: args.key,
|
|
33
|
+
value: args.value,
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
if (!res.ok) {
|
|
37
|
+
const body = res.body;
|
|
38
|
+
const msg = body.error || `HTTP ${res.status}`;
|
|
39
|
+
return {
|
|
40
|
+
content: [{ type: "text", text: `Error: ${msg}` }],
|
|
41
|
+
isError: true,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
return {
|
|
45
|
+
content: [
|
|
46
|
+
{
|
|
47
|
+
type: "text",
|
|
48
|
+
text: `## Secret Set\n\nSecret \`${args.key}\` has been set for project \`${args.project_id}\`.\n\nAccess it in your functions via \`process.env.${args.key}\`.`,
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=set-secret.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"set-secret.js","sourceRoot":"","sources":["../../src/tools/set-secret.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,gBAAgB,CAAC;IACjD,GAAG,EAAE,CAAC;SACH,MAAM,EAAE;SACR,QAAQ,CAAC,6EAA6E,CAAC;IAC1F,KAAK,EAAE,CAAC;SACL,MAAM,EAAE;SACR,QAAQ,CAAC,6DAA6D,CAAC;CAC3E,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,IAIrC;IACC,MAAM,OAAO,GAAG,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAC5C,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,oBAAoB,IAAI,CAAC,UAAU,2FAA2F;iBACrI;aACF;YACD,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC;IAED,MAAM,GAAG,GAAG,MAAM,UAAU,CAAC,sBAAsB,IAAI,CAAC,UAAU,UAAU,EAAE;QAC5E,MAAM,EAAE,MAAM;QACd,OAAO,EAAE;YACP,aAAa,EAAE,UAAU,OAAO,CAAC,WAAW,EAAE;SAC/C;QACD,IAAI,EAAE;YACJ,GAAG,EAAE,IAAI,CAAC,GAAG;YACb,KAAK,EAAE,IAAI,CAAC,KAAK;SAClB;KACF,CAAC,CAAC;IAEH,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;QACZ,MAAM,IAAI,GAAG,GAAG,CAAC,IAA+B,CAAC;QACjD,MAAM,GAAG,GAAI,IAAI,CAAC,KAAgB,IAAI,QAAQ,GAAG,CAAC,MAAM,EAAE,CAAC;QAC3D,OAAO;YACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,GAAG,EAAE,EAAE,CAAC;YAClD,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC;IAED,OAAO;QACL,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,6BAA6B,IAAI,CAAC,GAAG,iCAAiC,IAAI,CAAC,UAAU,wDAAwD,IAAI,CAAC,GAAG,KAAK;aACjK;SACF;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const claimSubdomainSchema: {
|
|
3
|
+
name: z.ZodString;
|
|
4
|
+
deployment_id: z.ZodString;
|
|
5
|
+
project_id: z.ZodOptional<z.ZodString>;
|
|
6
|
+
};
|
|
7
|
+
export declare function handleClaimSubdomain(args: {
|
|
8
|
+
name: string;
|
|
9
|
+
deployment_id: string;
|
|
10
|
+
project_id?: string;
|
|
11
|
+
}): Promise<{
|
|
12
|
+
content: Array<{
|
|
13
|
+
type: "text";
|
|
14
|
+
text: string;
|
|
15
|
+
}>;
|
|
16
|
+
isError?: boolean;
|
|
17
|
+
}>;
|
|
18
|
+
export declare const deleteSubdomainSchema: {
|
|
19
|
+
name: z.ZodString;
|
|
20
|
+
project_id: z.ZodOptional<z.ZodString>;
|
|
21
|
+
};
|
|
22
|
+
export declare function handleDeleteSubdomain(args: {
|
|
23
|
+
name: string;
|
|
24
|
+
project_id?: string;
|
|
25
|
+
}): Promise<{
|
|
26
|
+
content: Array<{
|
|
27
|
+
type: "text";
|
|
28
|
+
text: string;
|
|
29
|
+
}>;
|
|
30
|
+
isError?: boolean;
|
|
31
|
+
}>;
|
|
32
|
+
//# sourceMappingURL=subdomain.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subdomain.d.ts","sourceRoot":"","sources":["../../src/tools/subdomain.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,oBAAoB;;;;CAWhC,CAAC;AAEF,wBAAsB,oBAAoB,CAAC,IAAI,EAAE;IAC/C,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,GAAG,OAAO,CAAC;IAAE,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC,CAqDjF;AAED,eAAO,MAAM,qBAAqB;;;CAQjC,CAAC;AAEF,wBAAsB,qBAAqB,CAAC,IAAI,EAAE;IAChD,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,GAAG,OAAO,CAAC;IAAE,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC,CA+BjF"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { apiRequest } from "../client.js";
|
|
3
|
+
import { getProject } from "../keystore.js";
|
|
4
|
+
export const claimSubdomainSchema = {
|
|
5
|
+
name: z
|
|
6
|
+
.string()
|
|
7
|
+
.describe("Custom subdomain name (e.g. 'myapp' → myapp.run402.com). 3-63 chars, lowercase alphanumeric + hyphens."),
|
|
8
|
+
deployment_id: z
|
|
9
|
+
.string()
|
|
10
|
+
.describe("Deployment ID to point this subdomain at (e.g. 'dpl_1709337600000_a1b2c3')"),
|
|
11
|
+
project_id: z
|
|
12
|
+
.string()
|
|
13
|
+
.optional()
|
|
14
|
+
.describe("Optional project ID for ownership tracking. Uses stored service_key for auth."),
|
|
15
|
+
};
|
|
16
|
+
export async function handleClaimSubdomain(args) {
|
|
17
|
+
let authHeader = {};
|
|
18
|
+
if (args.project_id) {
|
|
19
|
+
const project = getProject(args.project_id);
|
|
20
|
+
if (!project) {
|
|
21
|
+
return {
|
|
22
|
+
content: [{ type: "text", text: `Error: Project "${args.project_id}" not found in key store. Provision a project first.` }],
|
|
23
|
+
isError: true,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
authHeader = { Authorization: `Bearer ${project.service_key}` };
|
|
27
|
+
}
|
|
28
|
+
const res = await apiRequest("/v1/subdomains", {
|
|
29
|
+
method: "POST",
|
|
30
|
+
headers: authHeader,
|
|
31
|
+
body: { name: args.name, deployment_id: args.deployment_id },
|
|
32
|
+
});
|
|
33
|
+
if (!res.ok) {
|
|
34
|
+
const body = res.body;
|
|
35
|
+
const msg = body.error || `HTTP ${res.status}`;
|
|
36
|
+
return {
|
|
37
|
+
content: [{ type: "text", text: `Error: ${msg}` }],
|
|
38
|
+
isError: true,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
const body = res.body;
|
|
42
|
+
const lines = [
|
|
43
|
+
`## Subdomain Claimed`,
|
|
44
|
+
``,
|
|
45
|
+
`| Field | Value |`,
|
|
46
|
+
`|-------|-------|`,
|
|
47
|
+
`| subdomain | \`${body.name}\` |`,
|
|
48
|
+
`| url | ${body.url} |`,
|
|
49
|
+
`| deployment | \`${body.deployment_id}\` |`,
|
|
50
|
+
`| deployment_url | ${body.deployment_url} |`,
|
|
51
|
+
``,
|
|
52
|
+
`The site is now live at **${body.url}**`,
|
|
53
|
+
];
|
|
54
|
+
return { content: [{ type: "text", text: lines.join("\n") }] };
|
|
55
|
+
}
|
|
56
|
+
export const deleteSubdomainSchema = {
|
|
57
|
+
name: z
|
|
58
|
+
.string()
|
|
59
|
+
.describe("Subdomain name to release (e.g. 'myapp')"),
|
|
60
|
+
project_id: z
|
|
61
|
+
.string()
|
|
62
|
+
.optional()
|
|
63
|
+
.describe("Optional project ID for ownership verification. Uses stored service_key for auth."),
|
|
64
|
+
};
|
|
65
|
+
export async function handleDeleteSubdomain(args) {
|
|
66
|
+
let authHeader = {};
|
|
67
|
+
if (args.project_id) {
|
|
68
|
+
const project = getProject(args.project_id);
|
|
69
|
+
if (!project) {
|
|
70
|
+
return {
|
|
71
|
+
content: [{ type: "text", text: `Error: Project "${args.project_id}" not found in key store. Provision a project first.` }],
|
|
72
|
+
isError: true,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
authHeader = { Authorization: `Bearer ${project.service_key}` };
|
|
76
|
+
}
|
|
77
|
+
const res = await apiRequest(`/v1/subdomains/${encodeURIComponent(args.name)}`, {
|
|
78
|
+
method: "DELETE",
|
|
79
|
+
headers: authHeader,
|
|
80
|
+
});
|
|
81
|
+
if (!res.ok) {
|
|
82
|
+
const body = res.body;
|
|
83
|
+
const msg = body.error || `HTTP ${res.status}`;
|
|
84
|
+
return {
|
|
85
|
+
content: [{ type: "text", text: `Error: ${msg}` }],
|
|
86
|
+
isError: true,
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
return {
|
|
90
|
+
content: [{ type: "text", text: `## Subdomain Released\n\nSubdomain \`${args.name}\` has been deleted. The URL \`https://${args.name}.run402.com\` is no longer active.` }],
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=subdomain.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subdomain.js","sourceRoot":"","sources":["../../src/tools/subdomain.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,IAAI,EAAE,CAAC;SACJ,MAAM,EAAE;SACR,QAAQ,CAAC,wGAAwG,CAAC;IACrH,aAAa,EAAE,CAAC;SACb,MAAM,EAAE;SACR,QAAQ,CAAC,4EAA4E,CAAC;IACzF,UAAU,EAAE,CAAC;SACV,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CAAC,+EAA+E,CAAC;CAC7F,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,IAI1C;IACC,IAAI,UAAU,GAA2B,EAAE,CAAC;IAE5C,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;QACpB,MAAM,OAAO,GAAG,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC5C,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,OAAO;gBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,mBAAmB,IAAI,CAAC,UAAU,sDAAsD,EAAE,CAAC;gBAC3H,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,IAAI,EAAE,wCAAwC,IAAI,CAAC,IAAI,0CAA0C,IAAI,CAAC,IAAI,oCAAoC,EAAE,CAAC;KAC5K,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const uploadFileSchema: {
|
|
3
|
+
project_id: z.ZodString;
|
|
4
|
+
bucket: z.ZodString;
|
|
5
|
+
path: z.ZodString;
|
|
6
|
+
content: z.ZodString;
|
|
7
|
+
content_type: z.ZodDefault<z.ZodString>;
|
|
8
|
+
};
|
|
9
|
+
export declare function handleUploadFile(args: {
|
|
10
|
+
project_id: string;
|
|
11
|
+
bucket: string;
|
|
12
|
+
path: string;
|
|
13
|
+
content: string;
|
|
14
|
+
content_type?: string;
|
|
15
|
+
}): Promise<{
|
|
16
|
+
content: Array<{
|
|
17
|
+
type: "text";
|
|
18
|
+
text: string;
|
|
19
|
+
}>;
|
|
20
|
+
isError?: boolean;
|
|
21
|
+
}>;
|
|
22
|
+
//# sourceMappingURL=upload-file.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upload-file.d.ts","sourceRoot":"","sources":["../../src/tools/upload-file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,gBAAgB;;;;;;CAS5B,CAAC;AAEF,wBAAsB,gBAAgB,CAAC,IAAI,EAAE;IAC3C,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,GAAG,OAAO,CAAC;IAAE,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC,CA6CjF"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { apiRequest } from "../client.js";
|
|
3
|
+
import { getProject } from "../keystore.js";
|
|
4
|
+
export const uploadFileSchema = {
|
|
5
|
+
project_id: z.string().describe("The project ID"),
|
|
6
|
+
bucket: z.string().describe("Storage bucket name"),
|
|
7
|
+
path: z.string().describe("File path within the bucket (e.g. 'logs/2024-01-01.txt')"),
|
|
8
|
+
content: z.string().describe("Text content to upload"),
|
|
9
|
+
content_type: z
|
|
10
|
+
.string()
|
|
11
|
+
.default("text/plain")
|
|
12
|
+
.describe("MIME type (default: text/plain)"),
|
|
13
|
+
};
|
|
14
|
+
export async function handleUploadFile(args) {
|
|
15
|
+
const project = getProject(args.project_id);
|
|
16
|
+
if (!project) {
|
|
17
|
+
return {
|
|
18
|
+
content: [
|
|
19
|
+
{
|
|
20
|
+
type: "text",
|
|
21
|
+
text: `Error: Project \`${args.project_id}\` not found in key store. Provision a project first.`,
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
|
+
isError: true,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
const contentType = args.content_type || "text/plain";
|
|
28
|
+
const apiPath = `/storage/v1/object/${args.bucket}/${args.path}`;
|
|
29
|
+
const res = await apiRequest(apiPath, {
|
|
30
|
+
method: "POST",
|
|
31
|
+
rawBody: args.content,
|
|
32
|
+
headers: {
|
|
33
|
+
"Content-Type": contentType,
|
|
34
|
+
apikey: project.anon_key,
|
|
35
|
+
Authorization: `Bearer ${project.anon_key}`,
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
if (!res.ok) {
|
|
39
|
+
const body = res.body;
|
|
40
|
+
const msg = body.error || `HTTP ${res.status}`;
|
|
41
|
+
return {
|
|
42
|
+
content: [{ type: "text", text: `Upload Error: ${msg}` }],
|
|
43
|
+
isError: true,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
const body = res.body;
|
|
47
|
+
return {
|
|
48
|
+
content: [
|
|
49
|
+
{
|
|
50
|
+
type: "text",
|
|
51
|
+
text: `File uploaded: **${body.key}** (${body.size} bytes)`,
|
|
52
|
+
},
|
|
53
|
+
],
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=upload-file.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upload-file.js","sourceRoot":"","sources":["../../src/tools/upload-file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,gBAAgB,CAAC;IACjD,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,qBAAqB,CAAC;IAClD,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,0DAA0D,CAAC;IACrF,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,wBAAwB,CAAC;IACtD,YAAY,EAAE,CAAC;SACZ,MAAM,EAAE;SACR,OAAO,CAAC,YAAY,CAAC;SACrB,QAAQ,CAAC,iCAAiC,CAAC;CAC/C,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,IAMtC;IACC,MAAM,OAAO,GAAG,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAC5C,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,oBAAoB,IAAI,CAAC,UAAU,uDAAuD;iBACjG;aACF;YACD,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC;IAED,MAAM,WAAW,GAAG,IAAI,CAAC,YAAY,IAAI,YAAY,CAAC;IACtD,MAAM,OAAO,GAAG,sBAAsB,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;IAEjE,MAAM,GAAG,GAAG,MAAM,UAAU,CAAC,OAAO,EAAE;QACpC,MAAM,EAAE,MAAM;QACd,OAAO,EAAE,IAAI,CAAC,OAAO;QACrB,OAAO,EAAE;YACP,cAAc,EAAE,WAAW;YAC3B,MAAM,EAAE,OAAO,CAAC,QAAQ;YACxB,aAAa,EAAE,UAAU,OAAO,CAAC,QAAQ,EAAE;SAC5C;KACF,CAAC,CAAC;IAEH,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;QACZ,MAAM,IAAI,GAAG,GAAG,CAAC,IAA+B,CAAC;QACjD,MAAM,GAAG,GAAI,IAAI,CAAC,KAAgB,IAAI,QAAQ,GAAG,CAAC,MAAM,EAAE,CAAC;QAC3D,OAAO;YACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,iBAAiB,GAAG,EAAE,EAAE,CAAC;YACzD,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC;IAED,MAAM,IAAI,GAAG,GAAG,CAAC,IAAqC,CAAC;IACvD,OAAO;QACL,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,oBAAoB,IAAI,CAAC,GAAG,OAAO,IAAI,CAAC,IAAI,SAAS;aAC5D;SACF;KACF,CAAC;AACJ,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "run402-mcp",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "MCP server for Run402 — AI-native Postgres databases with REST API, auth, storage, and row-level security. Pay with x402 USDC micropayments.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"bin": {
|
|
9
|
+
"run402-mcp": "dist/index.js"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"dist",
|
|
13
|
+
"README.md"
|
|
14
|
+
],
|
|
15
|
+
"scripts": {
|
|
16
|
+
"build": "tsc",
|
|
17
|
+
"start": "node dist/index.js"
|
|
18
|
+
},
|
|
19
|
+
"keywords": [
|
|
20
|
+
"mcp",
|
|
21
|
+
"model-context-protocol",
|
|
22
|
+
"postgres",
|
|
23
|
+
"database",
|
|
24
|
+
"ai",
|
|
25
|
+
"agent",
|
|
26
|
+
"run402",
|
|
27
|
+
"x402",
|
|
28
|
+
"supabase-alternative",
|
|
29
|
+
"backend-as-a-service"
|
|
30
|
+
],
|
|
31
|
+
"repository": {
|
|
32
|
+
"type": "git",
|
|
33
|
+
"url": "https://github.com/MajorTal/run402.git",
|
|
34
|
+
"directory": "packages/mcp"
|
|
35
|
+
},
|
|
36
|
+
"homepage": "https://run402.com",
|
|
37
|
+
"bugs": "https://github.com/MajorTal/run402/issues",
|
|
38
|
+
"author": "Kychee Technologies",
|
|
39
|
+
"publishConfig": {
|
|
40
|
+
"access": "public"
|
|
41
|
+
},
|
|
42
|
+
"engines": {
|
|
43
|
+
"node": ">=18"
|
|
44
|
+
},
|
|
45
|
+
"dependencies": {
|
|
46
|
+
"@modelcontextprotocol/sdk": "^1.27.1",
|
|
47
|
+
"zod": "^3.24.0"
|
|
48
|
+
},
|
|
49
|
+
"devDependencies": {
|
|
50
|
+
"@run402/shared": "1.0.0",
|
|
51
|
+
"@types/node": "^22.0.0",
|
|
52
|
+
"tsx": "^4.19.0",
|
|
53
|
+
"typescript": "^5.7.0"
|
|
54
|
+
},
|
|
55
|
+
"license": "MIT"
|
|
56
|
+
}
|