Skip to main content
Glama
pnp

CLI for Microsoft 365 MCP Server

by pnp

Microsoft 365 MCP 服务器的 CLI

💡 描述

目前,这是一项正在进行的工作,更多的是 POC,而不是解决方案。

Related MCP server: Microsoft MCP

📦先决条件

  • Node.js 20.x 或更高版本

🚀 如何构建和运行

首先运行npm install来安装所有依赖项。

然后为了构建项目运行:

npm run build

此 MCP 服务器使用全局安装的Microsoft 365 CLI ,您需要使用npm i -g @pnp/cli-microsoft365全局安装。

MCP 服务器不会为您执行任何身份验证。您需要先使用m365 login命令通过 Microsoft 365 的 CLI 进行身份验证。身份验证通过后,MCP 服务器在运行任何工具时都会使用相同的身份验证上下文。

使用检查器运行 MCP

测试 Microsoft 365 MCP 服务器 CLI 的方法之一是使用MCP 检查器。首先使用以下命令启动 MCP 服务器:

npm run start

现在,为了运行 MCP 服务器的检查器,您需要在 repo 根文件夹位置运行以下命令:

npx @modelcontextprotocol/inspector node dist/index.js

之后等待检查器启动并在浏览器中打开它。您应该看到 MCP 服务器正在运行,并且能够查询工具并在本地执行它们。

检查员

在 VS Code 中运行 MCP

您也可以在 VS Code 中从本地构建运行 MCP 服务器,以便 GitHub Copilot Agent 可以使用它。首先使用以下命令启动 Microsoft 365 MCP 服务器的 CLI:

npm run start

现在进入 VS Code GitHub Copilot Agent 模式,点击工具图标,选择Add more tools 。然后选择“ Add MCP server ,再选择Command (stdio) ,并输入以下命令:

node FULL_PATH_TO_YOUR_PROJECT/dist/index.js

点击 Enter 并随意命名。建议将其添加到workspace范围进行测试。之后,打开.vscode/mcp.json文件并修改它,以便传递身份验证所需的环境变量。

{
    "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
            ]
        }
    }
}

点击“开始”,您将看到 358 个新工具添加到您的 GitHub Copilot Agent。快来测试一下吧。为了获得最佳效果,建议使用Claude 3.5 Sonnet作为 AI 模型。

vs 代码

🔗 资源

Available Tools

4 tools
list-addC

Creates list in the specified site

ParametersJSON Schema
NameRequiredDescriptionDefault
titleYesTitle of the list to add.
webUrlYesURL of the site where the list should be added.

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states 'Creates' which implies a write/mutation operation, but doesn't disclose any behavioral traits like permissions needed, whether the operation is idempotent, what happens on failure, or rate limits. This leaves significant gaps for an agent to understand how to use it safely.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise at just 5 words, with no wasted words. It's front-loaded with the core action and resource. Every word earns its place in conveying the essential purpose.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given this is a creation/mutation tool with no annotations and no output schema, the description is insufficiently complete. It doesn't explain what the tool returns, error conditions, or behavioral constraints. For a tool that modifies state, more context is needed for safe and effective use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description adds minimal semantic context beyond the schema. It mentions 'in the specified site' which relates to the webUrl parameter, but doesn't explain what constitutes a valid site URL or provide examples. With 100% schema description coverage, the baseline is 3, and the description doesn't significantly enhance parameter understanding.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Creates') and resource ('list in the specified site'), making the purpose understandable. However, it doesn't distinguish this tool from its siblings (list-get, list-list, list-remove), which would require mentioning it's specifically for creation rather than retrieval or deletion.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites, when not to use it, or reference sibling tools like list-get or list-remove for different operations.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

list-getC

Gets information about the specific list

ParametersJSON Schema
NameRequiredDescriptionDefault
titleYesTitle of the list.
webUrlYesURL of the site where the list is located.
withPermissionsNoSet if you want to return associated roles and permissions of the list.

TDQS

