@leonardocrdso/office365-mcp-server 1.1.0 → 1.1.1
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/build/index.js +51 -8
- package/package.json +1 -1
package/build/index.js
CHANGED
|
@@ -23558,7 +23558,7 @@ class StdioServerTransport {
|
|
|
23558
23558
|
// package.json
|
|
23559
23559
|
var package_default = {
|
|
23560
23560
|
name: "@leonardocrdso/office365-mcp-server",
|
|
23561
|
-
version: "1.1.
|
|
23561
|
+
version: "1.1.1",
|
|
23562
23562
|
description: "MCP server for Microsoft 365 — Outlook, Calendar, OneDrive, SharePoint & Teams via Graph API",
|
|
23563
23563
|
type: "module",
|
|
23564
23564
|
main: "build/index.js",
|
|
@@ -33066,17 +33066,60 @@ ${formatted.join(`
|
|
|
33066
33066
|
|
|
33067
33067
|
`)}`;
|
|
33068
33068
|
}
|
|
33069
|
+
function getResourceTypeName(odataType) {
|
|
33070
|
+
if (!odataType)
|
|
33071
|
+
return "item";
|
|
33072
|
+
if (odataType.includes("driveItem"))
|
|
33073
|
+
return "driveItem";
|
|
33074
|
+
if (odataType.includes("site"))
|
|
33075
|
+
return "site";
|
|
33076
|
+
if (odataType.includes("listItem"))
|
|
33077
|
+
return "listItem";
|
|
33078
|
+
return "item";
|
|
33079
|
+
}
|
|
33080
|
+
function stripHtmlHighlights(text) {
|
|
33081
|
+
return text.replace(/<c0>/g, "").replace(/<\/c0>/g, "").replace(/<ddd\/>/g, "…");
|
|
33082
|
+
}
|
|
33083
|
+
function formatHit(hit) {
|
|
33084
|
+
const resource = hit.resource;
|
|
33085
|
+
const typeName = getResourceTypeName(resource?.["@odata.type"]);
|
|
33086
|
+
const name3 = resource?.name ?? resource?.displayName ?? "Sem nome";
|
|
33087
|
+
const summary = hit.summary ? stripHtmlHighlights(hit.summary) : "N/A";
|
|
33088
|
+
const url = resource?.webUrl ?? "N/A";
|
|
33089
|
+
const lines = [
|
|
33090
|
+
`- **${name3}** [${typeName}]`,
|
|
33091
|
+
` Resumo: ${summary}`,
|
|
33092
|
+
` URL: ${url}`
|
|
33093
|
+
];
|
|
33094
|
+
if (typeName === "driveItem") {
|
|
33095
|
+
const driveId = resource?.parentReference?.driveId;
|
|
33096
|
+
const itemId = hit.hitId;
|
|
33097
|
+
if (driveId) {
|
|
33098
|
+
lines.push(` **driveId:** ${driveId}`);
|
|
33099
|
+
lines.push(` **itemId:** ${itemId}`);
|
|
33100
|
+
lines.push(` _Use driveId + itemId com read-shared-file-content para ler este arquivo._`);
|
|
33101
|
+
}
|
|
33102
|
+
} else if (typeName === "site") {
|
|
33103
|
+
const siteId = resource?.id;
|
|
33104
|
+
if (siteId) {
|
|
33105
|
+
lines.push(` **siteId:** ${siteId}`);
|
|
33106
|
+
lines.push(` _Use siteId com get-site ou list-document-libraries._`);
|
|
33107
|
+
}
|
|
33108
|
+
} else if (typeName === "listItem") {
|
|
33109
|
+
const siteId = resource?.parentReference?.siteId;
|
|
33110
|
+
if (siteId) {
|
|
33111
|
+
lines.push(` **siteId:** ${siteId}`);
|
|
33112
|
+
}
|
|
33113
|
+
}
|
|
33114
|
+
return lines.join(`
|
|
33115
|
+
`);
|
|
33116
|
+
}
|
|
33069
33117
|
function formatSearchResults(query, results) {
|
|
33070
33118
|
if (!results?.length || !results[0]?.hitsContainers?.length) {
|
|
33071
33119
|
return `Nenhum resultado encontrado para "${query}".`;
|
|
33072
33120
|
}
|
|
33073
33121
|
const hits = results[0].hitsContainers[0].hits ?? [];
|
|
33074
|
-
const formatted = hits.map(
|
|
33075
|
-
const resource = hit.resource;
|
|
33076
|
-
return `- **${resource?.name ?? "Sem nome"}** (${hit.hitId})
|
|
33077
|
-
Resumo: ${hit.summary ?? "N/A"}
|
|
33078
|
-
URL: ${resource?.webUrl ?? "N/A"}`;
|
|
33079
|
-
});
|
|
33122
|
+
const formatted = hits.map(formatHit);
|
|
33080
33123
|
return `## Resultados SharePoint "${query}" (${formatted.length})
|
|
33081
33124
|
|
|
33082
33125
|
${formatted.join(`
|
|
@@ -33120,7 +33163,7 @@ function registerSharePointTools(server, sharepoint) {
|
|
|
33120
33163
|
content: [{ type: "text", text: formatLibraryItems(items) }]
|
|
33121
33164
|
};
|
|
33122
33165
|
}));
|
|
33123
|
-
server.tool("search-sharepoint", "Busca conteúdo no SharePoint (documentos, listas, sites).", {
|
|
33166
|
+
server.tool("search-sharepoint", "Busca conteúdo no SharePoint (documentos, listas, sites). Para arquivos (driveItem), retorna driveId e itemId que podem ser usados com read-shared-file-content.", {
|
|
33124
33167
|
query: exports_external.string().describe("Texto para buscar")
|
|
33125
33168
|
}, safeTool(async (params) => {
|
|
33126
33169
|
const results = await sharepoint.searchSharePoint(params.query);
|
package/package.json
CHANGED