Microsoft Docs 标志

Microsoft Docs

组织热门
MicrosoftDocs

Official Microsoft Learn MCP Server and CLI tool – powering LLMs and AI agents with real-time, trusted Microsoft docs & code samples.

发布者MicrosoftDocs
代码仓库mcp
语言TypeScript
复刻数
254
星标数
1.9K
可用工具
3
传输类型streamable-http
分类
许可协议CC-BY-4.0
链接
  • 将工具接入 AI 工作流

    Microsoft Docs 提供 MCP 功能,可供兼容的 AI 客户端和智能体使用。

  • 3 个可用工具

    浏览下方可调用的操作;如果服务器提供了名称和描述,也会一并显示。

  • 可直接复制的配置

    使用安装配置片段,在您首选的 MCP 客户端中配置此服务器。

  • 开源社区热度

    关联的代码仓库有 1.9K 个 Star 和 254 个 Fork。

🌟 Microsoft Learn MCP Server

Install in VS Code Install in VS Code Insiders

Stop AI Hallucinations. Give your AI assistant (Claude, Cursor, Copilot, Codex, ...) direct access to the latest official Microsoft documentation.

✨ Free. One-click install. No key needed.

🎯 Why install this?

Stop relying on outdated training data or risky web searches. Learn MCP server provides secure, direct access to Microsoft official docs.

  • 🧠 Eliminate Hallucinations. Stop your AI from inventing non-existent Azure SDK methods or hallucinating library packages. Get code that actually compiles.

  • 🔌 Plug & Play (No Auth). No API keys, no logins, no sign-ups required. Just one-click install and start coding immediately.

  • 🛡️ 100% Trusted & Safe. Protect your supply chain. Unlike generic web searches that may scrape insecure blogs or malicious sites, this tool only accesses official 1st-party Microsoft documentation.

  • 💸 Completely Free. High search capacity tailored for seamless, heavy coding sessions.

✨ Example Prompts

"Give me the Azure CLI commands to create an Azure Container App with a managed identity."

"Is gpt-5.4 available in Azure EU regions?"

"Are you sure this is the right way to implement IHttpClientFactory in a .NET 8 minimal API?"

"Show me runnable Python code to do harms eval using the Azure AI Foundry evaluation SDK."

🌐 The Microsoft Learn MCP Server Endpoint

The Microsoft Learn MCP Server is accessible to any IDE, agent, or tool that supports the Model Context Protocol (MCP). Any compatible client can connect to the following remote MCP endpoint:

https://learn.microsoft.com/api/mcp

Note: This URL is intended for use within a compliant MCP client via Streamable HTTP, such as the recommended clients listed in our Getting Started section. It does not support direct access from a web browser and may return a 405 Method Not Allowed error if accessed manually. For developers who need to build their own solution, please follow the mandatory guidelines in the Building a Custom Client section to ensure your implementation is resilient and supported.

Standard config works in most clients:

json
{
  "servers": {
    "microsoft-learn": {
      "type": "http",
      "url": "https://learn.microsoft.com/api/mcp"
    }
  }
}

For experimental features, see the Experimental Features section below.

🧪 Experimental Features

The Microsoft Learn MCP Server offers experimental features that are under active development. These features may change or be refined based on user feedback and usage patterns.

OpenAI-Compatible Endpoint

For applications that require OpenAI Deep Research model compatibility, you can use the OpenAI-compatible endpoint:

https://learn.microsoft.com/api/mcp/openai-compatible

This endpoint supports OpenAI Deep Research models and follows the OpenAI MCP specification.

Token Budget Control

To manage token usage and control costs, you can append the maxTokenBudget query parameter to the MCP endpoint URL. This parameter limits the token count in search tool responses by truncating the content to meet your specified budget.

https://learn.microsoft.com/api/mcp?maxTokenBudget=2000

Note: These experimental features are subject to change. We welcome feedback through our GitHub Discussions.

🛠️ Currently Supported Tools

Tool NameDescriptionInput Parameters
microsoft_docs_searchPerforms semantic search against Microsoft official technical documentationquery (string): The search query for retrieval
microsoft_docs_fetchFetch and convert a Microsoft documentation page into markdown formaturl (string): URL of the documentation page to read
microsoft_code_sample_searchSearch for official Microsoft/Azure code snippets and examplesquery (string): Search query for Microsoft/Azure code snippetslanguage (string, optional): Programming language filter.