C2.6/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states 'Gets information', suggesting a read-only operation, but doesn't cover critical aspects like authentication requirements, rate limits, error handling, or what specific information is returned (e.g., metadata, content). For a tool with parameters and no output schema, this leaves significant gaps in understanding its behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, clear sentence that directly states the tool's purpose without unnecessary words. It's front-loaded and efficient, though it could be slightly more informative (e.g., by hinting at sibling tools). There's no wasted verbiage, making it appropriately concise for a basic tool.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool has 3 parameters, no annotations, and no output schema, the description is incomplete. It doesn't explain what 'information' is retrieved, how to interpret parameters like 'withPermissions', or any behavioral traits. For a read operation with multiple inputs and no structured output, more context is needed to guide effective use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, fully documenting the three parameters (title, webUrl, withPermissions). The description adds no additional meaning beyond what the schema provides, such as explaining parameter relationships or usage context. With high schema coverage, the baseline score of 3 is appropriate, as the description doesn't compensate but also doesn't detract.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states the tool 'Gets information about the specific list', which clearly indicates a read operation on a list resource. However, it doesn't differentiate from sibling tools like 'list-list' (likely for listing multiple lists) or 'list-add'/'list-remove' (for modifications), leaving the specific scope ambiguous. The purpose is understandable but lacks sibling distinction.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No explicit guidance is provided on when to use this tool versus alternatives. The description implies it's for retrieving details of a specific list, but it doesn't clarify prerequisites (e.g., needing the list's title and webUrl), contrast with 'list-list' for broader queries, or mention any constraints. Usage is implied from the purpose but without actionable advice.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

list-listC

Gets all lists within the specified site

ParametersJSON Schema
NameRequiredDescriptionDefault
webUrlYesURL of the site where the lists to retrieve are located.

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It states it 'Gets all lists' but doesn't mention whether this is a read-only operation, if it requires specific permissions, what format the output takes, or if there are rate limits. This leaves significant gaps for a tool that presumably returns multiple items.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, clear sentence with no wasted words. It's appropriately sized for a simple tool and front-loads the essential information, making it highly efficient.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the lack of annotations and output schema, the description is incomplete. It doesn't explain what 'all lists' means in practice (e.g., pagination, filtering, or return format), which is crucial for a retrieval tool. The simplicity of the tool doesn't excuse these omissions.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 100%, with the single parameter 'webUrl' well-documented in the schema. The description adds no additional parameter semantics beyond what's already in the schema, so it meets the baseline for adequate but unremarkable coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Gets') and resource ('all lists within the specified site'), making the tool's purpose understandable. However, it doesn't explicitly differentiate from sibling tools like list-get (which presumably retrieves a single list), so it doesn't reach the highest score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like list-get or list-add. It mentions the site scope but doesn't explain why one would choose this over other list-related tools, leaving the agent without contextual usage instructions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

list-removeC

Removes the specified list

ParametersJSON Schema
NameRequiredDescriptionDefault
titleYesTitle of the list to remove.
webUrlYesURL of the site where the list to remove is located.

TDQS

C2.7/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries full burden but only states 'removes' without detailing behavioral traits. It doesn't disclose if this is destructive, requires permissions, has side effects, or what happens on success/failure, which is inadequate for a mutation tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, clear sentence with no wasted words, making it highly concise and front-loaded. It efficiently conveys the core action without unnecessary elaboration.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a destructive tool with no annotations and no output schema, the description is incomplete. It lacks details on behavior, return values, error handling, or context compared to siblings, failing to compensate for the missing structured information.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, with descriptions for 'title' and 'webUrl' parameters. The tool description adds no additional meaning beyond the schema, such as format examples or constraints, so it meets the baseline but doesn't enhance understanding.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states the action ('removes') and resource ('the specified list'), which clarifies the tool's basic purpose. However, it's vague about what 'removes' entails (e.g., deletion, archiving) and doesn't differentiate from siblings like 'list-add' or 'list-get' beyond the verb, missing specificity about scope or effects.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives. It doesn't mention prerequisites, exclusions, or compare to sibling tools like 'list-list' for listing or 'list-get' for retrieval, leaving the agent without context for selection.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 4 tool updatesv1.0.0
    • First observedlist-add
    • First observedlist-get
    • First observedlist-list
    • First observedlist-remove

TDQS

B3.4/5.0

Scored across 4 tools

Disambiguation5/5

Each tool has a clearly distinct purpose targeting different CRUD operations on lists: create, retrieve specific, retrieve all, and delete. The descriptions explicitly differentiate them with no overlap or ambiguity.

Naming Consistency5/5

All tools follow a perfect and consistent 'list-verb' pattern (list-add, list-get, list-list, list-remove) using hyphens and clear action verbs. This makes the naming highly predictable and readable.

Tool Count5/5

With 4 tools, this server is well-scoped for managing lists in Microsoft 365 sites. Each tool earns its place by covering essential CRUD operations without bloat or missing core functionality.

Completeness5/5

The tool set provides complete CRUD/lifecycle coverage for lists: create (list-add), read specific (list-get), read all (list-list), and delete (list-remove). There are no obvious gaps for this focused domain.

Maintenance

ActivityMaintained
ResponsivenessWithin a week

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    Lokka ia an MCP server for the Microsoft Graph API and can be used to query and update all resources in your Microsoft 365 tenant. This MCP server supports all Microsoft Graph APIs including update operations (limited by the permissions you grant to the app).
    296
    MIT
  • F
    license
    C
    quality
    D
    maintenance
    A powerful MCP server that enables AI assistants to interact with Microsoft Graph API for managing Outlook emails, Calendar events, OneDrive files, and Contacts through natural language commands.
    35
    56
    -
  • A
    license
    Not graded
    quality
    B
    maintenance
    A production-ready MCP server that provides secure, delegated access to Microsoft 365 services including Email, SharePoint, OneDrive, and Calendar. It enables AI models to search messages, browse files, manage calendar events, and parse document contents using OAuth 2.1 authentication.
    MIT
  • A
    license
    C
    quality
    Not graded
    maintenance
    An MCP server that enables interaction with Microsoft 365 services like Outlook, OneDrive, Teams, and SharePoint via the Microsoft Graph API. It supports comprehensive operations including email management, file access, and organizational collaboration for personal and work accounts.
    78
    -