@ductape/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.
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Client for the Ductape backend SDK proxy using Publishable Key.
3
+ */
4
+ export declare const API_BASE_URL = "https://api.ductape.app";
5
+ export type SDKModule = 'product' | 'app' | 'databases' | 'graph' | 'webhooks' | 'notifications' | 'messageBrokers' | 'storage' | 'vector' | 'caches' | 'sessions' | 'quotas' | 'actions' | 'features' | 'jobs' | 'logs' | 'resilience' | 'health' | 'fallback' | 'secrets';
6
+ /**
7
+ * Execute an SDK operation via the backend proxy using a Publishable Key.
8
+ */
9
+ export declare function executeViaProxy<T = unknown>(publishable_key: string, module: SDKModule, method: string, params?: unknown[]): Promise<T>;
10
+ export interface IGenerateExecutablePayloadRequest {
11
+ workspace_id: string;
12
+ user_id: string;
13
+ public_key: string;
14
+ product_tag: string;
15
+ env_slug: string;
16
+ operation_family: string;
17
+ method: string;
18
+ targets?: Record<string, unknown>;
19
+ include_session?: boolean;
20
+ include_cache?: boolean;
21
+ schema_mode?: 'strict' | 'best_effort';
22
+ input_hint?: Record<string, unknown>;
23
+ }
24
+ export interface IGenerateExecutablePayloadResponse {
25
+ payload: Record<string, unknown>;
26
+ meta: Record<string, unknown>;
27
+ }
28
+ export declare function generateExecutablePayload<T = IGenerateExecutablePayloadResponse>(request: IGenerateExecutablePayloadRequest): Promise<T>;
29
+ //# sourceMappingURL=proxy-client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"proxy-client.d.ts","sourceRoot":"","sources":["../src/proxy-client.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,eAAO,MAAM,YAAY,4BAA4B,CAAC;AAEtD,MAAM,MAAM,SAAS,GACjB,SAAS,GACT,KAAK,GACL,WAAW,GACX,OAAO,GACP,UAAU,GACV,eAAe,GACf,gBAAgB,GAChB,SAAS,GACT,QAAQ,GACR,QAAQ,GACR,UAAU,GACV,QAAQ,GACR,SAAS,GACT,UAAU,GACV,MAAM,GACN,MAAM,GACN,YAAY,GACZ,QAAQ,GACR,UAAU,GACV,SAAS,CAAC;AAUd;;GAEG;AACH,wBAAsB,eAAe,CAAC,CAAC,GAAG,OAAO,EAC/C,eAAe,EAAE,MAAM,EACvB,MAAM,EAAE,SAAS,EACjB,MAAM,EAAE,MAAM,EACd,MAAM,GAAE,OAAO,EAAO,GACrB,OAAO,CAAC,CAAC,CAAC,CAuBZ;AAED,MAAM,WAAW,iCAAiC;IAChD,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,gBAAgB,EAAE,MAAM,CAAC;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,WAAW,CAAC,EAAE,QAAQ,GAAG,aAAa,CAAC;IACvC,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACtC;AAED,MAAM,WAAW,kCAAkC;IACjD,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC/B;AAQD,wBAAsB,yBAAyB,CAAC,CAAC,GAAG,kCAAkC,EACpF,OAAO,EAAE,iCAAiC,GACzC,OAAO,CAAC,CAAC,CAAC,CAmBZ"}
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Client for the Ductape backend SDK proxy using Publishable Key.
3
+ */
4
+ export const API_BASE_URL = 'https://api.ductape.app';
5
+ /**
6
+ * Execute an SDK operation via the backend proxy using a Publishable Key.
7
+ */
8
+ export async function executeViaProxy(publishable_key, module, method, params = []) {
9
+ const url = `${API_BASE_URL.replace(/\/$/, '')}/proxy/v1/sdk-proxy/execute`;
10
+ const res = await fetch(url, {
11
+ method: 'POST',
12
+ headers: {
13
+ 'Content-Type': 'application/json',
14
+ },
15
+ body: JSON.stringify({
16
+ publishable_key,
17
+ module,
18
+ method,
19
+ params,
20
+ }),
21
+ });
22
+ const body = (await res.json());
23
+ if (!res.ok) {
24
+ throw new Error(body.message ?? `Proxy request failed: ${res.status}`);
25
+ }
26
+ if (typeof body.status === 'boolean' && !body.status) {
27
+ throw new Error(body.message ?? 'SDK operation failed');
28
+ }
29
+ return body.data?.data;
30
+ }
31
+ export async function generateExecutablePayload(request) {
32
+ const url = `${API_BASE_URL.replace(/\/$/, '')}/integrations/v1/payloads/generate`;
33
+ const res = await fetch(url, {
34
+ method: 'POST',
35
+ headers: {
36
+ 'Content-Type': 'application/json',
37
+ 'x-access-key': request.public_key,
38
+ },
39
+ body: JSON.stringify(request),
40
+ });
41
+ const body = (await res.json());
42
+ if (!res.ok) {
43
+ throw new Error(body.message ?? `Payload generation request failed: ${res.status}`);
44
+ }
45
+ if (typeof body.status === 'boolean' && !body.status) {
46
+ throw new Error(body.message ?? 'Payload generation failed');
47
+ }
48
+ return body.data;
49
+ }
package/docs/TOOLS.md ADDED
@@ -0,0 +1,204 @@
1
+ # MCP Tools Reference
2
+
3
+ The Ductape MCP server exposes **one tool**. All operations go through the backend proxy; the list of allowed modules and methods is enforced by the proxy
4
+
5
+ ---
6
+
7
+ ## Tool: `ductape_execute`
8
+
9
+ Executes a Ductape SDK operation via the backend proxy. Use this for databases, graph, storage, vector, caches, webhooks, jobs, and all other supported modules.
10
+
11
+ ### Arguments
12
+
13
+ | Argument | Type | Description |
14
+ |----------|------|-------------|
15
+ | `module` | string | SDK module name (see **Modules** below). |
16
+ | `method` | string | Method name for that module (see **Allowed methods per module**). |
17
+ | `params` | array | Arguments for the method, in the same order as the SDK signature. |
18
+
19
+ ### Example
20
+
21
+ - **Database query:**
22
+ `{ "module": "databases", "method": "query", "params": [{ "product": "my-product", "database": "mongo-db", "env": "prd", "query": "{}" }] }`
23
+
24
+ - **List storage buckets:**
25
+ `{ "module": "storage", "method": "list", "params": [] }`
26
+
27
+ - **Vector search:**
28
+ `{ "module": "vector", "method": "findSimilar", "params": ["namespace", "vector", { "topK": 10 }] }`
29
+
30
+ ### Response
31
+
32
+ Returns the SDK method result as JSON. On error, the tool returns an error message (e.g. validation or proxy failure).
33
+
34
+ ---
35
+
36
+ ## Tool: `ductape_generate_payload`
37
+
38
+ Generates canonical executable payload templates from backend route `/integrations/v1/payloads/generate`.
39
+ Use this when the MCP agent needs payload + metadata context before writing SDK code snippets for engineers.
40
+
41
+ ### Arguments
42
+
43
+ | Argument | Type | Description |
44
+ |----------|------|-------------|
45
+ | `workspace_id` | string | Workspace ID |
46
+ | `user_id` | string | User ID |
47
+ | `public_key` | string | Workspace public key (also sent as x-access-key) |
48
+ | `product_tag` | string | Product tag (e.g. `ductape:my-product`) |
49
+ | `env_slug` | string | Environment slug (`prd`, `stg`, etc.) |
50
+ | `operation_family` | string | Executable family (`action`, `workflow`, `database`, `graph`, `vector`, `storage`, `notification`, `messaging`) |
51
+ | `method` | string | Execution method (`run`, `dispatch`, `find`, `insert`, `send`, etc.) |
52
+ | `targets` | object | Optional component targeting payload |
53
+ | `schema_mode` | enum | `strict` or `best_effort` |
54
+ | `include_session` | boolean | Include session tags/context |
55
+ | `include_cache` | boolean | Include cache tags/context |
56
+ | `input_hint` | object | Optional schema/input hint used in payload generation |
57
+
58
+ ### Response
59
+
60
+ Returns JSON object:
61
+
62
+ - `payload`: canonical executable payload template
63
+ - `meta`: schema context, validation info, warnings, and inferred tags
64
+
65
+ ---
66
+
67
+ ## Tool: `ductape_generate_snippet`
68
+
69
+ Builds on `ductape_generate_payload` and returns both:
70
+
71
+ - `payload` (canonical payload/meta from backend)
72
+ - `snippet` (ready SDK example code)
73
+
74
+ ### Arguments
75
+
76
+ Same arguments as `ductape_generate_payload`, plus:
77
+
78
+ | Argument | Type | Description |
79
+ |----------|------|-------------|
80
+ | `language` | enum | `typescript` or `python` |
81
+
82
+ ### Response
83
+
84
+ Returns JSON object:
85
+
86
+ - `payload`: backend payload generation response
87
+ - `snippet`: executable code sample string
88
+
89
+ ---
90
+
91
+ ## Modules
92
+
93
+ The following modules are available. Each module supports only the methods listed for it; any other method will be rejected by the proxy.
94
+
95
+ - `product` – Product, environments, apps, webhooks, health
96
+ - `app` – App, environments, variables, constants, actions, auths, webhooks
97
+ - `databases` – Connect, query, CRUD, schema, migrations, actions
98
+ - `graph` – Connect, nodes, relationships, traversal, schema, actions, transactions
99
+ - `webhooks` – Create, list, events, enable, trigger
100
+ - `notifications` – Messages, templates, dispatch, send
101
+ - `messageBrokers` – Brokers, topics, publish, subscribe, messages
102
+ - `storage` – Buckets, upload, download, list files, signed URLs
103
+ - `vector` – Indexes, upsert, query, similar, namespaces, actions
104
+ - `caches` – Create, get, set, del, ttl, keys
105
+ - `sessions` – Create, start, verify, refresh, revoke
106
+ - `quotas` – Create, check, consume, reset, usage
107
+ - `actions` – Create, list, dispatch, run
108
+ - `features` – Feature flags, isEnabled, run
109
+ - `jobs` – Create, list, cancel, pause, resume, retry
110
+ - `logs` – Query, fetch, list, stream
111
+ - `resilience` – Quotas and fallbacks sub-modules
112
+ - `health` – Define, create, status, check, run
113
+ - `fallback` – Define, create, run, dispatch
114
+ - `secrets` – Create, list, resolve, revoke, validate
115
+
116
+ ---
117
+
118
+ ## Allowed methods per module
119
+
120
+ Only these methods can be called for each module. Method names are case-sensitive.
121
+
122
+ ### product
123
+
124
+ `create`, `fetch`, `update`, `init`, `updateValidation`, `environments.create`, `environments.list`, `environments.fetch`, `environments.update`, `apps.connect`, `apps.add`, `apps.list`, `apps.fetch`, `apps.update`, `apps.webhooks.list`, `apps.webhooks.enable`, `apps.webhooks.generateLink`, `apps.health.create`, `apps.health.update`, `apps.health.fetch`, `apps.health.list`
125
+
126
+ ### app
127
+
128
+ `create`, `fetch`, `update`, `init`, `environments.create`, `environments.list`, `environments.fetch`, `environments.update`, `variables.create`, `variables.list`, `variables.fetch`, `variables.update`, `constants.create`, `constants.list`, `constants.fetch`, `constants.update`, `actions.create`, `actions.list`, `actions.fetch`, `actions.update`, `actions.delete`, `auths.create`, `auths.list`, `auths.fetch`, `auths.update`, `webhooks.create`, `webhooks.list`, `webhooks.fetch`, `webhooks.update`, `webhooks.events.create`, `webhooks.events.list`, `webhooks.events.fetch`, `webhooks.events.update`
129
+
130
+ ### databases
131
+
132
+ `connect`, `testConnection`, `disconnect`, `closeAll`, `getCurrentContext`, `connection`, `create`, `register`, `list`, `fetch`, `update`, `updateLocalConfig`, `query`, `insert`, `updateRecords`, `delete`, `upsert`, `count`, `sum`, `avg`, `min`, `max`, `aggregate`, `beginTransaction`, `schema.create`, `schema.drop`, `schema.addField`, `schema.dropField`, `schema.renameField`, `schema.modifyField`, `schema.createIndex`, `schema.dropIndex`, `schema.addConstraint`, `schema.dropConstraint`, `schema.rename`, `schema.exists`, `schema.list`, `schema.describe`, `schema.indexes`, `migration.create`, `migration.update`, `migration.fetch`, `migration.list`, `migration.delete`, `migration.run`, `migration.rollback`, `migration.history`, `migration.status`, `action.create`, `action.update`, `action.fetch`, `action.list`, `action.delete`, `action.dispatch`, `dispatch`, `getAdapter`, `getService`
133
+
134
+ ### graph
135
+
136
+ `connect`, `testConnection`, `disconnect`, `disconnectAll`, `getCurrentContext`, `create`, `fetchAll`, `fetch`, `update`, `delete`, `createNode`, `findNodes`, `findNodeById`, `updateNode`, `deleteNode`, `mergeNode`, `addLabels`, `removeLabels`, `setLabels`, `createRelationship`, `findRelationships`, `findRelationshipById`, `updateRelationship`, `deleteRelationship`, `mergeRelationship`, `traverse`, `shortestPath`, `allPaths`, `getNeighborhood`, `findConnectedComponents`, `countNodes`, `countRelationships`, `getStatistics`, `fullTextSearch`, `vectorSearch`, `query`, `schema.createNodeIndex`, `schema.createNodeConstraint`, `schema.createRelationshipIndex`, `schema.listIndexes`, `schema.listConstraints`, `schema.dropIndex`, `schema.dropConstraint`, `schema.listLabels`, `schema.listRelationshipTypes`, `action.create`, `action.list`, `action.fetch`, `action.update`, `action.delete`, `action.dispatch`, `executeTransaction`, `beginTransaction`, `commitTransaction`, `rollbackTransaction`, `dispatch`, `execute`, `getService`
137
+
138
+ ### webhooks
139
+
140
+ `create`, `createWithEvents`, `list`, `fetch`, `update`, `enable`, `generateLink`, `trigger`, `events.create`, `events.list`, `events.fetch`, `events.update`
141
+
142
+ ### notifications
143
+
144
+ `getMessages`, `create`, `list`, `fetch`, `update`, `delete`, `templates.create`, `templates.list`, `templates.fetch`, `templates.update`, `templates.delete`, `messages.create`, `messages.list`, `messages.fetch`, `messages.update`, `dispatch`, `send`
145
+
146
+ ### messageBrokers
147
+
148
+ `create`, `list`, `fetch`, `update`, `delete`, `topics.create`, `topics.list`, `topics.fetch`, `topics.update`, `topics.delete`, `publish`, `subscribe`, `dispatch`, `testConnection`, `messages.query`, `messages.getProducers`, `messages.getConsumers`, `messages.getDeadLetters`, `messages.getStats`, `messages.getDashboard`
149
+
150
+ ### storage
151
+
152
+ `create`, `list`, `fetch`, `update`, `delete`, `upload`, `download`, `remove`, `listFiles`, `getSignedUrl`, `dispatch`, `stats`, `testConnection`
153
+
154
+ ### vector
155
+
156
+ `create`, `list`, `fetch`, `update`, `delete`, `connect`, `disconnect`, `disconnectAll`, `testConnection`, `query`, `upsert`, `upsertOne`, `fetchVectors`, `fetchOne`, `deleteVectors`, `deleteByIds`, `deleteAll`, `findSimilar`, `updateVector`, `updateMetadata`, `listVectors`, `listAllVectors`, `listNamespaces`, `deleteNamespace`, `describeIndex`, `getStats`, `createIndex`, `deleteIndex`, `listIndexes`, `count`, `exists`, `supportsFeature`, `getService`, `actions.create`, `actions.update`, `actions.fetch`, `actions.fetchAll`, `actions.delete`, `actions.execute`
157
+
158
+ ### caches
159
+
160
+ `create`, `list`, `fetch`, `update`, `delete`, `get`, `set`, `del`, `has`, `clear`, `ttl`, `expire`, `keys`, `fetchValues`, `fetchRemote`, `dispatch`
161
+
162
+ ### sessions
163
+
164
+ `create`, `update`, `list`, `fetch`, `delete`, `users`, `start`, `verify`, `refresh`, `revoke`, `listActive`, `revokeAll`, `updateData`, `extendSession`, `fetchUsers`, `fetchUserDetails`, `fetchDashboard`, `fetchUserDashboard`
165
+
166
+ ### quotas
167
+
168
+ `create`, `list`, `fetch`, `update`, `delete`, `check`, `consume`, `reset`, `getUsage`
169
+
170
+ ### actions
171
+
172
+ `create`, `list`, `fetch`, `update`, `delete`, `dispatch`, `run`, `import`
173
+
174
+ ### features
175
+
176
+ `create`, `list`, `fetch`, `update`, `delete`, `isEnabled`, `dispatch`, `run`
177
+
178
+ ### jobs
179
+
180
+ `create`, `list`, `fetch`, `update`, `delete`, `get`, `listJobs`, `cancel`, `cancelMany`, `pause`, `pauseMany`, `resume`, `resumeMany`, `retry`, `retryMany`, `reschedule`, `getHistory`, `getStats`, `setWebhook`, `getService`
181
+
182
+ ### logs
183
+
184
+ `query`, `fetch`, `list`, `stream`
185
+
186
+ ### resilience
187
+
188
+ `quotas.create`, `quotas.list`, `quotas.fetch`, `quotas.update`, `quotas.delete`, `quotas.check`, `quotas.consume`, `quotas.reset`, `fallbacks.create`, `fallbacks.list`, `fallbacks.fetch`, `fallbacks.update`, `fallbacks.delete`, `fallbacks.execute`
189
+
190
+ ### health
191
+
192
+ `define`, `create`, `list`, `fetch`, `update`, `delete`, `status`, `check`, `run`
193
+
194
+ ### fallback
195
+
196
+ `define`, `create`, `list`, `fetch`, `update`, `delete`, `run`, `dispatch`
197
+
198
+ ### secrets
199
+
200
+ `create`, `list`, `fetch`, `update`, `delete`, `exists`, `revoke`, `resolve`, `validate`, `getService`
201
+
202
+ ---
203
+
204
+ For method signatures and parameter shapes, see the Ductape SDK documentation or the SDK source (`sdk/ts/src/`). The proxy validates that `module` and `method` are in the lists above before executing.
package/package.json ADDED
@@ -0,0 +1,37 @@
1
+ {
2
+ "name": "@ductape/mcp",
3
+ "version": "0.1.0",
4
+ "description": "MCP server that exposes Ductape SDK operations via the backend proxy",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "bin": {
8
+ "ductape-mcp": "dist/index.js"
9
+ },
10
+ "scripts": {
11
+ "build": "tsc",
12
+ "start": "node dist/index.js",
13
+ "dev": "tsx src/index.ts"
14
+ },
15
+ "keywords": [
16
+ "mcp",
17
+ "ductape",
18
+ "sdk",
19
+ "proxy"
20
+ ],
21
+ "license": "UNLICENSED",
22
+ "dependencies": {
23
+ "@modelcontextprotocol/sdk": "^1.29.0",
24
+ "@modelcontextprotocol/server": "^2.0.0-alpha.2",
25
+ "crypto-js": "^4.2.0",
26
+ "zod": "^3.25.76"
27
+ },
28
+ "devDependencies": {
29
+ "@types/crypto-js": "^4.2.0",
30
+ "@types/node": "^25.6.0",
31
+ "tsx": "^4.19.0",
32
+ "typescript": "^5.3.0"
33
+ },
34
+ "engines": {
35
+ "node": ">=18"
36
+ }
37
+ }