Sponsored by Deepsite.site

MCP Server - Microsoft 365 File Search (SharePoint & OneDrive)

Created By
godwin37378 months ago
Content

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

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/downloads directory (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:

  1. Register a new application.
  2. Note down the Client ID and Tenant ID.
  3. Create a Client Secret under Certificates & Secrets.
  4. Under API permissions, add the following delegated or application permissions:
    • Sites.Read.All
    • Files.Read.All
  5. 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.

Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题; Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
Playwright McpPlaywright MCP server
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
DeepChatYour AI Partner on Desktop
Serper MCP ServerA Serper MCP Server
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
ChatWiseThe second fastest AI chatbot™
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
TimeA Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.
Amap Maps高德地图官方 MCP Server
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
Tavily Mcp
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
Context7Context7 MCP Server -- Up-to-date code documentation for LLMs and AI code editors
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
WindsurfThe new purpose-built IDE to harness magic
CursorThe AI Code Editor
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code