Microsoft Learn (MCP) Integration Guide

Technology: microsoft-learn · Category: tooling · Last reviewed: 2026-10-20

Source: https://tech-stack.codeamanilabs.org/guide/microsoft-learn

Insight:

The Microsoft Learn MCP Server is a free, remote, unauthenticated connector (https://learn.microsoft.com/api/mcp, GA since Nov 2025). It grounds Claude Code in live, first-party Azure, .NET, Entra and Microsoft 365 docs. Context7 applies the same "no guessing from training data" rule to npm and PyPI libraries; this server is the Microsoft equivalent. In Claude Code, install the microsoft-docs plugin (v0.3.1), which bundles the MCP server and three skills. Then work in the order microsoft_docs_search → microsoft_code_sample_search → microsoft_docs_fetch. The terminal fallback, @microsoft/learn-cli, reached 1.0.0 (mslearn) in Sept 2026. Throttling exists but its thresholds aren't published. It shows up as HTTP 429 and is applied per source IP, so shared-IP cloud agents hit it first.

███╗   ███╗██╗ ██████╗██████╗  ██████╗ ███████╗ ██████╗ ███████╗████████╗
████╗ ████║██║██╔════╝██╔══██╗██╔═══██╗██╔════╝██╔═══██╗██╔════╝╚══██╔══╝
██╔████╔██║██║██║     ██████╔╝██║   ██║███████╗██║   ██║█████╗     ██║
██║╚██╔╝██║██║██║     ██╔══██╗██║   ██║╚════██║██║   ██║██╔══╝     ██║
██║ ╚═╝ ██║██║╚██████╗██║  ██║╚██████╔╝███████║╚██████╔╝██║        ██║
╚═╝     ╚═╝╚═╝ ╚═════╝╚═╝  ╚═╝ ╚═════╝ ╚══════╝ ╚═════╝ ╚═╝        ╚═╝

██╗     ███████╗ █████╗ ██████╗ ███╗   ██╗
██║     ██╔════╝██╔══██╗██╔══██╗████╗  ██║
██║     █████╗  ███████║██████╔╝██╔██╗ ██║
██║     ██╔══╝  ██╔══██║██╔══██╗██║╚██╗██║
███████╗███████╗██║  ██║██║  ██║██║ ╚████║
╚══════╝╚══════╝╚═╝  ╚═╝╚═╝  ╚═╝╚═╝  ╚═══╝

Microsoft Learn (MCP) Integration Guide

Focus: Connecting the Microsoft Learn MCP server to Claude Code, Cursor and VS Code. With it, every answer about Azure, .NET, Entra ID, Microsoft 365 or Power Platform is grounded in current first-party docs, not stale training data. It also covers the mslearn CLI fallback and how this server sits next to Context7.

Overview

The Microsoft Learn MCP Server is a cloud-hosted Model Context Protocol server. It gives AI agents trusted, current content from Microsoft's official documentation. It is a front end to the same Learn knowledge service (a RAG index) that powers Ask Learn, Copilot in Azure, Foundry and Copilot Studio. That index refreshes incrementally after content changes and fully once a day.

Fact Value (verified 2026-10-20)
Endpoint https://learn.microsoft.com/api/mcp
Transport Streamable HTTP (type: "http"), not stdio. A browser GET returns 405
Auth None. No key, no sign-in, no sign-up. Use is subject to the Microsoft Learn Terms of Use
Price Free. There is no charge and no paid tier (issue #64)
Status GA since 2025-11-07
Server info serverInfo.name = "Microsoft Learn MCP Server", version = "1.0.0", MCP protocol 2025-06-18 (from a live initialize)
Capabilities tools, prompts and resources, each with listChanged: true. All three tools are annotated readOnlyHint: true and idempotentHint: true
Rate limits Exist, but no published numbers. A throttled call fails with HTTP 429 (see Rate limits)

Not a traditional API. Microsoft says the endpoint is meant to be used through an MCP client or agent framework. Tools, request shapes and response shapes can change. Always run tools/list at init and don't hard-code schemas.

Official Documentation

Resource URL
Overview & setup https://learn.microsoft.com/training/support/mcp
Developer reference https://learn.microsoft.com/training/support/mcp-developer-reference
Best practices https://learn.microsoft.com/training/support/mcp-best-practices
Get started (VS Code, Claude Code / Copilot CLI plugin) https://learn.microsoft.com/training/support/mcp-get-started
Get started (Foundry) https://learn.microsoft.com/training/support/mcp-get-started-foundry
Release notes https://learn.microsoft.com/training/support/mcp-release-notes
FAQ https://learn.microsoft.com/training/support/mcp-faq
GitHub repo (per-client install table, skills, CLI) https://github.com/MicrosoftDocs/mcp
CLI on npm https://www.npmjs.com/package/@microsoft/learn-cli

Release timeline (from the release notes and the repo)

Date Change
2025-06-12 Server released with microsoft_docs_search
2025-08-06 microsoft_docs_fetch added
2025-09-24 microsoft_code_sample_search added
2025-11-07 Generally available
2025-12-10 OpenAI-compatible endpoint (/api/mcp/openai-compatible, experimental)
2026-03-10 @microsoft/learn-cli released (preview, 0.1.0 on npm 2026-03-16)
2026-03-23 Plugin for Claude Code and Copilot CLI (microsoft-docs)
2026-09-10 @microsoft/learn-cli 1.0.0 published. Preview labels removed, and mslearn setup --cli added for agent discovery. The Learn release-notes page doesn't list this yet

Setup

The server is remote, so there is nothing to npm install. You register the endpoint, or install a plugin that registers it for you.

The plugin bundles the MCP server (it registers it as microsoft-learn) and three agent skills:

Skill Use for
microsoft-docs Concepts, tutorials, limits, configuration and factual lookups
microsoft-code-reference API lookups, code samples, checking a method exists, fixing errors
microsoft-skill-creator A meta-skill that generates a custom skill for one Microsoft technology

There are two install paths. Both install the same plugin (microsoft-docs, v0.3.1 in both .claude-plugin/plugin.json and .codex-plugin/plugin.json on 2026-10-20):

# Path A — Anthropic's official plugin marketplace (what the GitHub README now shows; used on this machine)
/plugin install microsoft-docs@claude-plugins-official

# Path B — Microsoft's own marketplace (what the Learn "Get started" page shows)
/plugin marketplace add microsoftdocs/mcp
/plugin install microsoft-docs@microsoft-docs-marketplace

Restart Claude Code after installing. The tools then appear namespaced as mcp__plugin_microsoft-docs_microsoft-learn__microsoft_docs_search (and the same pattern for _fetch and _code_sample_search). Install from one marketplace only, or you'll get two copies of the same server.

Claude Code: raw endpoint (no skills)

claude mcp add --transport http microsoft-learn https://learn.microsoft.com/api/mcp
claude mcp list   # confirm it connected

Or commit it to the project's .mcp.json. This is the same shape the repo's own .mcp.json uses:

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

Cursor

Click the "Install in Cursor" deeplink in the repo README, or add the server by hand to .cursor/mcp.json (project) or ~/.cursor/mcp.json (global):

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

Cursor isn't covered by the plugin. To get the same "always check Microsoft docs" behaviour there, add the system-prompt rule from Integration Patterns as a Cursor rule.

VS Code (GitHub Copilot agent mode)

Use the one-click "Install in VS Code" badge, search @mcp learn in the Extensions view, or add the server to .vscode/mcp.json (workspace) or the user mcp.json (run MCP: Open User Configuration). VS Code uses a servers key, not mcpServers:

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

The developer reference shows a bare "microsoft.docs.mcp": { "type": "http", "url": … } entry. That is the same server under a different key, and you nest it under servers (VS Code) or mcpServers (Claude Code, Cursor).

Other clients (from the repo's install table)

Client How
Visual Studio 2022 (17.13+) / 2026 Built in. Don't add it again (see the "Eclipsed" item in Troubleshooting)
GitHub Copilot CLI /plugin install microsoftdocs/mcp
Codex codex mcp add "microsoft-learn" --url "https://learn.microsoft.com/api/mcp" (a Codex plugin manifest also ships in the repo)
Claude Desktop / claude.ai Add custom connector, set the URL, no auth
Gemini CLI / Qwen Code {"Microsoft Learn MCP Server": {"httpUrl": "https://learn.microsoft.com/api/mcp"}}
Windsurf {"mcpServers": {"microsoft-learn": {"serverUrl": "https://learn.microsoft.com/api/mcp"}}}
Cline "type": "streamableHttp"
Foundry / Copilot Studio agents Add as an MCP tool (see the Foundry get-started page)

Optional URL parameters

Parameter / URL Effect
?maxTokenBudget=<n> Caps the token count of search responses by truncating them. microsoft_docs_fetch always returns the full page. Microsoft lists this as experimental
https://learn.microsoft.com/api/mcp/openai-compatible Search and fetch in the OpenAI Deep Research tool shape. Experimental

The three tools

Confirmed from a live tools/list on 2026-10-20. The tools now advertise an outputSchema, and its field names differ from older examples, so update any parsers.

Tool Input Output (structured) Limits
microsoft_docs_search query (string) { results: [{ title, content, contentUrl, content_omitted, id, extensionData }] } Up to 10 chunks, ≤500 tokens each
microsoft_code_sample_search query (required), language (optional) { results: [{ description, codeSnippet, link, language, content_omitted }] } Up to 20 snippets
microsoft_docs_fetch url (required; an HTML page on the microsoft.com domain) The full page as markdown, with headings, code blocks, tables and links kept One page per call. No PDF, DOCX or images

language values listed in the tool's schema: csharp javascript typescript python powershell azurecli al sql java kusto cpp go rust ruby php. There's no bicep value. For Bicep, put "bicep" in the query text instead.

Field-name gotcha: a search hit's link field is contentUrl, not url, and its text is content, not excerpt. A code sample's link is link.

The grounding loop

Microsoft's server instructions give this order: "Search gives breadth. Code Sample Search gives practical examples. Fetch gives depth."

flowchart TD
    A["Microsoft question<br/>Azure - .NET - Entra - M365"] --> B["microsoft_docs_search<br/>breadth"]
    B --> C["Up to 10 ranked chunks<br/>title plus contentUrl"]
    C --> F["microsoft_code_sample_search<br/>with language"]
    F --> G["Official snippets"]
    C --> D["microsoft_docs_fetch<br/>1 or 2 best URLs"]
    D --> E["Full page as markdown"]
    G --> H["Grounded answer or code"]
    E --> H
Tool:  microsoft_docs_search
Input: { "query": "Azure Functions HTTP trigger TypeScript v4 programming model" }

Tool:  microsoft_code_sample_search
Input: { "query": "Azure Functions HTTP trigger app.http", "language": "typescript" }

Tool:  microsoft_docs_fetch
Input: { "url": "https://learn.microsoft.com/azure/azure-functions/functions-bindings-http-webhook-trigger" }

In practice you just ask in plain language, and Claude calls the tools:

"Using current Microsoft Learn docs, give me the az CLI commands to create an Azure Container App with a managed identity."

"Is gpt-5.4 available in Azure EU regions? Check Microsoft Learn."


mslearn: the CLI fallback (@microsoft/learn-cli 1.0.0)

The CLI calls the same endpoint and the same three tools from a terminal, with no MCP client. Requires Node ≥ 22. The binary is mslearn.

npx @microsoft/learn-cli@1.0.0 search "azure functions timeout"
npm install -g @microsoft/learn-cli@1.0.0

mslearn search "azure functions timeout" --json | jq '.results[].title'
mslearn fetch "https://learn.microsoft.com/azure/azure-functions/functions-versions" --section "Function app timeout duration"
mslearn fetch "<url>" --max-chars 3000
mslearn code-search "cosmos db change feed processor" --language csharp
mslearn doctor --format json         # runtime + connectivity check

Agent discovery (new in 1.0.0). mslearn setup --cli installs a CLI-first skill that tells the agent to run npx @microsoft/learn-cli@latest whenever the MCP tools aren't available:

Agent User scope Project scope (--project)
Claude Code (--claude) ~/.claude/skills/microsoft-learn-cli/SKILL.md .claude/skills/microsoft-learn-cli/SKILL.md
GitHub Copilot (--copilot) ~/.copilot/skills/… .github/skills/…
Codex (--codex) ~/.agents/skills/… .agents/skills/…

mslearn remove --cli [targets] removes only the files it manages. Cursor isn't supported by setup. If an agent has both the plugin and the CLI skill, it should use the MCP tools and treat the CLI as a fallback.

Setting (non-secret) Purpose
MSLEARN_ENDPOINT env var, or --endpoint <url> Overrides the default https://learn.microsoft.com/api/mcp

When to use the CLI: CI scripts, shell one-liners, and agents with no MCP support. It's also useful in sandboxed cloud runs where MCP isn't configured.


Rate limits and auth

How to stay under the limits:

  1. Search once, with a sharp query. The server has no filter parameter (per the FAQ), so put the scope in the query text, e.g. "Azure Functions Flex Consumption timeout Node.js".
  2. Fetch only the 1–2 best contentUrls. Don't fetch every hit.
  3. Search code samples once, with language set.
  4. Use ?maxTokenBudget= in tight agent loops. It protects your context window, not the rate limit.
  5. On a 429, back off exponentially (2 s, 4 s, 8 s) and don't retry in a tight loop. See examples/learn-mcp-client.mts.

How it fits next to Context7

Both servers enforce the same rule: no answering from training data. Route each question by which source is authoritative.

Question is about… Use Why
Azure services, az CLI, Bicep/ARM, Entra ID, Microsoft Graph, M365, Power Platform, .NET/C#/ASP.NET Core/EF Core, Windows, VS/VS Code features Microsoft Learn MCP First-party, refreshed daily, and has official code-sample search. Also covers service limits, quotas and region availability, which aren't in any package
npm / PyPI libraries and frameworks (Next.js, React, Prisma, Supabase JS, Stripe SDK…) Context7 Version-accurate library docs, indexed from the library repos
Azure SDK packages (@azure/*, azure-* on PyPI) Learn first (microsoft_code_sample_search with language). Check pinned-version API details with Context7 Learn has the scenario docs. Context7 is better for one exact package version
Microsoft-authored OSS that isn't on Learn (e.g. TypeScript, Playwright) Context7 These repos' docs are indexed in Context7

Differences that matter in practice:

Microsoft Learn MCP Context7
Auth None OAuth or a ctx7sk- key recommended
Quota Unpublished fair-use limit, 429 when exceeded Free plan is 1,000 calls a month (see the context7/ guide)
Freshness Incremental updates plus a full daily refresh Per-library re-index
Scope Official Microsoft content only, which protects against unsafe sources Any indexed library. Watch out for forks

Context7 does index Microsoft content too. /microsoftdocs/mcp is this server's own repo, and /websites/learn_microsoft_en-us is a crawl of learn.microsoft.com. For Microsoft questions, though, use the first-party server, which has a daily refresh and dedicated code-sample search. Don't use a crawled copy.

flowchart TD
    Q1{"Microsoft product, service,<br/>CLI, limit or .NET API?"}
    Q1 -->|"yes"| A["Microsoft Learn MCP"]
    Q1 -->|"no"| Q2{"npm or PyPI library<br/>or framework?"}
    Q2 -->|"yes"| B["Context7"]
    Q2 -->|"no"| C["Vendor's own docs MCP<br/>or firecrawl"]

Server Endpoint What it does Auth
Microsoft Learn MCP (this guide) https://learn.microsoft.com/api/mcp Reads docs None
Azure MCP Server (github.com/microsoft/mcp) Local server Operates live Azure resources (Storage, App Service, AI Search…) Your Azure credentials
Foundry MCP Server (preview) https://mcp.ai.azure.com Works with Foundry resources in your subscription Entra sign-in

Use Learn to research a service and the Azure or Foundry servers to act on one. Those two need credentials, so give them least privilege and never point them at production from an unattended agent.


Integration Patterns

Put the rule in CLAUDE.md (or a Cursor rule)

Even with the plugin installed, models sometimes skip the tools. Microsoft's README recommends a system-prompt rule. The codeAmani version:

## Microsoft Documentation Policy

For any Azure, .NET, Entra ID, Microsoft 365, Graph, or Power Platform work:
1. `microsoft_docs_search` with a scoped query (service + runtime + feature)
2. `microsoft_code_sample_search` with `language` before writing code
3. `microsoft_docs_fetch` on the 1–2 best `contentUrl`s for full steps, limits, prerequisites
4. Never use remembered Azure API patterns if they differ from fetched docs
5. If the MCP tools are unavailable, fall back to `npx @microsoft/learn-cli@1.0.0 search "<query>"`

Slash command: research a Microsoft product

.claude/commands/ms-research.md:

Research the Microsoft product/service: $ARGUMENTS.

1. `microsoft_docs_search` for "$ARGUMENTS overview" and "$ARGUMENTS limits quotas pricing"
2. `microsoft_docs_fetch` the most authoritative result
3. `microsoft_code_sample_search` for a starter snippet with language "typescript"
4. Summarise: what it is, when to use it, limits/tiers, canonical docs URLs.
   Flag codeAmani considerations (Stripe default, M-Pesa only for Kenya-targeted
   projects, data residency, server-side secrets).

A custom client (server-side agents)

If your own backend agent calls Learn directly, for example a Next.js route handler, follow Microsoft's three rules: discover tools dynamically, re-list on a 400/404, and handle notifications/tools/list_changed. There's a type-checked, live-tested implementation in examples/learn-mcp-client.mts (@modelcontextprotocol/sdk@1.32.1).


codeAmani notes


Troubleshooting

Issue Fix
Tools don't appear Check type: "http" (not stdio). Run claude mcp list, or install the plugin and restart
Duplicate Learn servers or tools You installed the plugin from both marketplaces, or the plugin plus a manual claude mcp add. Keep one
HTTP 405 You opened the endpoint in a browser. Use an MCP client or MCP Inspector
HTTP 429 You're throttled. Back off exponentially and batch questions. On a shared-IP cloud agent, retry from a local session (#152)
A tool call fails with 400/404 Your cached tool list is stale. Re-run tools/list (reconnect) and retry
Parser can't find url / excerpt The search output fields are contentUrl and content. Code samples use link and codeSnippet
Visual Studio: "Microsoft Learn … unavailable (Reason: Eclipsed)" VS 17.13+ ships Learn built in. Remove any manual entry with the same name (microsoft-learn / Microsoft Learn) from ~/.mcp.json or the workspace .mcp.json
Code sample in the wrong language Pass language. The allowed values are in the table above
Thin search results Rephrase with specific technical terms, then microsoft_docs_fetch the best hit
The agent ignores the tools Add the Microsoft Documentation Policy rule. Microsoft notes even tool-friendly models sometimes skip MCP tools
mslearn fails to start It needs Node ≥ 22. Run mslearn doctor

Official docs: