Microsoft Learn MCP Server: Official Docs in Your Coding Agent

The Microsoft Learn MCP Server gives a coding agent search and fetch access to Microsoft’s official documentation and code samples, free and without a sign-in. What its three tools answer, how to add it to VS Code and Claude Code, how to keep its answers small, and where it stops.

6 min read

The Microsoft Learn MCP Server is a remote MCP server, run by Microsoft at https://learn.microsoft.com/api/mcp, that lets a coding agent search Microsoft’s official documentation, fetch a whole article as Markdown, and search official code samples. It is free, generally available, and needs no API key or sign-in. You add it to VS Code, Claude Code, Visual Studio or any other MCP client, and the agent checks Learn before it writes code against Azure, .NET, Microsoft 365 or another Microsoft product. It reads public documentation only: it knows how a service works, not how your tenant or your subscription is set up.

What it answers

Microsoft’s Learn MCP Server overview (opens in a new tab) describes it as an interface to the same knowledge service behind Ask Learn and Copilot for Azure. The content is public documentation, not training or user profile information, and the index refreshes incrementally as pages change, with a full refresh once a day. As of September 30, 2026 it offers three tools:

  • microsoft_docs_search: a semantic search across Microsoft’s technical documentation. It takes a query and returns the most relevant passages with their links.
  • microsoft_docs_fetch: takes a Learn url and returns the whole page converted to Markdown, for when a passage is not enough.
  • microsoft_code_sample_search: searches official Microsoft and Azure code snippets, with an optional language filter.

Good questions are narrow and current: “Give me the Azure CLI commands to create a Container App with a managed identity,” “Which Microsoft Graph permission does this call need?” or “Is this the right way to use IHttpClientFactory in a .NET minimal API?” These are exactly the places where a model’s training data is months old and a renamed flag or a retired SKU produces code that does not run. The server went live in June 2025, added fetch and code sample search later that year, and dropped its preview label on November 7, 2025, according to Microsoft’s release notes (opens in a new tab).

Set it up in VS Code

There are three ways in, all documented in Microsoft’s guide to adding MCP servers in VS Code (opens in a new tab): search @mcp learn in the Extensions view and install the Microsoft Learn entry, run MCP: Add Server from the Command Palette, or write the entry yourself. For one workspace, put this in .vscode/mcp.json:

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

VS Code asks you to trust a server the first time it starts. Then open chat in agent mode, ask a question about a Microsoft product, and allow the tool call. There is no key, so there is nothing to hide from source control, and committing the file is a reasonable way to give the whole team the same setup. If you mostly work on Microsoft technology, add it to your user configuration instead so it follows you into every workspace. More on the file itself is in VS Code mcp.json.

Set it up in Claude Code

The plain route is one command. Claude Code’s standard syntax for a remote server works as is, and --scope user makes it available in every project rather than only the current one:

Claude Code
# Remote server, available in all your projects
claude mcp add --scope user --transport http microsoft-learn https://learn.microsoft.com/api/mcp

# Or, inside a Claude Code session, install Microsoft's plugin (server plus skills)
/plugin marketplace add microsoftdocs/mcp
/plugin install microsoft-docs@microsoft-docs-marketplace

The plugin bundles the server with three skills: microsoft-docs for concepts and tutorials, microsoft-code-reference for API lookups and samples, and microsoft-skill-creator for writing your own skills about a Microsoft technology. Microsoft’s own pages disagree on how to install it. The Learn get-started page (opens in a new tab) uses the marketplace commands above, while the repository README gives /plugin install microsoft-docs@claude-plugins-official. If one fails, try the other, and check /mcp afterward to confirm the server is connected.

  • Visual Studio: the repository README says the Microsoft Learn server is already built in to current Visual Studio 2022 and 2026. Adding a second entry with the same name makes Visual Studio mark yours “Eclipsed”.
  • GitHub Copilot CLI: /plugin install microsoftdocs/mcp. More on MCP there in Copilot CLI and MCP.
  • Codex: codex mcp add "microsoft-learn" --url "https://learn.microsoft.com/api/mcp".
  • Copilot Studio and Microsoft Foundry agents can use it as a tool too; Microsoft lists both as supported uses.

Make the agent actually use it

Connecting the server does not mean the model will call it. Microsoft’s README admits that even tool-friendly models sometimes answer from memory instead. The fix is one instruction in the file your agent always reads: CLAUDE.md for Claude Code, .github/copilot-instructions.md or an instructions file for GitHub Copilot.

