@ctera/n8n-nodes-ctera-ai 0.2.0 → 0.4.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 +24 -24
- package/README.md +68 -113
- package/dist/credentials/CteraFilesystemApi.credentials.d.ts +7 -0
- package/dist/credentials/CteraFilesystemApi.credentials.js +40 -0
- package/dist/credentials/CteraPortalOAuth2Api.credentials.d.ts +10 -0
- package/dist/credentials/CteraPortalOAuth2Api.credentials.js +106 -0
- package/dist/nodes/CteraAi/ctera.svg +13 -13
- package/dist/nodes/CteraFilesystem/CteraFilesystem.node.d.ts +5 -0
- package/dist/nodes/CteraFilesystem/CteraFilesystem.node.js +598 -0
- package/dist/nodes/CteraFilesystem/ctera.svg +13 -0
- package/index.js +10 -10
- package/package.json +71 -60
package/LICENSE
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 CTERA Networks
|
|
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.
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 CTERA Networks
|
|
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.
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
package/README.md
CHANGED
|
@@ -1,113 +1,68 @@
|
|
|
1
|
-
# n8n-nodes-ctera
|
|
2
|
-
|
|
3
|
-
n8n community
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
- **
|
|
20
|
-
- **
|
|
21
|
-
- **
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
| standardMetadata | object | Standard file metadata (guid, dataset_id, permissions) |
|
|
70
|
-
| customMetadata | object | Custom metadata (classifier_tags, classifications) |
|
|
71
|
-
| snippet | string | Text snippet (when include_snippet=true) |
|
|
72
|
-
| markdownBody | string | Full markdown content (when include_markdown=true) |
|
|
73
|
-
| _meta | object | Pagination info (total, limit, offset) |
|
|
74
|
-
|
|
75
|
-
## Credentials
|
|
76
|
-
|
|
77
|
-
**1. Log into Admin UI** with your SSO credentials
|
|
78
|
-
|
|
79
|
-
**2. Generate MCP Bearer Token:**
|
|
80
|
-
|
|
81
|
-
Navigate to the MCP Tokens section in Admin UI, or use the API:
|
|
82
|
-
|
|
83
|
-
```bash
|
|
84
|
-
curl -k -X POST "https://YOUR_ADMIN_URL/admin/api/mcp-tokens/generate" \
|
|
85
|
-
-H "Cookie: connect.sid=YOUR_SESSION_COOKIE" \
|
|
86
|
-
-H "Content-Type: application/json" \
|
|
87
|
-
-d '{"days": 30}' | jq -r .token
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
**3. Configure in n8n:**
|
|
91
|
-
|
|
92
|
-
- **MCP Server URL**: `https://mcp.your-domain.com`
|
|
93
|
-
- **Bearer Token**: Paste the token from step 2
|
|
94
|
-
- **Ignore SSL Issues**: Enable for self-signed certificates
|
|
95
|
-
|
|
96
|
-
## Example Use Cases
|
|
97
|
-
|
|
98
|
-
- **Daily Intelligence Reports** - Schedule searches across experts for recent updates
|
|
99
|
-
- **Q&A Chatbots** - Build webhook-based chatbots using the Chat operation
|
|
100
|
-
- **Document Discovery** - Monitor for new content and send notifications
|
|
101
|
-
- **File Metadata Analysis** - Use File Search to find files by metadata filters and process each result
|
|
102
|
-
- **Compliance Scanning** - Search for files matching specific classifier tags
|
|
103
|
-
|
|
104
|
-
## Resources
|
|
105
|
-
|
|
106
|
-
- [n8n Community Nodes](https://docs.n8n.io/integrations/community-nodes/)
|
|
107
|
-
- [GitHub Issues](https://github.com/ctera/ctera-n8n-nodes/issues)
|
|
108
|
-
|
|
109
|
-
## License
|
|
110
|
-
|
|
111
|
-
[MIT](LICENSE) - See [PUBLISH.md](PUBLISH.md) for publishing guidelines.
|
|
112
|
-
|
|
113
|
-
|
|
1
|
+
# n8n-nodes-ctera
|
|
2
|
+
|
|
3
|
+
n8n community nodes for CTERA integration - filesystem operations and AI-powered data intelligence.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
cd ~/.n8n/nodes
|
|
9
|
+
npm install @ctera/n8n-nodes-ctera
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Restart n8n after installation.
|
|
13
|
+
|
|
14
|
+
## Nodes
|
|
15
|
+
|
|
16
|
+
### CTERA Filesystem
|
|
17
|
+
|
|
18
|
+
Perform storage operations on CTERA Portal via MCP:
|
|
19
|
+
- **File**: Read, write, copy, move, rename, delete
|
|
20
|
+
- **Directory**: List, create, delete, walk, recover
|
|
21
|
+
- **Links**: Public sharing links and permalinks
|
|
22
|
+
- **Versions**: File version history
|
|
23
|
+
|
|
24
|
+
Supports OAuth2 (Entra ID / Azure AD) authentication.
|
|
25
|
+
|
|
26
|
+
**[Detailed Documentation →](nodes/CteraFilesystem/README.md)**
|
|
27
|
+
|
|
28
|
+
### CTERA Data Intelligence
|
|
29
|
+
|
|
30
|
+
Interact with CTERA AI experts for semantic search and knowledge retrieval:
|
|
31
|
+
- **List Experts**: Discover available knowledge bases
|
|
32
|
+
- **Semantic Search**: Retrieve text chunks for RAG workflows
|
|
33
|
+
- **File Search**: Search files with metadata filters
|
|
34
|
+
- **Chat**: Get AI-generated answers
|
|
35
|
+
|
|
36
|
+
**[Detailed Documentation →](nodes/CteraAi/README.md)**
|
|
37
|
+
|
|
38
|
+
## Credentials
|
|
39
|
+
|
|
40
|
+
| Credential | Used By | Description |
|
|
41
|
+
|------------|---------|-------------|
|
|
42
|
+
| CTERA Portal OAuth2 API | Filesystem | Entra ID / Azure AD SSO authentication |
|
|
43
|
+
| CTERA AI MCP API | Data Intelligence | MCP bearer token authentication |
|
|
44
|
+
|
|
45
|
+
## Development
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
# Install dependencies
|
|
49
|
+
npm install
|
|
50
|
+
|
|
51
|
+
# Build
|
|
52
|
+
npm run build
|
|
53
|
+
|
|
54
|
+
# Run tests
|
|
55
|
+
npm test
|
|
56
|
+
|
|
57
|
+
# Link for local development
|
|
58
|
+
npm link
|
|
59
|
+
cd ~/.n8n/nodes && npm link @ctera/n8n-nodes-ctera
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Publishing
|
|
63
|
+
|
|
64
|
+
See [PUBLISH.md](PUBLISH.md) for npm publishing guidelines.
|
|
65
|
+
|
|
66
|
+
## License
|
|
67
|
+
|
|
68
|
+
[MIT](LICENSE)
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CteraFilesystemApi = void 0;
|
|
4
|
+
class CteraFilesystemApi {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.name = 'cteraFilesystemApi';
|
|
7
|
+
this.displayName = 'CTERA Filesystem API';
|
|
8
|
+
this.documentationUrl = 'https://github.com/ctera/ctera-n8n-nodes#readme';
|
|
9
|
+
this.properties = [
|
|
10
|
+
{
|
|
11
|
+
displayName: 'MCP Server URL',
|
|
12
|
+
name: 'serverUrl',
|
|
13
|
+
type: 'string',
|
|
14
|
+
default: '',
|
|
15
|
+
required: true,
|
|
16
|
+
placeholder: 'https://mcp.your-domain.com',
|
|
17
|
+
description: 'The base URL of your CTERA MCP server (e.g., https://mcp.example.com)',
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
displayName: 'Bearer Token (JWT)',
|
|
21
|
+
name: 'bearerToken',
|
|
22
|
+
type: 'string',
|
|
23
|
+
typeOptions: {
|
|
24
|
+
password: true,
|
|
25
|
+
},
|
|
26
|
+
default: '',
|
|
27
|
+
required: true,
|
|
28
|
+
description: 'Portal JWT token for authentication. Generate via Portal Settings → API Tokens, or using: curl -k "https://<portal>/api/tokens/generate?oid=<oid>&email=<email>"',
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
displayName: 'Ignore SSL Issues',
|
|
32
|
+
name: 'allowUnauthorizedCerts',
|
|
33
|
+
type: 'boolean',
|
|
34
|
+
default: false,
|
|
35
|
+
description: 'Whether to connect even if SSL certificate validation fails (use for self-signed certificates)',
|
|
36
|
+
},
|
|
37
|
+
];
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
exports.CteraFilesystemApi = CteraFilesystemApi;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { IAuthenticateGeneric, ICredentialTestRequest, ICredentialType, INodeProperties } from 'n8n-workflow';
|
|
2
|
+
export declare class CteraPortalOAuth2Api implements ICredentialType {
|
|
3
|
+
name: string;
|
|
4
|
+
extends: string[];
|
|
5
|
+
displayName: string;
|
|
6
|
+
documentationUrl: string;
|
|
7
|
+
properties: INodeProperties[];
|
|
8
|
+
authenticate: IAuthenticateGeneric;
|
|
9
|
+
test: ICredentialTestRequest;
|
|
10
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CteraPortalOAuth2Api = void 0;
|
|
4
|
+
class CteraPortalOAuth2Api {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.name = 'cteraPortalOAuth2Api';
|
|
7
|
+
this.extends = ['oAuth2Api'];
|
|
8
|
+
this.displayName = 'CTERA Portal OAuth2 API';
|
|
9
|
+
this.documentationUrl = 'https://github.com/ctera/ctera-n8n-nodes#oauth2-setup';
|
|
10
|
+
this.properties = [
|
|
11
|
+
{
|
|
12
|
+
displayName: 'Portal URL',
|
|
13
|
+
name: 'portalUrl',
|
|
14
|
+
type: 'string',
|
|
15
|
+
default: '',
|
|
16
|
+
required: true,
|
|
17
|
+
placeholder: 'https://your-portal.ctera.com',
|
|
18
|
+
description: 'Base URL of your CTERA Portal',
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
displayName: 'Grant Type',
|
|
22
|
+
name: 'grantType',
|
|
23
|
+
type: 'hidden',
|
|
24
|
+
default: 'authorizationCode',
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
displayName: 'Authorization URL',
|
|
28
|
+
name: 'authUrl',
|
|
29
|
+
type: 'string',
|
|
30
|
+
default: '',
|
|
31
|
+
required: true,
|
|
32
|
+
placeholder: 'https://login.microsoftonline.com/YOUR-TENANT-ID/oauth2/v2.0/authorize',
|
|
33
|
+
description: 'Azure AD authorization endpoint. Replace YOUR-TENANT-ID with your Azure tenant ID',
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
displayName: 'Access Token URL',
|
|
37
|
+
name: 'accessTokenUrl',
|
|
38
|
+
type: 'string',
|
|
39
|
+
default: '',
|
|
40
|
+
required: true,
|
|
41
|
+
placeholder: 'https://login.microsoftonline.com/YOUR-TENANT-ID/oauth2/v2.0/token',
|
|
42
|
+
description: 'Azure AD token endpoint. Replace YOUR-TENANT-ID with your Azure tenant ID',
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
displayName: 'API Scope',
|
|
46
|
+
name: 'apiScope',
|
|
47
|
+
type: 'string',
|
|
48
|
+
default: '',
|
|
49
|
+
required: true,
|
|
50
|
+
placeholder: 'api://YOUR-CLIENT-ID/access',
|
|
51
|
+
description: 'Your Azure AD API scope (e.g., api://client-id/access or api://client-id/claudeai). This is required for v2.0 tokens.',
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
displayName: 'Scope',
|
|
55
|
+
name: 'scope',
|
|
56
|
+
type: 'hidden',
|
|
57
|
+
default: '={{$self.apiScope}} openid profile offline_access',
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
displayName: 'Auth URI Query Parameters',
|
|
61
|
+
name: 'authQueryParameters',
|
|
62
|
+
type: 'hidden',
|
|
63
|
+
default: '',
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
displayName: 'Authentication',
|
|
67
|
+
name: 'authentication',
|
|
68
|
+
type: 'hidden',
|
|
69
|
+
default: 'body',
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
displayName: 'Ignore SSL Issues',
|
|
73
|
+
name: 'allowUnauthorizedCerts',
|
|
74
|
+
type: 'boolean',
|
|
75
|
+
default: false,
|
|
76
|
+
description: 'Whether to connect even if SSL certificate validation fails (use for self-signed certificates)',
|
|
77
|
+
},
|
|
78
|
+
];
|
|
79
|
+
this.authenticate = {
|
|
80
|
+
type: 'generic',
|
|
81
|
+
properties: {
|
|
82
|
+
headers: {
|
|
83
|
+
Authorization: '=Bearer {{$credentials.oauthTokenData.access_token}}',
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
};
|
|
87
|
+
this.test = {
|
|
88
|
+
request: {
|
|
89
|
+
baseURL: '={{$credentials.portalUrl}}/_SRV/MCP',
|
|
90
|
+
url: '/mcp',
|
|
91
|
+
method: 'POST',
|
|
92
|
+
body: {
|
|
93
|
+
jsonrpc: '2.0',
|
|
94
|
+
method: 'tools/call',
|
|
95
|
+
params: {
|
|
96
|
+
name: 'ctera_portal_who_am_i',
|
|
97
|
+
arguments: {},
|
|
98
|
+
},
|
|
99
|
+
id: 1,
|
|
100
|
+
},
|
|
101
|
+
skipSslCertificateValidation: '={{$credentials.allowUnauthorizedCerts}}',
|
|
102
|
+
},
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
exports.CteraPortalOAuth2Api = CteraPortalOAuth2Api;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
-
<g clip-path="url(#ub91fxv4ea)" transform="scale(1.15) translate(-1.8, -1.8)">
|
|
3
|
-
<path d="M20 0H4a4 4 0 0 0-4 4v16a4 4 0 0 0 4 4h16a4 4 0 0 0 4-4V4a4 4 0 0 0-4-4z" fill="#4F5CE5"/>
|
|
4
|
-
<path d="M20.373 15.297a8.941 8.941 0 0 1-2.01 3.066A8.98 8.98 0 0 1 12 21a8.883 8.883 0 0 1-3.297-.627 8.942 8.942 0 0 1-3.066-2.01A8.981 8.981 0 0 1 3 12c0-1.163.22-2.277.627-3.297a8.943 8.943 0 0 1 2.01-3.066A8.982 8.982 0 0 1 12 3c1.163 0 2.277.22 3.297.627a8.943 8.943 0 0 1 3.066 2.01l-1.65 1.65A6.668 6.668 0 0 0 12 5.333a6.663 6.663 0 0 0-4.713 1.953A6.668 6.668 0 0 0 5.333 12a6.664 6.664 0 0 0 1.953 4.713A6.668 6.668 0 0 0 12 18.667a6.662 6.662 0 0 0 4.713-1.953 6.667 6.667 0 0 0 1.49-2.27l2.17.853z" fill="#fff" stroke="#4F5CE5" stroke-width=".667" stroke-miterlimit="10"/>
|
|
5
|
-
<path d="M18.203 14.443a6.668 6.668 0 0 1-3.543 3.67 6.608 6.608 0 0 1-2.66.554 6.669 6.669 0 0 1-6.113-4.007A6.607 6.607 0 0 1 5.333 12 6.668 6.668 0 0 1 9.34 5.887 6.607 6.607 0 0 1 12 5.333a6.667 6.667 0 0 1 4.713 1.953L14.71 9.29A3.818 3.818 0 0 0 12 8.167c-.543 0-1.06.113-1.53.316A3.85 3.85 0 0 0 8.167 12c0 .543.113 1.06.316 1.53a3.847 3.847 0 0 0 5.047 1.987 3.848 3.848 0 0 0 2.037-2.114l2.636 1.04z" fill="#fff" stroke="#4F5CE5" stroke-width=".667" stroke-miterlimit="10"/>
|
|
6
|
-
<path d="M13.874 12c0 .13-.08.247-.204.292l-1.006.372-.37 1.007a.31.31 0 0 1-.584 0l-.373-1.007-1.007-.371a.31.31 0 0 1 0-.583l1.007-.373.37-1.008a.31.31 0 0 1 .584 0l.373 1.008 1.007.37a.308.308 0 0 1 .203.293z" fill="#fff"/>
|
|
7
|
-
</g>
|
|
8
|
-
<defs>
|
|
9
|
-
<clipPath id="ub91fxv4ea">
|
|
10
|
-
<path fill="#fff" d="M0 0h24v24H0z"/>
|
|
11
|
-
</clipPath>
|
|
12
|
-
</defs>
|
|
13
|
-
</svg>
|
|
1
|
+
<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<g clip-path="url(#ub91fxv4ea)" transform="scale(1.15) translate(-1.8, -1.8)">
|
|
3
|
+
<path d="M20 0H4a4 4 0 0 0-4 4v16a4 4 0 0 0 4 4h16a4 4 0 0 0 4-4V4a4 4 0 0 0-4-4z" fill="#4F5CE5"/>
|
|
4
|
+
<path d="M20.373 15.297a8.941 8.941 0 0 1-2.01 3.066A8.98 8.98 0 0 1 12 21a8.883 8.883 0 0 1-3.297-.627 8.942 8.942 0 0 1-3.066-2.01A8.981 8.981 0 0 1 3 12c0-1.163.22-2.277.627-3.297a8.943 8.943 0 0 1 2.01-3.066A8.982 8.982 0 0 1 12 3c1.163 0 2.277.22 3.297.627a8.943 8.943 0 0 1 3.066 2.01l-1.65 1.65A6.668 6.668 0 0 0 12 5.333a6.663 6.663 0 0 0-4.713 1.953A6.668 6.668 0 0 0 5.333 12a6.664 6.664 0 0 0 1.953 4.713A6.668 6.668 0 0 0 12 18.667a6.662 6.662 0 0 0 4.713-1.953 6.667 6.667 0 0 0 1.49-2.27l2.17.853z" fill="#fff" stroke="#4F5CE5" stroke-width=".667" stroke-miterlimit="10"/>
|
|
5
|
+
<path d="M18.203 14.443a6.668 6.668 0 0 1-3.543 3.67 6.608 6.608 0 0 1-2.66.554 6.669 6.669 0 0 1-6.113-4.007A6.607 6.607 0 0 1 5.333 12 6.668 6.668 0 0 1 9.34 5.887 6.607 6.607 0 0 1 12 5.333a6.667 6.667 0 0 1 4.713 1.953L14.71 9.29A3.818 3.818 0 0 0 12 8.167c-.543 0-1.06.113-1.53.316A3.85 3.85 0 0 0 8.167 12c0 .543.113 1.06.316 1.53a3.847 3.847 0 0 0 5.047 1.987 3.848 3.848 0 0 0 2.037-2.114l2.636 1.04z" fill="#fff" stroke="#4F5CE5" stroke-width=".667" stroke-miterlimit="10"/>
|
|
6
|
+
<path d="M13.874 12c0 .13-.08.247-.204.292l-1.006.372-.37 1.007a.31.31 0 0 1-.584 0l-.373-1.007-1.007-.371a.31.31 0 0 1 0-.583l1.007-.373.37-1.008a.31.31 0 0 1 .584 0l.373 1.008 1.007.37a.308.308 0 0 1 .203.293z" fill="#fff"/>
|
|
7
|
+
</g>
|
|
8
|
+
<defs>
|
|
9
|
+
<clipPath id="ub91fxv4ea">
|
|
10
|
+
<path fill="#fff" d="M0 0h24v24H0z"/>
|
|
11
|
+
</clipPath>
|
|
12
|
+
</defs>
|
|
13
|
+
</svg>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
|
|
2
|
+
export declare class CteraFilesystem implements INodeType {
|
|
3
|
+
description: INodeTypeDescription;
|
|
4
|
+
execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
|
|
5
|
+
}
|
|
@@ -0,0 +1,598 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CteraFilesystem = void 0;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
class CteraFilesystem {
|
|
6
|
+
constructor() {
|
|
7
|
+
this.description = {
|
|
8
|
+
displayName: 'CTERA Filesystem',
|
|
9
|
+
name: 'cteraFilesystem',
|
|
10
|
+
icon: 'file:ctera.svg',
|
|
11
|
+
group: ['transform'],
|
|
12
|
+
version: 1,
|
|
13
|
+
subtitle: '={{$parameter["resource"] + ": " + $parameter["operation"]}}',
|
|
14
|
+
description: 'Perform filesystem operations on CTERA Portal storage via MCP',
|
|
15
|
+
defaults: {
|
|
16
|
+
name: 'CTERA Filesystem',
|
|
17
|
+
},
|
|
18
|
+
inputs: ['main'],
|
|
19
|
+
outputs: ['main'],
|
|
20
|
+
credentials: [
|
|
21
|
+
{
|
|
22
|
+
name: 'cteraPortalOAuth2Api',
|
|
23
|
+
required: true,
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
properties: [
|
|
27
|
+
// Resource selector
|
|
28
|
+
{
|
|
29
|
+
displayName: 'Resource',
|
|
30
|
+
name: 'resource',
|
|
31
|
+
type: 'options',
|
|
32
|
+
noDataExpression: true,
|
|
33
|
+
options: [
|
|
34
|
+
{
|
|
35
|
+
name: 'Directory',
|
|
36
|
+
value: 'directory',
|
|
37
|
+
description: 'Operations on directories',
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
name: 'File',
|
|
41
|
+
value: 'file',
|
|
42
|
+
description: 'Operations on files',
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
name: 'Link',
|
|
46
|
+
value: 'link',
|
|
47
|
+
description: 'Public link and permalink operations',
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
name: 'Version',
|
|
51
|
+
value: 'version',
|
|
52
|
+
description: 'File version operations',
|
|
53
|
+
},
|
|
54
|
+
],
|
|
55
|
+
default: 'file',
|
|
56
|
+
},
|
|
57
|
+
// ==================== FILE OPERATIONS ====================
|
|
58
|
+
{
|
|
59
|
+
displayName: 'Operation',
|
|
60
|
+
name: 'operation',
|
|
61
|
+
type: 'options',
|
|
62
|
+
noDataExpression: true,
|
|
63
|
+
displayOptions: {
|
|
64
|
+
show: {
|
|
65
|
+
resource: ['file'],
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
options: [
|
|
69
|
+
{
|
|
70
|
+
name: 'Copy',
|
|
71
|
+
value: 'copy',
|
|
72
|
+
description: 'Copy a file to a new location',
|
|
73
|
+
action: 'Copy a file',
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
name: 'Delete',
|
|
77
|
+
value: 'delete',
|
|
78
|
+
description: 'Delete one or more files',
|
|
79
|
+
action: 'Delete files',
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
name: 'Move',
|
|
83
|
+
value: 'move',
|
|
84
|
+
description: 'Move a file to a new location',
|
|
85
|
+
action: 'Move a file',
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
name: 'Read',
|
|
89
|
+
value: 'read',
|
|
90
|
+
description: 'Read file contents (text files)',
|
|
91
|
+
action: 'Read a file',
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
name: 'Rename',
|
|
95
|
+
value: 'rename',
|
|
96
|
+
description: 'Rename a file',
|
|
97
|
+
action: 'Rename a file',
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
name: 'Write',
|
|
101
|
+
value: 'write',
|
|
102
|
+
description: 'Write content to a file',
|
|
103
|
+
action: 'Write a file',
|
|
104
|
+
},
|
|
105
|
+
],
|
|
106
|
+
default: 'read',
|
|
107
|
+
},
|
|
108
|
+
// ==================== DIRECTORY OPERATIONS ====================
|
|
109
|
+
{
|
|
110
|
+
displayName: 'Operation',
|
|
111
|
+
name: 'operation',
|
|
112
|
+
type: 'options',
|
|
113
|
+
noDataExpression: true,
|
|
114
|
+
displayOptions: {
|
|
115
|
+
show: {
|
|
116
|
+
resource: ['directory'],
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
options: [
|
|
120
|
+
{
|
|
121
|
+
name: 'Create',
|
|
122
|
+
value: 'create',
|
|
123
|
+
description: 'Create a new directory',
|
|
124
|
+
action: 'Create a directory',
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
name: 'Delete',
|
|
128
|
+
value: 'delete',
|
|
129
|
+
description: 'Delete one or more directories',
|
|
130
|
+
action: 'Delete directories',
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
name: 'List',
|
|
134
|
+
value: 'list',
|
|
135
|
+
description: 'List directory contents',
|
|
136
|
+
action: 'List directory contents',
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
name: 'Recover',
|
|
140
|
+
value: 'recover',
|
|
141
|
+
description: 'Recover deleted items',
|
|
142
|
+
action: 'Recover deleted items',
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
name: 'Walk',
|
|
146
|
+
value: 'walk',
|
|
147
|
+
description: 'Recursively walk directory tree',
|
|
148
|
+
action: 'Walk directory tree',
|
|
149
|
+
},
|
|
150
|
+
],
|
|
151
|
+
default: 'list',
|
|
152
|
+
},
|
|
153
|
+
// ==================== VERSION OPERATIONS ====================
|
|
154
|
+
{
|
|
155
|
+
displayName: 'Operation',
|
|
156
|
+
name: 'operation',
|
|
157
|
+
type: 'options',
|
|
158
|
+
noDataExpression: true,
|
|
159
|
+
displayOptions: {
|
|
160
|
+
show: {
|
|
161
|
+
resource: ['version'],
|
|
162
|
+
},
|
|
163
|
+
},
|
|
164
|
+
options: [
|
|
165
|
+
{
|
|
166
|
+
name: 'List',
|
|
167
|
+
value: 'list',
|
|
168
|
+
description: 'List all versions of a file',
|
|
169
|
+
action: 'List file versions',
|
|
170
|
+
},
|
|
171
|
+
],
|
|
172
|
+
default: 'list',
|
|
173
|
+
},
|
|
174
|
+
// ==================== LINK OPERATIONS ====================
|
|
175
|
+
{
|
|
176
|
+
displayName: 'Operation',
|
|
177
|
+
name: 'operation',
|
|
178
|
+
type: 'options',
|
|
179
|
+
noDataExpression: true,
|
|
180
|
+
displayOptions: {
|
|
181
|
+
show: {
|
|
182
|
+
resource: ['link'],
|
|
183
|
+
},
|
|
184
|
+
},
|
|
185
|
+
options: [
|
|
186
|
+
{
|
|
187
|
+
name: 'Create Public Link',
|
|
188
|
+
value: 'createPublicLink',
|
|
189
|
+
description: 'Create a public sharing link',
|
|
190
|
+
action: 'Create a public link',
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
name: 'Get Permalink',
|
|
194
|
+
value: 'getPermalink',
|
|
195
|
+
description: 'Get permanent link to a file or directory',
|
|
196
|
+
action: 'Get permalink',
|
|
197
|
+
},
|
|
198
|
+
],
|
|
199
|
+
default: 'createPublicLink',
|
|
200
|
+
},
|
|
201
|
+
// ==================== COMMON PARAMETERS ====================
|
|
202
|
+
// Path parameter (used by most operations)
|
|
203
|
+
{
|
|
204
|
+
displayName: 'Path',
|
|
205
|
+
name: 'path',
|
|
206
|
+
type: 'string',
|
|
207
|
+
default: '',
|
|
208
|
+
required: true,
|
|
209
|
+
placeholder: '/CloudFolders/shared/documents',
|
|
210
|
+
description: 'Path to the file or directory',
|
|
211
|
+
displayOptions: {
|
|
212
|
+
hide: {
|
|
213
|
+
operation: ['delete', 'recover'],
|
|
214
|
+
},
|
|
215
|
+
},
|
|
216
|
+
},
|
|
217
|
+
// Paths parameter (for delete/recover operations)
|
|
218
|
+
{
|
|
219
|
+
displayName: 'Paths',
|
|
220
|
+
name: 'paths',
|
|
221
|
+
type: 'string',
|
|
222
|
+
default: '',
|
|
223
|
+
required: true,
|
|
224
|
+
placeholder: '/CloudFolders/shared/file1.txt, /CloudFolders/shared/file2.txt',
|
|
225
|
+
description: 'Comma-separated list of paths to delete or recover',
|
|
226
|
+
displayOptions: {
|
|
227
|
+
show: {
|
|
228
|
+
operation: ['delete', 'recover'],
|
|
229
|
+
},
|
|
230
|
+
},
|
|
231
|
+
},
|
|
232
|
+
// ==================== FILE-SPECIFIC PARAMETERS ====================
|
|
233
|
+
// Content for write operation
|
|
234
|
+
{
|
|
235
|
+
displayName: 'Content',
|
|
236
|
+
name: 'content',
|
|
237
|
+
type: 'string',
|
|
238
|
+
default: '',
|
|
239
|
+
required: true,
|
|
240
|
+
typeOptions: {
|
|
241
|
+
rows: 5,
|
|
242
|
+
},
|
|
243
|
+
placeholder: 'File content to write...',
|
|
244
|
+
description: 'Content to write to the file (text or base64-encoded binary)',
|
|
245
|
+
displayOptions: {
|
|
246
|
+
show: {
|
|
247
|
+
resource: ['file'],
|
|
248
|
+
operation: ['write'],
|
|
249
|
+
},
|
|
250
|
+
},
|
|
251
|
+
},
|
|
252
|
+
// Destination for copy/move operations
|
|
253
|
+
{
|
|
254
|
+
displayName: 'Destination',
|
|
255
|
+
name: 'destination',
|
|
256
|
+
type: 'string',
|
|
257
|
+
default: '',
|
|
258
|
+
required: true,
|
|
259
|
+
placeholder: '/CloudFolders/archive/documents',
|
|
260
|
+
description: 'Destination path for the copy or move operation',
|
|
261
|
+
displayOptions: {
|
|
262
|
+
show: {
|
|
263
|
+
resource: ['file'],
|
|
264
|
+
operation: ['copy', 'move'],
|
|
265
|
+
},
|
|
266
|
+
},
|
|
267
|
+
},
|
|
268
|
+
// New name for rename operation
|
|
269
|
+
{
|
|
270
|
+
displayName: 'New Name',
|
|
271
|
+
name: 'newName',
|
|
272
|
+
type: 'string',
|
|
273
|
+
default: '',
|
|
274
|
+
required: true,
|
|
275
|
+
placeholder: 'new-filename.txt',
|
|
276
|
+
description: 'New name for the file (without path)',
|
|
277
|
+
displayOptions: {
|
|
278
|
+
show: {
|
|
279
|
+
resource: ['file'],
|
|
280
|
+
operation: ['rename'],
|
|
281
|
+
},
|
|
282
|
+
},
|
|
283
|
+
},
|
|
284
|
+
// ==================== DIRECTORY-SPECIFIC PARAMETERS ====================
|
|
285
|
+
// Create parents option
|
|
286
|
+
{
|
|
287
|
+
displayName: 'Create Parent Directories',
|
|
288
|
+
name: 'createParents',
|
|
289
|
+
type: 'boolean',
|
|
290
|
+
default: false,
|
|
291
|
+
description: 'Whether to create parent directories if they do not exist',
|
|
292
|
+
displayOptions: {
|
|
293
|
+
show: {
|
|
294
|
+
resource: ['directory'],
|
|
295
|
+
operation: ['create'],
|
|
296
|
+
},
|
|
297
|
+
},
|
|
298
|
+
},
|
|
299
|
+
// Include deleted option for list/walk
|
|
300
|
+
{
|
|
301
|
+
displayName: 'Include Deleted',
|
|
302
|
+
name: 'includeDeleted',
|
|
303
|
+
type: 'boolean',
|
|
304
|
+
default: false,
|
|
305
|
+
description: 'Whether to include deleted files in the results',
|
|
306
|
+
displayOptions: {
|
|
307
|
+
show: {
|
|
308
|
+
resource: ['directory'],
|
|
309
|
+
operation: ['list', 'walk'],
|
|
310
|
+
},
|
|
311
|
+
},
|
|
312
|
+
},
|
|
313
|
+
// ==================== LINK-SPECIFIC PARAMETERS ====================
|
|
314
|
+
// Access level for public link
|
|
315
|
+
{
|
|
316
|
+
displayName: 'Access Level',
|
|
317
|
+
name: 'access',
|
|
318
|
+
type: 'options',
|
|
319
|
+
options: [
|
|
320
|
+
{
|
|
321
|
+
name: 'Read Only',
|
|
322
|
+
value: 'RO',
|
|
323
|
+
description: 'Recipients can only view/download',
|
|
324
|
+
},
|
|
325
|
+
{
|
|
326
|
+
name: 'Read/Write',
|
|
327
|
+
value: 'RW',
|
|
328
|
+
description: 'Recipients can view, download, and modify',
|
|
329
|
+
},
|
|
330
|
+
],
|
|
331
|
+
default: 'RO',
|
|
332
|
+
description: 'Access level for the public link',
|
|
333
|
+
displayOptions: {
|
|
334
|
+
show: {
|
|
335
|
+
resource: ['link'],
|
|
336
|
+
operation: ['createPublicLink'],
|
|
337
|
+
},
|
|
338
|
+
},
|
|
339
|
+
},
|
|
340
|
+
// Expiration for public link
|
|
341
|
+
{
|
|
342
|
+
displayName: 'Expire In (Days)',
|
|
343
|
+
name: 'expireIn',
|
|
344
|
+
type: 'number',
|
|
345
|
+
default: 30,
|
|
346
|
+
typeOptions: {
|
|
347
|
+
minValue: 1,
|
|
348
|
+
maxValue: 365,
|
|
349
|
+
},
|
|
350
|
+
description: 'Number of days until the link expires',
|
|
351
|
+
displayOptions: {
|
|
352
|
+
show: {
|
|
353
|
+
resource: ['link'],
|
|
354
|
+
operation: ['createPublicLink'],
|
|
355
|
+
},
|
|
356
|
+
},
|
|
357
|
+
},
|
|
358
|
+
],
|
|
359
|
+
};
|
|
360
|
+
}
|
|
361
|
+
async execute() {
|
|
362
|
+
const items = this.getInputData();
|
|
363
|
+
const returnData = [];
|
|
364
|
+
// Get OAuth2 credentials
|
|
365
|
+
const oauth2Credentials = await this.getCredentials('cteraPortalOAuth2Api');
|
|
366
|
+
const oauthTokenData = oauth2Credentials.oauthTokenData;
|
|
367
|
+
const bearerToken = oauthTokenData === null || oauthTokenData === void 0 ? void 0 : oauthTokenData.access_token;
|
|
368
|
+
const mcpServerUrl = `${oauth2Credentials.portalUrl.replace(/\/$/, '')}/_SRV/MCP`;
|
|
369
|
+
const allowUnauthorizedCerts = oauth2Credentials.allowUnauthorizedCerts;
|
|
370
|
+
for (let i = 0; i < items.length; i++) {
|
|
371
|
+
try {
|
|
372
|
+
const resource = this.getNodeParameter('resource', i);
|
|
373
|
+
const operation = this.getNodeParameter('operation', i);
|
|
374
|
+
let toolName;
|
|
375
|
+
const toolArgs = {};
|
|
376
|
+
// Determine tool name and arguments based on resource and operation
|
|
377
|
+
if (resource === 'file') {
|
|
378
|
+
switch (operation) {
|
|
379
|
+
case 'read':
|
|
380
|
+
toolName = 'ctera_portal_read_file';
|
|
381
|
+
toolArgs.path = this.getNodeParameter('path', i);
|
|
382
|
+
break;
|
|
383
|
+
case 'write':
|
|
384
|
+
toolName = 'ctera_portal_upload_from_content';
|
|
385
|
+
toolArgs.filepath = this.getNodeParameter('path', i);
|
|
386
|
+
toolArgs.content = this.getNodeParameter('content', i);
|
|
387
|
+
break;
|
|
388
|
+
case 'delete': {
|
|
389
|
+
toolName = 'ctera_portal_delete_items';
|
|
390
|
+
const deletePaths = this.getNodeParameter('paths', i)
|
|
391
|
+
.split(',')
|
|
392
|
+
.map((p) => p.trim())
|
|
393
|
+
.filter((p) => p);
|
|
394
|
+
toolArgs.paths = deletePaths;
|
|
395
|
+
break;
|
|
396
|
+
}
|
|
397
|
+
case 'copy':
|
|
398
|
+
toolName = 'ctera_portal_copy_item';
|
|
399
|
+
toolArgs.source = this.getNodeParameter('path', i);
|
|
400
|
+
toolArgs.destination = this.getNodeParameter('destination', i);
|
|
401
|
+
break;
|
|
402
|
+
case 'move':
|
|
403
|
+
toolName = 'ctera_portal_move_item';
|
|
404
|
+
toolArgs.source = this.getNodeParameter('path', i);
|
|
405
|
+
toolArgs.destination = this.getNodeParameter('destination', i);
|
|
406
|
+
break;
|
|
407
|
+
case 'rename':
|
|
408
|
+
toolName = 'ctera_portal_rename_item';
|
|
409
|
+
toolArgs.path = this.getNodeParameter('path', i);
|
|
410
|
+
toolArgs.new_name = this.getNodeParameter('newName', i);
|
|
411
|
+
break;
|
|
412
|
+
default:
|
|
413
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown file operation: ${operation}`, { itemIndex: i });
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
else if (resource === 'directory') {
|
|
417
|
+
switch (operation) {
|
|
418
|
+
case 'list':
|
|
419
|
+
toolName = 'ctera_portal_list_dir';
|
|
420
|
+
toolArgs.path = this.getNodeParameter('path', i);
|
|
421
|
+
toolArgs.include_deleted = this.getNodeParameter('includeDeleted', i);
|
|
422
|
+
break;
|
|
423
|
+
case 'create': {
|
|
424
|
+
const createParents = this.getNodeParameter('createParents', i);
|
|
425
|
+
toolName = createParents ? 'ctera_portal_makedirs' : 'ctera_portal_create_directory';
|
|
426
|
+
toolArgs.path = this.getNodeParameter('path', i);
|
|
427
|
+
break;
|
|
428
|
+
}
|
|
429
|
+
case 'delete': {
|
|
430
|
+
toolName = 'ctera_portal_delete_items';
|
|
431
|
+
const dirPaths = this.getNodeParameter('paths', i)
|
|
432
|
+
.split(',')
|
|
433
|
+
.map((p) => p.trim())
|
|
434
|
+
.filter((p) => p);
|
|
435
|
+
toolArgs.paths = dirPaths;
|
|
436
|
+
break;
|
|
437
|
+
}
|
|
438
|
+
case 'recover': {
|
|
439
|
+
toolName = 'ctera_portal_recover_items';
|
|
440
|
+
const recoverPaths = this.getNodeParameter('paths', i)
|
|
441
|
+
.split(',')
|
|
442
|
+
.map((p) => p.trim())
|
|
443
|
+
.filter((p) => p);
|
|
444
|
+
toolArgs.paths = recoverPaths;
|
|
445
|
+
break;
|
|
446
|
+
}
|
|
447
|
+
case 'walk':
|
|
448
|
+
toolName = 'ctera_portal_walk_tree';
|
|
449
|
+
toolArgs.path = this.getNodeParameter('path', i);
|
|
450
|
+
toolArgs.include_deleted = this.getNodeParameter('includeDeleted', i);
|
|
451
|
+
break;
|
|
452
|
+
default:
|
|
453
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown directory operation: ${operation}`, { itemIndex: i });
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
else if (resource === 'version') {
|
|
457
|
+
switch (operation) {
|
|
458
|
+
case 'list':
|
|
459
|
+
toolName = 'ctera_portal_list_versions';
|
|
460
|
+
toolArgs.path = this.getNodeParameter('path', i);
|
|
461
|
+
break;
|
|
462
|
+
default:
|
|
463
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown version operation: ${operation}`, { itemIndex: i });
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
else if (resource === 'link') {
|
|
467
|
+
switch (operation) {
|
|
468
|
+
case 'createPublicLink':
|
|
469
|
+
toolName = 'ctera_portal_create_public_link';
|
|
470
|
+
toolArgs.path = this.getNodeParameter('path', i);
|
|
471
|
+
toolArgs.access = this.getNodeParameter('access', i);
|
|
472
|
+
toolArgs.expire_in = this.getNodeParameter('expireIn', i);
|
|
473
|
+
break;
|
|
474
|
+
case 'getPermalink':
|
|
475
|
+
toolName = 'ctera_portal_get_permalink';
|
|
476
|
+
toolArgs.path = this.getNodeParameter('path', i);
|
|
477
|
+
break;
|
|
478
|
+
default:
|
|
479
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown link operation: ${operation}`, { itemIndex: i });
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
else {
|
|
483
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown resource: ${resource}`, {
|
|
484
|
+
itemIndex: i,
|
|
485
|
+
});
|
|
486
|
+
}
|
|
487
|
+
// Construct JSON-RPC 2.0 request
|
|
488
|
+
const requestBody = {
|
|
489
|
+
jsonrpc: '2.0',
|
|
490
|
+
method: 'tools/call',
|
|
491
|
+
params: {
|
|
492
|
+
name: toolName,
|
|
493
|
+
arguments: toolArgs,
|
|
494
|
+
},
|
|
495
|
+
id: i + 1,
|
|
496
|
+
};
|
|
497
|
+
// Make HTTP request to MCP server
|
|
498
|
+
const response = await this.helpers.httpRequest({
|
|
499
|
+
method: 'POST',
|
|
500
|
+
url: `${mcpServerUrl}/mcp/`,
|
|
501
|
+
headers: {
|
|
502
|
+
'Content-Type': 'application/json',
|
|
503
|
+
Authorization: `Bearer ${bearerToken}`,
|
|
504
|
+
},
|
|
505
|
+
body: JSON.stringify(requestBody),
|
|
506
|
+
skipSslCertificateValidation: allowUnauthorizedCerts,
|
|
507
|
+
});
|
|
508
|
+
// Parse response
|
|
509
|
+
const parsedResponse = typeof response === 'string' ? JSON.parse(response) : response;
|
|
510
|
+
// Handle MCP error responses
|
|
511
|
+
if (parsedResponse.error) {
|
|
512
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `MCP Error: ${parsedResponse.error.message || JSON.stringify(parsedResponse.error)}`, { itemIndex: i });
|
|
513
|
+
}
|
|
514
|
+
// Extract result from MCP response
|
|
515
|
+
let result = null;
|
|
516
|
+
if (parsedResponse.result && parsedResponse.result.content) {
|
|
517
|
+
const content = parsedResponse.result.content[0];
|
|
518
|
+
if (content && content.type === 'text') {
|
|
519
|
+
try {
|
|
520
|
+
// Convert Python syntax to JSON syntax
|
|
521
|
+
let jsonText = content.text
|
|
522
|
+
.replace(/'/g, '"') // Single quotes to double quotes
|
|
523
|
+
.replace(/None/g, 'null') // Python None to JSON null
|
|
524
|
+
.replace(/True/g, 'true') // Python True to JSON true
|
|
525
|
+
.replace(/False/g, 'false'); // Python False to JSON false
|
|
526
|
+
result = JSON.parse(jsonText);
|
|
527
|
+
}
|
|
528
|
+
catch {
|
|
529
|
+
result = content.text;
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
else {
|
|
533
|
+
result = content;
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
else {
|
|
537
|
+
result = parsedResponse.result;
|
|
538
|
+
}
|
|
539
|
+
// Handle fan-out for list operations (directory list, walk, versions)
|
|
540
|
+
if ((resource === 'directory' && (operation === 'list' || operation === 'walk')) ||
|
|
541
|
+
(resource === 'version' && operation === 'list')) {
|
|
542
|
+
if (Array.isArray(result) && result.length > 0) {
|
|
543
|
+
for (const item of result) {
|
|
544
|
+
returnData.push({
|
|
545
|
+
json: {
|
|
546
|
+
...items[i].json,
|
|
547
|
+
resource,
|
|
548
|
+
operation,
|
|
549
|
+
...item,
|
|
550
|
+
},
|
|
551
|
+
pairedItem: { item: i },
|
|
552
|
+
});
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
else {
|
|
556
|
+
// Empty result
|
|
557
|
+
returnData.push({
|
|
558
|
+
json: {
|
|
559
|
+
...items[i].json,
|
|
560
|
+
resource,
|
|
561
|
+
operation,
|
|
562
|
+
result: [],
|
|
563
|
+
},
|
|
564
|
+
pairedItem: { item: i },
|
|
565
|
+
});
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
else {
|
|
569
|
+
// Single result operations
|
|
570
|
+
returnData.push({
|
|
571
|
+
json: {
|
|
572
|
+
...items[i].json,
|
|
573
|
+
resource,
|
|
574
|
+
operation,
|
|
575
|
+
result: result,
|
|
576
|
+
},
|
|
577
|
+
pairedItem: { item: i },
|
|
578
|
+
});
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
catch (error) {
|
|
582
|
+
if (this.continueOnFail()) {
|
|
583
|
+
returnData.push({
|
|
584
|
+
json: {
|
|
585
|
+
...items[i].json,
|
|
586
|
+
error: error.message,
|
|
587
|
+
},
|
|
588
|
+
pairedItem: { item: i },
|
|
589
|
+
});
|
|
590
|
+
continue;
|
|
591
|
+
}
|
|
592
|
+
throw error;
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
return [returnData];
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
exports.CteraFilesystem = CteraFilesystem;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<g clip-path="url(#ub91fxv4ea)" transform="scale(1.15) translate(-1.8, -1.8)">
|
|
3
|
+
<path d="M20 0H4a4 4 0 0 0-4 4v16a4 4 0 0 0 4 4h16a4 4 0 0 0 4-4V4a4 4 0 0 0-4-4z" fill="#4F5CE5"/>
|
|
4
|
+
<path d="M20.373 15.297a8.941 8.941 0 0 1-2.01 3.066A8.98 8.98 0 0 1 12 21a8.883 8.883 0 0 1-3.297-.627 8.942 8.942 0 0 1-3.066-2.01A8.981 8.981 0 0 1 3 12c0-1.163.22-2.277.627-3.297a8.943 8.943 0 0 1 2.01-3.066A8.982 8.982 0 0 1 12 3c1.163 0 2.277.22 3.297.627a8.943 8.943 0 0 1 3.066 2.01l-1.65 1.65A6.668 6.668 0 0 0 12 5.333a6.663 6.663 0 0 0-4.713 1.953A6.668 6.668 0 0 0 5.333 12a6.664 6.664 0 0 0 1.953 4.713A6.668 6.668 0 0 0 12 18.667a6.662 6.662 0 0 0 4.713-1.953 6.667 6.667 0 0 0 1.49-2.27l2.17.853z" fill="#fff" stroke="#4F5CE5" stroke-width=".667" stroke-miterlimit="10"/>
|
|
5
|
+
<path d="M18.203 14.443a6.668 6.668 0 0 1-3.543 3.67 6.608 6.608 0 0 1-2.66.554 6.669 6.669 0 0 1-6.113-4.007A6.607 6.607 0 0 1 5.333 12 6.668 6.668 0 0 1 9.34 5.887 6.607 6.607 0 0 1 12 5.333a6.667 6.667 0 0 1 4.713 1.953L14.71 9.29A3.818 3.818 0 0 0 12 8.167c-.543 0-1.06.113-1.53.316A3.85 3.85 0 0 0 8.167 12c0 .543.113 1.06.316 1.53a3.847 3.847 0 0 0 5.047 1.987 3.848 3.848 0 0 0 2.037-2.114l2.636 1.04z" fill="#fff" stroke="#4F5CE5" stroke-width=".667" stroke-miterlimit="10"/>
|
|
6
|
+
<path d="M13.874 12c0 .13-.08.247-.204.292l-1.006.372-.37 1.007a.31.31 0 0 1-.584 0l-.373-1.007-1.007-.371a.31.31 0 0 1 0-.583l1.007-.373.37-1.008a.31.31 0 0 1 .584 0l.373 1.008 1.007.37a.308.308 0 0 1 .203.293z" fill="#fff"/>
|
|
7
|
+
</g>
|
|
8
|
+
<defs>
|
|
9
|
+
<clipPath id="ub91fxv4ea">
|
|
10
|
+
<path fill="#fff" d="M0 0h24v24H0z"/>
|
|
11
|
+
</clipPath>
|
|
12
|
+
</defs>
|
|
13
|
+
</svg>
|
package/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
...require('./dist/nodes/CteraAi/CteraAi.node'),
|
|
3
|
-
...require('./dist/credentials/CteraAiMcpApi.credentials'),
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
module.exports = {
|
|
2
|
+
...require('./dist/nodes/CteraAi/CteraAi.node'),
|
|
3
|
+
...require('./dist/credentials/CteraAiMcpApi.credentials'),
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
package/package.json
CHANGED
|
@@ -1,60 +1,71 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@ctera/n8n-nodes-ctera-ai",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "n8n community
|
|
5
|
-
"keywords": [
|
|
6
|
-
"n8n-community-node-package",
|
|
7
|
-
"n8n",
|
|
8
|
-
"ctera",
|
|
9
|
-
"ai",
|
|
10
|
-
"mcp",
|
|
11
|
-
"rag"
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
"
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
"
|
|
25
|
-
},
|
|
26
|
-
"
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
"
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
"
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
"
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
"
|
|
59
|
-
|
|
60
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@ctera/n8n-nodes-ctera-ai",
|
|
3
|
+
"version": "0.4.0",
|
|
4
|
+
"description": "n8n community nodes for CTERA Portal - includes AI/RAG integration and filesystem operations via MCP",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"n8n-community-node-package",
|
|
7
|
+
"n8n",
|
|
8
|
+
"ctera",
|
|
9
|
+
"ai",
|
|
10
|
+
"mcp",
|
|
11
|
+
"rag",
|
|
12
|
+
"filesystem",
|
|
13
|
+
"storage",
|
|
14
|
+
"file-management"
|
|
15
|
+
],
|
|
16
|
+
"license": "MIT",
|
|
17
|
+
"homepage": "https://github.com/ctera/ctera-n8n-nodes",
|
|
18
|
+
"author": {
|
|
19
|
+
"name": "CTERA Networks",
|
|
20
|
+
"email": "support@ctera.com"
|
|
21
|
+
},
|
|
22
|
+
"repository": {
|
|
23
|
+
"type": "git",
|
|
24
|
+
"url": "https://github.com/ctera/ctera-n8n-nodes.git"
|
|
25
|
+
},
|
|
26
|
+
"publishConfig": {
|
|
27
|
+
"access": "public"
|
|
28
|
+
},
|
|
29
|
+
"main": "index.js",
|
|
30
|
+
"scripts": {
|
|
31
|
+
"build": "tsc && gulp build:icons",
|
|
32
|
+
"dev": "tsc --watch",
|
|
33
|
+
"format": "prettier nodes credentials --write",
|
|
34
|
+
"lint": "eslint \"nodes/**/*.ts\" \"credentials/**/*.ts\" package.json",
|
|
35
|
+
"lintfix": "eslint \"nodes/**/*.ts\" \"credentials/**/*.ts\" package.json --fix",
|
|
36
|
+
"prepublishOnly": "npm run build && npm run lint",
|
|
37
|
+
"test": "jest",
|
|
38
|
+
"test:watch": "jest --watch",
|
|
39
|
+
"test:coverage": "jest --coverage"
|
|
40
|
+
},
|
|
41
|
+
"files": [
|
|
42
|
+
"dist"
|
|
43
|
+
],
|
|
44
|
+
"n8n": {
|
|
45
|
+
"n8nNodesApiVersion": 1,
|
|
46
|
+
"credentials": [
|
|
47
|
+
"dist/credentials/CteraAiMcpApi.credentials.js",
|
|
48
|
+
"dist/credentials/CteraPortalOAuth2Api.credentials.js"
|
|
49
|
+
],
|
|
50
|
+
"nodes": [
|
|
51
|
+
"dist/nodes/CteraAi/CteraAi.node.js",
|
|
52
|
+
"dist/nodes/CteraFilesystem/CteraFilesystem.node.js"
|
|
53
|
+
]
|
|
54
|
+
},
|
|
55
|
+
"devDependencies": {
|
|
56
|
+
"@types/jest": "^29.5.12",
|
|
57
|
+
"@typescript-eslint/eslint-plugin": "^5.62.0",
|
|
58
|
+
"@typescript-eslint/parser": "^5.59.0",
|
|
59
|
+
"eslint": "^8.40.0",
|
|
60
|
+
"eslint-plugin-n8n-nodes-base": "^1.12.0",
|
|
61
|
+
"gulp": "^5.0.1",
|
|
62
|
+
"jest": "^29.7.0",
|
|
63
|
+
"n8n-workflow": "^1.0.0",
|
|
64
|
+
"prettier": "^2.8.8",
|
|
65
|
+
"ts-jest": "^29.1.2",
|
|
66
|
+
"typescript": "^5.0.4"
|
|
67
|
+
},
|
|
68
|
+
"peerDependencies": {
|
|
69
|
+
"n8n-workflow": "^1.0.0"
|
|
70
|
+
}
|
|
71
|
+
}
|