n8n-nodes-datamcp 0.0.0-stage → 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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Andrei Mironov
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,146 @@
1
- # Temporary Holding Version
1
+ # DataMCP node for n8n
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Use a source-scoped DataMCP Integration credential to read PostgreSQL or MySQL
4
+ from n8n. Private PostgreSQL sources can be reached through Local Agent Tunnel.
5
+ The n8n action is **DataMCP Database** for both direct and tunneled sources;
6
+ the tunnel is a routing choice in DataMCP, not a second n8n node.
7
+
8
+ **Setup guide:** [Credentials and operations](#credential-setup)
9
+
10
+ ## Installation
11
+
12
+ When this package is available on npm, install `n8n-nodes-datamcp` through
13
+ n8n's Community Nodes settings. Before publication, use the local preview
14
+ below. Do not use an `npx install` command; n8n does not provide one.
15
+
16
+ People who receive this source package from DataMCP can run the verified local
17
+ preview:
18
+
19
+ ```bash
20
+ cd n8n-nodes-datamcp
21
+ npm install
22
+ npm run build
23
+ npm test
24
+ npm run dev
25
+ ```
26
+
27
+ The final command opens a local n8n editor with the DataMCP node installed. The
28
+ package has been loaded with n8n 2.44.6.
29
+
30
+ For a self-hosted n8n instance, build a supplied archive and install it into
31
+ the n8n user folder:
32
+
33
+ ```bash
34
+ # In this package directory
35
+ npm install
36
+ npm run build
37
+ npm pack --silent
38
+
39
+ # On the self-hosted n8n machine
40
+ mkdir -p ~/.n8n/nodes
41
+ cd ~/.n8n/nodes
42
+ npm install /absolute/path/to/the-copied-package.tgz
43
+ ```
44
+
45
+ Copy the archive whose filename `npm pack` prints to the n8n machine, then
46
+ replace the example path. Restart n8n after installation. n8n Cloud cannot
47
+ load this unpublished local package.
48
+
49
+ ## Credential setup
50
+
51
+ 1. Create the database source in DataMCP.
52
+ 2. Open **API Keys → Integration credentials** in the DataMCP dashboard.
53
+ 3. Create a read credential limited to only the source(s) the workflow needs.
54
+ 4. Copy the `dm_int_` secret immediately; it is shown once.
55
+ 5. In n8n, create **DataMCP Integration API**, choose QA or Production, and
56
+ paste the secret.
57
+
58
+ Do not use a workspace `sk_live_` API key. Workspace keys have broader access.
59
+ An Integration credential is restricted to selected sources and operations.
60
+
61
+ To try a first read, import the
62
+ [example workflow](https://github.com/datamcpapp/n8n-nodes-datamcp/blob/main/examples/read-query.json)
63
+ into n8n. Select your saved Integration credential and a permitted database
64
+ source in the DataMCP Database node, then execute it. The example has no key,
65
+ credential reference, or database address embedded in it.
66
+
67
+ ## Operations
68
+
69
+ ### Read Query
70
+
71
+ Read Query is available in QA. Production requires the Integration API rollout
72
+ before this credential and action can work there. The operation accepts
73
+ read-only SQL and an optional JSON array of bound values. Use `$1`, `$2`, and
74
+ so on for PostgreSQL, or `?` for MySQL. Values are sent separately from SQL.
75
+
76
+ Reads return at most 100 rows and 512 KiB. Each result row becomes one n8n item
77
+ with `row`, `columns`, `values`, `rowCount`, `truncated`, and `sourceId`. An
78
+ empty result emits one item with `row: null`.
79
+
80
+ For larger tables, page by a stable unique key rather than increasing OFFSET:
81
+
82
+ ```sql
83
+ SELECT id, label FROM public.orders WHERE id > $1 ORDER BY id LIMIT 100
84
+ ```
85
+
86
+ Start with a bound parameter of `0` for a positive identity key, then pass the
87
+ last returned ID into the next request. Stop when a page is empty. If a query
88
+ already contains `LIMIT 100`, `truncated: false` does not prove that the table
89
+ has no later rows. Narrow wide rows with an explicit column list; a single
90
+ row larger than 512 KiB is rejected rather than silently cut in half.
91
+
92
+ ### Create Row, Update Row, and Delete Row
93
+
94
+ Row mutations require integration writes to be enabled in your DataMCP
95
+ environment. Choose up to 20 schema-qualified tables in one source, then grant
96
+ only the Create, Update, and Delete actions the workflow needs. A write
97
+ credential may also allow Read Query. Read Query can reach any table covered
98
+ by the database user's SELECT grants in that source; selecting write tables
99
+ does not narrow SQL reads. Database grants remain the final permission
100
+ boundary.
101
+
102
+ Create and Update accept **Row Values**, a JSON object. Update and Delete also
103
+ require **Primary Key**, a JSON object containing every primary-key column.
104
+ Each action affects at most one row and returns `affectedRows` as `0` or `1`.
105
+
106
+ Do not add automatic retries to write nodes. If a response is lost, read the
107
+ row before retrying because the write may already have reached the database.
108
+
109
+ ## Local Agent Tunnel
110
+
111
+ The node does not connect directly to a database. For a tunnel-backed source,
112
+ the PostgreSQL password remains on the Local Agent machine, while SQL and query
113
+ results pass through DataMCP and n8n. The agent must be online and the source
114
+ schema must be synchronized before the source can be used.
115
+
116
+ ## Current release checks
117
+
118
+ QA n8n 2.44.6 has exercised direct hosted PostgreSQL and Local Agent Tunnel:
119
+ bounded 25,000-row reads, CTE/window queries, bound parameters, create/update/
120
+ delete, zero-row updates, read-only and cross-source denials, paused sources,
121
+ offline/recovered agents, and oversized result rows. Key revocation returned
122
+ 401 immediately in a running n8n workflow. Temporarily canceling and then
123
+ restoring a QA test subscription produced a 402 denial followed by a
124
+ successful read after the entitlement cache expired. A QA rate-limit burst
125
+ returned HTTP 429, which a running n8n workflow displayed as a safe rate-limit
126
+ error. The packed archive was checked separately from the source checkout.
127
+
128
+ Do not publish this package before completing:
129
+
130
+ - production migration and write-feature review;
131
+ - production-backed regression and npm publication/scan.
132
+
133
+ The QA credentials and disposable databases used during development are test
134
+ fixtures and must never be included in this package.
135
+
136
+ ## Publishing checklist
137
+
138
+ The package must live in a public GitHub repository before submission. Its
139
+ `v*.*.*` tag runs CI and publishes to npm from GitHub Actions with provenance.
140
+ The npm package must trust this repository's `publish.yml` workflow, or the
141
+ repository must have a narrowly scoped `NPM_TOKEN` secret for the first publish.
142
+ Do not tag a release until the QA checks above pass and production supports
143
+ every operation advertised by the node. After publication, run n8n's
144
+ `@n8n/scan-community-package` check against the published package version and
145
+ submit through the n8n Creator Portal. The scanner resolves npm packages; it
146
+ cannot validate an unpublished local directory.
@@ -0,0 +1,10 @@
1
+ import type { IAuthenticateGeneric, ICredentialTestRequest, ICredentialType, INodeProperties, Icon } from 'n8n-workflow';
2
+ export declare class DataMcpApi implements ICredentialType {
3
+ name: string;
4
+ displayName: string;
5
+ icon: Icon;
6
+ documentationUrl: string;
7
+ properties: INodeProperties[];
8
+ authenticate: IAuthenticateGeneric;
9
+ test: ICredentialTestRequest;
10
+ }
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DataMcpApi = void 0;
4
+ class DataMcpApi {
5
+ constructor() {
6
+ this.name = 'dataMcpApi';
7
+ this.displayName = 'DataMCP Integration API';
8
+ this.icon = {
9
+ light: 'file:../nodes/DataMcp/datamcp-brand.svg',
10
+ dark: 'file:../nodes/DataMcp/datamcp-brand.svg',
11
+ };
12
+ this.documentationUrl = 'https://github.com/datamcpapp/n8n-nodes-datamcp#credential-setup';
13
+ this.properties = [
14
+ {
15
+ displayName: 'Environment',
16
+ name: 'environment',
17
+ type: 'options',
18
+ options: [
19
+ { name: 'Production', value: 'production' },
20
+ { name: 'QA', value: 'qa' },
21
+ ],
22
+ default: 'production',
23
+ },
24
+ {
25
+ displayName: 'Integration Key',
26
+ name: 'accessToken',
27
+ type: 'string',
28
+ typeOptions: { password: true },
29
+ required: true,
30
+ default: '',
31
+ description: 'Create a source-scoped key under DataMCP Dashboard → API Keys → Integration credentials. The dm_int_ secret is shown once. Do not use a workspace sk_live_ API key.',
32
+ },
33
+ ];
34
+ this.authenticate = {
35
+ type: 'generic',
36
+ properties: {
37
+ headers: {
38
+ Authorization: '=Bearer {{$credentials.accessToken}}',
39
+ },
40
+ },
41
+ };
42
+ this.test = {
43
+ request: {
44
+ url: "={{$credentials.environment === 'qa' ? 'https://api-qa.datamcp.app/api/integrations/v1/sources' : 'https://api.datamcp.app/api/integrations/v1/sources'}}",
45
+ method: 'GET',
46
+ disableFollowRedirect: true,
47
+ sendCredentialsOnCrossOriginRedirect: false,
48
+ },
49
+ };
50
+ }
51
+ }
52
+ exports.DataMcpApi = DataMcpApi;
53
+ //# sourceMappingURL=DataMcpApi.credentials.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DataMcpApi.credentials.js","sourceRoot":"","sources":["../../credentials/DataMcpApi.credentials.ts"],"names":[],"mappings":";;;AAQA,MAAa,UAAU;IAAvB;QACE,SAAI,GAAG,YAAY,CAAC;QACpB,gBAAW,GAAG,yBAAyB,CAAC;QACxC,SAAI,GAAS;YACX,KAAK,EAAE,yCAAyC;YAChD,IAAI,EAAE,yCAAyC;SAChD,CAAC;QACF,qBAAgB,GAAG,kEAAkE,CAAC;QAEtF,eAAU,GAAsB;YAC9B;gBACE,WAAW,EAAE,aAAa;gBAC1B,IAAI,EAAE,aAAa;gBACnB,IAAI,EAAE,SAAS;gBACf,OAAO,EAAE;oBACP,EAAE,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,YAAY,EAAE;oBAC3C,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE;iBAC5B;gBACD,OAAO,EAAE,YAAY;aACtB;YACD;gBACE,WAAW,EAAE,iBAAiB;gBAC9B,IAAI,EAAE,aAAa;gBACnB,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;gBAC/B,QAAQ,EAAE,IAAI;gBACd,OAAO,EAAE,EAAE;gBACX,WAAW,EACT,qKAAqK;aACxK;SACF,CAAC;QAEF,iBAAY,GAAyB;YACnC,IAAI,EAAE,SAAS;YACf,UAAU,EAAE;gBACV,OAAO,EAAE;oBACP,aAAa,EAAE,sCAAsC;iBACtD;aACF;SACF,CAAC;QAEF,SAAI,GAA2B;YAC7B,OAAO,EAAE;gBACP,GAAG,EAAE,2JAA2J;gBAChK,MAAM,EAAE,KAAK;gBACb,qBAAqB,EAAE,IAAI;gBAC3B,oCAAoC,EAAE,KAAK;aAC5C;SACF,CAAC;IACJ,CAAC;CAAA;AAjDD,gCAiDC"}
@@ -0,0 +1,10 @@
1
+ import type { IExecuteFunctions, ILoadOptionsFunctions, INodeExecutionData, INodePropertyOptions, INodeType, INodeTypeDescription } from 'n8n-workflow';
2
+ export declare class DataMcp implements INodeType {
3
+ description: INodeTypeDescription;
4
+ methods: {
5
+ loadOptions: {
6
+ getSources(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
7
+ };
8
+ };
9
+ execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
10
+ }
@@ -0,0 +1,220 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DataMcp = void 0;
4
+ const n8n_workflow_1 = require("n8n-workflow");
5
+ const api_1 = require("./api");
6
+ class DataMcp {
7
+ constructor() {
8
+ this.description = {
9
+ displayName: 'DataMCP Database',
10
+ name: 'dataMcp',
11
+ icon: { light: 'file:datamcp-brand.svg', dark: 'file:datamcp-brand.svg' },
12
+ group: ['input'],
13
+ version: 1,
14
+ description: 'Read and change rows in a DataMCP database source',
15
+ subtitle: '={{$parameter["operation"]}}',
16
+ defaults: { name: 'DataMCP Database' },
17
+ inputs: [n8n_workflow_1.NodeConnectionTypes.Main],
18
+ outputs: [n8n_workflow_1.NodeConnectionTypes.Main],
19
+ usableAsTool: true,
20
+ credentials: [{ name: 'dataMcpApi', required: true }],
21
+ properties: [
22
+ {
23
+ displayName: 'Operation',
24
+ name: 'operation',
25
+ type: 'options',
26
+ options: [
27
+ { name: 'Read Query', value: 'readQuery' },
28
+ { name: 'Create Row', value: 'createRow' },
29
+ { name: 'Update Row', value: 'updateRow' },
30
+ { name: 'Delete Row', value: 'deleteRow' },
31
+ ],
32
+ default: 'readQuery',
33
+ noDataExpression: true,
34
+ },
35
+ {
36
+ displayName: 'Source Name or ID',
37
+ name: 'sourceId',
38
+ type: 'options',
39
+ typeOptions: { loadOptionsMethod: 'getSources' },
40
+ default: '',
41
+ required: true,
42
+ description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
43
+ },
44
+ {
45
+ displayName: 'SQL Query',
46
+ name: 'query',
47
+ displayOptions: { show: { operation: ['readQuery'] } },
48
+ type: 'string',
49
+ typeOptions: { rows: 5 },
50
+ default: '',
51
+ required: true,
52
+ description: 'Read-only SQL. DataMCP enforces permissions and result limits.',
53
+ },
54
+ {
55
+ displayName: 'Maximum Rows',
56
+ name: 'maxRows',
57
+ displayOptions: { show: { operation: ['readQuery'] } },
58
+ type: 'number',
59
+ typeOptions: { minValue: 1, maxValue: 100 },
60
+ default: 100,
61
+ description: 'The API also caps the response size at 512 KiB',
62
+ },
63
+ {
64
+ displayName: 'Query Parameters',
65
+ name: 'queryParameters',
66
+ displayOptions: { show: { operation: ['readQuery'] } },
67
+ type: 'string',
68
+ typeOptions: { rows: 2 },
69
+ default: '',
70
+ description: 'Optional JSON array of values bound to SQL placeholders ($1, $2 for PostgreSQL; ? for MySQL). Do not concatenate values into SQL.',
71
+ },
72
+ {
73
+ displayName: 'Table',
74
+ name: 'table',
75
+ type: 'string',
76
+ default: '',
77
+ required: true,
78
+ displayOptions: { show: { operation: ['createRow', 'updateRow', 'deleteRow'] } },
79
+ description: 'Schema-qualified table name, for example public.orders. The integration key must allow this table.',
80
+ },
81
+ {
82
+ displayName: 'Row Values',
83
+ name: 'rowValues',
84
+ type: 'string',
85
+ typeOptions: { rows: 4 },
86
+ default: '{}',
87
+ required: true,
88
+ displayOptions: { show: { operation: ['createRow', 'updateRow'] } },
89
+ description: 'JSON object of columns and values to insert or update',
90
+ },
91
+ {
92
+ displayName: 'Primary Key',
93
+ name: 'primaryKey',
94
+ type: 'string',
95
+ typeOptions: { rows: 2 },
96
+ default: '{}',
97
+ required: true,
98
+ displayOptions: { show: { operation: ['updateRow', 'deleteRow'] } },
99
+ description: 'JSON object with every primary-key column, targeting exactly one row',
100
+ },
101
+ ],
102
+ };
103
+ this.methods = {
104
+ loadOptions: {
105
+ async getSources() {
106
+ var _a;
107
+ try {
108
+ const credentials = await this.getCredentials('dataMcpApi');
109
+ const response = await this.helpers.httpRequestWithAuthentication.call(this, 'dataMcpApi', {
110
+ method: 'GET',
111
+ url: `${(0, api_1.apiBaseUrl)(credentials.environment)}/integrations/v1/sources`,
112
+ json: true,
113
+ disableFollowRedirect: true,
114
+ sendCredentialsOnCrossOriginRedirect: false,
115
+ });
116
+ const operation = (_a = this.getCurrentNodeParameter) === null || _a === void 0 ? void 0 : _a.call(this, 'operation');
117
+ const scope = { readQuery: 'read_query', createRow: 'create_row', updateRow: 'update_row', deleteRow: 'delete_row' }[operation !== null && operation !== void 0 ? operation : 'readQuery'];
118
+ return (0, api_1.readSources)(response)
119
+ .filter((source) => source.operations.includes(scope))
120
+ .map((source) => {
121
+ var _a;
122
+ return ({
123
+ name: `${source.name} (${(_a = source.databaseType) !== null && _a !== void 0 ? _a : 'database'})`,
124
+ value: source.id,
125
+ });
126
+ });
127
+ }
128
+ catch (error) {
129
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), (0, api_1.safeRequestError)(error));
130
+ }
131
+ },
132
+ },
133
+ };
134
+ }
135
+ async execute() {
136
+ var _a;
137
+ const items = this.getInputData();
138
+ const output = [];
139
+ const credentials = await this.getCredentials('dataMcpApi');
140
+ const baseUrl = (0, api_1.apiBaseUrl)(credentials.environment);
141
+ for (let itemIndex = 0; itemIndex < items.length; itemIndex++) {
142
+ let operation = 'readQuery';
143
+ try {
144
+ const sourceId = this.getNodeParameter('sourceId', itemIndex);
145
+ operation = (_a = this.getNodeParameter('operation', itemIndex, 'readQuery')) !== null && _a !== void 0 ? _a : 'readQuery';
146
+ if (!/^conn_[A-Za-z0-9_-]{1,100}$/.test(sourceId)) {
147
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Select a valid DataMCP source', {
148
+ itemIndex,
149
+ });
150
+ }
151
+ if (operation === 'readQuery') {
152
+ const query = this.getNodeParameter('query', itemIndex);
153
+ const maxRows = this.getNodeParameter('maxRows', itemIndex);
154
+ const parameters = (0, api_1.parseQueryParameters)(this.getNodeParameter('queryParameters', itemIndex, ''), this.getNode());
155
+ if (!Number.isInteger(maxRows) || maxRows < 1 || maxRows > 100) {
156
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Maximum rows must be between 1 and 100', {
157
+ itemIndex,
158
+ });
159
+ }
160
+ const response = await this.helpers.httpRequestWithAuthentication.call(this, 'dataMcpApi', {
161
+ method: 'POST',
162
+ url: `${baseUrl}/integrations/v1/sources/${encodeURIComponent(sourceId)}/query`,
163
+ body: parameters.length > 0 ? { query, maxRows, parameters } : { query, maxRows },
164
+ json: true,
165
+ disableFollowRedirect: true,
166
+ sendCredentialsOnCrossOriginRedirect: false,
167
+ });
168
+ const result = (0, api_1.readQueryResult)(response);
169
+ for (const row of (0, api_1.queryOutput)(sourceId, result)) {
170
+ output.push({ json: row, pairedItem: { item: itemIndex } });
171
+ }
172
+ }
173
+ else {
174
+ const methods = {
175
+ createRow: 'POST', updateRow: 'PATCH', deleteRow: 'DELETE',
176
+ };
177
+ const method = methods[operation];
178
+ if (!method)
179
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Unsupported DataMCP operation', { itemIndex });
180
+ const table = this.getNodeParameter('table', itemIndex);
181
+ if (!/^[A-Za-z_][A-Za-z0-9_]*\.[A-Za-z_][A-Za-z0-9_]*$/.test(table)) {
182
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Enter a schema-qualified table name', { itemIndex });
183
+ }
184
+ const body = { table };
185
+ if (operation !== 'deleteRow') {
186
+ body.values = (0, api_1.parseRowObject)(this.getNodeParameter('rowValues', itemIndex), this.getNode(), 'values');
187
+ }
188
+ if (operation !== 'createRow') {
189
+ body.key = (0, api_1.parseRowObject)(this.getNodeParameter('primaryKey', itemIndex), this.getNode(), 'key');
190
+ }
191
+ const response = await this.helpers.httpRequestWithAuthentication.call(this, 'dataMcpApi', {
192
+ method,
193
+ url: `${baseUrl}/integrations/v1/sources/${encodeURIComponent(sourceId)}/rows`,
194
+ body,
195
+ json: true,
196
+ disableFollowRedirect: true,
197
+ sendCredentialsOnCrossOriginRedirect: false,
198
+ });
199
+ output.push({
200
+ json: { sourceId, table, operation, affectedRows: (0, api_1.readMutationResult)(response, this.getNode()) },
201
+ pairedItem: { item: itemIndex },
202
+ });
203
+ }
204
+ }
205
+ catch (error) {
206
+ const message = error instanceof n8n_workflow_1.NodeOperationError
207
+ ? error.message
208
+ : (0, api_1.safeRequestError)(error, operation !== 'readQuery');
209
+ if (this.continueOnFail()) {
210
+ output.push({ json: { error: message }, pairedItem: { item: itemIndex } });
211
+ continue;
212
+ }
213
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), message, { itemIndex });
214
+ }
215
+ }
216
+ return [output];
217
+ }
218
+ }
219
+ exports.DataMcp = DataMcp;
220
+ //# sourceMappingURL=DataMcp.node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DataMcp.node.js","sourceRoot":"","sources":["../../../n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AAC,IAAI,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC;YACvE,CAAC;QACH,CAAC;QACD,OAAO,CAAC,MAAM,CAAC,CAAC;IAClB,CAAC;CACF;AA7ND,0BA6NC"}
@@ -0,0 +1,23 @@
1
+ import type { INode } from 'n8n-workflow';
2
+ export interface DataMcpSource {
3
+ id: string;
4
+ name: string;
5
+ type: string;
6
+ databaseType?: string;
7
+ routingType?: string;
8
+ operations: string[];
9
+ }
10
+ export interface DataMcpQueryResult {
11
+ columns: string[];
12
+ rows: unknown[][];
13
+ rowCount: number;
14
+ truncated: boolean;
15
+ }
16
+ export declare function parseRowObject(input: unknown, node: INode, kind: 'values' | 'key'): Record<string, string | number | boolean | null>;
17
+ export declare function readMutationResult(response: unknown, node: INode): number;
18
+ export declare function apiBaseUrl(environment: unknown): string;
19
+ export declare function parseQueryParameters(input: unknown, node: INode): Array<string | number | boolean | null>;
20
+ export declare function readSources(response: unknown): DataMcpSource[];
21
+ export declare function readQueryResult(response: unknown): DataMcpQueryResult;
22
+ export declare function queryOutput(sourceId: string, result: DataMcpQueryResult): Array<Record<string, unknown>>;
23
+ export declare function safeRequestError(error: unknown, write?: boolean): string;
@@ -0,0 +1,165 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseRowObject = parseRowObject;
4
+ exports.readMutationResult = readMutationResult;
5
+ exports.apiBaseUrl = apiBaseUrl;
6
+ exports.parseQueryParameters = parseQueryParameters;
7
+ exports.readSources = readSources;
8
+ exports.readQueryResult = readQueryResult;
9
+ exports.queryOutput = queryOutput;
10
+ exports.safeRequestError = safeRequestError;
11
+ const n8n_workflow_1 = require("n8n-workflow");
12
+ function parseRowObject(input, node, kind) {
13
+ let parsed;
14
+ try {
15
+ parsed = typeof input === 'string' ? JSON.parse(input) : input;
16
+ }
17
+ catch {
18
+ throw new n8n_workflow_1.NodeOperationError(node, `${kind} must be a JSON object`);
19
+ }
20
+ if (!isRecord(parsed)) {
21
+ throw new n8n_workflow_1.NodeOperationError(node, `${kind} must be a JSON object`);
22
+ }
23
+ const entries = Object.entries(parsed);
24
+ if (entries.length < 1 ||
25
+ entries.length > (kind === 'key' ? 4 : 25) ||
26
+ entries.some(([name, value]) => !/^[A-Za-z_][A-Za-z0-9_]*$/.test(name) ||
27
+ (kind === 'key' && value === null) ||
28
+ (value !== null &&
29
+ !((typeof value === 'string' && value.length <= 4096) ||
30
+ (typeof value === 'number' && Number.isFinite(value) && (!Number.isInteger(value) || Number.isSafeInteger(value))) ||
31
+ typeof value === 'boolean'))) ||
32
+ Buffer.byteLength(JSON.stringify(parsed), 'utf8') > 64 * 1024) {
33
+ throw new n8n_workflow_1.NodeOperationError(node, `${kind} contains unsupported fields or values`);
34
+ }
35
+ return parsed;
36
+ }
37
+ function readMutationResult(response, node) {
38
+ if (!isRecord(response) ||
39
+ response.success !== true ||
40
+ !isRecord(response.data) ||
41
+ !Number.isInteger(response.data.affectedRows) ||
42
+ response.data.affectedRows < 0 ||
43
+ response.data.affectedRows > 1) {
44
+ throw new n8n_workflow_1.NodeOperationError(node, 'DataMCP returned an invalid mutation result');
45
+ }
46
+ return response.data.affectedRows;
47
+ }
48
+ function apiBaseUrl(environment) {
49
+ if (environment === 'qa')
50
+ return 'https://api-qa.datamcp.app/api';
51
+ if (environment === 'production')
52
+ return 'https://api.datamcp.app/api';
53
+ throw new Error('Unsupported DataMCP environment');
54
+ }
55
+ function parseQueryParameters(input, node) {
56
+ if (input === '' || input === undefined || input === null)
57
+ return [];
58
+ let parameters;
59
+ try {
60
+ parameters = typeof input === 'string' ? JSON.parse(input) : input;
61
+ }
62
+ catch {
63
+ throw new n8n_workflow_1.NodeOperationError(node, 'Query parameters must be a JSON array');
64
+ }
65
+ if (!Array.isArray(parameters) ||
66
+ parameters.length > 50 ||
67
+ parameters.some((value) => value !== null &&
68
+ !((typeof value === 'string' && value.length <= 4096) ||
69
+ (typeof value === 'number' && Number.isFinite(value) && (!Number.isInteger(value) || Number.isSafeInteger(value))) ||
70
+ typeof value === 'boolean')) ||
71
+ Buffer.byteLength(JSON.stringify(parameters), 'utf8') > 64 * 1024) {
72
+ throw new n8n_workflow_1.NodeOperationError(node, 'Query parameters must contain at most 50 scalar values');
73
+ }
74
+ return parameters;
75
+ }
76
+ function readSources(response) {
77
+ if (!isRecord(response) || response.success !== true || !Array.isArray(response.data)) {
78
+ throw new Error('DataMCP returned an invalid source list');
79
+ }
80
+ if (!response.data.every(isSource)) {
81
+ throw new Error('DataMCP returned an invalid source list');
82
+ }
83
+ return response.data;
84
+ }
85
+ function readQueryResult(response) {
86
+ if (!isRecord(response) || response.success !== true || !isRecord(response.data)) {
87
+ throw new Error('DataMCP returned an invalid query result');
88
+ }
89
+ const data = response.data;
90
+ const columns = data.columns;
91
+ if (!Array.isArray(columns) ||
92
+ !columns.every((column) => typeof column === 'string') ||
93
+ !Array.isArray(data.rows) ||
94
+ !data.rows.every((row) => Array.isArray(row) && row.length === columns.length) ||
95
+ !Number.isInteger(data.rowCount) ||
96
+ data.rowCount !== data.rows.length ||
97
+ typeof data.truncated !== 'boolean') {
98
+ throw new Error('DataMCP returned an invalid query result');
99
+ }
100
+ return data;
101
+ }
102
+ function queryOutput(sourceId, result) {
103
+ if (result.rows.length === 0) {
104
+ return [{ sourceId, columns: result.columns, values: null, row: null, rowCount: 0, truncated: result.truncated }];
105
+ }
106
+ return result.rows.map((values) => {
107
+ if (values.length !== result.columns.length) {
108
+ throw new Error('DataMCP returned a row with mismatched columns');
109
+ }
110
+ const row = Object.fromEntries(result.columns.map((column, index) => [column, values[index]]));
111
+ return {
112
+ sourceId,
113
+ columns: result.columns,
114
+ values,
115
+ row,
116
+ rowCount: result.rowCount,
117
+ truncated: result.truncated,
118
+ };
119
+ });
120
+ }
121
+ function safeRequestError(error, write = false) {
122
+ var _a, _b, _c, _d;
123
+ const response = isRecord(error) && isRecord(error.response) ? error.response : undefined;
124
+ const status = (_b = (_a = response === null || response === void 0 ? void 0 : response.statusCode) !== null && _a !== void 0 ? _a : response === null || response === void 0 ? void 0 : response.status) !== null && _b !== void 0 ? _b : (isRecord(error) ? (_d = (_c = error.statusCode) !== null && _c !== void 0 ? _c : error.status) !== null && _d !== void 0 ? _d : error.httpCode : undefined);
125
+ switch (Number(status)) {
126
+ case 401:
127
+ return 'Integration key is invalid or revoked';
128
+ case 402:
129
+ return 'DataMCP subscription or trial is inactive';
130
+ case 403:
131
+ return 'Source access or query is not permitted';
132
+ case 400:
133
+ return 'DataMCP rejected the query';
134
+ case 409:
135
+ return 'Write outcome is unknown. Check the row before retrying';
136
+ case 413:
137
+ return 'One result row exceeds 512 KiB. Select fewer columns or shorten the value';
138
+ case 412:
139
+ return 'Sync the DataMCP source schema before writing';
140
+ case 429:
141
+ return 'DataMCP query rate limit exceeded';
142
+ case 500:
143
+ return 'DataMCP request failed. Check data before retrying a write';
144
+ case 503:
145
+ return write
146
+ ? 'Write outcome is unknown. Check the row and Local Agent before retrying'
147
+ : 'DataMCP source is unavailable. If it uses a tunnel, check that the Local Agent is running';
148
+ case 504:
149
+ return write ? 'Write outcome is unknown. Check the row before retrying' : 'DataMCP query timed out';
150
+ default:
151
+ return write ? 'Write outcome is unknown. Check the row before retrying' : 'DataMCP request failed';
152
+ }
153
+ }
154
+ function isRecord(value) {
155
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
156
+ }
157
+ function isSource(value) {
158
+ return (isRecord(value) &&
159
+ typeof value.id === 'string' &&
160
+ typeof value.name === 'string' &&
161
+ typeof value.type === 'string' &&
162
+ Array.isArray(value.operations) &&
163
+ value.operations.every((operation) => typeof operation === 'string'));
164
+ }
165
+ //# sourceMappingURL=api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.js","sourceRoot":"","sources":["../../../nodes/DataMcp/api.ts"],"names":[],"mappings":";;AAmBA,wCAkCC;AAED,gDAYC;AAED,gCAIC;AAED,oDAyBC;AAED,kCAQC;AAED,0CAkBC;AAED,kCA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AC9B,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC;QAC/B,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,OAAO,SAAS,KAAK,QAAQ,CAAC,CACrE,CAAC;AACJ,CAAC"}
@@ -0,0 +1,5 @@
1
+ <svg width="64" height="64" viewBox="0 0 64 64" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M25 13H13V51H25" stroke="#101828" stroke-width="6" stroke-linecap="square" stroke-linejoin="miter"/>
3
+ <path d="M39 13H51V51H39" stroke="#3656D4" stroke-width="6" stroke-linecap="square" stroke-linejoin="miter"/>
4
+ <path d="M23 32H41" stroke="#3656D4" stroke-width="5" stroke-linecap="square"/>
5
+ </svg>
@@ -0,0 +1,45 @@
1
+ {
2
+ "name": "n8n-nodes-datamcp",
3
+ "version": "0.1.0",
4
+ "description": "Source-scoped DataMCP actions for n8n",
5
+ "license": "MIT",
6
+ "homepage": "https://datamcp.app",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/datamcpapp/n8n-nodes-datamcp.git"
10
+ },
11
+ "bugs": {
12
+ "url": "https://github.com/datamcpapp/n8n-nodes-datamcp/issues"
13
+ },
14
+ "publishConfig": {
15
+ "access": "public"
16
+ },
17
+ "author": {
18
+ "name": "Andrei Mironov",
19
+ "email": "hello@datamcp.app"
20
+ },
21
+ "keywords": ["n8n-community-node-package"],
22
+ "scripts": {
23
+ "build": "n8n-node build",
24
+ "dev": "n8n-node dev",
25
+ "typecheck": "tsc --noEmit",
26
+ "lint": "n8n-node lint",
27
+ "test": "node --test test/*.test.js",
28
+ "test:package": "node test/package-check.js"
29
+ },
30
+ "files": ["dist"],
31
+ "n8n": {
32
+ "n8nNodesApiVersion": 1,
33
+ "strict": true,
34
+ "credentials": ["dist/credentials/DataMcpApi.credentials.js"],
35
+ "nodes": ["dist/nodes/DataMcp/DataMcp.node.js"]
36
+ },
37
+ "devDependencies": {
38
+ "@n8n/node-cli": "0.53.4",
39
+ "n8n-workflow": "2.16.0",
40
+ "typescript": "^5.9.3"
41
+ },
42
+ "peerDependencies": {
43
+ "n8n-workflow": "*"
44
+ }
45
+ }
package/package.json CHANGED
@@ -1,6 +1,45 @@
1
1
  {
2
2
  "name": "n8n-nodes-datamcp",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
4
+ "description": "Source-scoped DataMCP actions for n8n",
5
+ "license": "MIT",
6
+ "homepage": "https://datamcp.app",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/datamcpapp/n8n-nodes-datamcp.git"
10
+ },
11
+ "bugs": {
12
+ "url": "https://github.com/datamcpapp/n8n-nodes-datamcp/issues"
13
+ },
14
+ "publishConfig": {
15
+ "access": "public"
16
+ },
17
+ "author": {
18
+ "name": "Andrei Mironov",
19
+ "email": "hello@datamcp.app"
20
+ },
21
+ "keywords": ["n8n-community-node-package"],
22
+ "scripts": {
23
+ "build": "n8n-node build",
24
+ "dev": "n8n-node dev",
25
+ "typecheck": "tsc --noEmit",
26
+ "lint": "n8n-node lint",
27
+ "test": "node --test test/*.test.js",
28
+ "test:package": "node test/package-check.js"
29
+ },
30
+ "files": ["dist"],
31
+ "n8n": {
32
+ "n8nNodesApiVersion": 1,
33
+ "strict": true,
34
+ "credentials": ["dist/credentials/DataMcpApi.credentials.js"],
35
+ "nodes": ["dist/nodes/DataMcp/DataMcp.node.js"]
36
+ },
37
+ "devDependencies": {
38
+ "@n8n/node-cli": "0.53.4",
39
+ "n8n-workflow": "2.16.0",
40
+ "typescript": "^5.9.3"
41
+ },
42
+ "peerDependencies": {
43
+ "n8n-workflow": "*"
44
+ }
45
+ }