@aidalinfo/m365-mcp 0.6.1 → 0.6.2
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 +12 -0
- package/dist/review/model.js +50 -12
- package/dist/tools/access-review.js +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -101,6 +101,10 @@ per site.
|
|
|
101
101
|
snapshots (`users`; `users` + `skus` for licences; `groups`; `groups` + `channels` for entries, exits
|
|
102
102
|
and new owners; `roles`; `applications`): one of them not read on either side makes that change
|
|
103
103
|
*NOT compared* — with the reason — never a list of accounts, groups or admins "created" or "deleted".
|
|
104
|
+
Only exception, `channels`: without it (typically `ChannelMember.Read.All` missing) the entries, exits
|
|
105
|
+
and new owners of groups and teams are still compared; the private/shared channels are left out,
|
|
106
|
+
named (as read in the other snapshot), and the change is *⚠ partial*. Without `groups` they stay
|
|
107
|
+
*NOT compared*.
|
|
104
108
|
A truncated list (10 000 accounts, 2 000 groups, 2 000 role assignments, 300 applications) creates or
|
|
105
109
|
deletes nothing for the objects present on one side only, and the change is *⚠ partial*; a group or
|
|
106
110
|
private channel whose members were cut is left out of entries and exits and named; delegated consents
|
|
@@ -648,6 +652,7 @@ taken without the exchange feature is compared as *not evaluated*, never as "rig
|
|
|
648
652
|
| `⚠ Permission list truncated (server page budget)` / `⚠ truncated` | Pagination budget (20 pages) reached | That right is partial |
|
|
649
653
|
| Review: *not evaluated — section(s) mailboxAccess failed / not configured*, or *⚠ partial — …* | Section not read, or read in part | The signal / change is not concluded |
|
|
650
654
|
| Changes: *NOT compared — previous snapshot: section users failed (…)* | That section was not read in one of the two reviews | Nothing is known of those changes — never report deletions or creations; compare with another snapshot |
|
|
655
|
+
| Changes: *⚠ partial — private/shared channels NOT compared — … section channels failed (…); N channel(s) left out, as read in the … snapshot: …* | Channel members not read in one of the two reviews (`ChannelMember.Read.All`) | The group and team entries, exits and new owners listed are real; nothing is known of the named channels |
|
|
651
656
|
|
|
652
657
|
### Limits (stated in every answer)
|
|
653
658
|
|
|
@@ -871,6 +876,13 @@ snapshot, signals and comparison end to end.
|
|
|
871
876
|
|
|
872
877
|
## Validation status
|
|
873
878
|
|
|
879
|
+
- 0.6.2 (#153, decision of the reviewer): `channels` not read in one of the two snapshots no longer
|
|
880
|
+
leaves the entries, exits and new owners *NOT compared*: the groups and teams are still compared, the
|
|
881
|
+
private/shared channels are left out, named, and the change is *⚠ partial* — never a channel member
|
|
882
|
+
"joined" or "left". `groups` not read keeps them *NOT compared*. Unit tests on fixtures (channels
|
|
883
|
+
failed on either side and on both, groups not read, end to end through the tool). **No Microsoft
|
|
884
|
+
call was made.**
|
|
885
|
+
|
|
874
886
|
- 0.6.1 (#153): `m365_access_review_snapshot` with `compareWith` no longer turns a section not read
|
|
875
887
|
(failed, not configured, absent from an older snapshot) or truncated into accounts, groups, admin
|
|
876
888
|
roles, members or applications created or deleted, nor a missing `skus` into licence changes (SKU
|
package/dist/review/model.js
CHANGED
|
@@ -102,6 +102,18 @@ export const DIFF_DEPENDS = {
|
|
|
102
102
|
apps_new: ["applications"],
|
|
103
103
|
app_consents_new: ["applications"],
|
|
104
104
|
};
|
|
105
|
+
/**
|
|
106
|
+
* Among DIFF_DEPENDS, the sections that hold only PART of an entry. One not read on either side leaves that
|
|
107
|
+
* part out — named, the entry "partial" — instead of making the whole entry "not evaluated": without
|
|
108
|
+
* ChannelMember.Read.All the groups and teams are still read, and their entries and exits still compared.
|
|
109
|
+
* The others are needed whole: no group list means no team, hence no channel (collect.ts), and licences
|
|
110
|
+
* without skus are GUIDs on one side. (Delegated consents, read apart, are already left out the same way.)
|
|
111
|
+
*/
|
|
112
|
+
export const DIFF_PARTIAL_DEPENDS = {
|
|
113
|
+
members_joined: ["channels"],
|
|
114
|
+
members_left: ["channels"],
|
|
115
|
+
owners_new: ["channels"],
|
|
116
|
+
};
|
|
105
117
|
const LIST_NOUN = { users: "account", groups: "group", channels: "private/shared channel", roles: "admin role assignment", applications: "application" };
|
|
106
118
|
/** Why a snapshot's sections cannot be compared (failed, not configured, absent), or undefined when all were read. */
|
|
107
119
|
function sectionsUnread(s, which, deps) {
|
|
@@ -119,9 +131,11 @@ function sectionsUnread(s, which, deps) {
|
|
|
119
131
|
}
|
|
120
132
|
/**
|
|
121
133
|
* What changed between two snapshots. A section not read in either snapshot is never turned into
|
|
122
|
-
* creations or deletions: every entry depending on it (DIFF_DEPENDS) is "not evaluated", with the reason
|
|
123
|
-
*
|
|
124
|
-
* entry is "partial"
|
|
134
|
+
* creations or deletions: every entry depending on it (DIFF_DEPENDS) is "not evaluated", with the reason —
|
|
135
|
+
* unless it holds only part of that entry (DIFF_PARTIAL_DEPENDS): that part is left out, named, and the
|
|
136
|
+
* entry is "partial". A truncated list proves nothing about the objects present on one side only: they are
|
|
137
|
+
* left out and the entry is "partial"; a group or channel whose members were cut is left out of entries and
|
|
138
|
+
* exits, and named.
|
|
125
139
|
*/
|
|
126
140
|
export function diff(prev, cur) {
|
|
127
141
|
const users = new Map([...prev.users, ...cur.users].map((u) => [u.id, u]));
|
|
@@ -135,15 +149,24 @@ export function diff(prev, cur) {
|
|
|
135
149
|
/** Snapshots in which a section's list was cut at its cap. */
|
|
136
150
|
const cutIn = (n) => [prev.sections?.[n]?.truncated ? "previous" : "", cur.sections?.[n]?.truncated ? "current" : ""].filter(Boolean);
|
|
137
151
|
const listCut = (n) => cutIn(n).length > 0;
|
|
152
|
+
/** Why sections were not read, in either snapshot ("" when read in both). */
|
|
153
|
+
const unreadIn = (deps) => [sectionsUnread(prev, "previous", deps), sectionsUnread(cur, "current", deps)].filter(Boolean).join("; ");
|
|
138
154
|
const push = (code, title, compute) => {
|
|
139
155
|
const deps = DIFF_DEPENDS[code];
|
|
140
|
-
const
|
|
156
|
+
const partOnly = DIFF_PARTIAL_DEPENDS[code] ?? [];
|
|
157
|
+
const why = unreadIn(deps.filter((n) => !partOnly.includes(n)));
|
|
141
158
|
if (why)
|
|
142
159
|
return void out.push({ code, title, items: [], notEvaluated: why });
|
|
160
|
+
// a section holding only part of the entry, not read: that part is left out by compute() and said here
|
|
161
|
+
const leftOut = partOnly.flatMap((n) => {
|
|
162
|
+
const w = unreadIn([n]);
|
|
163
|
+
return w ? [`${LIST_NOUN[n] ?? n}s NOT compared — ${w}`] : [];
|
|
164
|
+
});
|
|
143
165
|
const r = compute();
|
|
144
166
|
const { items, partial = [] } = Array.isArray(r) ? { items: r } : r;
|
|
145
|
-
const
|
|
146
|
-
const
|
|
167
|
+
const read = deps.filter((n) => !unreadIn([n]));
|
|
168
|
+
const cut = read.flatMap((n) => (listCut(n) ? [`${LIST_NOUN[n] ?? n} list truncated in the ${cutIn(n).join(" and ")} snapshot — nothing beyond the cap is compared`] : []));
|
|
169
|
+
const text = [...leftOut, ...cut, ...partial].join("; ");
|
|
147
170
|
out.push({ code, title, items, ...(text ? { partial: text } : {}) });
|
|
148
171
|
};
|
|
149
172
|
/** Objects of one snapshot absent from the other — created or deleted, unless that list was truncated: then absence proves nothing. */
|
|
@@ -196,13 +219,28 @@ export function diff(prev, cur) {
|
|
|
196
219
|
for (const o of setDiff(p.owners, g.owners))
|
|
197
220
|
ownersGone.push(`${label(o)} no longer owns ${name}`);
|
|
198
221
|
}
|
|
222
|
+
const named = (xs) => `${xs.slice(0, 5).join(", ")}${xs.length > 5 ? `, … (${xs.length - 5} more)` : ""}`;
|
|
223
|
+
const channelName = (c) => `${c.teamName ?? c.teamId} › ${c.displayName} (${c.membershipType} channel)`;
|
|
224
|
+
// channels not read in one snapshot or both: left out of entries, exits and new owners (push says why), the ones
|
|
225
|
+
// read on the other side named — the groups and teams above are still compared
|
|
226
|
+
const channelsUnread = Boolean(unreadIn(["channels"]));
|
|
227
|
+
const channelsLeftOut = [];
|
|
228
|
+
if (channelsUnread) {
|
|
229
|
+
const readOn = ["previous", "current"].filter((w) => (w === "previous" ? prev : cur).sections?.channels?.ok);
|
|
230
|
+
if (!readOn.length)
|
|
231
|
+
channelsLeftOut.push("channels read in neither snapshot: which ones are left out is unknown");
|
|
232
|
+
for (const w of readOn) {
|
|
233
|
+
const known = (w === "previous" ? prev : cur).channels;
|
|
234
|
+
channelsLeftOut.push(known.length ? `${known.length} channel(s) left out, as read in the ${w} snapshot: ${named(known.map(channelName))}` : `the ${w} snapshot read no private/shared channel`);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
199
237
|
// a channel missing from the previous snapshot is new (all its members are entries) — unless a list was cut
|
|
200
238
|
const channelListCut = listCut("channels") || listCut("groups");
|
|
201
239
|
let newChannelsSkipped = 0;
|
|
202
240
|
const pc = new Map(prev.channels.map((c) => [c.channelId, c]));
|
|
203
|
-
for (const c of cur.channels) {
|
|
241
|
+
for (const c of channelsUnread ? [] : cur.channels) {
|
|
204
242
|
const p = pc.get(c.channelId);
|
|
205
|
-
const name =
|
|
243
|
+
const name = channelName(c);
|
|
206
244
|
if (!p && channelListCut) {
|
|
207
245
|
newChannelsSkipped++;
|
|
208
246
|
continue;
|
|
@@ -219,15 +257,15 @@ export function diff(prev, cur) {
|
|
|
219
257
|
for (const o of setDiff(c.owners, p?.owners ?? []))
|
|
220
258
|
ownersNew.push(`${label(o)} owns ${name}`);
|
|
221
259
|
}
|
|
222
|
-
const named = (xs) => `${xs.slice(0, 5).join(", ")}${xs.length > 5 ? `, … (${xs.length - 5} more)` : ""}`;
|
|
223
260
|
const groupNotes = cutGroups.length ? [`members or owners truncated in ${cutGroups.length} group(s), not compared: ${named(cutGroups)}`] : [];
|
|
224
261
|
const channelNotes = [
|
|
225
262
|
cutChannels.length ? `members truncated in ${cutChannels.length} channel(s), not compared: ${named(cutChannels)}` : "",
|
|
226
263
|
newChannelsSkipped ? `${newChannelsSkipped} private/shared channel(s) present only in the current snapshot not compared` : "",
|
|
227
264
|
].filter(Boolean);
|
|
228
|
-
|
|
229
|
-
push("
|
|
230
|
-
push("
|
|
265
|
+
const memberNotes = [...channelsLeftOut, ...groupNotes, ...channelNotes];
|
|
266
|
+
push("members_joined", "Entries in groups, teams and private/shared channels", () => ({ items: joined, partial: memberNotes }));
|
|
267
|
+
push("members_left", "Exits from groups, teams and private/shared channels", () => ({ items: left, partial: memberNotes }));
|
|
268
|
+
push("owners_new", "New owners", () => ({ items: ownersNew, partial: memberNotes }));
|
|
231
269
|
push("owners_removed", "Owners removed", () => ({ items: ownersGone, partial: groupNotes }));
|
|
232
270
|
const roleKey = (r) => `${r.roleId}|${r.principalId}|${r.scope}`;
|
|
233
271
|
const pr = new Set(prev.roles.map(roleKey));
|
|
@@ -12,7 +12,7 @@ function changesCaveat(changes) {
|
|
|
12
12
|
const partial = changes.filter((c) => !c.notEvaluated && c.partial).length;
|
|
13
13
|
return [
|
|
14
14
|
unread ? `\n⚠ ${unread} of ${changes.length} change lists NOT compared — a section was not read (failed or not configured) in one of the two snapshots: nothing is known of those changes (not "no change", not deleted)` : "",
|
|
15
|
-
partial ? `\n⚠ ${partial} change list(s) compared in part only (truncated lists or data not read): changes may be missing` : "",
|
|
15
|
+
partial ? `\n⚠ ${partial} change list(s) compared in part only (truncated lists, or data not read — e.g. private/shared channels left out of entries, exits and new owners): changes may be missing` : "",
|
|
16
16
|
].join("");
|
|
17
17
|
}
|
|
18
18
|
export const snapshotFileName = (s) => `m365-review-${s.tenantId}-${s.generatedAt.replace(/[:.]/g, "-")}.json`;
|
|
@@ -91,7 +91,7 @@ export function registerAccessReviewTools(server, ctx, serverVersion) {
|
|
|
91
91
|
? `- Shared mailboxes reviewed: ${snap.mailboxAccess.length} (${snap.mailboxAccess.reduce((n, m) => n + m.grants.length, 0)} explicit delegated rights${snap.mailboxAccess.some((m) => m.notEvaluated?.length) ? `; rights NOT evaluated on ${snap.mailboxAccess.filter((m) => m.notEvaluated?.length).length} mailbox(es)` : ""})`
|
|
92
92
|
: `- Shared-mailbox delegations: NOT evaluated (${snap.sections.mailboxAccess?.notConfigured ? "not configured" : "section failed"} — see below)`,
|
|
93
93
|
`- Storage (mailboxes + OneDrive + sites): ${sizeText(storage)}${snap.reportsConcealed ? " — ⚠ report names concealed: storage and mailbox types are not matched to accounts" : ""}`,
|
|
94
|
-
failed.length ? `\n⚠ Sections NOT read (their signals are not evaluated, the changes that
|
|
94
|
+
failed.length ? `\n⚠ Sections NOT read (their signals are not evaluated, the changes that need them are not compared — without channels, group entries, exits and owners are still compared, ⚠ partial):\n${failed.map(([n, s]) => `- ${n}: ${s.error}`).join("\n")}` : "",
|
|
95
95
|
notConfigured.length ? `\nℹ Not covered by this configuration (not evaluated — never "none"):\n${notConfigured.map(([n, s]) => `- ${n}: ${s.error}`).join("\n")}` : "",
|
|
96
96
|
truncated.length ? `\n⚠ Truncated sections (caps reached): ${truncated.join(", ")}` : "",
|
|
97
97
|
Object.entries(snap.sections).filter(([, s]) => s.note).map(([n, s]) => `- note ${n}: ${s.note}`).join("\n"),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aidalinfo/m365-mcp",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.2",
|
|
4
4
|
"description": "Microsoft 365 MCP server over Microsoft Graph — Entra ID users, groups and applications, licences, Teams, SharePoint, usage reports, service health, roles, MFA, audit, access review, shared mailbox delegation (Exchange Online). Read-only by default; full mode uses separate scoped identities with two-step confirmed, audited writes",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|