Microsoft 365 File Search MCP Server
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Microsoft 365 File Search MCP Server find files containing project plan"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MCP Server - Microsoft 365 File Search (SharePoint & OneDrive)
Overview
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
Related MCP server: SharePoint MCP Server
Components
Tools
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.
Returns: Array of file metadata objects. Metadata includes the file content summary, drive ID, and file ID, among other details.
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.
Returns: File content as a binary stream.
Note: Uses a local cache to speed up repeat access.
Caching
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.
Cached files are stored in the
./src/mcp_m365_filesearch/.local/downloadsdirectory (relative to the project root).When a file is requested via
get_file_content, the server first checks the cache.If the file is already cached, it is returned directly from disk without a new API call.
This feature ensures faster response times and efficient use of API rate limits.
Usage with Claude Desktop
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"
}
}
}Microsoft Graph App Registration
To use this server, you'll need to register an application in the Azure Portal:
Register a new application.
Note down the Client ID and Tenant ID.
Create a Client Secret under Certificates & Secrets.
Under API permissions, add the following delegated or application permissions:
Sites.Read.AllFiles.Read.All
Click Grant admin consent for these permissions.
Ensure these values are correctly set in your env configuration for the MCP server.
License
This project is licensed under the MIT License.
You are free to use, modify, and distribute it with proper attribution.
Available Tools
2 toolsget_file_contentC
Get content of Microsoft 365 file by drive id and file id.
Inputs: fileid (required), driveid (required).
search_m365_filesC
Search Microsoft 365 files by query and file type. If you need content of a file, you can make use of resource microsoft365://{driveid}/{fileid}
Inputs: query (required), file_type, max_results.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 2 tools
search_m365_files locates files via query and type, while get_file_content retrieves a specific file's content using drive and file IDs. One is discovery and the other is retrieval, so there is no overlap.
Both tool names follow a consistent verb_noun snake_case pattern: search + m365_files and get + file_content. This makes their purposes predictable and consistent.
Two tools is minimal, but it fits the server's search-focused purpose: discover files and fetch their content. It is slightly below the typical well-scoped range, but each tool earns its place.
The core workflow is covered: search returns resource identifiers that get_file_content can consume. There is no browse/list/metadata-only operation, but this is a minor gap for a search-oriented server.
Maintenance
Related MCP Connectors
Find, read and reorganize files across Google Drive, OneDrive, SharePoint and Dropbox, with undo.
Read and search folders on your own computer with explicit consent. Files are never uploaded.
Securely search and manage workspace context files for AI agents and teams.
Permissioned access to Outlook, OneDrive and Teams via the user's own Microsoft account
Related MCP Servers
- AlicenseDqualityDmaintenanceProvides access to organizational Sharepoint documents through the Microsoft Graph API, enabling search and retrieval of Sharepoint content for AI assistants.115 npm21ISC
- AlicenseNot gradedqualityDmaintenanceEnables interaction with Microsoft SharePoint sites, document libraries, and files through the Microsoft Graph API. Supports browsing, searching, uploading/downloading files, managing lists, and creating sharing links with secure OAuth authentication.3MIT
- AlicenseNot gradedqualityDmaintenanceEnables browsing and interacting with Microsoft SharePoint sites and documents through Microsoft Graph API, supporting file search, site listing, document library browsing, and file content retrieval with OAuth2 authentication.56 npm11MIT
- FlicenseNot gradedqualityNot gradedmaintenanceProvides unified access to OneDrive and SharePoint through Microsoft Graph API, enabling file operations, SharePoint list management, Excel integration, and content search across personal and business Microsoft accounts.-