DEV Community

Cover image for Install and use the Microsoft Learn MCP server in VS Code
Olivier Miossec
Olivier Miossec

Posted on

Install and use the Microsoft Learn MCP server in VS Code

This short guide shows how to install and use the Microsoft Learn MCP server inside Visual Studio Code so you can query official Microsoft documentation and code samples directly from your editor.
You will need a VS Code installation with the latest updates, Internet and permission to install extensions.

VS Code allows you to use MCP servers. An MCP server (Model Context Protocol server) is a small service that exposes tools and data to AI agents. Instead of returning only text, it can call real functions such as reading web pages or querying documentation and return structured results that the editor can use.

As a cloud platform engineer or operator, you often switch between an editor and a browser to look up docs, examples, or snippets. The Microsoft Learn MCP server brings official docs and code samples into VS Code, so answers and examples appear where you work.

To activate the MS Learn MCP server in VS Code, go to “Extensions” (or CTRL + Shift + x) and then type @mcp
You will have to enable the “MCP server marketplace” if it is the first time you do that.

Then search for the Microsoft Learn MCP server.

And then click on install. You now have access to the service.

To start using the MS Learn MCP server, open the AI shell with [Ctrl + Shift + I] in VSCode.

Make sure you are in “Agent” mode in the chat windows.

For more context, I open a PowerShell file, then I can type the prompt:

Give me an example of PowerShell code to create a VNET use microsoft_code_sample_search

The chat provides a sample code based on the MCP server.
We can do the same with Azure Bicep.

How can I add the private subnet option to a subnet resource in Bicep? Use the microsoft_code_sample_search feature, which will provide a sample in Bicep.

If you need to know more about the private subnet feature, you can use the MCP tool, microsoft_docs_search, to query Microsoft Doc.

using microsoft_docs_search, explain the features of private subnets in an Azure VNet

There is another useful tool in the MCP server, microsoft_docs_fetch, which can take a Microsoft Doc page and put it in a Markdown format.

microsoft_docs_fetch https://learn.microsoft.com/en-us/azure/expressroute/resiliency-insights

It is very useful when you are working on a documentation or on a script, you can have the Microsoft Documentation inside your editor.

The MS Learn MCP server is an excellent introduction to the world of AI-assisted programming. It can help you solve a problem, reduce the number of tabs open in your browser, and be more efficient while working with VSCode.

Top comments (0)