@lightdash-tools/mcp 0.2.4 → 0.2.5
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/dist/bin.js +1 -1
- package/dist/tools/groups.js +80 -0
- package/package.json +3 -3
- package/src/bin.ts +1 -1
- package/src/tools/groups.ts +132 -1
package/dist/bin.js
CHANGED
|
@@ -44,7 +44,7 @@ const program = new commander_1.Command();
|
|
|
44
44
|
program
|
|
45
45
|
.name('lightdash-mcp')
|
|
46
46
|
.description('MCP server for Lightdash AI')
|
|
47
|
-
.version('0.2.
|
|
47
|
+
.version('0.2.5')
|
|
48
48
|
.option('--http', 'Run as HTTP server instead of Stdio')
|
|
49
49
|
.option('--safety-mode <mode>', 'Filter registered tools by safety mode (read-only, write-idempotent, write-destructive)')
|
|
50
50
|
.action((options) => {
|
package/dist/tools/groups.js
CHANGED
|
@@ -38,4 +38,84 @@ function registerGroupTools(server, client) {
|
|
|
38
38
|
const group = yield c.v1.groups.getGroup(groupUuid);
|
|
39
39
|
return { content: [{ type: 'text', text: JSON.stringify(group, null, 2) }] };
|
|
40
40
|
})));
|
|
41
|
+
(0, shared_js_1.registerToolSafe)(server, 'create_group', {
|
|
42
|
+
title: 'Create group',
|
|
43
|
+
description: 'Create a new group in the organization',
|
|
44
|
+
inputSchema: {
|
|
45
|
+
name: zod_1.z.string().describe('Group name'),
|
|
46
|
+
},
|
|
47
|
+
annotations: shared_js_1.WRITE_IDEMPOTENT,
|
|
48
|
+
}, (0, shared_js_1.wrapTool)(client, (c) => (_a) => __awaiter(this, [_a], void 0, function* ({ name }) {
|
|
49
|
+
const group = yield c.v1.groups.createGroup({ name });
|
|
50
|
+
return { content: [{ type: 'text', text: JSON.stringify(group, null, 2) }] };
|
|
51
|
+
})));
|
|
52
|
+
(0, shared_js_1.registerToolSafe)(server, 'update_group', {
|
|
53
|
+
title: 'Update group',
|
|
54
|
+
description: 'Update a group name',
|
|
55
|
+
inputSchema: {
|
|
56
|
+
groupUuid: zod_1.z.string().describe('Group UUID'),
|
|
57
|
+
name: zod_1.z.string().describe('New group name'),
|
|
58
|
+
},
|
|
59
|
+
annotations: shared_js_1.WRITE_IDEMPOTENT,
|
|
60
|
+
}, (0, shared_js_1.wrapTool)(client, (c) => (_a) => __awaiter(this, [_a], void 0, function* ({ groupUuid, name }) {
|
|
61
|
+
const group = yield c.v1.groups.updateGroup(groupUuid, { name });
|
|
62
|
+
return { content: [{ type: 'text', text: JSON.stringify(group, null, 2) }] };
|
|
63
|
+
})));
|
|
64
|
+
(0, shared_js_1.registerToolSafe)(server, 'delete_group', {
|
|
65
|
+
title: 'Delete group',
|
|
66
|
+
description: 'Delete a group by UUID',
|
|
67
|
+
inputSchema: {
|
|
68
|
+
groupUuid: zod_1.z.string().describe('Group UUID'),
|
|
69
|
+
},
|
|
70
|
+
annotations: shared_js_1.WRITE_DESTRUCTIVE,
|
|
71
|
+
}, (0, shared_js_1.wrapTool)(client, (c) => (_a) => __awaiter(this, [_a], void 0, function* ({ groupUuid }) {
|
|
72
|
+
yield c.v1.groups.deleteGroup(groupUuid);
|
|
73
|
+
return { content: [{ type: 'text', text: `Group ${groupUuid} deleted successfully` }] };
|
|
74
|
+
})));
|
|
75
|
+
(0, shared_js_1.registerToolSafe)(server, 'list_group_members', {
|
|
76
|
+
title: 'List group members',
|
|
77
|
+
description: 'List members of a group',
|
|
78
|
+
inputSchema: {
|
|
79
|
+
groupUuid: zod_1.z.string().describe('Group UUID'),
|
|
80
|
+
},
|
|
81
|
+
annotations: shared_js_1.READ_ONLY_DEFAULT,
|
|
82
|
+
}, (0, shared_js_1.wrapTool)(client, (c) => (_a) => __awaiter(this, [_a], void 0, function* ({ groupUuid }) {
|
|
83
|
+
const members = yield c.v1.groups.getGroupMembers(groupUuid);
|
|
84
|
+
return { content: [{ type: 'text', text: JSON.stringify(members, null, 2) }] };
|
|
85
|
+
})));
|
|
86
|
+
(0, shared_js_1.registerToolSafe)(server, 'add_user_to_group', {
|
|
87
|
+
title: 'Add user to group',
|
|
88
|
+
description: 'Add a user to a group',
|
|
89
|
+
inputSchema: {
|
|
90
|
+
groupUuid: zod_1.z.string().describe('Group UUID'),
|
|
91
|
+
userUuid: zod_1.z.string().describe('User UUID'),
|
|
92
|
+
},
|
|
93
|
+
annotations: shared_js_1.WRITE_IDEMPOTENT,
|
|
94
|
+
}, (0, shared_js_1.wrapTool)(client, (c) => (_a) => __awaiter(this, [_a], void 0, function* ({ groupUuid, userUuid }) {
|
|
95
|
+
yield c.v1.groups.addUserToGroup(groupUuid, userUuid);
|
|
96
|
+
return {
|
|
97
|
+
content: [
|
|
98
|
+
{ type: 'text', text: `User ${userUuid} added to group ${groupUuid} successfully` },
|
|
99
|
+
],
|
|
100
|
+
};
|
|
101
|
+
})));
|
|
102
|
+
(0, shared_js_1.registerToolSafe)(server, 'remove_user_from_group', {
|
|
103
|
+
title: 'Remove user from group',
|
|
104
|
+
description: 'Remove a user from a group',
|
|
105
|
+
inputSchema: {
|
|
106
|
+
groupUuid: zod_1.z.string().describe('Group UUID'),
|
|
107
|
+
userUuid: zod_1.z.string().describe('User UUID'),
|
|
108
|
+
},
|
|
109
|
+
annotations: shared_js_1.WRITE_DESTRUCTIVE,
|
|
110
|
+
}, (0, shared_js_1.wrapTool)(client, (c) => (_a) => __awaiter(this, [_a], void 0, function* ({ groupUuid, userUuid }) {
|
|
111
|
+
yield c.v1.groups.removeUserFromGroup(groupUuid, userUuid);
|
|
112
|
+
return {
|
|
113
|
+
content: [
|
|
114
|
+
{
|
|
115
|
+
type: 'text',
|
|
116
|
+
text: `User ${userUuid} removed from group ${groupUuid} successfully`,
|
|
117
|
+
},
|
|
118
|
+
],
|
|
119
|
+
};
|
|
120
|
+
})));
|
|
41
121
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lightdash-tools/mcp",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.5",
|
|
4
4
|
"description": "MCP server and utilities for Lightdash AI.",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
"@modelcontextprotocol/sdk": "^1.26.0",
|
|
15
15
|
"commander": "^14.0.3",
|
|
16
16
|
"zod": "^4.3.6",
|
|
17
|
-
"@lightdash-tools/client": "0.2.
|
|
18
|
-
"@lightdash-tools/common": "0.2.
|
|
17
|
+
"@lightdash-tools/client": "0.2.5",
|
|
18
|
+
"@lightdash-tools/common": "0.2.5"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"@types/node": "^25.2.3"
|
package/src/bin.ts
CHANGED
package/src/tools/groups.ts
CHANGED
|
@@ -5,7 +5,13 @@
|
|
|
5
5
|
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
6
6
|
import type { LightdashClient } from '@lightdash-tools/client';
|
|
7
7
|
import { z } from 'zod';
|
|
8
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
wrapTool,
|
|
10
|
+
registerToolSafe,
|
|
11
|
+
READ_ONLY_DEFAULT,
|
|
12
|
+
WRITE_IDEMPOTENT,
|
|
13
|
+
WRITE_DESTRUCTIVE,
|
|
14
|
+
} from './shared.js';
|
|
9
15
|
|
|
10
16
|
type ListGroupsParams = {
|
|
11
17
|
page?: number;
|
|
@@ -32,6 +38,7 @@ export function registerGroupTools(server: McpServer, client: LightdashClient):
|
|
|
32
38
|
return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
|
|
33
39
|
}),
|
|
34
40
|
);
|
|
41
|
+
|
|
35
42
|
registerToolSafe(
|
|
36
43
|
server,
|
|
37
44
|
'get_group',
|
|
@@ -46,4 +53,128 @@ export function registerGroupTools(server: McpServer, client: LightdashClient):
|
|
|
46
53
|
return { content: [{ type: 'text', text: JSON.stringify(group, null, 2) }] };
|
|
47
54
|
}),
|
|
48
55
|
);
|
|
56
|
+
|
|
57
|
+
registerToolSafe(
|
|
58
|
+
server,
|
|
59
|
+
'create_group',
|
|
60
|
+
{
|
|
61
|
+
title: 'Create group',
|
|
62
|
+
description: 'Create a new group in the organization',
|
|
63
|
+
inputSchema: {
|
|
64
|
+
name: z.string().describe('Group name'),
|
|
65
|
+
},
|
|
66
|
+
annotations: WRITE_IDEMPOTENT,
|
|
67
|
+
},
|
|
68
|
+
wrapTool(client, (c) => async ({ name }: { name: string }) => {
|
|
69
|
+
const group = await c.v1.groups.createGroup({ name });
|
|
70
|
+
return { content: [{ type: 'text', text: JSON.stringify(group, null, 2) }] };
|
|
71
|
+
}),
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
registerToolSafe(
|
|
75
|
+
server,
|
|
76
|
+
'update_group',
|
|
77
|
+
{
|
|
78
|
+
title: 'Update group',
|
|
79
|
+
description: 'Update a group name',
|
|
80
|
+
inputSchema: {
|
|
81
|
+
groupUuid: z.string().describe('Group UUID'),
|
|
82
|
+
name: z.string().describe('New group name'),
|
|
83
|
+
},
|
|
84
|
+
annotations: WRITE_IDEMPOTENT,
|
|
85
|
+
},
|
|
86
|
+
wrapTool(client, (c) => async ({ groupUuid, name }: { groupUuid: string; name: string }) => {
|
|
87
|
+
const group = await c.v1.groups.updateGroup(groupUuid, { name });
|
|
88
|
+
return { content: [{ type: 'text', text: JSON.stringify(group, null, 2) }] };
|
|
89
|
+
}),
|
|
90
|
+
);
|
|
91
|
+
|
|
92
|
+
registerToolSafe(
|
|
93
|
+
server,
|
|
94
|
+
'delete_group',
|
|
95
|
+
{
|
|
96
|
+
title: 'Delete group',
|
|
97
|
+
description: 'Delete a group by UUID',
|
|
98
|
+
inputSchema: {
|
|
99
|
+
groupUuid: z.string().describe('Group UUID'),
|
|
100
|
+
},
|
|
101
|
+
annotations: WRITE_DESTRUCTIVE,
|
|
102
|
+
},
|
|
103
|
+
wrapTool(client, (c) => async ({ groupUuid }: { groupUuid: string }) => {
|
|
104
|
+
await c.v1.groups.deleteGroup(groupUuid);
|
|
105
|
+
return { content: [{ type: 'text', text: `Group ${groupUuid} deleted successfully` }] };
|
|
106
|
+
}),
|
|
107
|
+
);
|
|
108
|
+
|
|
109
|
+
registerToolSafe(
|
|
110
|
+
server,
|
|
111
|
+
'list_group_members',
|
|
112
|
+
{
|
|
113
|
+
title: 'List group members',
|
|
114
|
+
description: 'List members of a group',
|
|
115
|
+
inputSchema: {
|
|
116
|
+
groupUuid: z.string().describe('Group UUID'),
|
|
117
|
+
},
|
|
118
|
+
annotations: READ_ONLY_DEFAULT,
|
|
119
|
+
},
|
|
120
|
+
wrapTool(client, (c) => async ({ groupUuid }: { groupUuid: string }) => {
|
|
121
|
+
const members = await c.v1.groups.getGroupMembers(groupUuid);
|
|
122
|
+
return { content: [{ type: 'text', text: JSON.stringify(members, null, 2) }] };
|
|
123
|
+
}),
|
|
124
|
+
);
|
|
125
|
+
|
|
126
|
+
registerToolSafe(
|
|
127
|
+
server,
|
|
128
|
+
'add_user_to_group',
|
|
129
|
+
{
|
|
130
|
+
title: 'Add user to group',
|
|
131
|
+
description: 'Add a user to a group',
|
|
132
|
+
inputSchema: {
|
|
133
|
+
groupUuid: z.string().describe('Group UUID'),
|
|
134
|
+
userUuid: z.string().describe('User UUID'),
|
|
135
|
+
},
|
|
136
|
+
annotations: WRITE_IDEMPOTENT,
|
|
137
|
+
},
|
|
138
|
+
wrapTool(
|
|
139
|
+
client,
|
|
140
|
+
(c) =>
|
|
141
|
+
async ({ groupUuid, userUuid }: { groupUuid: string; userUuid: string }) => {
|
|
142
|
+
await c.v1.groups.addUserToGroup(groupUuid, userUuid);
|
|
143
|
+
return {
|
|
144
|
+
content: [
|
|
145
|
+
{ type: 'text', text: `User ${userUuid} added to group ${groupUuid} successfully` },
|
|
146
|
+
],
|
|
147
|
+
};
|
|
148
|
+
},
|
|
149
|
+
),
|
|
150
|
+
);
|
|
151
|
+
|
|
152
|
+
registerToolSafe(
|
|
153
|
+
server,
|
|
154
|
+
'remove_user_from_group',
|
|
155
|
+
{
|
|
156
|
+
title: 'Remove user from group',
|
|
157
|
+
description: 'Remove a user from a group',
|
|
158
|
+
inputSchema: {
|
|
159
|
+
groupUuid: z.string().describe('Group UUID'),
|
|
160
|
+
userUuid: z.string().describe('User UUID'),
|
|
161
|
+
},
|
|
162
|
+
annotations: WRITE_DESTRUCTIVE,
|
|
163
|
+
},
|
|
164
|
+
wrapTool(
|
|
165
|
+
client,
|
|
166
|
+
(c) =>
|
|
167
|
+
async ({ groupUuid, userUuid }: { groupUuid: string; userUuid: string }) => {
|
|
168
|
+
await c.v1.groups.removeUserFromGroup(groupUuid, userUuid);
|
|
169
|
+
return {
|
|
170
|
+
content: [
|
|
171
|
+
{
|
|
172
|
+
type: 'text',
|
|
173
|
+
text: `User ${userUuid} removed from group ${groupUuid} successfully`,
|
|
174
|
+
},
|
|
175
|
+
],
|
|
176
|
+
};
|
|
177
|
+
},
|
|
178
|
+
),
|
|
179
|
+
);
|
|
49
180
|
}
|