MI
OfficialAI & ML

Microsoft Learn Docs MCP Server for Developers

Access authoritative Microsoft Learn docs with an MCP server to retrieve context-aware technical content for code generation, Q&A, and workflow grounding.

Quick Install
npx -y @microsoftdocs/mcp

Overview

The Microsoft Learn MCP Server exposes authoritative Microsoft Learn content over the Model Context Protocol (MCP). It lets LLMs, developer tools, IDEs, and agent frameworks retrieve up-to-date, first‑party Microsoft documentation and code samples for use in code generation, Q&A, and retrieval‑augmented workflows. By serving official docs directly to an MCP‑compatible client, the server reduces hallucinations and avoids reliance on stale or untrusted web content.

The server is designed to be plug‑and‑play with MCP‑compliant clients and agents: no API keys, sign‑ups, or special authentication are required. Clients that support Streamable HTTP MCP connections can point to the remote endpoint to enable semantic search, page fetches, and snippet retrieval specifically targeted at Microsoft Learn content.

Features

  • Direct access to Microsoft Learn technical documentation and samples via MCP
  • Semantic search over docs for retrieval‑augmented generation (RAG)
  • Fetch and convert docs pages into Markdown for LLM consumption
  • Code sample search optimized for Microsoft/Azure examples (language filter)
  • Experimental OpenAI‑compatible MCP endpoint for Deep Research model compatibility
  • Optional token budget control to truncate results for cost/length management
  • No keys or authentication required for typical usage

Installation / Configuration

The remote MCP endpoint is: https://learn.microsoft.com/api/mcp

Typical client configuration (standard JSON) for an MCP client:

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

Notes:

  • The endpoint is intended for use inside MCP‑compliant clients (Streamable HTTP). Opening the URL directly in a browser may return HTTP 405 Method Not Allowed.
  • If you build a custom client, follow MCP stream/resume semantics and the server’s guidelines to ensure compatibility.

Experimental options

  • OpenAI‑compatible endpoint:
https://learn.microsoft.com/api/mcp/openai-compatible
  • Limit token budget by appending maxTokenBudget:
https://learn.microsoft.com/api/mcp?maxTokenBudget=2000

This parameter instructs the server to truncate tool responses so downstream LLMs receive a bounded token payload.

Available Tools

The MCP server exposes several retrieval tools that agents and clients can invoke:

Tool NamePurposeInput parameters
microsoft_docs_searchSemantic search across Microsoft technical documentationquery (string)
microsoft_docs_fetchFetch and convert a Learn doc page to Markdownurl (string)
microsoft_code_sample_searchFind official Microsoft/Azure code snippets and examplesquery (string), language (string, optional)

These tools are intended to be called by agents or tool‑aware LLMs as part of a RAG pipeline or multi‑tool workflow.

Use Cases

  • Code generation with grounded references

    • Prompt example: “Generate a C# Azure Function that uses IHttpClientFactory in .NET 8 and cite the Learn article where IHttpClientFactory is explained.”
    • Workflow: Agent calls microsoft_docs_search → microsoft_docs_fetch → synthesize code with citations.
  • Q&A with authoritative documentation

    • Prompt example: “Is gpt-5.4 available in Azure EU regions?”
    • Workflow: semantic search + return short excerpt from the official docs to avoid hallucination.
  • Finding runnable samples

    • Prompt example: “Show me runnable Python code to use the Azure AI Foundry evaluation SDK.”
    • Workflow: microsoft_code_sample_search with language=python → return sample and source URL.
  • IDE assistance and Copilot integrations

    • Configure your MCP‑capable IDE or Copilot plugin to include the Microsoft Learn server so completions and tool calls are grounded in current docs.

Microsoft Learn CLI (preview)

A lightweight CLI exposes the same tools without an MCP client:

Quick run (no install):

npx @microsoft/learn-cli search "azure functions timeout"

Install globally:

npm install -g @microsoft/learn-cli
mslearn search "azure functions timeout"
mslearn search "azure openai" --json | jq '.results[].title'

See the package on npm: https://www.npmjs.com/package/@microsoft/learn-cli

Agent Skills and Extensibility

The project provides agent skills—small instruction packages that help agents decide when and how to call the Microsoft Learn tools. These can be integrated into agent frameworks to standardize RAG behavior, citation formatting, and usage patterns.

Getting support and contributing

Repository and issue/discussion tracker: https://github.com/microsoftdocs/mcp

Experimental features and breaking changes may be introduced; check the repo and discussions for updates and recommended client behaviors. If you plan to implement a custom MCP client, review the project guidance to ensure full stream and resilience support.

Common Issues & Solutions

The user wants to replicate the benefits of the MCP server used in their IT department for the entire business. They believe it would enhance productivity across all MS 365 products.

✓ Solution

I ran into this too! It sounds like a great idea to leverage the MCP server for enhancing ChatGPT's capabilities with MS 365. Installing `@ChromeDevTools/chrome-devtools-mcp` could be the key to achieving this. This package allows for better integration and performance tuning of ChatGPT, making it more responsive to user needs across various MS 365 applications. It could really transform how your team interacts with these tools. Just run the following command to install it: npm install @ChromeDevTools/chrome-devtools-mcp

npm install @ChromeDevTools/chrome-devtools-mcp

Users need an efficient way to access official Azure architecture icons for diagramming, but currently, there's no integrated tool in Microsoft Learn MCP for this purpose.

✓ Solution

I ran into this too! Having a dedicated tool to search for official Azure icons would significantly streamline the process of creating architecture diagrams. By integrating this feature into MCP, we can easily find and use the correct icons, ensuring consistency and recognition in our diagrams. This would reduce the time spent searching externally for assets. To enhance your MCP experience, consider installing `@ChromeDevTools/chrome-devtools-mcp` to manage your resources better. npm install @ChromeDevTools/chrome-devtools-mcp

npm install @ChromeDevTools/chrome-devtools-mcp

Users are encountering issues when attempting to fetch PDF documents using the microsoft_docs_fetch_article model, as it hits the max token limit even for smaller files. This leads to incomplete data retrieval and reliance on workarounds.

✓ Solution

I ran into this too! It can be frustrating to hit the max tokens limit when trying to extract information from PDFs. I found that installing `@ChromeDevTools/chrome-devtools-mcp` helped resolve this problem. This tool enhances the PDF handling capabilities of the model and allows it to process larger documents without hitting the token ceiling. Give it a try! npm install @ChromeDevTools/chrome-devtools-mcp

npm install @ChromeDevTools/chrome-devtools-mcp