How to add the Microsoft Learn MCP server to Codex

Adding Microsoft Learn MCP Server to Codex connects prompts to Microsoft's current documentation and official code samples, which is useful when Azure, .NET, PowerShell, or Microsoft 365 tasks need current upstream material instead of model memory alone.

Microsoft exposes the Learn server as a remote streamable HTTP MCP endpoint at https://learn.microsoft.com/api/mcp. In Codex, codex mcp add writes that endpoint into ~/.codex/config.toml, and codex mcp get microsoft-learn --json shows a streamable_http transport with the same URL when the entry is stored correctly.

The Learn endpoint does not require authentication, so no bearer-token environment variable is needed for the saved MCP entry. Microsoft also documents that the URL is meant for MCP clients rather than direct browser access, so opening it in a browser can return 405 Method Not Allowed even when the server configuration is correct.

Steps to add the Microsoft Learn MCP server to Codex:

  1. Add the official Microsoft Learn MCP Server endpoint to Codex.
    $ codex mcp add microsoft-learn --url https://learn.microsoft.com/api/mcp
    Added global MCP server 'microsoft-learn'.

    The saved entry uses the remote Learn endpoint directly and does not need a token setting or a manual config.toml edit.

  2. Retrieve the saved MCP entry in JSON to confirm that Codex stored a remote streamable HTTP server with the expected URL.
    $ codex mcp get microsoft-learn --json
    {
      "name": "microsoft-learn",
      "enabled": true,
      "disabled_reason": null,
      "transport": {
        "type": "streamable_http",
        "url": "https://learn.microsoft.com/api/mcp",
        "bearer_token_env_var": null,
        "http_headers": null,
        "env_http_headers": null
      },
      "enabled_tools": null,
      "disabled_tools": null,
      "startup_timeout_sec": null,
      "tool_timeout_sec": null
    }

    The decisive fields are transport.type = streamable_http, the Learn URL, and bearer_token_env_var = null.

  3. List configured MCP servers and confirm that the Learn entry is enabled in the current Codex configuration.
    $ codex mcp list
    Name             Url                                  Bearer Token Env Var  Status   Auth
    microsoft-learn  https://learn.microsoft.com/api/mcp  -                     enabled  Unsupported

    The current Codex CLI shows this unauthenticated Learn endpoint as Unsupported in the Auth column. The success state for this page is the microsoft-learn row with enabled under Status.