💻 Microsoft Learn CLI

npm version

The @microsoft/learn-cli package gives you terminal access to the same tools — search docs, fetch pages, and find code samples — without an MCP client.

sh
# Run instantly (no install)
npx @microsoft/learn-cli search "azure functions timeout"

# Or install globally
npm install -g @microsoft/learn-cli
# then use `mslearn`
mslearn search "azure functions timeout"

Installing the npm package alone does not install agent discovery. The CLI can install a CLI-first skill for the same ecosystems supported by this repository's plugins: GitHub Copilot, Claude Code, and Codex.

sh
# User profile (default)
mslearn setup --cli

# Current repository
mslearn setup --cli --project

# Override auto-detection with explicit targets
mslearn setup --cli --copilot
mslearn setup --cli --claude
mslearn setup --cli --codex
mslearn setup --cli --copilot --project
mslearn setup --cli --claude --project
mslearn setup --cli --codex --project

# Multiple agents
mslearn setup --cli --copilot --claude --codex

Remove only managed discovery content with:

sh
mslearn remove --cli
mslearn remove --cli --copilot
mslearn remove --cli --claude --codex --project
AgentUser scopeProject scope
GitHub Copilot~/.copilot/skills/.github/skills/
Claude Code~/.claude/skills/.claude/skills/
Codex~/.agents/skills/.agents/skills/

When no target is specified, setup detects installed agents from their well-known user or project directories. Removal detects only agents with Microsoft Learn CLI-managed discovery artifacts. Explicit targets (--copilot, --claude, or --codex) override detection and can be combined. This workflow does not configure MCP or install agents outside the plugin ecosystems such as Cursor. When both integrations are installed, agents should prefer the Microsoft Learn MCP tools and use the standalone CLI skill only as a fallback.

Pass --json to get structured JSON output, useful for programmatic processing:

sh
mslearn search "azure openai" --json | jq '.results[].title'

See cli/README.md for the full command reference.

🤖 Agent Skills

Agent Skills are portable instruction packages that help AI agents use tools more effectively. We provide three skills that guide agents on when and how to use the Microsoft Learn MCP tools:

SkillPurposeBest For
microsoft-docsUnderstanding concepts, tutorials, architecture, limits"How does X work?", learning, configuration guides
microsoft-code-referenceAPI lookups, code samples, verification, error fixingImplementing code, finding correct methods, troubleshooting
microsoft-skill-creatorMeta-skill that generates custom agent skills for any Microsoft technologyCreating a skill to teach agents about a new Azure library, .NET feature, or other Microsoft tech

Quick Setup

Choose the integration that matches how you want the agent to retrieve Microsoft Learn content:

ModeInstallationAgent behavior
Standalone CLI-firstInstall/run @microsoft/learn-cli, then run mslearn setup --cli [agent-target]Detected or selected agents invoke npx @microsoft/learn-cli@latest; MCP is not configured
Repository plugin, MCP-firstInstall the repository plugin for GitHub Copilot, Claude Code, or CodexThe plugin supplies the Learn MCP endpoint and MCP-oriented skills

The repository plugin also supports Claude Code. Run the following command and restart Claude Code:

/plugin install microsoft-docs@claude-plugins-official

For the MCP-first GitHub Copilot CLI plugin, run:

/plugin install microsoftdocs/mcp

Otherwise:

  1. Install the MCP Server first — See Installation below
  2. Copy the skill folders to your project's .github/skills/ or .claude/skills/ directory:

Supported Agents

Agent Skills work across multiple AI agents:

  • VS Code (Insiders) — enable chat.useAgentSkills setting
  • GitHub Copilot CLI & Copilot coding agent
  • Claude Code, Cursor, OpenAI Codex, and more

Which Skill Do I Need?

If you want to...Install
Cover all Microsoft docs scenariosAll three skills
Focus on coding (APIs, samples, errors)microsoft-code-reference only
Focus on facts & concepts (limits, config, tutorials)microsoft-docs only
Generate a custom skill for a specific Microsoft technologymicrosoft-skill-creator only

