Cover image
Try Now
2025-04-06

3 years

Works with Finder

1

Github Watches

0

Github Forks

0

Github Stars

Microsoft 365 MCP Server

💡 Description

Currently this is a work in progress and more POC than a solution. The goal is to create a MCP server that will allow to run any kind of CLI for Microsoft 365 command. The primary aim is to make this MCP server ready to be used in VS Code so that it may be used by GitHub Copilot Agent. In future this MCP server should be distributed as a dedicated VS Code extension or a sub-extensiont to SPFx Toolkit VS Code extension. In far future this MCP server could allow not only to run CLI for Microsoft 365 commands but also have more functionality to support also developing apps for Microsoft 365, like helping out with creating SPFx web parts, extensions or Teams apps or M365 Copilot Agents.

📦 Prerequisites

  • Node.js 20.x or higher

🚀 How to build and run

Before anything first run npm install to install all dependencies.

Then in order to build the project run:

npm run build

In order to test this tool you will need to create a Entra app req and a certificate so that this MCP server can authenticate against Microsoft 365 as an app. In order to create a certificate and the app req with needed scopes and added it to your tenant along with the certificate runt the createApp.ps1 script and follow along the instructions. Most of the things you may leave empty when creating the cert except the password. The password is needed. As the script uses CLI for Microsoft 365 to create the app req and other stuff you will first need to install CLI for Microsoft 365 globally using npm i -g @pnp/cli-microsoft365 and sign in to your tenant as admin. After you executed the script you should see a 'MCP Server Test' app reg on your Entra ID with the needed scopes and certificate. You should also see the certificate file and the exported base64 encoded certificate in the temp folder. YOu will need them later.

Running MCP using the inspector

One of the ways to test the M365 MCP server is using the MCP Inspector. First start the M365 MCP server using the command:

npm run start

Now in order to run the inspector for your MCP server also passing down the needed parameters as environment so that the MCP server may pick them up and use them to authenticate against Microsoft 365 you can run the following command:

npx @modelcontextprotocol/inspector -e CertificatePassword='YOUR_PASSOWRD' -e AppId='ENTRA_APP_REG_ID' -e TenantId='TENANT_ID' -e TenantUrl='TENANT_URL' -e CertificateBase64Encoded='BASE64_ENCODED_VALUE_OF_YOUR_CERT' node dist/index.js

After that wait for the inspector to start and open the inspector in your browser. You should see the MCP server running and you should be able to query the tools and execute them locally.

inspector

Running MCP in VS Code

It is also possible to run the MCP server in VS Code from your local build so that it may be used by GitHub Copilot Agent. As of now this is only supported in VS Code Insiders. First start the M365 MCP server using the command:

npm run start

Now go to VS Code GitHub Copilot Agent mode click on the tools icon and select Add more tools. Then select Add MCP server and then Command (stdio) and enter the following command:

node FULL_PATH_TO_YOUR_PROJECT/dist/index.js

Click enter and name it how ever you like. It is recommended to add it to workspace scope for testing. After that open up your .vscode/mcp.json file and modify it so pass the environment variables needed for auth.

{
    "servers": {
        "m365-mcp-server": {
            "type": "stdio",
            "command": "node",
            "args": [
                "FULL_PATH_TO_YOUR_PROJECT/dist/index.js" // e.g. C:/workspace/repo/microsoft-365-mcp-server/dist/index.js
            ],
            "env": {
                "CertificateBase64Encoded": "BASE64_ENCODED_VALUE_OF_YOUR_CERT",
                "CertificatePassword": "YOUR_PASSOWRD",
                "AppId": "ENTRA_APP_REG_ID",
                "TenantId": "TENANT_ID",
                "TenantUrl": "TENANT_URL" // e.g. https://tenanttocheck.sharepoint.com/
            }
        }
    }
}

Click on start and you should see 4 new tools added to your GitHub Copilot Agent. Test them out.

vs code

🎬 Demo

👉 Movie 🎬

🔗 Resources

相关推荐

  • Joshua Armstrong
  • Confidential guide on numerology and astrology, based of GG33 Public information

  • https://suefel.com
  • Latest advice and best practices for custom GPT development.

  • Alexandru Strujac
  • Efficient thumbnail creator for YouTube videos

  • Emmet Halm
  • Converts Figma frames into front-end code for various mobile frameworks.

  • Elijah Ng Shi Yi
  • Advanced software engineer GPT that excels through nailing the basics.

  • lumpenspace
  • Take an adjectivised noun, and create images making it progressively more adjective!

  • https://maiplestudio.com
  • Find Exhibitors, Speakers and more

  • Yusuf Emre Yeşilyurt
  • I find academic articles and books for research and literature reviews.

  • Carlos Ferrin
  • Encuentra películas y series en plataformas de streaming.

  • https://zenepic.net
  • Embark on a thrilling diplomatic quest across a galaxy on the brink of war. Navigate complex politics and alien cultures to forge peace and avert catastrophe in this immersive interstellar adventure.

  • apappascs
  • 发现市场上最全面,最新的MCP服务器集合。该存储库充当集中式枢纽,提供了广泛的开源和专有MCP服务器目录,并提供功能,文档链接和贡献者。

  • ShrimpingIt
  • MCP系列GPIO Expander的基于Micropython I2C的操作,源自ADAFRUIT_MCP230XX

  • jae-jae
  • MCP服务器使用剧作《无头浏览器》获取网页内容。

  • ravitemer
  • 一个功能强大的Neovim插件,用于管理MCP(模型上下文协议)服务器

  • patruff
  • Ollama和MCP服务器之间的桥梁,使本地LLMS可以使用模型上下文协议工具

  • pontusab
  • 光标与风浪冲浪社区,查找规则和MCP

  • JackKuo666
  • 🔍使AI助手可以通过简单的MCP接口搜索和访问PYPI软件包信息。

  • av
  • 毫不费力地使用一个命令运行LLM后端,API,前端和服务。

  • appcypher
  • 很棒的MCP服务器 - 模型上下文协议服务器的策划列表

    Reviews

    4 (1)
    Avatar
    user_fzEK6ouL
    2025-04-18

    The microsoft-365-mcp-server by Adam-it is an outstanding tool that has significantly streamlined my workflow. Its seamless integration with Microsoft's suite has truly empowered our team's productivity. I highly recommend visiting the GitHub repository for more information and a comprehensive overview of its capabilities. If you're committed to maximizing efficiency in your projects, this server is a must-have. Highly recommended!