(by godwin3737) - MCP server with tools to search and get file content from Microsoft 365 including Onedrive and SharePoint. Works with Documents (pdf/docx), Presentations, Spreadsheets and Images.
A Model Context Protocol (MCP) server implementation that provides advanced file search capabilities within Microsoft 365. This server enables efficient file discovery, metadata analysis, and integration with business workflows by making available the content from SharePoint/OneDrive.
https://github.com/user-attachments/assets/bbe63c02-f6d9-4c9b-8f98-36fc22a081cc
The server offers 2 core tools:
search_m365_files
Perform a file search within the M365 environment.
Input:
query
(string): The search term or criteria.get_file_content
Retrieve content from a specific file.
Input:
driveid
(string): The unique identifier of the parent drive.fileid
(string): The unique identifier of the file.To improve performance and reduce redundant API calls, the server caches downloaded files locally. This is particularly useful when working with large documents or frequently accessed files.
./src/mcp_m365_filesearch/.local/downloads
directory (relative to the project root).get_file_content
, the server first checks the cache.This feature ensures faster response times and efficient use of API rate limits.
To integrate the server with Claude Desktop, update your claude_desktop_config.json
:
"mcpServers": {
"M365 File Search (SharePoint/OneDrive)": {
"command": "uv",
"args": [
"--directory",
"full_path_to_parent_directory",
"run",
".\\src\\mcp_m365_filesearch\\server.py"
],
"env": {
"CLIENT_ID": "MSGraph Client ID",
"CLIENT_SECRET": "MS Graph Client Secret",
"TENANT_ID": "TENANT ID",
"REGION": "SEARCH REGION"
}
}
}
To use this server, you'll need to register an application in the Azure Portal:
Sites.Read.All
Files.Read.All
Ensure these values are correctly set in your env
configuration for the MCP server.
This project is licensed under the MIT License.
You are free to use, modify, and distribute it with proper attribution.