# Microsoft Learn CLI

Use the Microsoft Learn CLI to retrieve current official Microsoft documentation and...

- Repository: https://github.com/MicrosoftDocs/mcp (1964 stars)
- Category: AI and agents
- License: CC-BY-4.0
- Last updated: 2026-10-30
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add MicrosoftDocs/mcp --skill microsoft-learn-cli -g -a claude-code -y`
Codex: `npx skills add MicrosoftDocs/mcp --skill microsoft-learn-cli -g -a codex -y`
Cursor: `npx skills add MicrosoftDocs/mcp --skill microsoft-learn-cli -g -a cursor -y`
Gemini CLI: `npx skills add MicrosoftDocs/mcp --skill microsoft-learn-cli -g -a gemini-cli -y`
Claude Code plugin marketplace: `/plugin marketplace add MicrosoftDocs/mcp`

## Description

Use the Microsoft Learn CLI to retrieve current official Microsoft documentation and code samples when Microsoft Learn MCP tools are unavailable. Use for questions about Microsoft technologies, SDKs, APIs, configuration, limits, best practices, tutorials, or Microsoft-specific coding errors that would otherwise benefit from current official documentation.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# Microsoft Learn CLI

Prefer Microsoft Learn MCP tools when they are available. Otherwise, use the Learn CLI instead of
relying on training data for questions about Microsoft technologies. The CLI retrieves official
Microsoft Learn documentation and code samples without requiring an MCP client.

```sh
npx @microsoft/learn-cli@latest search "<query>" --json
npx @microsoft/learn-cli@latest fetch "<url>"
npx @microsoft/learn-cli@latest code-search "<query>" --language <language> --json
```

## When to Use

- Microsoft product concepts, architecture, tutorials, configuration, limits, quotas, or best practices
- Microsoft SDK, API, package, class, method, or command questions
- Code that uses Azure, .NET, Microsoft 365, Windows, Power Platform, Dynamics, or other Microsoft technologies
- Microsoft-specific errors, deprecated APIs, version migrations, or authentication guidance

Do not use this skill for unrelated programming concepts, business logic, or non-Microsoft products.

## Documentation Workflow

1. Search with a specific query that includes the technology, version, platform, language, and task
   when relevant:

   ```sh
   npx @microsoft/learn-cli@latest search "Azure Functions Python v2 timeout configuration" --json
   ```

2. Use the most relevant result excerpts first. Fetch a Microsoft Learn URL only when the excerpt
   is insufficient or the user needs a complete tutorial, configuration reference, or API page:

   ```sh
   npx @microsoft/learn-cli@latest fetch "<url>"
   ```

3. For a long page, fetch only the relevant section or limit the returned content:

   ```sh
   npx @microsoft/learn-cli@latest fetch "<url>" --section "<heading>"
   npx @microsoft/learn-cli@latest fetch "<url>" --max-chars 5000
   ```

4. Answer from the retrieved content and cite the Microsoft Learn URLs used.

## Code Workflow

Use code search before producing or fixing code that depends on a Microsoft SDK or API:

The rest: https://github.com/MicrosoftDocs/mcp/blob/HEAD/cli/assets/microsoft-learn-cli/SKILL.md
