nana800-mcp-server 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +175 -0
- package/dist/index.js +912 -0
- package/package.json +46 -0
package/README.md
ADDED
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
# nana800 MCP Server
|
|
2
|
+
|
|
3
|
+
MCP (Model Context Protocol) server for [nana800.io](https://nana800.io) Public API. This server enables AI-powered IDEs like Cursor, Claude Desktop, and VS Code to interact with your no-code automation projects.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install -g nana800-mcp-server
|
|
9
|
+
# or
|
|
10
|
+
npx nana800-mcp-server
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Getting API Key
|
|
14
|
+
|
|
15
|
+
1. Go to [https://cloud.nana800.io/settings](https://cloud.nana800.io/settings)
|
|
16
|
+
2. Create or copy your API key
|
|
17
|
+
3. Use it in the configuration below
|
|
18
|
+
|
|
19
|
+
## Configuration
|
|
20
|
+
|
|
21
|
+
### Cursor IDE
|
|
22
|
+
|
|
23
|
+
Add to your `~/.cursor/mcp.json`:
|
|
24
|
+
|
|
25
|
+
```json
|
|
26
|
+
{
|
|
27
|
+
"mcpServers": {
|
|
28
|
+
"nana800": {
|
|
29
|
+
"command": "npx",
|
|
30
|
+
"args": ["nana800-mcp-server"],
|
|
31
|
+
"env": {
|
|
32
|
+
"MCP_API_KEY": "your_api_key_here",
|
|
33
|
+
"MCP_PROJECT_ID": "your_default_project_id",
|
|
34
|
+
"MCP_SCHEME_ID": "your_default_scheme_id"
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Claude Desktop
|
|
42
|
+
|
|
43
|
+
Add to your Claude Desktop config (`~/Library/Application Support/Claude/claude_desktop_config.json` on macOS):
|
|
44
|
+
|
|
45
|
+
```json
|
|
46
|
+
{
|
|
47
|
+
"mcpServers": {
|
|
48
|
+
"nana800": {
|
|
49
|
+
"command": "npx",
|
|
50
|
+
"args": ["nana800-mcp-server"],
|
|
51
|
+
"env": {
|
|
52
|
+
"MCP_API_KEY": "your_api_key_here",
|
|
53
|
+
"MCP_PROJECT_ID": "your_default_project_id",
|
|
54
|
+
"MCP_SCHEME_ID": "your_default_scheme_id"
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### VS Code with Cline/Continue
|
|
62
|
+
|
|
63
|
+
Add to your extension settings:
|
|
64
|
+
|
|
65
|
+
```json
|
|
66
|
+
{
|
|
67
|
+
"mcpServers": {
|
|
68
|
+
"nana800": {
|
|
69
|
+
"command": "npx",
|
|
70
|
+
"args": ["nana800-mcp-server"],
|
|
71
|
+
"env": {
|
|
72
|
+
"MCP_API_KEY": "your_api_key_here",
|
|
73
|
+
"MCP_PROJECT_ID": "your_default_project_id",
|
|
74
|
+
"MCP_SCHEME_ID": "your_default_scheme_id"
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Environment Variables
|
|
82
|
+
|
|
83
|
+
| Variable | Required | Description |
|
|
84
|
+
|----------|----------|-------------|
|
|
85
|
+
| `MCP_API_KEY` | Yes | Your nana800.io API key |
|
|
86
|
+
| `MCP_PROJECT_ID` | No | Default project ID (can be overridden per tool call) |
|
|
87
|
+
| `MCP_SCHEME_ID` | No | Default scheme ID (can be overridden per tool call) |
|
|
88
|
+
|
|
89
|
+
## Available Tools
|
|
90
|
+
|
|
91
|
+
### Project Management
|
|
92
|
+
|
|
93
|
+
| Tool | Description |
|
|
94
|
+
|------|-------------|
|
|
95
|
+
| `project_create` | Create a new project |
|
|
96
|
+
| `project_get` | Get project details by ID |
|
|
97
|
+
| `project_list_by_payment_account` | List projects by payment account |
|
|
98
|
+
| `project_update` | Update project properties |
|
|
99
|
+
| `project_delete` | Delete a project |
|
|
100
|
+
|
|
101
|
+
### Scheme Management
|
|
102
|
+
|
|
103
|
+
| Tool | Description |
|
|
104
|
+
|------|-------------|
|
|
105
|
+
| `scheme_create` | Create a new scheme (workflow) |
|
|
106
|
+
| `scheme_get` | Get scheme details |
|
|
107
|
+
| `scheme_list_by_project` | List all schemes in a project |
|
|
108
|
+
| `scheme_update` | Update scheme properties |
|
|
109
|
+
| `scheme_delete` | Delete a scheme |
|
|
110
|
+
| `scheme_export` | Export scheme as JSON |
|
|
111
|
+
| `scheme_import` | Import nodes into a scheme |
|
|
112
|
+
| `scheme_get_context_type` | Get scheme context type |
|
|
113
|
+
| `scheme_get_swagger_json` | Get OpenAPI spec for scheme |
|
|
114
|
+
|
|
115
|
+
### Node Management
|
|
116
|
+
|
|
117
|
+
| Tool | Description |
|
|
118
|
+
|------|-------------|
|
|
119
|
+
| `node_create_trigger` | Create a trigger node |
|
|
120
|
+
| `node_create_action` | Create an action node |
|
|
121
|
+
| `node_get` | Get node details |
|
|
122
|
+
| `node_list_by_scheme` | List all nodes in a scheme |
|
|
123
|
+
| `node_update` | Update node properties |
|
|
124
|
+
| `node_update_config` | Update node configuration |
|
|
125
|
+
| `node_delete` | Delete a node |
|
|
126
|
+
| `node_connect` | Connect two nodes |
|
|
127
|
+
| `node_disconnect` | Disconnect two nodes |
|
|
128
|
+
| `node_copy` | Copy a node |
|
|
129
|
+
| `node_get_scheme_edges` | Get all connections in a scheme |
|
|
130
|
+
| `node_find_existing_buttons` | Find node output buttons |
|
|
131
|
+
|
|
132
|
+
### Node Process Management
|
|
133
|
+
|
|
134
|
+
| Tool | Description |
|
|
135
|
+
|------|-------------|
|
|
136
|
+
| `node_process_get` | Get node process details |
|
|
137
|
+
| `node_process_list_filtered` | List node processes with filters |
|
|
138
|
+
| `node_process_delete` | Delete a node process record |
|
|
139
|
+
|
|
140
|
+
### Scheme Process Management
|
|
141
|
+
|
|
142
|
+
| Tool | Description |
|
|
143
|
+
|------|-------------|
|
|
144
|
+
| `scheme_process_get` | Get scheme process details |
|
|
145
|
+
| `scheme_process_list_filtered` | List scheme processes with filters |
|
|
146
|
+
| `scheme_process_delete` | Delete a scheme process record |
|
|
147
|
+
|
|
148
|
+
### Payment Account Management
|
|
149
|
+
|
|
150
|
+
| Tool | Description |
|
|
151
|
+
|------|-------------|
|
|
152
|
+
| `payment_account_get_by_user` | Get payment account by user ID |
|
|
153
|
+
| `payment_account_get_by_project` | Get payment account by project ID |
|
|
154
|
+
| `payment_account_update` | Update payment account info |
|
|
155
|
+
| `payment_account_remove` | Remove payment account |
|
|
156
|
+
| `payment_account_get_transactions` | Get transaction history |
|
|
157
|
+
|
|
158
|
+
## Usage Examples
|
|
159
|
+
|
|
160
|
+
Once configured, you can ask your AI assistant things like:
|
|
161
|
+
|
|
162
|
+
- "List all my projects"
|
|
163
|
+
- "Create a new scheme called 'Email Notifications' in project X"
|
|
164
|
+
- "Show me all nodes in scheme Y"
|
|
165
|
+
- "Connect the webhook trigger to the email action"
|
|
166
|
+
- "Export the scheme configuration"
|
|
167
|
+
- "What processes are currently running?"
|
|
168
|
+
|
|
169
|
+
## API Documentation
|
|
170
|
+
|
|
171
|
+
Full API documentation available at: [https://api.nana800.io/docs](https://api.nana800.io/docs)
|
|
172
|
+
|
|
173
|
+
## License
|
|
174
|
+
|
|
175
|
+
MIT
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,912 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// src/index.ts
|
|
4
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
5
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
6
|
+
|
|
7
|
+
// src/tools/project.tools.ts
|
|
8
|
+
import { z } from "zod";
|
|
9
|
+
|
|
10
|
+
// src/api-client.ts
|
|
11
|
+
var API_BASE_URL = "https://api.nana800.io";
|
|
12
|
+
var API_KEY_HEADER = "x-nana-api-key";
|
|
13
|
+
var DEFAULT_PROJECT_ID = process.env.MCP_PROJECT_ID || "";
|
|
14
|
+
var DEFAULT_SCHEME_ID = process.env.MCP_SCHEME_ID || "";
|
|
15
|
+
var getProjectId = (providedId) => {
|
|
16
|
+
const id = providedId || DEFAULT_PROJECT_ID;
|
|
17
|
+
if (!id) {
|
|
18
|
+
throw new Error("project_id is required. Provide it as parameter or set MCP_PROJECT_ID env variable");
|
|
19
|
+
}
|
|
20
|
+
return id;
|
|
21
|
+
};
|
|
22
|
+
var getSchemeId = (providedId) => {
|
|
23
|
+
const id = providedId || DEFAULT_SCHEME_ID;
|
|
24
|
+
if (!id) {
|
|
25
|
+
throw new Error("scheme_id is required. Provide it as parameter or set MCP_SCHEME_ID env variable");
|
|
26
|
+
}
|
|
27
|
+
return id;
|
|
28
|
+
};
|
|
29
|
+
var ApiClient = class {
|
|
30
|
+
apiKey;
|
|
31
|
+
constructor(apiKey) {
|
|
32
|
+
this.apiKey = apiKey;
|
|
33
|
+
}
|
|
34
|
+
async get(path, queryParams) {
|
|
35
|
+
try {
|
|
36
|
+
const url = new URL(`${API_BASE_URL}${path}`);
|
|
37
|
+
if (queryParams) {
|
|
38
|
+
Object.entries(queryParams).forEach(([key, value]) => {
|
|
39
|
+
if (value !== void 0) {
|
|
40
|
+
url.searchParams.append(key, String(value));
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
const response = await fetch(url.toString(), {
|
|
45
|
+
method: "GET",
|
|
46
|
+
headers: {
|
|
47
|
+
[API_KEY_HEADER]: this.apiKey,
|
|
48
|
+
"Content-Type": "application/json"
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
if (!response.ok) {
|
|
52
|
+
const errorText = await response.text();
|
|
53
|
+
return { success: false, error: `HTTP ${response.status}: ${errorText}` };
|
|
54
|
+
}
|
|
55
|
+
const data = await response.json();
|
|
56
|
+
return { success: true, data };
|
|
57
|
+
} catch (error) {
|
|
58
|
+
return { success: false, error: error instanceof Error ? error.message : "Unknown error" };
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
async post(path, body) {
|
|
62
|
+
try {
|
|
63
|
+
const response = await fetch(`${API_BASE_URL}${path}`, {
|
|
64
|
+
method: "POST",
|
|
65
|
+
headers: {
|
|
66
|
+
[API_KEY_HEADER]: this.apiKey,
|
|
67
|
+
"Content-Type": "application/json"
|
|
68
|
+
},
|
|
69
|
+
body: body ? JSON.stringify(body) : void 0
|
|
70
|
+
});
|
|
71
|
+
if (!response.ok) {
|
|
72
|
+
const errorText = await response.text();
|
|
73
|
+
return { success: false, error: `HTTP ${response.status}: ${errorText}` };
|
|
74
|
+
}
|
|
75
|
+
const data = await response.json();
|
|
76
|
+
return { success: true, data };
|
|
77
|
+
} catch (error) {
|
|
78
|
+
return { success: false, error: error instanceof Error ? error.message : "Unknown error" };
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
async put(path, body) {
|
|
82
|
+
try {
|
|
83
|
+
const response = await fetch(`${API_BASE_URL}${path}`, {
|
|
84
|
+
method: "PUT",
|
|
85
|
+
headers: {
|
|
86
|
+
[API_KEY_HEADER]: this.apiKey,
|
|
87
|
+
"Content-Type": "application/json"
|
|
88
|
+
},
|
|
89
|
+
body: body ? JSON.stringify(body) : void 0
|
|
90
|
+
});
|
|
91
|
+
if (!response.ok) {
|
|
92
|
+
const errorText = await response.text();
|
|
93
|
+
return { success: false, error: `HTTP ${response.status}: ${errorText}` };
|
|
94
|
+
}
|
|
95
|
+
const data = await response.json();
|
|
96
|
+
return { success: true, data };
|
|
97
|
+
} catch (error) {
|
|
98
|
+
return { success: false, error: error instanceof Error ? error.message : "Unknown error" };
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
async delete(path) {
|
|
102
|
+
try {
|
|
103
|
+
const response = await fetch(`${API_BASE_URL}${path}`, {
|
|
104
|
+
method: "DELETE",
|
|
105
|
+
headers: {
|
|
106
|
+
[API_KEY_HEADER]: this.apiKey,
|
|
107
|
+
"Content-Type": "application/json"
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
if (!response.ok) {
|
|
111
|
+
const errorText = await response.text();
|
|
112
|
+
return { success: false, error: `HTTP ${response.status}: ${errorText}` };
|
|
113
|
+
}
|
|
114
|
+
const data = await response.json();
|
|
115
|
+
return { success: true, data };
|
|
116
|
+
} catch (error) {
|
|
117
|
+
return { success: false, error: error instanceof Error ? error.message : "Unknown error" };
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
var apiClientInstance = null;
|
|
122
|
+
var getApiClient = () => {
|
|
123
|
+
if (!apiClientInstance) {
|
|
124
|
+
const apiKey = process.env.MCP_API_KEY;
|
|
125
|
+
if (!apiKey) {
|
|
126
|
+
throw new Error("MCP_API_KEY environment variable is not set");
|
|
127
|
+
}
|
|
128
|
+
apiClientInstance = new ApiClient(apiKey);
|
|
129
|
+
}
|
|
130
|
+
return apiClientInstance;
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
// src/tools/project.tools.ts
|
|
134
|
+
var registerProjectTools = (server) => {
|
|
135
|
+
server.tool(
|
|
136
|
+
"project_create",
|
|
137
|
+
"Create a new project in your account. Projects are containers for schemes (automation workflows).",
|
|
138
|
+
{
|
|
139
|
+
project_name: z.string().describe("Name of the project"),
|
|
140
|
+
project_slug: z.string().describe("URL-friendly slug for the project (lowercase, no spaces)"),
|
|
141
|
+
user_id: z.string().describe("User ID who owns the project")
|
|
142
|
+
},
|
|
143
|
+
async ({ project_name, project_slug, user_id }) => {
|
|
144
|
+
const client = getApiClient();
|
|
145
|
+
const result = await client.post("/project/create", { project_name, project_slug, user_id });
|
|
146
|
+
return {
|
|
147
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
);
|
|
151
|
+
server.tool(
|
|
152
|
+
"project_get",
|
|
153
|
+
"Get details of a specific project by its ID",
|
|
154
|
+
{
|
|
155
|
+
project_id: z.string().optional().describe("The unique ID of the project (uses MCP_PROJECT_ID env if not provided)")
|
|
156
|
+
},
|
|
157
|
+
async ({ project_id }) => {
|
|
158
|
+
try {
|
|
159
|
+
const resolvedProjectId = getProjectId(project_id);
|
|
160
|
+
const client = getApiClient();
|
|
161
|
+
const result = await client.get(`/project/get/${resolvedProjectId}`);
|
|
162
|
+
return {
|
|
163
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
|
|
164
|
+
};
|
|
165
|
+
} catch (error) {
|
|
166
|
+
return {
|
|
167
|
+
content: [{ type: "text", text: JSON.stringify({ success: false, error: error instanceof Error ? error.message : "Unknown error" }, null, 2) }]
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
);
|
|
172
|
+
server.tool(
|
|
173
|
+
"project_list_by_payment_account",
|
|
174
|
+
"Get list of all projects associated with a payment account",
|
|
175
|
+
{
|
|
176
|
+
payment_account_id: z.string().describe("The payment account ID")
|
|
177
|
+
},
|
|
178
|
+
async ({ payment_account_id }) => {
|
|
179
|
+
const client = getApiClient();
|
|
180
|
+
const result = await client.get(`/project/get_list_by_payment_account/${payment_account_id}`);
|
|
181
|
+
return {
|
|
182
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
);
|
|
186
|
+
server.tool(
|
|
187
|
+
"project_update",
|
|
188
|
+
"Update an existing project properties",
|
|
189
|
+
{
|
|
190
|
+
project_id: z.string().optional().describe("The unique ID of the project to update (uses MCP_PROJECT_ID env if not provided)"),
|
|
191
|
+
project_name: z.string().optional().describe("New name for the project"),
|
|
192
|
+
project_slug: z.string().optional().describe("New slug for the project")
|
|
193
|
+
},
|
|
194
|
+
async ({ project_id, project_name, project_slug }) => {
|
|
195
|
+
try {
|
|
196
|
+
const resolvedProjectId = getProjectId(project_id);
|
|
197
|
+
const client = getApiClient();
|
|
198
|
+
const body = {};
|
|
199
|
+
if (project_name) body.project_name = project_name;
|
|
200
|
+
if (project_slug) body.project_slug = project_slug;
|
|
201
|
+
const result = await client.put(`/project/update/${resolvedProjectId}`, body);
|
|
202
|
+
return {
|
|
203
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
|
|
204
|
+
};
|
|
205
|
+
} catch (error) {
|
|
206
|
+
return {
|
|
207
|
+
content: [{ type: "text", text: JSON.stringify({ success: false, error: error instanceof Error ? error.message : "Unknown error" }, null, 2) }]
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
);
|
|
212
|
+
server.tool(
|
|
213
|
+
"project_delete",
|
|
214
|
+
"Delete a project and all its associated schemes. This action is irreversible!",
|
|
215
|
+
{
|
|
216
|
+
project_id: z.string().optional().describe("The unique ID of the project to delete (uses MCP_PROJECT_ID env if not provided)")
|
|
217
|
+
},
|
|
218
|
+
async ({ project_id }) => {
|
|
219
|
+
try {
|
|
220
|
+
const resolvedProjectId = getProjectId(project_id);
|
|
221
|
+
const client = getApiClient();
|
|
222
|
+
const result = await client.delete(`/project/delete/${resolvedProjectId}`);
|
|
223
|
+
return {
|
|
224
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
|
|
225
|
+
};
|
|
226
|
+
} catch (error) {
|
|
227
|
+
return {
|
|
228
|
+
content: [{ type: "text", text: JSON.stringify({ success: false, error: error instanceof Error ? error.message : "Unknown error" }, null, 2) }]
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
);
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
// src/tools/scheme.tools.ts
|
|
236
|
+
import { z as z2 } from "zod";
|
|
237
|
+
var registerSchemeTools = (server) => {
|
|
238
|
+
server.tool(
|
|
239
|
+
"scheme_create",
|
|
240
|
+
"Create a new scheme (automation workflow) within a project",
|
|
241
|
+
{
|
|
242
|
+
project_id: z2.string().optional().describe("The project ID where the scheme will be created (uses MCP_PROJECT_ID env if not provided)"),
|
|
243
|
+
scheme_name: z2.string().describe("Name of the scheme")
|
|
244
|
+
},
|
|
245
|
+
async ({ project_id, scheme_name }) => {
|
|
246
|
+
try {
|
|
247
|
+
const resolvedProjectId = getProjectId(project_id);
|
|
248
|
+
const client = getApiClient();
|
|
249
|
+
const result = await client.post("/scheme/create", { project_id: resolvedProjectId, scheme_name });
|
|
250
|
+
return {
|
|
251
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
|
|
252
|
+
};
|
|
253
|
+
} catch (error) {
|
|
254
|
+
return {
|
|
255
|
+
content: [{ type: "text", text: JSON.stringify({ success: false, error: error instanceof Error ? error.message : "Unknown error" }, null, 2) }]
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
);
|
|
260
|
+
server.tool(
|
|
261
|
+
"scheme_update",
|
|
262
|
+
"Update an existing scheme properties",
|
|
263
|
+
{
|
|
264
|
+
scheme_id: z2.string().optional().describe("The unique ID of the scheme to update (uses MCP_SCHEME_ID env if not provided)"),
|
|
265
|
+
scheme_name: z2.string().optional().describe("New name for the scheme"),
|
|
266
|
+
scheme_description: z2.string().optional().describe("New description for the scheme"),
|
|
267
|
+
is_active: z2.boolean().optional().describe("Enable or disable the scheme")
|
|
268
|
+
},
|
|
269
|
+
async ({ scheme_id, scheme_name, scheme_description, is_active }) => {
|
|
270
|
+
try {
|
|
271
|
+
const resolvedSchemeId = getSchemeId(scheme_id);
|
|
272
|
+
const client = getApiClient();
|
|
273
|
+
const body = {};
|
|
274
|
+
if (scheme_name !== void 0) body.scheme_name = scheme_name;
|
|
275
|
+
if (scheme_description !== void 0) body.scheme_description = scheme_description;
|
|
276
|
+
if (is_active !== void 0) body.is_active = is_active;
|
|
277
|
+
const result = await client.put(`/scheme/update/${resolvedSchemeId}`, body);
|
|
278
|
+
return {
|
|
279
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
|
|
280
|
+
};
|
|
281
|
+
} catch (error) {
|
|
282
|
+
return {
|
|
283
|
+
content: [{ type: "text", text: JSON.stringify({ success: false, error: error instanceof Error ? error.message : "Unknown error" }, null, 2) }]
|
|
284
|
+
};
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
);
|
|
288
|
+
server.tool(
|
|
289
|
+
"scheme_get",
|
|
290
|
+
"Get details of a specific scheme by its ID",
|
|
291
|
+
{
|
|
292
|
+
scheme_id: z2.string().optional().describe("The unique ID of the scheme (uses MCP_SCHEME_ID env if not provided)")
|
|
293
|
+
},
|
|
294
|
+
async ({ scheme_id }) => {
|
|
295
|
+
try {
|
|
296
|
+
const resolvedSchemeId = getSchemeId(scheme_id);
|
|
297
|
+
const client = getApiClient();
|
|
298
|
+
const result = await client.get(`/scheme/get/${resolvedSchemeId}`);
|
|
299
|
+
return {
|
|
300
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
|
|
301
|
+
};
|
|
302
|
+
} catch (error) {
|
|
303
|
+
return {
|
|
304
|
+
content: [{ type: "text", text: JSON.stringify({ success: false, error: error instanceof Error ? error.message : "Unknown error" }, null, 2) }]
|
|
305
|
+
};
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
);
|
|
309
|
+
server.tool(
|
|
310
|
+
"scheme_list_by_project",
|
|
311
|
+
"Get list of all schemes in a project",
|
|
312
|
+
{
|
|
313
|
+
project_id: z2.string().optional().describe("The project ID (uses MCP_PROJECT_ID env if not provided)")
|
|
314
|
+
},
|
|
315
|
+
async ({ project_id }) => {
|
|
316
|
+
try {
|
|
317
|
+
const resolvedProjectId = getProjectId(project_id);
|
|
318
|
+
const client = getApiClient();
|
|
319
|
+
const result = await client.get(`/scheme/project_list/${resolvedProjectId}`);
|
|
320
|
+
return {
|
|
321
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
|
|
322
|
+
};
|
|
323
|
+
} catch (error) {
|
|
324
|
+
return {
|
|
325
|
+
content: [{ type: "text", text: JSON.stringify({ success: false, error: error instanceof Error ? error.message : "Unknown error" }, null, 2) }]
|
|
326
|
+
};
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
);
|
|
330
|
+
server.tool(
|
|
331
|
+
"scheme_get_context_type",
|
|
332
|
+
"Get the context type of a scheme",
|
|
333
|
+
{
|
|
334
|
+
scheme_id: z2.string().optional().describe("The unique ID of the scheme (uses MCP_SCHEME_ID env if not provided)")
|
|
335
|
+
},
|
|
336
|
+
async ({ scheme_id }) => {
|
|
337
|
+
try {
|
|
338
|
+
const resolvedSchemeId = getSchemeId(scheme_id);
|
|
339
|
+
const client = getApiClient();
|
|
340
|
+
const result = await client.get(`/scheme/context_type/${resolvedSchemeId}`);
|
|
341
|
+
return {
|
|
342
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
|
|
343
|
+
};
|
|
344
|
+
} catch (error) {
|
|
345
|
+
return {
|
|
346
|
+
content: [{ type: "text", text: JSON.stringify({ success: false, error: error instanceof Error ? error.message : "Unknown error" }, null, 2) }]
|
|
347
|
+
};
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
);
|
|
351
|
+
server.tool(
|
|
352
|
+
"scheme_get_swagger_json",
|
|
353
|
+
"Get Swagger/OpenAPI JSON specification for a scheme",
|
|
354
|
+
{
|
|
355
|
+
scheme_id: z2.string().optional().describe("The unique ID of the scheme (uses MCP_SCHEME_ID env if not provided)")
|
|
356
|
+
},
|
|
357
|
+
async ({ scheme_id }) => {
|
|
358
|
+
try {
|
|
359
|
+
const resolvedSchemeId = getSchemeId(scheme_id);
|
|
360
|
+
const client = getApiClient();
|
|
361
|
+
const result = await client.get(`/scheme/swagger_json/${resolvedSchemeId}`);
|
|
362
|
+
return {
|
|
363
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
|
|
364
|
+
};
|
|
365
|
+
} catch (error) {
|
|
366
|
+
return {
|
|
367
|
+
content: [{ type: "text", text: JSON.stringify({ success: false, error: error instanceof Error ? error.message : "Unknown error" }, null, 2) }]
|
|
368
|
+
};
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
);
|
|
372
|
+
server.tool(
|
|
373
|
+
"scheme_export",
|
|
374
|
+
"Export a scheme configuration (nodes and connections) as JSON",
|
|
375
|
+
{
|
|
376
|
+
scheme_id: z2.string().optional().describe("The unique ID of the scheme to export (uses MCP_SCHEME_ID env if not provided)")
|
|
377
|
+
},
|
|
378
|
+
async ({ scheme_id }) => {
|
|
379
|
+
try {
|
|
380
|
+
const resolvedSchemeId = getSchemeId(scheme_id);
|
|
381
|
+
const client = getApiClient();
|
|
382
|
+
const result = await client.get(`/scheme/export/${resolvedSchemeId}`);
|
|
383
|
+
return {
|
|
384
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
|
|
385
|
+
};
|
|
386
|
+
} catch (error) {
|
|
387
|
+
return {
|
|
388
|
+
content: [{ type: "text", text: JSON.stringify({ success: false, error: error instanceof Error ? error.message : "Unknown error" }, null, 2) }]
|
|
389
|
+
};
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
);
|
|
393
|
+
server.tool(
|
|
394
|
+
"scheme_import",
|
|
395
|
+
"Import nodes into a scheme from exported JSON data",
|
|
396
|
+
{
|
|
397
|
+
scheme_id: z2.string().optional().describe("The unique ID of the scheme to import into (uses MCP_SCHEME_ID env if not provided)"),
|
|
398
|
+
nodes_list: z2.string().describe("JSON string of nodes list to import")
|
|
399
|
+
},
|
|
400
|
+
async ({ scheme_id, nodes_list }) => {
|
|
401
|
+
try {
|
|
402
|
+
const resolvedSchemeId = getSchemeId(scheme_id);
|
|
403
|
+
const client = getApiClient();
|
|
404
|
+
let parsedNodes;
|
|
405
|
+
try {
|
|
406
|
+
parsedNodes = JSON.parse(nodes_list);
|
|
407
|
+
} catch {
|
|
408
|
+
return {
|
|
409
|
+
content: [{ type: "text", text: JSON.stringify({ success: false, error: "Invalid JSON in nodes_list" }, null, 2) }]
|
|
410
|
+
};
|
|
411
|
+
}
|
|
412
|
+
const result = await client.post(`/scheme/import/${resolvedSchemeId}`, { nodes_list: parsedNodes });
|
|
413
|
+
return {
|
|
414
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
|
|
415
|
+
};
|
|
416
|
+
} catch (error) {
|
|
417
|
+
return {
|
|
418
|
+
content: [{ type: "text", text: JSON.stringify({ success: false, error: error instanceof Error ? error.message : "Unknown error" }, null, 2) }]
|
|
419
|
+
};
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
);
|
|
423
|
+
server.tool(
|
|
424
|
+
"scheme_delete",
|
|
425
|
+
"Delete a scheme and all its nodes. This action is irreversible!",
|
|
426
|
+
{
|
|
427
|
+
scheme_id: z2.string().optional().describe("The unique ID of the scheme to delete (uses MCP_SCHEME_ID env if not provided)")
|
|
428
|
+
},
|
|
429
|
+
async ({ scheme_id }) => {
|
|
430
|
+
try {
|
|
431
|
+
const resolvedSchemeId = getSchemeId(scheme_id);
|
|
432
|
+
const client = getApiClient();
|
|
433
|
+
const result = await client.delete(`/scheme/delete/${resolvedSchemeId}`);
|
|
434
|
+
return {
|
|
435
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
|
|
436
|
+
};
|
|
437
|
+
} catch (error) {
|
|
438
|
+
return {
|
|
439
|
+
content: [{ type: "text", text: JSON.stringify({ success: false, error: error instanceof Error ? error.message : "Unknown error" }, null, 2) }]
|
|
440
|
+
};
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
);
|
|
444
|
+
};
|
|
445
|
+
|
|
446
|
+
// src/tools/node.tools.ts
|
|
447
|
+
import { z as z3 } from "zod";
|
|
448
|
+
var registerNodeTools = (server) => {
|
|
449
|
+
server.tool(
|
|
450
|
+
"node_create_trigger",
|
|
451
|
+
"Create a new trigger node in a scheme. Triggers start the execution of automation workflows.",
|
|
452
|
+
{
|
|
453
|
+
scheme: z3.string().optional().describe("The scheme ID where the trigger will be created (uses MCP_SCHEME_ID env if not provided)"),
|
|
454
|
+
node_type: z3.string().describe("Type of trigger (e.g., webhook, timer, code_action)"),
|
|
455
|
+
node_name: z3.string().optional().describe("Display name for the trigger"),
|
|
456
|
+
node_description: z3.string().optional().describe("Description of what this trigger does"),
|
|
457
|
+
slug: z3.string().optional().describe("URL-friendly identifier for code_action triggers")
|
|
458
|
+
},
|
|
459
|
+
async ({ scheme, node_type, node_name, node_description, slug }) => {
|
|
460
|
+
try {
|
|
461
|
+
const resolvedSchemeId = getSchemeId(scheme);
|
|
462
|
+
const client = getApiClient();
|
|
463
|
+
const body = { scheme: resolvedSchemeId, node_type };
|
|
464
|
+
if (node_name) body.node_name = node_name;
|
|
465
|
+
if (node_description) body.node_description = node_description;
|
|
466
|
+
if (slug) body.slug = slug;
|
|
467
|
+
const result = await client.post("/node/create/trigger", body);
|
|
468
|
+
return {
|
|
469
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
|
|
470
|
+
};
|
|
471
|
+
} catch (error) {
|
|
472
|
+
return {
|
|
473
|
+
content: [{ type: "text", text: JSON.stringify({ success: false, error: error instanceof Error ? error.message : "Unknown error" }, null, 2) }]
|
|
474
|
+
};
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
);
|
|
478
|
+
server.tool(
|
|
479
|
+
"node_create_action",
|
|
480
|
+
"Create a new action node in a scheme. Actions perform operations like sending emails, making HTTP requests, etc.",
|
|
481
|
+
{
|
|
482
|
+
scheme: z3.string().optional().describe("The scheme ID where the action will be created (uses MCP_SCHEME_ID env if not provided)"),
|
|
483
|
+
node_type: z3.string().describe("Type of action (e.g., email, http_request, condition, telegram)"),
|
|
484
|
+
node_name: z3.string().optional().describe("Display name for the action"),
|
|
485
|
+
node_description: z3.string().optional().describe("Description of what this action does")
|
|
486
|
+
},
|
|
487
|
+
async ({ scheme, node_type, node_name, node_description }) => {
|
|
488
|
+
try {
|
|
489
|
+
const resolvedSchemeId = getSchemeId(scheme);
|
|
490
|
+
const client = getApiClient();
|
|
491
|
+
const body = { scheme: resolvedSchemeId, node_type };
|
|
492
|
+
if (node_name) body.node_name = node_name;
|
|
493
|
+
if (node_description) body.node_description = node_description;
|
|
494
|
+
const result = await client.post("/node/create/action", body);
|
|
495
|
+
return {
|
|
496
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
|
|
497
|
+
};
|
|
498
|
+
} catch (error) {
|
|
499
|
+
return {
|
|
500
|
+
content: [{ type: "text", text: JSON.stringify({ success: false, error: error instanceof Error ? error.message : "Unknown error" }, null, 2) }]
|
|
501
|
+
};
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
);
|
|
505
|
+
server.tool(
|
|
506
|
+
"node_update",
|
|
507
|
+
"Update an existing node properties",
|
|
508
|
+
{
|
|
509
|
+
node_id: z3.string().describe("The unique ID of the node to update"),
|
|
510
|
+
node_name: z3.string().optional().describe("New display name"),
|
|
511
|
+
node_description: z3.string().optional().describe("New description")
|
|
512
|
+
},
|
|
513
|
+
async ({ node_id, node_name, node_description }) => {
|
|
514
|
+
const client = getApiClient();
|
|
515
|
+
const body = {};
|
|
516
|
+
if (node_name !== void 0) body.node_name = node_name;
|
|
517
|
+
if (node_description !== void 0) body.node_description = node_description;
|
|
518
|
+
const result = await client.put(`/node/update/${node_id}`, body);
|
|
519
|
+
return {
|
|
520
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
|
|
521
|
+
};
|
|
522
|
+
}
|
|
523
|
+
);
|
|
524
|
+
server.tool(
|
|
525
|
+
"node_connect",
|
|
526
|
+
"Connect two nodes together to create an execution flow",
|
|
527
|
+
{
|
|
528
|
+
node_from: z3.string().describe("The source node ID (execution flows from this node)"),
|
|
529
|
+
node_to: z3.string().describe("The target node ID (execution flows to this node)"),
|
|
530
|
+
button_type: z3.string().optional().describe('For condition nodes: specify which output to connect (e.g., "true", "false")')
|
|
531
|
+
},
|
|
532
|
+
async ({ node_from, node_to, button_type }) => {
|
|
533
|
+
const client = getApiClient();
|
|
534
|
+
const body = { node_from, node_to };
|
|
535
|
+
if (button_type) body.button_type = button_type;
|
|
536
|
+
const result = await client.put("/node/connect_nodes", body);
|
|
537
|
+
return {
|
|
538
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
|
|
539
|
+
};
|
|
540
|
+
}
|
|
541
|
+
);
|
|
542
|
+
server.tool(
|
|
543
|
+
"node_disconnect",
|
|
544
|
+
"Disconnect two nodes",
|
|
545
|
+
{
|
|
546
|
+
node_from: z3.string().describe("The source node ID"),
|
|
547
|
+
node_to: z3.string().describe("The target node ID")
|
|
548
|
+
},
|
|
549
|
+
async ({ node_from, node_to }) => {
|
|
550
|
+
const client = getApiClient();
|
|
551
|
+
const result = await client.put("/node/disconnect_nodes", { node_from, node_to });
|
|
552
|
+
return {
|
|
553
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
|
|
554
|
+
};
|
|
555
|
+
}
|
|
556
|
+
);
|
|
557
|
+
server.tool(
|
|
558
|
+
"node_find_existing_buttons",
|
|
559
|
+
"Find existing output buttons/connections from a node",
|
|
560
|
+
{
|
|
561
|
+
node_id: z3.string().describe("The node ID to find buttons for")
|
|
562
|
+
},
|
|
563
|
+
async ({ node_id }) => {
|
|
564
|
+
const client = getApiClient();
|
|
565
|
+
const result = await client.get(`/node/find_existing_button_from/${node_id}`);
|
|
566
|
+
return {
|
|
567
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
|
|
568
|
+
};
|
|
569
|
+
}
|
|
570
|
+
);
|
|
571
|
+
server.tool(
|
|
572
|
+
"node_copy",
|
|
573
|
+
"Create a copy of an existing node",
|
|
574
|
+
{
|
|
575
|
+
node_id: z3.string().describe("The node ID to copy")
|
|
576
|
+
},
|
|
577
|
+
async ({ node_id }) => {
|
|
578
|
+
const client = getApiClient();
|
|
579
|
+
const result = await client.post(`/node/copy_node_create/${node_id}`);
|
|
580
|
+
return {
|
|
581
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
|
|
582
|
+
};
|
|
583
|
+
}
|
|
584
|
+
);
|
|
585
|
+
server.tool(
|
|
586
|
+
"node_get_scheme_edges",
|
|
587
|
+
"Get all connections (edges) between nodes in a scheme",
|
|
588
|
+
{
|
|
589
|
+
scheme_id: z3.string().optional().describe("The scheme ID (uses MCP_SCHEME_ID env if not provided)")
|
|
590
|
+
},
|
|
591
|
+
async ({ scheme_id }) => {
|
|
592
|
+
try {
|
|
593
|
+
const resolvedSchemeId = getSchemeId(scheme_id);
|
|
594
|
+
const client = getApiClient();
|
|
595
|
+
const result = await client.get(`/node/scheme_node_edges_list/${resolvedSchemeId}`);
|
|
596
|
+
return {
|
|
597
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
|
|
598
|
+
};
|
|
599
|
+
} catch (error) {
|
|
600
|
+
return {
|
|
601
|
+
content: [{ type: "text", text: JSON.stringify({ success: false, error: error instanceof Error ? error.message : "Unknown error" }, null, 2) }]
|
|
602
|
+
};
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
);
|
|
606
|
+
server.tool(
|
|
607
|
+
"node_get",
|
|
608
|
+
"Get details of a specific node by its ID",
|
|
609
|
+
{
|
|
610
|
+
node_id: z3.string().describe("The unique ID of the node")
|
|
611
|
+
},
|
|
612
|
+
async ({ node_id }) => {
|
|
613
|
+
const client = getApiClient();
|
|
614
|
+
const result = await client.get(`/node/get/${node_id}`);
|
|
615
|
+
return {
|
|
616
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
|
|
617
|
+
};
|
|
618
|
+
}
|
|
619
|
+
);
|
|
620
|
+
server.tool(
|
|
621
|
+
"node_update_config",
|
|
622
|
+
"Update the configuration of a node (e.g., email templates, HTTP request settings)",
|
|
623
|
+
{
|
|
624
|
+
node_id: z3.string().describe("The unique ID of the node"),
|
|
625
|
+
config: z3.string().describe("JSON string of the new configuration object")
|
|
626
|
+
},
|
|
627
|
+
async ({ node_id, config }) => {
|
|
628
|
+
const client = getApiClient();
|
|
629
|
+
let parsedConfig;
|
|
630
|
+
try {
|
|
631
|
+
parsedConfig = JSON.parse(config);
|
|
632
|
+
} catch {
|
|
633
|
+
return {
|
|
634
|
+
content: [{ type: "text", text: JSON.stringify({ success: false, error: "Invalid JSON in config" }, null, 2) }]
|
|
635
|
+
};
|
|
636
|
+
}
|
|
637
|
+
const result = await client.put(`/node/update_config/${node_id}`, parsedConfig);
|
|
638
|
+
return {
|
|
639
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
|
|
640
|
+
};
|
|
641
|
+
}
|
|
642
|
+
);
|
|
643
|
+
server.tool(
|
|
644
|
+
"node_list_by_scheme",
|
|
645
|
+
"Get list of all nodes in a scheme",
|
|
646
|
+
{
|
|
647
|
+
scheme_id: z3.string().optional().describe("The scheme ID (uses MCP_SCHEME_ID env if not provided)")
|
|
648
|
+
},
|
|
649
|
+
async ({ scheme_id }) => {
|
|
650
|
+
try {
|
|
651
|
+
const resolvedSchemeId = getSchemeId(scheme_id);
|
|
652
|
+
const client = getApiClient();
|
|
653
|
+
const result = await client.get(`/node/scheme_list/${resolvedSchemeId}`);
|
|
654
|
+
return {
|
|
655
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
|
|
656
|
+
};
|
|
657
|
+
} catch (error) {
|
|
658
|
+
return {
|
|
659
|
+
content: [{ type: "text", text: JSON.stringify({ success: false, error: error instanceof Error ? error.message : "Unknown error" }, null, 2) }]
|
|
660
|
+
};
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
);
|
|
664
|
+
server.tool(
|
|
665
|
+
"node_delete",
|
|
666
|
+
"Delete a node from a scheme. This action is irreversible!",
|
|
667
|
+
{
|
|
668
|
+
node_id: z3.string().describe("The unique ID of the node to delete")
|
|
669
|
+
},
|
|
670
|
+
async ({ node_id }) => {
|
|
671
|
+
const client = getApiClient();
|
|
672
|
+
const result = await client.delete(`/node/delete/${node_id}`);
|
|
673
|
+
return {
|
|
674
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
|
|
675
|
+
};
|
|
676
|
+
}
|
|
677
|
+
);
|
|
678
|
+
};
|
|
679
|
+
|
|
680
|
+
// src/tools/node-process.tools.ts
|
|
681
|
+
import { z as z4 } from "zod";
|
|
682
|
+
var registerNodeProcessTools = (server) => {
|
|
683
|
+
server.tool(
|
|
684
|
+
"node_process_get",
|
|
685
|
+
"Get details of a specific node process execution",
|
|
686
|
+
{
|
|
687
|
+
node_process_id: z4.string().describe("The unique ID of the node process")
|
|
688
|
+
},
|
|
689
|
+
async ({ node_process_id }) => {
|
|
690
|
+
const client = getApiClient();
|
|
691
|
+
const result = await client.get(`/node-process/get/${node_process_id}`);
|
|
692
|
+
return {
|
|
693
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
|
|
694
|
+
};
|
|
695
|
+
}
|
|
696
|
+
);
|
|
697
|
+
server.tool(
|
|
698
|
+
"node_process_list_filtered",
|
|
699
|
+
"Get filtered list of node processes with pagination",
|
|
700
|
+
{
|
|
701
|
+
scheme: z4.string().optional().describe("Filter by scheme ID"),
|
|
702
|
+
node: z4.string().optional().describe("Filter by node ID"),
|
|
703
|
+
scheme_process: z4.string().optional().describe("Filter by scheme process ID"),
|
|
704
|
+
running_status: z4.string().optional().describe("Filter by status (e.g., running, completed, failed)"),
|
|
705
|
+
node_type: z4.string().optional().describe("Filter by node type"),
|
|
706
|
+
page_index: z4.number().optional().describe("Page index for pagination (0-based)"),
|
|
707
|
+
page_size: z4.number().optional().describe("Number of items per page")
|
|
708
|
+
},
|
|
709
|
+
async ({ scheme, node, scheme_process, running_status, node_type, page_index, page_size }) => {
|
|
710
|
+
const client = getApiClient();
|
|
711
|
+
const result = await client.get("/node-process/scheme_list_filtered", {
|
|
712
|
+
scheme,
|
|
713
|
+
node,
|
|
714
|
+
scheme_process,
|
|
715
|
+
running_status,
|
|
716
|
+
node_type,
|
|
717
|
+
page_index,
|
|
718
|
+
page_size
|
|
719
|
+
});
|
|
720
|
+
return {
|
|
721
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
|
|
722
|
+
};
|
|
723
|
+
}
|
|
724
|
+
);
|
|
725
|
+
server.tool(
|
|
726
|
+
"node_process_delete",
|
|
727
|
+
"Delete a node process record",
|
|
728
|
+
{
|
|
729
|
+
node_process_id: z4.string().describe("The unique ID of the node process to delete")
|
|
730
|
+
},
|
|
731
|
+
async ({ node_process_id }) => {
|
|
732
|
+
const client = getApiClient();
|
|
733
|
+
const result = await client.delete(`/node-process/delete/${node_process_id}`);
|
|
734
|
+
return {
|
|
735
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
|
|
736
|
+
};
|
|
737
|
+
}
|
|
738
|
+
);
|
|
739
|
+
};
|
|
740
|
+
|
|
741
|
+
// src/tools/scheme-process.tools.ts
|
|
742
|
+
import { z as z5 } from "zod";
|
|
743
|
+
var registerSchemeProcessTools = (server) => {
|
|
744
|
+
server.tool(
|
|
745
|
+
"scheme_process_get",
|
|
746
|
+
"Get details of a specific scheme process (workflow execution instance)",
|
|
747
|
+
{
|
|
748
|
+
scheme_process_id: z5.string().describe("The unique ID of the scheme process")
|
|
749
|
+
},
|
|
750
|
+
async ({ scheme_process_id }) => {
|
|
751
|
+
const client = getApiClient();
|
|
752
|
+
const result = await client.get(`/scheme-process/get/${scheme_process_id}`);
|
|
753
|
+
return {
|
|
754
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
|
|
755
|
+
};
|
|
756
|
+
}
|
|
757
|
+
);
|
|
758
|
+
server.tool(
|
|
759
|
+
"scheme_process_list_filtered",
|
|
760
|
+
"Get filtered list of scheme processes (workflow executions) with pagination",
|
|
761
|
+
{
|
|
762
|
+
project: z5.string().optional().describe("Filter by project ID"),
|
|
763
|
+
scheme: z5.string().optional().describe("Filter by scheme ID"),
|
|
764
|
+
running_trigger: z5.string().optional().describe("Filter by trigger node ID"),
|
|
765
|
+
running_status: z5.string().optional().describe("Filter by status (e.g., running, completed, failed)"),
|
|
766
|
+
completion_status: z5.string().optional().describe("Filter by completion status"),
|
|
767
|
+
page_index: z5.number().optional().describe("Page index for pagination (0-based)"),
|
|
768
|
+
page_size: z5.number().optional().describe("Number of items per page")
|
|
769
|
+
},
|
|
770
|
+
async ({ project, scheme, running_trigger, running_status, completion_status, page_index, page_size }) => {
|
|
771
|
+
const client = getApiClient();
|
|
772
|
+
const result = await client.get("/scheme-process/scheme_list_filtered", {
|
|
773
|
+
project,
|
|
774
|
+
scheme,
|
|
775
|
+
running_trigger,
|
|
776
|
+
running_status,
|
|
777
|
+
completion_status,
|
|
778
|
+
page_index,
|
|
779
|
+
page_size
|
|
780
|
+
});
|
|
781
|
+
return {
|
|
782
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
|
|
783
|
+
};
|
|
784
|
+
}
|
|
785
|
+
);
|
|
786
|
+
server.tool(
|
|
787
|
+
"scheme_process_delete",
|
|
788
|
+
"Delete a scheme process record",
|
|
789
|
+
{
|
|
790
|
+
scheme_process_id: z5.string().describe("The unique ID of the scheme process to delete")
|
|
791
|
+
},
|
|
792
|
+
async ({ scheme_process_id }) => {
|
|
793
|
+
const client = getApiClient();
|
|
794
|
+
const result = await client.delete(`/scheme-process/delete/${scheme_process_id}`);
|
|
795
|
+
return {
|
|
796
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
|
|
797
|
+
};
|
|
798
|
+
}
|
|
799
|
+
);
|
|
800
|
+
};
|
|
801
|
+
|
|
802
|
+
// src/tools/payment-account.tools.ts
|
|
803
|
+
import { z as z6 } from "zod";
|
|
804
|
+
var registerPaymentAccountTools = (server) => {
|
|
805
|
+
server.tool(
|
|
806
|
+
"payment_account_remove",
|
|
807
|
+
"Remove payment account from user",
|
|
808
|
+
{
|
|
809
|
+
user_id: z6.string().describe("The user ID")
|
|
810
|
+
},
|
|
811
|
+
async ({ user_id }) => {
|
|
812
|
+
const client = getApiClient();
|
|
813
|
+
const result = await client.delete(`/payment_account/remove_payment_account/${user_id}`);
|
|
814
|
+
return {
|
|
815
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
|
|
816
|
+
};
|
|
817
|
+
}
|
|
818
|
+
);
|
|
819
|
+
server.tool(
|
|
820
|
+
"payment_account_update",
|
|
821
|
+
"Update payment account information",
|
|
822
|
+
{
|
|
823
|
+
user_id: z6.string().describe("The user ID"),
|
|
824
|
+
email: z6.string().optional().describe("Payment email"),
|
|
825
|
+
first_name: z6.string().optional().describe("First name"),
|
|
826
|
+
last_name: z6.string().optional().describe("Last name"),
|
|
827
|
+
phone: z6.string().optional().describe("Phone number")
|
|
828
|
+
},
|
|
829
|
+
async ({ user_id, email, first_name, last_name, phone }) => {
|
|
830
|
+
const client = getApiClient();
|
|
831
|
+
const body = {};
|
|
832
|
+
if (email) body.email = email;
|
|
833
|
+
if (first_name) body.first_name = first_name;
|
|
834
|
+
if (last_name) body.last_name = last_name;
|
|
835
|
+
if (phone) body.phone = phone;
|
|
836
|
+
const result = await client.post(`/payment_account/update_payment_account/${user_id}`, body);
|
|
837
|
+
return {
|
|
838
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
|
|
839
|
+
};
|
|
840
|
+
}
|
|
841
|
+
);
|
|
842
|
+
server.tool(
|
|
843
|
+
"payment_account_get_by_user",
|
|
844
|
+
"Get payment account by user ID",
|
|
845
|
+
{
|
|
846
|
+
user_id: z6.string().describe("The user ID")
|
|
847
|
+
},
|
|
848
|
+
async ({ user_id }) => {
|
|
849
|
+
const client = getApiClient();
|
|
850
|
+
const result = await client.get(`/payment_account/get_user_payment_account/${user_id}`);
|
|
851
|
+
return {
|
|
852
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
|
|
853
|
+
};
|
|
854
|
+
}
|
|
855
|
+
);
|
|
856
|
+
server.tool(
|
|
857
|
+
"payment_account_get_by_project",
|
|
858
|
+
"Get payment account by project ID",
|
|
859
|
+
{
|
|
860
|
+
project_id: z6.string().describe("The project ID")
|
|
861
|
+
},
|
|
862
|
+
async ({ project_id }) => {
|
|
863
|
+
const client = getApiClient();
|
|
864
|
+
const result = await client.get(`/payment_account/get_project_payment_account/${project_id}`);
|
|
865
|
+
return {
|
|
866
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
|
|
867
|
+
};
|
|
868
|
+
}
|
|
869
|
+
);
|
|
870
|
+
server.tool(
|
|
871
|
+
"payment_account_get_transactions",
|
|
872
|
+
"Get payment transactions history for an account",
|
|
873
|
+
{
|
|
874
|
+
payment_account_id: z6.string().describe("The payment account ID")
|
|
875
|
+
},
|
|
876
|
+
async ({ payment_account_id }) => {
|
|
877
|
+
const client = getApiClient();
|
|
878
|
+
const result = await client.get(`/payment_account/get_payment_account_transactions_history/${payment_account_id}`);
|
|
879
|
+
return {
|
|
880
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
|
|
881
|
+
};
|
|
882
|
+
}
|
|
883
|
+
);
|
|
884
|
+
};
|
|
885
|
+
|
|
886
|
+
// src/index.ts
|
|
887
|
+
var SERVER_NAME = "nana800-mcp-server";
|
|
888
|
+
var SERVER_VERSION = "1.0.0";
|
|
889
|
+
var main = async () => {
|
|
890
|
+
const apiKey = process.env.MCP_API_KEY;
|
|
891
|
+
if (!apiKey) {
|
|
892
|
+
console.error("Error: MCP_API_KEY environment variable is required");
|
|
893
|
+
console.error("Get your API key at: https://cloud.nana800.io/settings");
|
|
894
|
+
process.exit(1);
|
|
895
|
+
}
|
|
896
|
+
const server = new McpServer({
|
|
897
|
+
name: SERVER_NAME,
|
|
898
|
+
version: SERVER_VERSION
|
|
899
|
+
});
|
|
900
|
+
registerProjectTools(server);
|
|
901
|
+
registerSchemeTools(server);
|
|
902
|
+
registerNodeTools(server);
|
|
903
|
+
registerNodeProcessTools(server);
|
|
904
|
+
registerSchemeProcessTools(server);
|
|
905
|
+
registerPaymentAccountTools(server);
|
|
906
|
+
const transport = new StdioServerTransport();
|
|
907
|
+
await server.connect(transport);
|
|
908
|
+
};
|
|
909
|
+
main().catch((error) => {
|
|
910
|
+
console.error("Failed to start MCP server:", error);
|
|
911
|
+
process.exit(1);
|
|
912
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "nana800-mcp-server",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "MCP Server for nana800.io Public API - enables AI IDEs to interact with your no-code projects",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"files": [
|
|
7
|
+
"dist"
|
|
8
|
+
],
|
|
9
|
+
"bin": {
|
|
10
|
+
"nana800-mcp": "./dist/index.js"
|
|
11
|
+
},
|
|
12
|
+
"main": "./dist/index.js",
|
|
13
|
+
"scripts": {
|
|
14
|
+
"build": "node scripts/build.js",
|
|
15
|
+
"release": "yarn build && npm publish --access public"
|
|
16
|
+
},
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"@modelcontextprotocol/sdk": "^1.0.0",
|
|
19
|
+
"zod": "^3.23.8"
|
|
20
|
+
},
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"@types/node": "^22.0.0",
|
|
23
|
+
"esbuild": "^0.24.0",
|
|
24
|
+
"typescript": "^5.6.0"
|
|
25
|
+
},
|
|
26
|
+
"keywords": [
|
|
27
|
+
"mcp",
|
|
28
|
+
"model-context-protocol",
|
|
29
|
+
"nana800",
|
|
30
|
+
"ai",
|
|
31
|
+
"cursor",
|
|
32
|
+
"claude",
|
|
33
|
+
"no-code",
|
|
34
|
+
"low-code",
|
|
35
|
+
"automation",
|
|
36
|
+
"api"
|
|
37
|
+
],
|
|
38
|
+
"license": "MIT",
|
|
39
|
+
"repository": {
|
|
40
|
+
"type": "git",
|
|
41
|
+
"url": "https://github.com/nicenana800/nana800-mcp-server"
|
|
42
|
+
},
|
|
43
|
+
"engines": {
|
|
44
|
+
"node": ">=18.0.0"
|
|
45
|
+
}
|
|
46
|
+
}
|