M365 Copilot MCP Server

M365 Copilot MCP Server

Integrates with Microsoft 365 Copilot APIs to enable retrieval of content from SharePoint and OneDrive, document search across M365, and conversational AI interactions with your Microsoft 365 data while respecting access permissions.

Category
访问服务器

README

Microsoft 365 Copilot MCP Server

CI npm version License: MIT

Note: This is an unofficial MCP server, but developed by Microsoft engineers, integrating the latest Microsoft 365 Copilot APIs. We welcome your feedback and contributions!

Connect your AI assistant to Microsoft 365 through the Model Context Protocol (MCP). This server enables AI tools to access your SharePoint documents, OneDrive files, emails, Teams conversations, and more - all while respecting your organization's access controls.

Overview

The m365-copilot-mcp server provides three powerful capabilities for AI assistants:

Capability Purpose Use Cases
📄 Retrieval Extract relevant text content from your M365 data Answer questions using information from your documents, emails, and conversations
🔍 Search Find specific documents and files Locate files, discover relevant content across your M365 environment
💬 Chat Conversational AI powered by M365 Copilot Ask about your schedule, get summaries, interact with time-aware queries

Learn more: These capabilities are built on the official Microsoft 365 Copilot APIs.

Prerequisites

  • Node.js 20+ - Runtime environment
  • Microsoft 365 account - With Microsoft 365 Copilot license
  • MCP-compatible AI tool - Such as Claude Code, GitHub Copilot, or any other MCP client

Configuration

Configure the MCP server in your AI tool's settings. The server uses npx to run directly from npm without requiring global installation.

Claude Code

Add the server using the Claude Code CLI:

macOS/Linux:

claude mcp add --transport stdio m365-copilot -- npx -y m365-copilot-mcp

Windows:

claude mcp add --transport stdio m365-copilot -- cmd /c "npx -y m365-copilot-mcp"

The -y flag automatically accepts prompts, and npx will download and run the latest version of the package.

GitHub Copilot (VS Code)

Create a .vscode/mcp.json file in your project root, or add to your VS Code user settings:

Option 1: Project-level configuration (.vscode/mcp.json):

{
  "servers": {
    "m365-copilot": {
      "command": "npx",
      "args": ["-y", "m365-copilot-mcp"]
    }
  }
}

Option 2: User-level configuration (VS Code settings.json):

{
  "mcp.servers": {
    "m365-copilot": {
      "command": "npx",
      "args": ["-y", "m365-copilot-mcp"]
    }
  }
}

Requirements: VS Code 1.99+ with GitHub Copilot extension installed.

Other MCP Clients

For other MCP-compatible tools, use the following command with npx:

npx -y m365-copilot-mcp

Refer to your specific AI tool's documentation for MCP server configuration instructions.

Authentication

On first use, the server will automatically open your browser for Microsoft 365 authentication. After signing in once, your credentials are securely cached locally - no need to sign in again.

Security & Privacy

Your data is safe. The MCP server:

  • ✅ Only reads data through official Microsoft Graph APIs
  • ✅ Respects your organization's access controls and permissions
  • ✅ Stores authentication tokens locally on your machine (encrypted)
  • ✅ Does NOT store, collect, or transmit any of your M365 content
  • ✅ Makes direct API calls to Microsoft - no third-party servers involved

Using Your Own Azure AD App (Optional)

If you have security concerns or organizational requirements, you can use your own Azure AD application instead of the built-in one. However, this is completely optional - the default configuration is secure and sufficient for most users.

To use a custom Azure AD app, provide environment variables during configuration:

Claude Code

macOS/Linux:

claude mcp add --transport stdio m365-copilot \
  --env AZURE_CLIENT_ID=your-client-id \
  --env AZURE_TENANT_ID=your-tenant-id \
  -- npx -y m365-copilot-mcp

Windows:

claude mcp add --transport stdio m365-copilot --env AZURE_CLIENT_ID=your-client-id --env AZURE_TENANT_ID=your-tenant-id -- cmd /c "npx -y m365-copilot-mcp"

GitHub Copilot (VS Code)

Add environment variables to your configuration:

{
  "servers": {
    "m365-copilot": {
      "command": "npx",
      "args": ["-y", "m365-copilot-mcp"],
      "env": {
        "AZURE_CLIENT_ID": "your-client-id",
        "AZURE_TENANT_ID": "your-tenant-id"
      }
    }
  }
}

Required Microsoft Graph API Permissions:

  • Sites.Read.All
  • Files.Read.All
  • Mail.Read
  • Chat.Read
  • ChannelMessage.Read.All
  • OnlineMeetingTranscript.Read.All
  • People.Read.All
  • ExternalItem.Read.All

Available Tools

Your AI assistant can now use these three tools to interact with your M365 content:

1. m365copilotretrieval

Retrieves relevant text excerpts from your SharePoint and OneDrive content to answer questions.

Best for:

  • Answering questions based on your documents
  • Finding information buried in your content
  • Grounding AI responses in your actual data

Example prompts:

  • "What are the Q4 project deadlines mentioned in my documents?"
  • "Summarize the team's decision about the new feature"
  • "What does our company policy say about remote work?"

2. m365copilotsearch

Searches across your M365 environment to find specific documents and files.

Best for:

  • Locating specific documents
  • Getting document links to open or share
  • Discovering relevant files across SharePoint and OneDrive

Example prompts:

  • "Find the VPN setup guide"
  • "Search for the Q4 budget spreadsheet"
  • "Locate documents about network security policies"

3. m365copilotchat

Enables conversational interactions with Microsoft 365 Copilot, with awareness of your calendar, tasks, and content.

Best for:

  • Asking about your schedule and meetings
  • Getting summaries of recent activities
  • Time-aware queries that need context

Example prompts:

  • "What meetings do I have tomorrow?"
  • "Summarize recent discussions about the product launch"
  • "What are my action items for this week?"

Note: This tool requires your timezone in IANA format (e.g., "America/New_York", "Europe/London", "Asia/Shanghai").

How It Works

┌─────────────────┐
│   AI Assistant  │
│ (Claude, etc.)  │
└────────┬────────┘
         │
         │ MCP Protocol
         ▼
┌─────────────────┐
│ m365-copilot-mcp│
│     Server      │
└────────┬────────┘
         │
         │ Microsoft Graph API
         ▼
┌─────────────────┐
│  Microsoft 365  │
│   (Your Data)   │
└─────────────────┘

The MCP server acts as a secure bridge between your AI assistant and Microsoft 365, using official Microsoft APIs to access your data based on your permissions.

Troubleshooting

Authentication Issues

Problem: Browser doesn't open for login Solution: Manually authenticate by setting AZURE_CLIENT_ID in your environment

Problem: "Permission denied" errors Solution: Ensure your Microsoft 365 account has access to the requested resources

Connection Issues

Problem: AI assistant can't find the MCP server Solution:

  • Verify installation: npm list -g m365-copilot-mcp
  • Check that Node.js 20+ is installed: node --version
  • Restart your AI assistant

Tool Not Working

Problem: Chat tool fails with timezone error Solution: Ensure you provide timezone in IANA format (e.g., "America/New_York")

Problem: No results returned Solution: Verify you have access to M365 content and are signed in to the correct account

Supported Platforms

  • ✅ Windows 10/11
  • ✅ macOS 10.15+
  • ✅ Linux (Ubuntu 20.04+, other distributions)

Feedback & Support

This project is actively maintained. We welcome your feedback and contributions!

License

MIT License - see LICENSE file for details.


Developed by Microsoft engineers | Powered by Microsoft 365 Copilot APIs

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选