A line for CLAUDE.md or copilot-instructions.md
## Microsoft documentation
When a task involves Azure, .NET, Microsoft Graph, Microsoft 365 or another
Microsoft product, search Microsoft Learn with microsoft_docs_search before
writing code, and fetch the full page with microsoft_docs_fetch when a command,
permission or limit matters. Cite the Learn URL you relied on.

If you would rather not register a server at all, Microsoft also ships a command-line tool, npx @microsoft/learn-cli search "azure functions timeout", and mslearn setup --cli --claude installs a skill that tells the agent to run it. The trade-off between the two styles is the same as for any tool, covered in MCP vs Claude skills.

Keep the answers small

A search result is a handful of passages; a fetched page can be an entire reference article, and it stays in the conversation once it arrives. Microsoft’s best practices page (opens in a new tab) describes an option for this: add maxTokenBudget to the endpoint, for example https://learn.microsoft.com/api/mcp?maxTokenBudget=2000, and search results are truncated to fit. It only affects search, since fetch always returns the full page, and the repository labels it experimental and subject to change.

Claude Code adds its own guardrail. Its MCP documentation (opens in a new tab) says it warns when one tool result passes 10,000 tokens and caps results at 25,000 by default, a limit you can change with MAX_MCP_OUTPUT_TOKENS. Asking for the specific thing, a command, a permission name, a quota, rather than “explain Azure Functions,” keeps both tools cheap. The wider picture is in MCP token usage.

Where it stops

  • Public docs only. It cannot see your subscription, your resources or your tenant. For live Azure state you need a different server, such as the Azure MCP Server, which signs in and acts on real resources.
  • Microsoft only. For the open-source libraries in the same project, a general docs service such as Context7 fills the gap.
  • Rate limits exist but are not published. Microsoft’s FAQ says the free endpoint is rate limited for fair use and asks for responsible use.
  • No filters. You cannot restrict a search to one product or version, only word the query so it points there.
  • Not an API. Microsoft says tools, parameters and response formats may change, so a custom client should call tools/list at startup rather than hard-code tool names.
  • Docs describe previews too. Plenty of Learn pages cover preview features, and a correct answer about a preview can still change next month. When the agent relies on one, have it say so.

Looking for an MCP server example from Microsoft Learn?

Some searches for “Microsoft Learn MCP” are really after Microsoft’s tutorial for building a server. That is a different page: the .NET quickstart that runs dotnet new mcpserver, whose project template is still marked as in preview, adds a sample random-number tool and publishes the result to NuGet. We walk through the C# route in building an MCP server in C#.

Docs say how; the board says why

Learn can tell an agent the right way to configure a managed identity. It cannot tell it that your team chose a user-assigned identity on purpose, or that the migration off connection strings is half done. On a fenbs board that knowledge sits next to the work: AI context notes that every connected assistant reads with fenbs_get_context before it starts, and a Decisions and rules page where the choices a person made, and the rules that hold from now on, come first. fenbs is a plain board, with lanes To Do, Next Up, In Progress and Completed, and no sprints or due dates, so it holds what is being done and why, not a schedule.

Related

What AI context is: AI context. Connect a board next to Learn: Claude Code integration and GitHub Copilot integration. How sign-in works for servers that do need one: MCP OAuth.

Questions people ask.

Is the Microsoft Learn MCP Server free?

Yes. Microsoft says it is publicly available with no charge, and it needs no API key, account or sign-in. Use is subject to the Microsoft Learn Terms of Use, and the endpoint has rate limits for fair use.

What is the Microsoft Learn MCP Server URL?

https://learn.microsoft.com/api/mcp, over Streamable HTTP. It is meant for MCP clients, so opening it in a browser returns an error such as 405 Method Not Allowed.

Can the Microsoft Learn MCP Server see my Azure resources?

No. It only searches and fetches public Microsoft documentation and code samples. To read or change live Azure resources, use a server that signs in to your subscription, such as the Azure MCP Server.

Why does my agent not use the Microsoft Learn MCP tools?

Models often answer from training data when a tool is available but not required. Add a short instruction to CLAUDE.md or your Copilot instructions telling the agent to search Microsoft Learn for Microsoft products before writing code.

Start with one thing.

There is nothing to set up first. Write one line and you’ve started.