Microsoft Learn (MCP) Integration Guide
What is the Microsoft Learn MCP Server?
`https://learn.microsoft.com/api/mcp` is an unauthenticated streamable-HTTP MCP server. Use it in the order search → code-sample → fetch.
In Claude Code, install the `microsoft-docs` plugin (v0.3.1). It bundles this MCP and three helper skills. Install it with `/plugin install microsoft-docs@claude-plugins-official`, or from Microsoft's marketplace (`/plugin marketplace add microsoftdocs/mcp` then `@microsoft-docs-marketplace`). Use one path, not both. You can also register the raw endpoint with `claude mcp add --transport http microsoft-learn https://learn.microsoft.com/api/mcp`. Cursor uses `.cursor/mcp.json` with `mcpServers`, and VS Code uses `.vscode/mcp.json` with `servers`. It isn't a REST API, so let the client list tools at init. The tool set is dynamic, and a 400/404 means re-list. Search hits return `title`, `content` and `contentUrl` (not `url`). Code samples return `codeSnippet` and `link`. With no MCP client, use `npx @microsoft/learn-cli@1.0.0` (the `mslearn` command, Node 22+). It mirrors the three tools, and `mslearn setup --cli --claude` adds a fallback skill. For codeAmani it's the Microsoft-side twin of the Context7 rule: Azure, .NET, Entra and M365 questions go here, and npm/PyPI questions go to Context7. Use it to scope Azure OpenAI as a third AI-routing provider, Entra External ID as an enterprise CIAM path alongside Clerk, or Azure Functions for an M-Pesa callback when a client mandates an Azure tenant — all grounded, before committing.
Six Microsoft Learn connector primitives
Three doc tools, the remote transport that serves them, the grounding workflow, and the corpus they read.
███╗ ███╗██╗ ██████╗██████╗ ██████╗ ███████╗ ██████╗ ███████╗████████╗
████╗ ████║██║██╔════╝██╔══██╗██╔═══██╗██╔════╝██╔═══██╗██╔════╝╚══██╔══╝
██╔████╔██║██║██║ ██████╔╝██║ ██║███████╗██║ ██║█████╗ ██║
██║╚██╔╝██║██║██║ ██╔══██╗██║ ██║╚════██║██║ ██║██╔══╝ ██║
██║ ╚═╝ ██║██║╚██████╗██║ ██║╚██████╔╝███████║╚██████╔╝██║ ██║
╚═╝ ╚═╝╚═╝ ╚═════╝╚═╝ ╚═╝ ╚═════╝ ╚══════╝ ╚═════╝ ╚═╝ ╚═╝
██╗ ███████╗ █████╗ ██████╗ ███╗ ██╗
██║ ██╔════╝██╔══██╗██╔══██╗████╗ ██║
██║ █████╗ ███████║██████╔╝██╔██╗ ██║
██║ ██╔══╝ ██╔══██║██╔══██╗██║╚██╗██║
███████╗███████╗██║ ██║██║ ██║██║ ╚████║
╚══════╝╚══════╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═══╝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
mslearnCLI 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/listat 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.
Claude Code: the microsoft-docs plugin (recommended)
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-marketplaceRestart 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 connectedOr 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, noturl, and its text iscontent, notexcerpt. A code sample's link islink.
The grounding loop
Microsoft's server instructions give this order: "Search gives breadth. Code Sample Search gives practical examples. Fetch gives depth."
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 checkAgent 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
- Auth: none. The overview page says: "There's no authentication required." There's no key to store, rotate or leak, so this guide has no secrets.
- Rate limits: yes, unpublished. The FAQ says: "As a public and free endpoint, our service does have rate limits in place to ensure fair usage." Microsoft hasn't published thresholds, and there's no paid tier for higher limits.
- What throttling looks like: the tool call fails with
HTTP 429, and sometimes so does the MCPinitializeitself. - Throttling is effectively per source IP. In April 2026, Claude Managed Agents got 429s on single queries. Microsoft's explanation was that "Claude.ai is using a single outbound IP for all the MCP calls coming out of the managed agents." They mitigated it, and the reporter confirmed it fixed on 2026-04-27 (issue #152). Expect it to come back on any shared-egress platform: claude.ai connectors, cloud routines, CI runners.
- Intended use: "designed for end users to connect their AI agents to Microsoft docs… not really optimized or intended for massive batch jobs." For batch work, spread calls through the day and avoid peak hours.
How to stay under the limits:
- 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".
- Fetch only the 1–2 best
contentUrls. Don't fetch every hit. - Search code samples once, with
languageset. - Use
?maxTokenBudget=in tight agent loops. It protects your context window, not the rate limit. - 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.
Related Microsoft MCP servers (don't confuse them)
| 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
- Secrets: the connector needs no key. Anything you build from its research (Azure OpenAI, Storage, Entra apps) keeps its secrets server-side only:
.env.local, Vercel env vars, the Hazina vault or Azure Key Vault. Never put them in client code. Where Azure supports it, prefer keyless auth (Entra ID / Managed Identity) over API keys. - AI routing: Anthropic Claude stays primary. Azure OpenAI / Foundry models are an extra provider, used only when a client contractually needs models inside their Azure tenant. Use this connector to scope that choice (model and region availability, quotas) before committing.
- When Azure earns its place: the default stack (Vercel + Cloudflare + Supabase/Neon + Clerk + Stripe) covers most US consumer and SME work. Bring in Azure for enterprise clients with Microsoft 365 estates, data-residency mandates or .NET backends.
- Payments: Stripe is the default. If a Kenya-targeted project has to host its M-Pesa callback on Azure Functions, keep the same rules: HTTPS callback, store
CheckoutRequestIDon the STK Push response, dedupe on callback. For African-market clients, check Azure region availability (South Africa North/West) withmicrosoft_docs_searchinstead of assuming. - Cloud agents and 429s: routines, Managed Agents and the claude.ai connector share egress IPs, so they're the first to be throttled. Keep Learn lookups in interactive Claude Code sessions where you can, and use the CLI from CI with backoff.
- Freshness: the server has no version to track.
@microsoft/learn-cliis now listed underpackages:so the freshness checker can watch it. Re-check the release notes and the repo's commit history, because the CLI 1.0.0 release only shows up in the repo so far.
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 |