🔌 Installation & Getting Started

The Microsoft Learn MCP Server supports quick installation across multiple development environments. Choose your preferred client below for streamlined setup:

ClientOne-click InstallationMCP Guide
VS CodeInstall in VS Code or search "@mcp learn" in Extensions to show "Microsoft Learn" MCPVS Code MCP Official Guide
GitHub Copilot CLI/plugin install microsoftdocs/mcp
Claude DesktopFollow "Add custom connector" instructions in official guide.Claude Desktop Remote MCP Guide
Claude Code/plugin install microsoft-docs@claude-plugins-official (includes MCP server + skills)Claude Code Remote MCP Guide
Visual StudioUpgrade to latest VS 2022 or 2026, "Microsoft Learn" MCP is already built-inVisual Studio MCP Official Guide
Cursor IDEInstall in CursorCursor MCP Official Guide
Codexcodex mcp add "microsoft-learn" --url "https://learn.microsoft.com/api/mcp"Codex MCP documentation
Roo CodeOpen Roo Code Marketplace, search for Microsoft Learn, and click InstallRoo Code MCP Official Guide
ClineManual configuration requiredUse "type": "streamableHttp"Cline MCP Official Guide
Gemini CLIManual configuration required View ConfigNote: Add an mcpServer object to .gemini/settings.json file{ "Microsoft Learn MCP Server": { "httpUrl": "https://learn.microsoft.com/api/mcp" }}How to set up your MCP server
Qwen CodeManual configuration required View ConfigNote: Add an mcpServer object to .qwen/settings.json file{ "Microsoft Learn MCP Server": { "httpUrl": "https://learn.microsoft.com/api/mcp" }}Configure the MCP server in settings.json
GitHubManual configuration required View ConfigNote: Navigate to Settings → Coding agent{ "mslearn": { "type": "http", "url": "https://learn.microsoft.com/api/mcp", "tools": [ "*" ] }}
ChatGPTManual configuration required View Instructions1. Open ChatGPT in the browser2. Go to Settings → Connectors → Advanced settings → Turn Developer mode on3. Go back to connectors and click create4. Give the connector a name, enter URL https://learn.microsoft.com/api/mcp, set authentication to No authentication and trust the application5. Click create ChatGPT Official Guide
WindsurfManual configuration required View Config{ "mcpServers": { "microsoft-learn": { "serverUrl": "https://learn.microsoft.com/api/mcp" } }}Windsurf MCP Guide
KiroView Config{ "microsoft-learn": { "url": "https://learn.microsoft.com/api/mcp" }} Kiro MCP Guide

⚠️ Building a Custom Client

If your use case requires a direct, programmatic integration, it is essential to understand that MCP is a dynamic protocol, not a static API. The available tools and their schemas will evolve.

To build a resilient client that will not break as the service is updated, you should adhere to the following principles:

  1. Discover Tools Dynamically: Your client should fetch current tool definitions from the server at runtime (e.g., using tools/list). Do not hard-code tool names or parameters.
  2. Refresh on Failure: Your client should handle errors during tool/invoke calls. If a tool call fails with an error indicating it is missing or its schema has changed (e.g., an HTTP 404 or 400 error), your client should assume its cache is stale and automatically trigger a refresh by calling tools/list.
  3. Handle Live Updates: Your client should listen for server notifications (e.g., listChanged) and refresh its tool cache accordingly.

❓ Troubleshooting

💻 System Prompt

Even tool-friendly models like Claude Sonnet 4 sometimes fail to call MCP tools by default; use system prompts to encourage usage.

Here's an example of a Cursor rule (a system prompt) that will cause the LLM to utilize microsoft-learn more frequently:

md
## Querying Microsoft Documentation

You have access to MCP tools called `microsoft_docs_search`, `microsoft_docs_fetch`, and `microsoft_code_sample_search` - these tools allow you to search through and fetch Microsoft's latest official documentation and code samples, and that information might be more detailed or newer than what's in your training data set.

When handling questions around how to work with native Microsoft technologies, such as C#, F#, ASP.NET Core, Microsoft.Extensions, NuGet, Entity Framework, the `dotnet` runtime - please use these tools for research purposes when dealing with specific / narrowly defined questions that may occur.

⚠️ Common Issues

IssuePossible Solution
Connection errorsVerify your network connection and that the server URL is correctly entered
No results returnedTry rephrasing your query with more specific technical terms
Tool not appearing in VS CodeRestart VS Code or check that the MCP extension is properly installed
HTTP status 405Method not allowed happens when a browser tries to connect to the endpoint. Try using the MCP Server through VS Code GitHub Copilot or MCP Inspector instead.
MCP server 'Microsoft Learn' marked as unavailable in Visual Studio (Reason: Eclipsed)Visual Studio 2022 (17.13+) ships "Microsoft Learn" as a built-in MCP server at a higher-priority scope. "Eclipsed" means a higher-priority definition already exists and the duplicate lower-priority entry is suppressed. Eclipsing is matched on the server name, so remove any manually added entry with the same name as the built-in server (commonly microsoft-learn or Microsoft Learn) from your ~/.mcp.json or workspace .mcp.json. The built-in server will then become active automatically. No additional configuration is required for Visual Studio users.

🆘 Getting Support

📚 Additional Resources

安装

TypingMind
{
  "mcpServers": {
    "microsoft-docs": {
      "url": "https://learn.microsoft.com/api/mcp"
    }
  }
}

可用工具

  • microsoft_docs_search

    Search official Microsoft/Azure documentation to find the most relevant and trustworthy content for a user's query. This tool returns up to 10 high-quality content chunks (each max 500 tokens), extracted from Microsoft Learn and other official sources. Each result includes the article title, URL, and a self-contained content excerpt optimized for fast retrieval and reasoning. Always use this tool to quickly ground your answers in accurate, first-party Microsoft/Azure knowledge.

    Follow-up Pattern

    To ensure completeness, use microsoft_docs_fetch when high-value pages are identified by search. The fetch tool complements search by providing the full detail. This is a required step for comprehensive results.

  • microsoft_code_sample_search

    Search for code snippets and examples in official Microsoft Learn documentation. This tool retrieves relevant code samples from Microsoft documentation pages providing developers with practical implementation examples and best practices for Microsoft/Azure products and services related coding tasks. This tool will help you use the LATEST OFFICIAL code snippets to empower coding capabilities.

    When to Use This Tool

    • When you are going to provide sample Microsoft/Azure related code snippets in your answers.
    • When you are generating any Microsoft/Azure related code.

    Usage Pattern

    Input a descriptive query, or SDK/class/method name to retrieve related code samples. The optional parameter language can help to filter results.

    Eligible values for language parameter include: csharp javascript typescript python powershell azurecli al sql java kusto cpp go rust ruby php

  • microsoft_docs_fetch

    Fetch and convert a Microsoft Learn documentation webpage to markdown format. This tool retrieves the latest complete content of Microsoft documentation webpages including Azure, .NET, Microsoft 365, and other Microsoft technologies.

    When to Use This Tool

    • When search results provide incomplete information or truncated content
    • When you need complete step-by-step procedures or tutorials
    • When you need troubleshooting sections, prerequisites, or detailed explanations
    • When search results reference a specific page that seems highly relevant
    • For comprehensive guides that require full context

    Usage Pattern

    Use this tool AFTER microsoft_docs_search when you identify specific high-value pages that need complete content. The search tool gives you an overview; this tool gives you the complete picture.

    URL Requirements

    • The URL must be a valid HTML documentation webpage from the microsoft.com domain
    • Binary files (PDF, DOCX, images, etc.) are not supported

    Output Format

将 Microsoft Docs MCP 与多个 AI 模型配合使用

TypingMind 在工作区级别连接 MCP 工具,因此连接 Microsoft Docs 后,您就可以在 TypingMind 中搭配不同的 AI 模型使用,无需为每个模型单独设置。 此 MCP 通过远程托管的 MCP 服务器 URL 在 TypingMind 中连接。

添加 MCP 服务器 URL

如果 Microsoft Docs 已托管在远程服务器上,或您的团队希望让多个用户共用一个连接器,请选择此方式。

1

打开 MCP 连接器

