Microsoft Learn MCP

com.microsoft由 microsoft.com 發布官方發布者v1.0.0更新於 Oct 24, 2026

Enables clients like GitHub Copilot and other AI agents to bring trusted and up-to-date information directly from Microsoft's official documentation.

已驗證Streamable HTTP可網頁執行知識與記憶開發者工具

概覽

AI 產生的概覽

一個免費的遠端 MCP 伺服器,讓 AI 助理搜尋微軟官方 Learn 文件、尋找程式碼範例,並把文件頁面抓取為 markdown。

可以做什麼
搜尋微軟與 Azure 官方文件,回傳附標題和連結的排序內容片段(microsoft_docs_search)。在微軟官方文件中搜尋程式碼片段和範例,可依程式語言篩選(microsoft_code_sample_search)。抓取微軟 Learn 文件頁面並轉換為 markdown,取得完整的最新內容(microsoft_docs_fetch)。
適用情境
適合回答關於 Azure、.NET、Microsoft 365、C#、ASP.NET Core、Entity Framework 等微軟技術的問題,或需要取得最新官方文件和可執行程式碼範例、而不依賴模型訓練資料時使用。
執行需求
透過 Streamable HTTP 存取的遠端端點,無需 API 金鑰、登入或註冊。用戶端需支援遠端 MCP 伺服器;此端點無法在瀏覽器中直接開啟使用。需要能存取 learn.microsoft.com 的網路。
安裝前請注意
此伺服器為唯讀:只搜尋和抓取公開文件,不寫入或修改資料。查詢內容和請求的頁面網址會傳送到微軟的服務。README 說明部分功能為實驗性、可能變動,工具名稱和參數結構也可能演進,用戶端應動態探索工具。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Microsoft Learn MCP,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Web executable,透過 Streamable HTTP。 遠端服務在工作區中設定後即可從網頁執行環境執行。

交給代理程式安裝

把這段提示詞貼上到 Claude Code、Codex、Cursor 等代理程式,或 SourceWeft 對話中。代理程式會讀取該伺服器的安裝指南,先向你展示發布者、端點和登入方式,經你同意後再把它新增到你的客戶端。金鑰不會寫進任何命令。

閱讀 https://sourceweft.com/mcp/com.microsoft%2Fmicrosoft-learn-mcp/install.md,並按其中說明把這個 MCP 伺服器接入我的客戶端。修改任何設定之前,先告訴我它的發布者、端點和登入方式,等我確認。不要把 API 金鑰寫進命令或我會提交的檔案;問我金鑰應從哪裡取得。

檢視代理程式所依據的安裝指南

其他 MCP 客戶端

把它新增到你客戶端的 mcpServers 設定中。

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

README

🌟 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 snippets
language (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 globallynpm 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 repositorymslearn setup --cli --project
# Override auto-detection with explicit targetsmslearn setup --cli --copilotmslearn setup --cli --claudemslearn setup --cli --codexmslearn setup --cli --copilot --projectmslearn setup --cli --claude --projectmslearn setup --cli --codex --project
# Multiple agentsmslearn setup --cli --copilot --claude --codex

Remove only managed discovery content with:

sh
mslearn remove --climslearn remove --cli --copilotmslearn 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 Code[Install in VS Code]
or search "@mcp learn" in Extensions to show "Microsoft Learn" MCP
VS 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 IDE[Install in Cursor]Cursor 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 required
Use "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 browser
2. Go to Settings → Connectors → Advanced settings → Turn Developer mode on
3. Go back to connectors and click create
4. Give the connector a name, enter URL https://learn.microsoft.com/api/mcp, set authentication to No authentication and trust the application
5. Click create
ChatGPT Official Guide
WindsurfManual configuration required
View Config{
"mcpServers": {
"microsoft-learn": {
"serverUrl": "https://learn.microsoft.com/api/mcp"
}
}
}
Windsurf MCP Guide
Kiro
View 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

來源:README.md,提交 f8ffde1

工具

3

microsoft_docs_fetch

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 markdown with headings, code blocks, tables, and links preserved.

輸入參數url必填

版本歷史

1
  1. v1.0.0最新Sep 16, 2026

評分

已滿足適用檢查項的 100%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通必需25 分
  • 已宣告認證方式必需10 分
  • 已列出工具必需15 分
  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分

其他 Microsoft 整合