@otwa/mcp-server 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/CHANGELOG.md +11 -0
- package/LICENSE +21 -0
- package/README.md +228 -0
- package/dist/client/errors.js +67 -0
- package/dist/client/errors.js.map +1 -0
- package/dist/client/http.js +92 -0
- package/dist/client/http.js.map +1 -0
- package/dist/client/types.js +6 -0
- package/dist/client/types.js.map +1 -0
- package/dist/guards/confirm.js +25 -0
- package/dist/guards/confirm.js.map +1 -0
- package/dist/http/index.js +138 -0
- package/dist/http/index.js.map +1 -0
- package/dist/index.js +73 -0
- package/dist/index.js.map +1 -0
- package/dist/server.js +21 -0
- package/dist/server.js.map +1 -0
- package/dist/tools/_helpers.js +45 -0
- package/dist/tools/_helpers.js.map +1 -0
- package/dist/tools/_register.js +18 -0
- package/dist/tools/_register.js.map +1 -0
- package/dist/tools/account.js +16 -0
- package/dist/tools/account.js.map +1 -0
- package/dist/tools/billing.js +53 -0
- package/dist/tools/billing.js.map +1 -0
- package/dist/tools/catalog.js +36 -0
- package/dist/tools/catalog.js.map +1 -0
- package/dist/tools/networking.js +48 -0
- package/dist/tools/networking.js.map +1 -0
- package/dist/tools/servers.js +246 -0
- package/dist/tools/servers.js.map +1 -0
- package/dist/tools/webhooks.js +54 -0
- package/dist/tools/webhooks.js.map +1 -0
- package/dist/util/env.js +18 -0
- package/dist/util/env.js.map +1 -0
- package/dist/util/version.js +20 -0
- package/dist/util/version.js.map +1 -0
- package/package.json +63 -0
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.registerWebhookTools = registerWebhookTools;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const confirm_1 = require("../guards/confirm");
|
|
6
|
+
const _helpers_1 = require("./_helpers");
|
|
7
|
+
function registerWebhookTools(server, client) {
|
|
8
|
+
server.registerTool('otwa_list_webhooks', {
|
|
9
|
+
title: 'List webhook subscriptions',
|
|
10
|
+
description: 'Returns every webhook the account has registered, with delivery URL and the events each one ' +
|
|
11
|
+
'subscribes to (e.g. server.created, invoice.paid).',
|
|
12
|
+
inputSchema: {},
|
|
13
|
+
}, (0, _helpers_1.safeHandler)(async () => {
|
|
14
|
+
const res = await client.request('/v1/webhooks');
|
|
15
|
+
return (0, _helpers_1.jsonResult)(res);
|
|
16
|
+
}));
|
|
17
|
+
server.registerTool('otwa_create_webhook', {
|
|
18
|
+
title: 'Register a new webhook subscription',
|
|
19
|
+
description: 'Creates a webhook subscription. otwa.cloud will POST signed JSON to the given URL whenever any ' +
|
|
20
|
+
'of the listed events fire. The signing secret is returned ONCE in this response — save it; the ' +
|
|
21
|
+
'API will not reveal it again unless explicitly rotated.',
|
|
22
|
+
inputSchema: {
|
|
23
|
+
url: zod_1.z
|
|
24
|
+
.string()
|
|
25
|
+
.url()
|
|
26
|
+
.describe('HTTPS endpoint that will receive delivery POSTs. Must accept JSON.'),
|
|
27
|
+
events: zod_1.z
|
|
28
|
+
.array(zod_1.z.string().min(1))
|
|
29
|
+
.min(1)
|
|
30
|
+
.describe('Event names to subscribe to, e.g. ["server.created", "server.destroyed", "invoice.paid"].'),
|
|
31
|
+
},
|
|
32
|
+
}, (0, _helpers_1.safeHandler)(async ({ url, events }) => {
|
|
33
|
+
const res = await client.request('/v1/webhooks', {
|
|
34
|
+
method: 'POST',
|
|
35
|
+
body: { url, events },
|
|
36
|
+
});
|
|
37
|
+
return (0, _helpers_1.jsonResult)(res);
|
|
38
|
+
}));
|
|
39
|
+
server.registerTool('otwa_delete_webhook', {
|
|
40
|
+
title: 'Delete a webhook subscription',
|
|
41
|
+
description: 'Permanently removes a webhook. Any in-flight deliveries finish; nothing further is sent. ' +
|
|
42
|
+
'Cannot be undone — the consumer just needs to re-create it.',
|
|
43
|
+
inputSchema: {
|
|
44
|
+
id: zod_1.z.string().describe('Webhook UUID.'),
|
|
45
|
+
...confirm_1.mediumConfirm,
|
|
46
|
+
},
|
|
47
|
+
}, (0, _helpers_1.safeHandler)(async ({ id }) => {
|
|
48
|
+
const res = await client.request(`/v1/webhooks/${encodeURIComponent(id)}`, {
|
|
49
|
+
method: 'DELETE',
|
|
50
|
+
});
|
|
51
|
+
return (0, _helpers_1.jsonResult)(res);
|
|
52
|
+
}));
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=webhooks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webhooks.js","sourceRoot":"","sources":["../../src/tools/webhooks.ts"],"names":[],"mappings":";;AAOA,oDAiEC;AAvED,6BAAwB;AAGxB,+CAAkD;AAClD,yCAAqD;AAErD,SAAgB,oBAAoB,CAAC,MAAiB,EAAE,MAAkB;IACxE,MAAM,CAAC,YAAY,CACjB,oBAAoB,EACpB;QACE,KAAK,EAAE,4BAA4B;QACnC,WAAW,EACT,8FAA8F;YAC9F,oDAAoD;QACtD,WAAW,EAAE,EAAE;KAChB,EACD,IAAA,sBAAW,EAAC,KAAK,IAAI,EAAE;QACrB,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,OAAO,CAAmB,cAAc,CAAC,CAAC;QACnE,OAAO,IAAA,qBAAU,EAAC,GAAG,CAAC,CAAC;IACzB,CAAC,CAAC,CACH,CAAC;IAEF,MAAM,CAAC,YAAY,CACjB,qBAAqB,EACrB;QACE,KAAK,EAAE,qCAAqC;QAC5C,WAAW,EACT,iGAAiG;YACjG,iGAAiG;YACjG,yDAAyD;QAC3D,WAAW,EAAE;YACX,GAAG,EAAE,OAAC;iBACH,MAAM,EAAE;iBACR,GAAG,EAAE;iBACL,QAAQ,CAAC,oEAAoE,CAAC;YACjF,MAAM,EAAE,OAAC;iBACN,KAAK,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;iBACxB,GAAG,CAAC,CAAC,CAAC;iBACN,QAAQ,CACP,2FAA2F,CAC5F;SACJ;KACF,EACD,IAAA,sBAAW,EAAC,KAAK,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE;QACpC,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,OAAO,CAAiB,cAAc,EAAE;YAC/D,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE;SACtB,CAAC,CAAC;QACH,OAAO,IAAA,qBAAU,EAAC,GAAG,CAAC,CAAC;IACzB,CAAC,CAAC,CACH,CAAC;IAEF,MAAM,CAAC,YAAY,CACjB,qBAAqB,EACrB;QACE,KAAK,EAAE,+BAA+B;QACtC,WAAW,EACT,2FAA2F;YAC3F,6DAA6D;QAC/D,WAAW,EAAE;YACX,EAAE,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,eAAe,CAAC;YACxC,GAAG,uBAAa;SACjB;KACF,EACD,IAAA,sBAAW,EAAC,KAAK,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE;QAC3B,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC,gBAAgB,kBAAkB,CAAC,EAAE,CAAC,EAAE,EAAE;YACzE,MAAM,EAAE,QAAQ;SACjB,CAAC,CAAC;QACH,OAAO,IAAA,qBAAU,EAAC,GAAG,CAAC,CAAC;IACzB,CAAC,CAAC,CACH,CAAC;AACJ,CAAC"}
|
package/dist/util/env.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.readEnv = readEnv;
|
|
4
|
+
function readEnv() {
|
|
5
|
+
const apiKey = process.env.OTWA_API_KEY?.trim() || '';
|
|
6
|
+
if (!apiKey) {
|
|
7
|
+
throw new Error('OTWA_API_KEY is not set. Create one at https://otwa.cloud/dashboard/settings/api-keys ' +
|
|
8
|
+
'and set the OTWA_API_KEY environment variable, then restart this MCP server.');
|
|
9
|
+
}
|
|
10
|
+
if (!apiKey.startsWith('otwa_')) {
|
|
11
|
+
throw new Error('OTWA_API_KEY does not look like an otwa.cloud API key (expected prefix "otwa_"). ' +
|
|
12
|
+
'Generate a new key at https://otwa.cloud/dashboard/settings/api-keys.');
|
|
13
|
+
}
|
|
14
|
+
const apiBase = (process.env.OTWA_API_BASE?.trim() || 'https://api.otwa.cloud').replace(/\/+$/, '');
|
|
15
|
+
const telemetry = /^(1|true|yes)$/i.test(process.env.OTWA_TELEMETRY?.trim() || '');
|
|
16
|
+
return { apiKey, apiBase, telemetry };
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=env.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env.js","sourceRoot":"","sources":["../../src/util/env.ts"],"names":[],"mappings":";;AAMA,0BAiBC;AAjBD,SAAgB,OAAO;IACrB,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,YAAY,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IACtD,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CACb,wFAAwF;YACtF,8EAA8E,CACjF,CAAC;IACJ,CAAC;IACD,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;QAChC,MAAM,IAAI,KAAK,CACb,mFAAmF;YACjF,uEAAuE,CAC1E,CAAC;IACJ,CAAC;IACD,MAAM,OAAO,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,IAAI,EAAE,IAAI,wBAAwB,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IACpG,MAAM,SAAS,GAAG,iBAAiB,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;IACnF,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;AACxC,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.packageInfo = packageInfo;
|
|
4
|
+
const fs_1 = require("fs");
|
|
5
|
+
const path_1 = require("path");
|
|
6
|
+
let cached = null;
|
|
7
|
+
function packageInfo() {
|
|
8
|
+
if (cached)
|
|
9
|
+
return cached;
|
|
10
|
+
try {
|
|
11
|
+
const raw = (0, fs_1.readFileSync)((0, path_1.join)(__dirname, '..', '..', 'package.json'), 'utf-8');
|
|
12
|
+
const pkg = JSON.parse(raw);
|
|
13
|
+
cached = { name: pkg.name || '@otwa/mcp-server', version: pkg.version || '0.0.0' };
|
|
14
|
+
}
|
|
15
|
+
catch {
|
|
16
|
+
cached = { name: '@otwa/mcp-server', version: '0.0.0' };
|
|
17
|
+
}
|
|
18
|
+
return cached;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=version.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/util/version.ts"],"names":[],"mappings":";;AAKA,kCAUC;AAfD,2BAAkC;AAClC,+BAA4B;AAE5B,IAAI,MAAM,GAA6C,IAAI,CAAC;AAE5D,SAAgB,WAAW;IACzB,IAAI,MAAM;QAAE,OAAO,MAAM,CAAC;IAC1B,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,IAAA,iBAAY,EAAC,IAAA,WAAI,EAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,cAAc,CAAC,EAAE,OAAO,CAAC,CAAC;QAC/E,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAwC,CAAC;QACnE,MAAM,GAAG,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,IAAI,kBAAkB,EAAE,OAAO,EAAE,GAAG,CAAC,OAAO,IAAI,OAAO,EAAE,CAAC;IACrF,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,GAAG,EAAE,IAAI,EAAE,kBAAkB,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC;IAC1D,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@otwa/mcp-server",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Official Model Context Protocol server for otwa.cloud — provision and manage servers from Claude Code, Cursor, Windsurf and other MCP-capable AI tools.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"homepage": "https://otwa.cloud/docs/integrations/mcp",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/otwacloud/mcp-server.git"
|
|
10
|
+
},
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/otwacloud/mcp-server/issues"
|
|
13
|
+
},
|
|
14
|
+
"keywords": [
|
|
15
|
+
"mcp",
|
|
16
|
+
"model-context-protocol",
|
|
17
|
+
"otwa",
|
|
18
|
+
"otwa.cloud",
|
|
19
|
+
"vps",
|
|
20
|
+
"cloud",
|
|
21
|
+
"claude",
|
|
22
|
+
"cursor",
|
|
23
|
+
"ai"
|
|
24
|
+
],
|
|
25
|
+
"engines": {
|
|
26
|
+
"node": ">=20"
|
|
27
|
+
},
|
|
28
|
+
"type": "commonjs",
|
|
29
|
+
"main": "dist/index.js",
|
|
30
|
+
"bin": {
|
|
31
|
+
"otwa-mcp": "dist/index.js",
|
|
32
|
+
"otwa-mcp-http": "dist/http/index.js"
|
|
33
|
+
},
|
|
34
|
+
"files": [
|
|
35
|
+
"dist",
|
|
36
|
+
"README.md",
|
|
37
|
+
"LICENSE",
|
|
38
|
+
"CHANGELOG.md"
|
|
39
|
+
],
|
|
40
|
+
"publishConfig": {
|
|
41
|
+
"access": "public"
|
|
42
|
+
},
|
|
43
|
+
"dependencies": {
|
|
44
|
+
"@modelcontextprotocol/sdk": "^1.21.0",
|
|
45
|
+
"express": "^4.21.0",
|
|
46
|
+
"zod": "4.3.6"
|
|
47
|
+
},
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"@types/express": "^4.17.21",
|
|
50
|
+
"@types/node": "^22.0.0",
|
|
51
|
+
"tsx": "^4.19.0",
|
|
52
|
+
"typescript": "^5.7.2"
|
|
53
|
+
},
|
|
54
|
+
"scripts": {
|
|
55
|
+
"dev": "tsx watch src/index.ts",
|
|
56
|
+
"dev:http": "tsx watch src/http/index.ts",
|
|
57
|
+
"start": "node dist/index.js",
|
|
58
|
+
"start:http": "node dist/http/index.js",
|
|
59
|
+
"build": "tsc -p tsconfig.json",
|
|
60
|
+
"type-check": "tsc -p tsconfig.json --noEmit",
|
|
61
|
+
"clean": "rm -rf dist"
|
|
62
|
+
}
|
|
63
|
+
}
|