AI

Add the Microsoft Learn MCP server so Claude Code checks .NET docs first

Round The Code (David Grace) David Grace
AI

Claude Code and other models can write stale .NET code because their training stops short of the latest release. David Grace wires the free Microsoft Learn MCP server into a .NET 11 project and measures what changes with and without it.

Key points

  • `claude mcp add --transport http --scope project` writes the server into `.mcp.json`, so anyone who clones the repo gets it.
  • The server exposes three tools: `microsoft_docs_search`, `microsoft_docs_fetch` and `microsoft_code_sample_search`.
  • It is free, needs no account or API key, and its content is fully refreshed once a day.
  • A CLAUDE.md line makes Claude Code query the docs before touching .NET code.
  • The same line keeps project skills and conventions ahead of the documentation when they disagree.
  • Approval is stored in `.claude/settings.local.json` as `enabledMcpjsonServers`; `/mcp` shows the connection.
  • Without MCP, the model still found the async validation APIs by scanning the .NET 11 RC2 SDK reference assemblies.

Why it matters

This concerns any .NET team that writes code with an assistant, not just those moving to a new release: when a model's training lags behind, the code it produces can compile against APIs that are already outdated. The MCP server adds a docs lookup the model cannot skip, and the cost is one terminal command plus a line in CLAUDE.md.

Do not treat it as a guarantee, though. The author's own test shows a strong model locating the right APIs by scanning the installed SDK, and the ASP.NET Core pages it read were still written for .NET 10. Use the server as a safety net, keep build and test in the loop, and state in CLAUDE.md that your own conventions outrank the documentation.

Real-world use

  • A Minimal API orders endpoint whose result is a C# 15 union type of created, validation failure and out of stock.
  • Team repositories upgrading to a new .NET version where generated code must be checked against official docs.
  • A POST endpoint that validates a product id asynchronously through `IsValidAsync`.

This summary was generated by the agent from the original post on Round The Code (David Grace). The full text and all rights belong to its author and publisher. Go to original

Report this story

Is something wrong with the summary, or do you own this content? Your message comes straight to my inbox.

Type of message

Related stories

Feedback

Found a bug or have an idea? Your message lands straight in my inbox.

Type of message