@lightdash-tools/mcp 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +53 -0
- package/dist/config.d.ts +11 -0
- package/dist/config.js +16 -0
- package/dist/errors.d.ts +8 -0
- package/dist/errors.js +29 -0
- package/dist/http.d.ts +5 -0
- package/dist/http.js +172 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +36 -0
- package/dist/index.test.d.ts +1 -0
- package/dist/index.test.js +9 -0
- package/dist/tools/charts.d.ts +6 -0
- package/dist/tools/charts.js +55 -0
- package/dist/tools/dashboards.d.ts +6 -0
- package/dist/tools/dashboards.js +28 -0
- package/dist/tools/explores.d.ts +6 -0
- package/dist/tools/explores.js +40 -0
- package/dist/tools/groups.d.ts +6 -0
- package/dist/tools/groups.js +41 -0
- package/dist/tools/index.d.ts +6 -0
- package/dist/tools/index.js +24 -0
- package/dist/tools/projects.d.ts +6 -0
- package/dist/tools/projects.js +37 -0
- package/dist/tools/query.d.ts +6 -0
- package/dist/tools/query.js +34 -0
- package/dist/tools/shared.d.ts +39 -0
- package/dist/tools/shared.js +68 -0
- package/dist/tools/spaces.d.ts +6 -0
- package/dist/tools/spaces.js +40 -0
- package/dist/tools/users.d.ts +6 -0
- package/dist/tools/users.js +50 -0
- package/package.json +23 -0
- package/src/config.ts +16 -0
- package/src/errors.ts +27 -0
- package/src/http.ts +184 -0
- package/src/index.test.ts +8 -0
- package/src/index.ts +28 -0
- package/src/tools/charts.ts +85 -0
- package/src/tools/dashboards.ts +25 -0
- package/src/tools/explores.ts +46 -0
- package/src/tools/groups.ts +49 -0
- package/src/tools/index.ts +25 -0
- package/src/tools/projects.ts +39 -0
- package/src/tools/query.ts +47 -0
- package/src/tools/shared.ts +101 -0
- package/src/tools/spaces.ts +46 -0
- package/src/tools/users.ts +64 -0
- package/tsconfig.json +13 -0
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP tools: users / organization members (list, get, delete).
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
6
|
+
import type { LightdashClient } from '@lightdash-tools/client';
|
|
7
|
+
import { z } from 'zod';
|
|
8
|
+
import { wrapTool, registerToolSafe, READ_ONLY_DEFAULT, WRITE_DESTRUCTIVE } from './shared.js';
|
|
9
|
+
|
|
10
|
+
type ListMembersParams = {
|
|
11
|
+
page?: number;
|
|
12
|
+
pageSize?: number;
|
|
13
|
+
searchQuery?: string;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export function registerUserTools(server: McpServer, client: LightdashClient): void {
|
|
17
|
+
registerToolSafe(
|
|
18
|
+
server,
|
|
19
|
+
'list_organization_members',
|
|
20
|
+
{
|
|
21
|
+
title: 'List organization members',
|
|
22
|
+
description: 'List organization members (one page)',
|
|
23
|
+
inputSchema: {
|
|
24
|
+
page: z.number().optional().describe('Page number'),
|
|
25
|
+
pageSize: z.number().optional().describe('Page size'),
|
|
26
|
+
searchQuery: z.string().optional().describe('Search query'),
|
|
27
|
+
},
|
|
28
|
+
annotations: READ_ONLY_DEFAULT,
|
|
29
|
+
},
|
|
30
|
+
wrapTool(client, (c) => async (params: ListMembersParams) => {
|
|
31
|
+
const result = await c.v1.users.listMembers(params ?? {});
|
|
32
|
+
return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
|
|
33
|
+
}),
|
|
34
|
+
);
|
|
35
|
+
registerToolSafe(
|
|
36
|
+
server,
|
|
37
|
+
'get_member',
|
|
38
|
+
{
|
|
39
|
+
title: 'Get member',
|
|
40
|
+
description: 'Get an organization member by UUID',
|
|
41
|
+
inputSchema: { userUuid: z.string().describe('User UUID') },
|
|
42
|
+
annotations: READ_ONLY_DEFAULT,
|
|
43
|
+
},
|
|
44
|
+
wrapTool(client, (c) => async ({ userUuid }: { userUuid: string }) => {
|
|
45
|
+
const member = await c.v1.users.getMemberByUuid(userUuid);
|
|
46
|
+
return { content: [{ type: 'text', text: JSON.stringify(member, null, 2) }] };
|
|
47
|
+
}),
|
|
48
|
+
);
|
|
49
|
+
registerToolSafe(
|
|
50
|
+
server,
|
|
51
|
+
'delete_member',
|
|
52
|
+
{
|
|
53
|
+
title: 'Delete member (destructive)',
|
|
54
|
+
description:
|
|
55
|
+
'Permanently remove a user from the organization. Destructive; clients and agents should obtain explicit user confirmation before calling.',
|
|
56
|
+
inputSchema: { userUuid: z.string().describe('User UUID') },
|
|
57
|
+
annotations: WRITE_DESTRUCTIVE,
|
|
58
|
+
},
|
|
59
|
+
wrapTool(client, (c) => async ({ userUuid }: { userUuid: string }) => {
|
|
60
|
+
await c.v1.users.deleteMember(userUuid);
|
|
61
|
+
return { content: [{ type: 'text', text: 'Member deleted.' }] };
|
|
62
|
+
}),
|
|
63
|
+
);
|
|
64
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "es2016",
|
|
4
|
+
"module": "commonjs",
|
|
5
|
+
"declaration": true,
|
|
6
|
+
"outDir": "./dist",
|
|
7
|
+
"strict": true,
|
|
8
|
+
"esModuleInterop": true,
|
|
9
|
+
"skipLibCheck": true,
|
|
10
|
+
"forceConsistentCasingInFileNames": true
|
|
11
|
+
},
|
|
12
|
+
"include": ["src"]
|
|
13
|
+
}
|