mcp-dataverse 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/.env.example +15 -0
- package/CAPABILITIES.md +992 -0
- package/LICENSE +21 -0
- package/README.md +277 -0
- package/config.example.json +11 -0
- package/dist/auth/auth-provider.factory.d.ts +4 -0
- package/dist/auth/auth-provider.factory.d.ts.map +1 -0
- package/dist/auth/auth-provider.factory.js +15 -0
- package/dist/auth/auth-provider.factory.js.map +1 -0
- package/dist/auth/auth-provider.interface.d.ts +21 -0
- package/dist/auth/auth-provider.interface.d.ts.map +1 -0
- package/dist/auth/auth-provider.interface.js +2 -0
- package/dist/auth/auth-provider.interface.js.map +1 -0
- package/dist/auth/msal-auth-provider.d.ts +14 -0
- package/dist/auth/msal-auth-provider.d.ts.map +1 -0
- package/dist/auth/msal-auth-provider.js +62 -0
- package/dist/auth/msal-auth-provider.js.map +1 -0
- package/dist/auth/pac-auth-provider.d.ts +19 -0
- package/dist/auth/pac-auth-provider.d.ts.map +1 -0
- package/dist/auth/pac-auth-provider.js +153 -0
- package/dist/auth/pac-auth-provider.js.map +1 -0
- package/dist/config/config.loader.d.ts +3 -0
- package/dist/config/config.loader.d.ts.map +1 -0
- package/dist/config/config.loader.js +52 -0
- package/dist/config/config.loader.js.map +1 -0
- package/dist/config/config.schema.d.ts +34 -0
- package/dist/config/config.schema.d.ts.map +1 -0
- package/dist/config/config.schema.js +25 -0
- package/dist/config/config.schema.js.map +1 -0
- package/dist/dataverse/dataverse-client-advanced.d.ts +47 -0
- package/dist/dataverse/dataverse-client-advanced.d.ts.map +1 -0
- package/dist/dataverse/dataverse-client-advanced.js +147 -0
- package/dist/dataverse/dataverse-client-advanced.js.map +1 -0
- package/dist/dataverse/dataverse-client.d.ts +49 -0
- package/dist/dataverse/dataverse-client.d.ts.map +1 -0
- package/dist/dataverse/dataverse-client.js +313 -0
- package/dist/dataverse/dataverse-client.js.map +1 -0
- package/dist/dataverse/dataverse-client.metadata.d.ts +40 -0
- package/dist/dataverse/dataverse-client.metadata.d.ts.map +1 -0
- package/dist/dataverse/dataverse-client.metadata.js +121 -0
- package/dist/dataverse/dataverse-client.metadata.js.map +1 -0
- package/dist/dataverse/dataverse-client.utils.d.ts +14 -0
- package/dist/dataverse/dataverse-client.utils.d.ts.map +1 -0
- package/dist/dataverse/dataverse-client.utils.js +65 -0
- package/dist/dataverse/dataverse-client.utils.js.map +1 -0
- package/dist/dataverse/http-client.d.ts +36 -0
- package/dist/dataverse/http-client.d.ts.map +1 -0
- package/dist/dataverse/http-client.js +103 -0
- package/dist/dataverse/http-client.js.map +1 -0
- package/dist/dataverse/types.d.ts +68 -0
- package/dist/dataverse/types.d.ts.map +1 -0
- package/dist/dataverse/types.js +2 -0
- package/dist/dataverse/types.js.map +1 -0
- package/dist/server.d.ts +3 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +165 -0
- package/dist/server.js.map +1 -0
- package/dist/setup-auth.d.ts +2 -0
- package/dist/setup-auth.d.ts.map +1 -0
- package/dist/setup-auth.js +29 -0
- package/dist/setup-auth.js.map +1 -0
- package/dist/tools/actions.tools.d.ts +170 -0
- package/dist/tools/actions.tools.d.ts.map +1 -0
- package/dist/tools/actions.tools.js +179 -0
- package/dist/tools/actions.tools.js.map +1 -0
- package/dist/tools/annotations.tools.d.ts +82 -0
- package/dist/tools/annotations.tools.d.ts.map +1 -0
- package/dist/tools/annotations.tools.js +180 -0
- package/dist/tools/annotations.tools.js.map +1 -0
- package/dist/tools/audit.tools.d.ts +45 -0
- package/dist/tools/audit.tools.d.ts.map +1 -0
- package/dist/tools/audit.tools.js +163 -0
- package/dist/tools/audit.tools.js.map +1 -0
- package/dist/tools/auth.tools.d.ts +17 -0
- package/dist/tools/auth.tools.d.ts.map +1 -0
- package/dist/tools/auth.tools.js +30 -0
- package/dist/tools/auth.tools.js.map +1 -0
- package/dist/tools/batch.tools.d.ts +45 -0
- package/dist/tools/batch.tools.d.ts.map +1 -0
- package/dist/tools/batch.tools.js +71 -0
- package/dist/tools/batch.tools.js.map +1 -0
- package/dist/tools/crud.tools.d.ts +206 -0
- package/dist/tools/crud.tools.d.ts.map +1 -0
- package/dist/tools/crud.tools.js +213 -0
- package/dist/tools/crud.tools.js.map +1 -0
- package/dist/tools/customization.tools.d.ts +75 -0
- package/dist/tools/customization.tools.d.ts.map +1 -0
- package/dist/tools/customization.tools.js +187 -0
- package/dist/tools/customization.tools.js.map +1 -0
- package/dist/tools/environment.tools.d.ts +40 -0
- package/dist/tools/environment.tools.d.ts.map +1 -0
- package/dist/tools/environment.tools.js +145 -0
- package/dist/tools/environment.tools.js.map +1 -0
- package/dist/tools/file.tools.d.ts +61 -0
- package/dist/tools/file.tools.d.ts.map +1 -0
- package/dist/tools/file.tools.js +142 -0
- package/dist/tools/file.tools.js.map +1 -0
- package/dist/tools/impersonate.tools.d.ts +37 -0
- package/dist/tools/impersonate.tools.d.ts.map +1 -0
- package/dist/tools/impersonate.tools.js +85 -0
- package/dist/tools/impersonate.tools.js.map +1 -0
- package/dist/tools/metadata.tools.d.ts +156 -0
- package/dist/tools/metadata.tools.d.ts.map +1 -0
- package/dist/tools/metadata.tools.js +200 -0
- package/dist/tools/metadata.tools.js.map +1 -0
- package/dist/tools/org.tools.d.ts +26 -0
- package/dist/tools/org.tools.d.ts.map +1 -0
- package/dist/tools/org.tools.js +57 -0
- package/dist/tools/org.tools.js.map +1 -0
- package/dist/tools/quality.tools.d.ts +30 -0
- package/dist/tools/quality.tools.d.ts.map +1 -0
- package/dist/tools/quality.tools.js +69 -0
- package/dist/tools/quality.tools.js.map +1 -0
- package/dist/tools/query.tools.d.ts +120 -0
- package/dist/tools/query.tools.d.ts.map +1 -0
- package/dist/tools/query.tools.js +182 -0
- package/dist/tools/query.tools.js.map +1 -0
- package/dist/tools/relations.tools.d.ts +65 -0
- package/dist/tools/relations.tools.d.ts.map +1 -0
- package/dist/tools/relations.tools.js +64 -0
- package/dist/tools/relations.tools.js.map +1 -0
- package/dist/tools/search.tools.d.ts +68 -0
- package/dist/tools/search.tools.d.ts.map +1 -0
- package/dist/tools/search.tools.js +134 -0
- package/dist/tools/search.tools.js.map +1 -0
- package/dist/tools/solution.tools.d.ts +95 -0
- package/dist/tools/solution.tools.d.ts.map +1 -0
- package/dist/tools/solution.tools.js +130 -0
- package/dist/tools/solution.tools.js.map +1 -0
- package/dist/tools/teams.tools.d.ts +27 -0
- package/dist/tools/teams.tools.d.ts.map +1 -0
- package/dist/tools/teams.tools.js +67 -0
- package/dist/tools/teams.tools.js.map +1 -0
- package/dist/tools/trace.tools.d.ts +63 -0
- package/dist/tools/trace.tools.d.ts.map +1 -0
- package/dist/tools/trace.tools.js +218 -0
- package/dist/tools/trace.tools.js.map +1 -0
- package/dist/tools/tracking.tools.d.ts +35 -0
- package/dist/tools/tracking.tools.d.ts.map +1 -0
- package/dist/tools/tracking.tools.js +40 -0
- package/dist/tools/tracking.tools.js.map +1 -0
- package/dist/tools/users.tools.d.ts +57 -0
- package/dist/tools/users.tools.d.ts.map +1 -0
- package/dist/tools/users.tools.js +146 -0
- package/dist/tools/users.tools.js.map +1 -0
- package/dist/tools/views.tools.d.ts +30 -0
- package/dist/tools/views.tools.d.ts.map +1 -0
- package/dist/tools/views.tools.js +84 -0
- package/dist/tools/views.tools.js.map +1 -0
- package/package.json +81 -0
- package/server.json +30 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { DataverseAdvancedClient } from '../dataverse/dataverse-client-advanced.js';
|
|
2
|
+
export declare const userTools: ({
|
|
3
|
+
name: string;
|
|
4
|
+
description: string;
|
|
5
|
+
inputSchema: {
|
|
6
|
+
type: "object";
|
|
7
|
+
properties: {
|
|
8
|
+
userId: {
|
|
9
|
+
type: string;
|
|
10
|
+
description: string;
|
|
11
|
+
};
|
|
12
|
+
search?: never;
|
|
13
|
+
businessUnitId?: never;
|
|
14
|
+
includeDisabled?: never;
|
|
15
|
+
includeApplicationUsers?: never;
|
|
16
|
+
top?: never;
|
|
17
|
+
};
|
|
18
|
+
required: string[];
|
|
19
|
+
};
|
|
20
|
+
} | {
|
|
21
|
+
name: string;
|
|
22
|
+
description: string;
|
|
23
|
+
inputSchema: {
|
|
24
|
+
type: "object";
|
|
25
|
+
properties: {
|
|
26
|
+
search: {
|
|
27
|
+
type: string;
|
|
28
|
+
description: string;
|
|
29
|
+
};
|
|
30
|
+
businessUnitId: {
|
|
31
|
+
type: string;
|
|
32
|
+
description: string;
|
|
33
|
+
};
|
|
34
|
+
includeDisabled: {
|
|
35
|
+
type: string;
|
|
36
|
+
description: string;
|
|
37
|
+
};
|
|
38
|
+
includeApplicationUsers: {
|
|
39
|
+
type: string;
|
|
40
|
+
description: string;
|
|
41
|
+
};
|
|
42
|
+
top: {
|
|
43
|
+
type: string;
|
|
44
|
+
description: string;
|
|
45
|
+
};
|
|
46
|
+
userId?: never;
|
|
47
|
+
};
|
|
48
|
+
required?: never;
|
|
49
|
+
};
|
|
50
|
+
})[];
|
|
51
|
+
export declare function handleUserTool(name: string, args: unknown, client: DataverseAdvancedClient): Promise<{
|
|
52
|
+
content: Array<{
|
|
53
|
+
type: 'text';
|
|
54
|
+
text: string;
|
|
55
|
+
}>;
|
|
56
|
+
}>;
|
|
57
|
+
//# sourceMappingURL=users.tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"users.tools.d.ts","sourceRoot":"","sources":["../../src/tools/users.tools.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,2CAA2C,CAAC;AAiBzF,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA8CrB,CAAC;AAEF,wBAAsB,cAAc,CAChC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,OAAO,EACb,MAAM,EAAE,uBAAuB,GAChC,OAAO,CAAC;IAAE,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE,CAAC,CA0G7D"}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
const GetUserRolesInput = z.object({
|
|
3
|
+
userId: z.string().uuid(),
|
|
4
|
+
});
|
|
5
|
+
const ListUsersInput = z.object({
|
|
6
|
+
search: z.string().optional(),
|
|
7
|
+
businessUnitId: z.string().optional(),
|
|
8
|
+
includeDisabled: z.boolean().optional().default(false),
|
|
9
|
+
includeApplicationUsers: z.boolean().optional().default(false),
|
|
10
|
+
top: z.number().int().positive().max(100).optional().default(20),
|
|
11
|
+
}).refine(data => data.search || data.businessUnitId, { message: 'At least one of search or businessUnitId is required' });
|
|
12
|
+
export const userTools = [
|
|
13
|
+
{
|
|
14
|
+
name: 'dataverse_get_user_roles',
|
|
15
|
+
description: 'Returns all security roles assigned to a Dataverse system user. Provide the user GUID to retrieve full name, domain name (UPN), and the list of roles with role ID, name, and managed status.',
|
|
16
|
+
inputSchema: {
|
|
17
|
+
type: 'object',
|
|
18
|
+
properties: {
|
|
19
|
+
userId: {
|
|
20
|
+
type: 'string',
|
|
21
|
+
description: 'The system user GUID',
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
required: ['userId'],
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
name: 'dataverse_list_users',
|
|
29
|
+
description: 'Searches Dataverse system users by name or email. Returns user ID, full name, domain name (UPN), email, business unit, and disabled status. Excludes application users and disabled users by default.',
|
|
30
|
+
inputSchema: {
|
|
31
|
+
type: 'object',
|
|
32
|
+
properties: {
|
|
33
|
+
search: {
|
|
34
|
+
type: 'string',
|
|
35
|
+
description: 'Full-name or email contains-search',
|
|
36
|
+
},
|
|
37
|
+
businessUnitId: {
|
|
38
|
+
type: 'string',
|
|
39
|
+
description: 'Restrict to a business unit (GUID)',
|
|
40
|
+
},
|
|
41
|
+
includeDisabled: {
|
|
42
|
+
type: 'boolean',
|
|
43
|
+
description: 'Include disabled users (default false)',
|
|
44
|
+
},
|
|
45
|
+
includeApplicationUsers: {
|
|
46
|
+
type: 'boolean',
|
|
47
|
+
description: 'Include application/service users (default false)',
|
|
48
|
+
},
|
|
49
|
+
top: {
|
|
50
|
+
type: 'number',
|
|
51
|
+
description: 'Maximum number of results (default 20, max 100)',
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
];
|
|
57
|
+
export async function handleUserTool(name, args, client) {
|
|
58
|
+
switch (name) {
|
|
59
|
+
case 'dataverse_get_user_roles': {
|
|
60
|
+
const { userId } = GetUserRolesInput.parse(args);
|
|
61
|
+
const response = await client.query('systemusers', {
|
|
62
|
+
filter: `systemuserid eq ${userId}`,
|
|
63
|
+
select: ['fullname', 'domainname'],
|
|
64
|
+
expand: 'systemuserroles_association($select=name,roleid,ismanaged)',
|
|
65
|
+
top: 1,
|
|
66
|
+
});
|
|
67
|
+
const rows = (response.value ?? []);
|
|
68
|
+
if (rows.length === 0) {
|
|
69
|
+
throw new Error(`User with ID '${userId}' not found`);
|
|
70
|
+
}
|
|
71
|
+
const user = rows[0];
|
|
72
|
+
const rawRoles = (user['systemuserroles_association'] ?? []);
|
|
73
|
+
const roles = rawRoles.map(r => ({
|
|
74
|
+
roleId: r['roleid'] ?? '',
|
|
75
|
+
name: r['name'] ?? '',
|
|
76
|
+
isManaged: r['ismanaged'] === true,
|
|
77
|
+
}));
|
|
78
|
+
return {
|
|
79
|
+
content: [
|
|
80
|
+
{
|
|
81
|
+
type: 'text',
|
|
82
|
+
text: JSON.stringify({
|
|
83
|
+
userId,
|
|
84
|
+
fullname: user['fullname'] ?? '',
|
|
85
|
+
domainname: user['domainname'] ?? '',
|
|
86
|
+
roles,
|
|
87
|
+
roleCount: roles.length,
|
|
88
|
+
}, null, 2),
|
|
89
|
+
},
|
|
90
|
+
],
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
case 'dataverse_list_users': {
|
|
94
|
+
const params = ListUsersInput.parse(args);
|
|
95
|
+
const filterParts = [];
|
|
96
|
+
if (!params.includeDisabled) {
|
|
97
|
+
filterParts.push('isdisabled eq false');
|
|
98
|
+
}
|
|
99
|
+
if (!params.includeApplicationUsers) {
|
|
100
|
+
filterParts.push('applicationid eq null');
|
|
101
|
+
}
|
|
102
|
+
if (params.search) {
|
|
103
|
+
const escaped = params.search.replace(/'/g, "''");
|
|
104
|
+
filterParts.push(`(contains(fullname,'${escaped}') or contains(internalemailaddress,'${escaped}'))`);
|
|
105
|
+
}
|
|
106
|
+
if (params.businessUnitId) {
|
|
107
|
+
filterParts.push(`_businessunitid_value eq ${params.businessUnitId}`);
|
|
108
|
+
}
|
|
109
|
+
const response = await client.query('systemusers', {
|
|
110
|
+
select: [
|
|
111
|
+
'systemuserid',
|
|
112
|
+
'fullname',
|
|
113
|
+
'domainname',
|
|
114
|
+
'internalemailaddress',
|
|
115
|
+
'applicationid',
|
|
116
|
+
'isdisabled',
|
|
117
|
+
],
|
|
118
|
+
filter: filterParts.join(' and '),
|
|
119
|
+
expand: 'businessunitid($select=name)',
|
|
120
|
+
orderby: 'fullname asc',
|
|
121
|
+
top: params.top,
|
|
122
|
+
});
|
|
123
|
+
const rows = (response.value ?? []);
|
|
124
|
+
const users = rows.map(row => ({
|
|
125
|
+
id: row['systemuserid'] ?? '',
|
|
126
|
+
fullName: row['fullname'] ?? '',
|
|
127
|
+
domainName: row['domainname'] ?? '',
|
|
128
|
+
email: row['internalemailaddress'] ?? '',
|
|
129
|
+
businessUnit: row['businessunitid']?.['name'] ?? null,
|
|
130
|
+
isDisabled: row['isdisabled'] === true,
|
|
131
|
+
isApplicationUser: row['applicationid'] != null,
|
|
132
|
+
}));
|
|
133
|
+
return {
|
|
134
|
+
content: [
|
|
135
|
+
{
|
|
136
|
+
type: 'text',
|
|
137
|
+
text: JSON.stringify({ users, count: users.length }, null, 2),
|
|
138
|
+
},
|
|
139
|
+
],
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
default:
|
|
143
|
+
throw new Error(`Unknown user tool: ${name}`);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
//# sourceMappingURL=users.tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"users.tools.js","sourceRoot":"","sources":["../../src/tools/users.tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/B,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE;CAC5B,CAAC,CAAC;AAEH,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5B,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC7B,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACrC,eAAe,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC;IACtD,uBAAuB,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC;IAC9D,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;CACnE,CAAC,CAAC,MAAM,CACL,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,cAAc,EAC1C,EAAE,OAAO,EAAE,sDAAsD,EAAE,CACtE,CAAC;AAEF,MAAM,CAAC,MAAM,SAAS,GAAG;IACrB;QACI,IAAI,EAAE,0BAA0B;QAChC,WAAW,EACP,+LAA+L;QACnM,WAAW,EAAE;YACT,IAAI,EAAE,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tC,iBAAiB,EAAE,GAAG,CAAC,eAAe,CAAC,IAAI,IAAI;aAClD,CAAC,CAAC,CAAC;YAEJ,OAAO;gBACH,OAAO,EAAE;oBACL;wBACI,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,MAAM,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;qBAChE;iBACJ;aACJ,CAAC;QACN,CAAC;QAED;YACI,MAAM,IAAI,KAAK,CAAC,sBAAsB,IAAI,EAAE,CAAC,CAAC;IACtD,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { DataverseAdvancedClient } from '../dataverse/dataverse-client-advanced.js';
|
|
2
|
+
export declare const viewTools: {
|
|
3
|
+
name: string;
|
|
4
|
+
description: string;
|
|
5
|
+
inputSchema: {
|
|
6
|
+
type: "object";
|
|
7
|
+
properties: {
|
|
8
|
+
entityLogicalName: {
|
|
9
|
+
type: string;
|
|
10
|
+
description: string;
|
|
11
|
+
};
|
|
12
|
+
includePersonal: {
|
|
13
|
+
type: string;
|
|
14
|
+
description: string;
|
|
15
|
+
};
|
|
16
|
+
top: {
|
|
17
|
+
type: string;
|
|
18
|
+
description: string;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
required: string[];
|
|
22
|
+
};
|
|
23
|
+
}[];
|
|
24
|
+
export declare function handleViewTool(name: string, args: unknown, client: DataverseAdvancedClient): Promise<{
|
|
25
|
+
content: Array<{
|
|
26
|
+
type: 'text';
|
|
27
|
+
text: string;
|
|
28
|
+
}>;
|
|
29
|
+
}>;
|
|
30
|
+
//# sourceMappingURL=views.tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"views.tools.d.ts","sourceRoot":"","sources":["../../src/tools/views.tools.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,2CAA2C,CAAC;AAQzF,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;GAwBrB,CAAC;AAgBF,wBAAsB,cAAc,CAClC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,OAAO,EACb,MAAM,EAAE,uBAAuB,GAC9B,OAAO,CAAC;IAAE,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE,CAAC,CAgE7D"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
const ListViewsInput = z.object({
|
|
3
|
+
entityLogicalName: z.string().min(1),
|
|
4
|
+
includePersonal: z.boolean().optional().default(false),
|
|
5
|
+
top: z.number().int().positive().max(100).optional().default(20),
|
|
6
|
+
});
|
|
7
|
+
export const viewTools = [
|
|
8
|
+
{
|
|
9
|
+
name: 'dataverse_list_views',
|
|
10
|
+
description: 'Lists saved views (system and optionally personal) for a Dataverse table. System views come from savedqueries; personal views come from userqueries. Returns view name, ID, default flag, query type, and description.',
|
|
11
|
+
inputSchema: {
|
|
12
|
+
type: 'object',
|
|
13
|
+
properties: {
|
|
14
|
+
entityLogicalName: {
|
|
15
|
+
type: 'string',
|
|
16
|
+
description: 'Logical name of the entity to list views for (e.g., "account")',
|
|
17
|
+
},
|
|
18
|
+
includePersonal: {
|
|
19
|
+
type: 'boolean',
|
|
20
|
+
description: 'Include personal (user) views in addition to system views (default false)',
|
|
21
|
+
},
|
|
22
|
+
top: {
|
|
23
|
+
type: 'number',
|
|
24
|
+
description: 'Maximum number of results per category (default 20, max 100)',
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
required: ['entityLogicalName'],
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
];
|
|
31
|
+
export async function handleViewTool(name, args, client) {
|
|
32
|
+
switch (name) {
|
|
33
|
+
case 'dataverse_list_views': {
|
|
34
|
+
const { entityLogicalName, includePersonal, top } = ListViewsInput.parse(args);
|
|
35
|
+
const escaped = entityLogicalName.replace(/'/g, "''");
|
|
36
|
+
const systemResult = await client.query('savedqueries', {
|
|
37
|
+
filter: `returnedtypecode eq '${escaped}' and statecode eq 0`,
|
|
38
|
+
select: ['savedqueryid', 'name', 'isdefault', 'querytype', 'description'],
|
|
39
|
+
orderby: 'name asc',
|
|
40
|
+
top,
|
|
41
|
+
});
|
|
42
|
+
const systemViews = systemResult.value.map(v => ({
|
|
43
|
+
id: v.savedqueryid,
|
|
44
|
+
name: v.name,
|
|
45
|
+
isDefault: v.isdefault,
|
|
46
|
+
queryType: v.querytype,
|
|
47
|
+
description: v.description ?? null,
|
|
48
|
+
viewType: 'system',
|
|
49
|
+
}));
|
|
50
|
+
let personalViews = [];
|
|
51
|
+
if (includePersonal) {
|
|
52
|
+
const personalResult = await client.query('userqueries', {
|
|
53
|
+
filter: `returnedtypecode eq '${escaped}'`,
|
|
54
|
+
select: ['userqueryid', 'name', 'description'],
|
|
55
|
+
orderby: 'name asc',
|
|
56
|
+
top,
|
|
57
|
+
});
|
|
58
|
+
personalViews = personalResult.value.map(v => ({
|
|
59
|
+
id: v.userqueryid,
|
|
60
|
+
name: v.name,
|
|
61
|
+
description: v.description ?? null,
|
|
62
|
+
viewType: 'personal',
|
|
63
|
+
}));
|
|
64
|
+
}
|
|
65
|
+
return {
|
|
66
|
+
content: [
|
|
67
|
+
{
|
|
68
|
+
type: 'text',
|
|
69
|
+
text: JSON.stringify({
|
|
70
|
+
entityLogicalName,
|
|
71
|
+
systemViews,
|
|
72
|
+
systemViewCount: systemViews.length,
|
|
73
|
+
personalViews: includePersonal ? personalViews : undefined,
|
|
74
|
+
personalViewCount: includePersonal ? personalViews.length : undefined,
|
|
75
|
+
}, null, 2),
|
|
76
|
+
},
|
|
77
|
+
],
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
default:
|
|
81
|
+
throw new Error(`Unknown view tool: ${name}`);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=views.tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"views.tools.js","sourceRoot":"","sources":["../../src/tools/views.tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9B,iBAAiB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACpC,eAAe,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC;IACtD,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;CACjE,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB;QACE,IAAI,EAAE,sBAAsB;QAC5B,WAAW,EACT,wNAAwN;QAC1N,WAAW,EAAE;YACX,IAAI,EAAE,QAAiB;YACvB,UAAU,EAAE;gBACV,iBAAiB,EAAE;oBACjB,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,gEAAgE;iBAC9E;gBACD,eAAe,EAAE;oBACf,IAAI,EAAE,SAAS;oBACf,WAAW,EAAE,2EAA2E;iBACzF;gBACD,GAAG,EAAE;oBACH,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,8DAA8D;iBAC5E;aACF;YACD,QAAQ,EAAE,CAAC,mBAAmB,CAAC;SAChC;KACF;CACF,CAAC;AAgBF,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,IAAY,EACZ,IAAa,EACb,MAA+B;IAE/B,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,sBAAsB,CAAC,CAAC,CAAC;YAC5B,MAAM,EAAE,iBAAiB,EAAE,eAAe,EAA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W,IAAI,IAAI;oBAClC,QAAQ,EAAE,UAAmB;iBAC9B,CAAC,CAAC,CAAC;YACN,CAAC;YAED,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;4BACnB,iBAAiB;4BACjB,WAAW;4BACX,eAAe,EAAE,WAAW,CAAC,MAAM;4BACnC,aAAa,EAAE,eAAe,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,SAAS;4BAC1D,iBAAiB,EAAE,eAAe,CAAC,CAAC,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS;yBACtE,EAAE,IAAI,EAAE,CAAC,CAAC;qBACZ;iBACF;aACF,CAAC;QACJ,CAAC;QAED;YACE,MAAM,IAAI,KAAK,CAAC,sBAAsB,IAAI,EAAE,CAAC,CAAC;IAClD,CAAC;AACH,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "mcp-dataverse",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "MCP Server for Microsoft Dataverse Web API",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/server.js",
|
|
7
|
+
"bin": {
|
|
8
|
+
"mcp-dataverse": "dist/server.js"
|
|
9
|
+
},
|
|
10
|
+
"mcpName": "io.github.codeurali/dataverse",
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"engines": {
|
|
13
|
+
"node": ">=20"
|
|
14
|
+
},
|
|
15
|
+
"keywords": [
|
|
16
|
+
"mcp",
|
|
17
|
+
"dataverse",
|
|
18
|
+
"power-platform",
|
|
19
|
+
"dynamics-365",
|
|
20
|
+
"copilot",
|
|
21
|
+
"model-context-protocol"
|
|
22
|
+
],
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "https://github.com/codeurali/mcp-dataverse.git"
|
|
26
|
+
},
|
|
27
|
+
"files": [
|
|
28
|
+
"dist/**",
|
|
29
|
+
"config.example.json",
|
|
30
|
+
".env.example",
|
|
31
|
+
"README.md",
|
|
32
|
+
"LICENSE",
|
|
33
|
+
"CAPABILITIES.md",
|
|
34
|
+
"server.json"
|
|
35
|
+
],
|
|
36
|
+
"scripts": {
|
|
37
|
+
"prepublishOnly": "npm run build",
|
|
38
|
+
"publish:all": "node scripts/publish.mjs",
|
|
39
|
+
"publish:npm": "node scripts/publish.mjs --npm",
|
|
40
|
+
"publish:mcp": "node scripts/publish.mjs --mcp",
|
|
41
|
+
"publish:dry": "node scripts/publish.mjs --dry",
|
|
42
|
+
"build": "tsc",
|
|
43
|
+
"dev": "tsx watch src/server.ts",
|
|
44
|
+
"start": "node dist/server.js",
|
|
45
|
+
"auth:setup": "node dist/setup-auth.js",
|
|
46
|
+
"test": "jest",
|
|
47
|
+
"test:unit": "jest --testPathPattern=tests/unit",
|
|
48
|
+
"test:integration": "jest --testPathPattern=tests/integration",
|
|
49
|
+
"test:coverage": "jest --coverage",
|
|
50
|
+
"lint": "eslint src/**/*.ts tests/**/*.ts",
|
|
51
|
+
"typecheck": "tsc --noEmit",
|
|
52
|
+
"prepare": "husky"
|
|
53
|
+
},
|
|
54
|
+
"lint-staged": {
|
|
55
|
+
"src/**/*.ts": [
|
|
56
|
+
"eslint --fix"
|
|
57
|
+
],
|
|
58
|
+
"tests/**/*.ts": [
|
|
59
|
+
"eslint --fix"
|
|
60
|
+
]
|
|
61
|
+
},
|
|
62
|
+
"dependencies": {
|
|
63
|
+
"@azure/msal-node": "^2.16.0",
|
|
64
|
+
"@modelcontextprotocol/sdk": "^1.0.0",
|
|
65
|
+
"zod": "^3.23.0"
|
|
66
|
+
},
|
|
67
|
+
"devDependencies": {
|
|
68
|
+
"@types/jest": "^29.5.0",
|
|
69
|
+
"@types/node": "^20.0.0",
|
|
70
|
+
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
|
71
|
+
"@typescript-eslint/parser": "^8.0.0",
|
|
72
|
+
"eslint": "^9.0.0",
|
|
73
|
+
"husky": "^9.1.7",
|
|
74
|
+
"jest": "^29.0.0",
|
|
75
|
+
"lint-staged": "^16.2.7",
|
|
76
|
+
"ts-jest": "^29.0.0",
|
|
77
|
+
"tsx": "^4.0.0",
|
|
78
|
+
"typescript": "^5.4.0",
|
|
79
|
+
"typescript-eslint": "^8.56.0"
|
|
80
|
+
}
|
|
81
|
+
}
|
package/server.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
|
|
3
|
+
"name": "io.github.codeurali/dataverse",
|
|
4
|
+
"title": "MCP Dataverse",
|
|
5
|
+
"description": "MCP server exposing 48 Microsoft Dataverse Web API tools for AI agents — query, CRUD, metadata, search, files, audit, and more.",
|
|
6
|
+
"repository": {
|
|
7
|
+
"url": "https://github.com/codeurali/mcp-dataverse",
|
|
8
|
+
"source": "github"
|
|
9
|
+
},
|
|
10
|
+
"version": "0.1.0",
|
|
11
|
+
"packages": [
|
|
12
|
+
{
|
|
13
|
+
"registryType": "npm",
|
|
14
|
+
"identifier": "mcp-dataverse",
|
|
15
|
+
"version": "0.1.0",
|
|
16
|
+
"transport": {
|
|
17
|
+
"type": "stdio"
|
|
18
|
+
},
|
|
19
|
+
"environmentVariables": [
|
|
20
|
+
{
|
|
21
|
+
"name": "DATAVERSE_ENV_URL",
|
|
22
|
+
"description": "Your Dataverse environment URL (e.g. https://yourorg.crm.dynamics.com)",
|
|
23
|
+
"isRequired": false,
|
|
24
|
+
"format": "string",
|
|
25
|
+
"isSecret": false
|
|
26
|
+
}
|
|
27
|
+
]
|
|
28
|
+
}
|
|
29
|
+
]
|
|
30
|
+
}
|