在 TypingMind 中,前往“插件”,打开“MCP 连接器”,然后选择“添加 URL”。

  1. 在您的浏览器中打开 TypingMind。
  2. 进入“插件”。
  3. 打开“MCP 连接器”。
  4. 点击“添加 URL”。
TypingMind 的“添加自定义 MCP 服务器 URL”表单
2

粘贴服务器 URL

在“服务器 URL”字段中输入 https://learn.microsoft.com/api/mcp。根据服务器要求,添加连接名称、描述、图标、自定义 HTTP 请求头或 OAuth 客户端设置。

  1. 将 https://learn.microsoft.com/api/mcp 粘贴到“服务器 URL”字段中。
  2. 为 Microsoft Docs 输入连接名称。
  3. 您可以添加描述和图标,以便更容易识别此连接。
  4. 如果服务器需要身份验证,请添加自定义 HTTP 请求头或 OAuth 客户端信息。
3

创建连接

点击“创建连接”,然后返回插件列表,确认新的 MCP 连接显示为“有效”。

  1. 点击“创建连接”。
  2. 返回 MCP 连接器列表。
  3. 确认 Microsoft Docs 连接显示为“有效”。
  4. 如果连接未立即出现,请刷新插件列表。
4

切换模型,无需重新连接

使用您偏好的模型开始聊天,在“插件”中启用 Microsoft Docs 工具,并根据需要随时切换到其他模型。该 MCP 连接在 TypingMind 工作区中仍然可用。

  1. 在 TypingMind 中开始新聊天。
  2. 选择您想使用的 AI 模型。
  3. 在“插件”中启用 Microsoft Docs 工具。
  4. 需要时,请让模型使用该工具。
  5. 切换到其他 AI 模型,继续使用同一个 MCP 连接。
在 TypingMind 聊天中使用已启用的 MCP 工具和选定的 AI 模型
您能使用 Microsoft Docs 帮我完成这项任务吗?
Microsoft Docs
当然。我已阅读。
以下是我使用 Microsoft Docs 得到的结果。

常见问题

Microsoft Docs MCP 服务器有什么用途?

Microsoft Docs 是一个 MCP 服务器,可让兼容的 AI 客户端连接外部工具并获取上下文。在 TypingMind 中,只需添加一次此 MCP 服务器,即可在您的 AI 工作区中使用其工具。

可以在 TypingMind 中让多个 AI 模型使用 Microsoft Docs MCP 吗?

可以。TypingMind 在工作区层面连接 MCP 工具,因此您可以让 Claude、ChatGPT、Gemini 等不同 AI 模型,或您在 TypingMind 中配置的其他模型使用 Microsoft Docs,而无需为每个模型单独配置 MCP 服务器。

为什么在 TypingMind 中使用 Microsoft Docs MCP?

TypingMind 将多个 AI 模型、提示词、插件、AI 智能体、API 密钥和 MCP 工具整合到同一个工作区中,是优秀的大语言模型聊天前端之一。连接 Microsoft Docs 后,您可以在偏好的不同模型中使用其 MCP 工具,同时在 TypingMind 中井然有序地管理聊天工作流程。

如何将 Microsoft Docs MCP 连接到 TypingMind?

在 TypingMind 中添加 Microsoft Docs 托管的 MCP 服务器 URL,即可连接。如果您希望在 TypingMind 工作区中使用远程 MCP 连接,这种方式很适合。

Microsoft Docs MCP 在 TypingMind 中提供哪些工具?

Microsoft Docs 提供 3 个 MCP 工具,您可以在 TypingMind 的插件页面启用这些工具,然后在聊天中使用,或将其分配给 AI 智能体。

使用 Microsoft Docs MCP 需要向 TypingMind 提供我的 API 密钥吗?

不需要。TypingMind 采用本地优先的设计,让您自行掌控模型提供商、API 密钥、提示词和 MCP 配置。如果 Microsoft Docs 需要身份验证,请在创建连接时,为该 MCP 服务器添加所需的请求头、OAuth 设置或本地配置。

相关 MCP 服务器

查看全部

立即创建您自己的 AI 工作区

订阅我们的电子简报,获取新功能和后续赠奖活动的通知 👇