Next Level AI Coding Agents - MCP Servers

April 23, 2026
Categories: #AI
Next Level AI Coding Agents - MCP Servers
Barret Blake

Barret Blake, Architect

This post is part 3 in a series of posts about taking your AI coding agents to the next level.

So far in this series, we have learned different ways to ramp up the capabilities of your AI coding agents. In part 1, we covered instructions files, and in part 2, we learned about skills files. But there are things that an AI coding agent simply isn’t capable of doing out of the box, even with the best written instructions or skills files. This is where MCP servers come in.

An AI coding agent is limited. It doesn’t have access to anything outside the scope of the conversation that you are having with it inside the context of your editor. They can’t query your database, or read your file system, or check the status of your CI/CD pipeline, or access your git repository server, or look at the latest documentation for a NuGet package on their website. MCP servers bridge that gap, giving AI coding agents access to various aspects of that outside world that they wouldn’t otherwise have.

What Is MCP?

MCP stands for Model Context Protocol. It’s an open standard, originally developed by Anthropic, for allowing an AI coding agent to connect to various outside tools and data sources. Like skills files, it was originally developed for Claude, but has been widely accepted and implemented by most of the AI coding agents, being supported by Cursor, GitHub Copilot, Windsurf, and others.

To use a .NET analogy, the AI agent would be the code you wrote yourself, and the MCP servers would be libraries that you imported from NuGet to give that code the ability to access the file system, access a database, make HTTP calls, encrypt and decrypt data, and so forth. MCP does the same thing for AI agents, giving them capabilities beyond what would be allowed otherwise.

It’s essentially a set of plugins that you can allow your AI coding agent to access that gives it a set of tools to work with, letting it reach out beyond the framework of the editor window. For instance, there is a GitHub MCP server that allows a coding agent to access your code repositories, create issues, review pull requests, trigger actions, and so forth. Another example is the Microsoft Azure MCP server, which allows agents to interact with Azure resources.

Every MCP consists of two parts. The first is the server, which is essentially a mini application running somewhere that provides various capabilities. Typically, it will be running locally on your machine, but it can also be hosted on a remote server or device somewhere else on the network or in the cloud. The second part is the client, which is your AI coding agent, running locally from the command line, from your editor, or in the coding agent’s native application.

MCP vs Skills

Having talked about skills files in the previous post, it would be beneficial to review the differences between MCP servers and Skills:

Skills FileMCP Server
What it gives the agentProcedural knowledgeLive capabilities
Lives inYour repoA running process
Example“Here’s how to scaffold a module”“Query the live database”
Requires running infraNoYes
AnalogyInstruction manualPower tool

The MCP Ecosystem

So where do MCP servers come from? Well, you can certainly write one yourself. We’ll cover that a little later. But you certainly don’t have to. There is a vast collection of MCP servers already available out there that you can access. I’ve already mentioned two of them: GitHub’s MCP server and Microsoft’s Azure MCP server. There are many, many more. Some of them are hosted by the provider. As I mentioned earlier, some of them are hosted by a provider, but most of them you will install locally in your editing tool or coding agent environment of choice.

The primary MCP server registry can be found at the Official MCP Registry, but there are a bunch of other lists at various vendor and community maintained sites across the web. I have listed a few examples in the resources section at the end of this post.

Generally speaking, MCP servers fall into one of a handful of categories:

  • Source Control - access and manipulation of source code, such as GitHub
  • Data - direct access to database servers or some other data source to read and update data and schemas
  • Documentation - access to documentation on the web or in local files
  • Project Management - access to systems such as GitHub, Jira, or Azure DevOps to track and maintain tickets, bugs, and feature requests
  • Browser Control - ability to control a web browser for UI testing, such as Playwright, or to retrieve information from web pages, such as for getting the latest information about a library
  • File System & Memory - access to your local file system for file manipulation or maintaining context and memory across AI sessions

Configuring MCP Servers For Your Agent

For setting up an MCP server, it depends on the agent and the environment you are working in. For example, if you are working with the Claude CLI interface, there is the claude mcp add command, which will walk you through adding a tool that way. In VS Code, you will open the command interface with CTRL - SHIFT - P and search for the MCP: Add Server command. In Cursor’s app, you would select the File -> Preferences -> Cursor Settings menu item, then add an MCP server under the Tools & MCP tab. It just depends on the environment you’re working in.

In most environments, the scope of the MCP server can be specified, allowing you to define an MCP server for a project, globally for a user, or for a team. But again, this capability will vary by tool and environment.

MCP server configuration is often maintained in a JSON file. For instance, VS Code on Windows maintains a file called mcp.json in your %AppData%\Roaming\Code\User\ folder. Here’s what such a file might look like:

{
	"servers": {
		"io.github.upstash/context7": {
			"type": "stdio",
			"command": "npx",
			"args": [
				"@upstash/context7-mcp@1.0.31"
			],
			"env": {
				"CONTEXT7_API_KEY": "${input:CONTEXT7_API_KEY}"
			},
			"gallery": "https://api.mcp.github.com",
			"version": "1.0.31"
		},
		"microsoftdocs/mcp": {
			"type": "http",
			"url": "https://learn.microsoft.com/api/mcp",
			"gallery": "https://api.mcp.github.com",
			"version": "1.0.0"
		},
		"com.microsoft/azure": {
			"type": "stdio",
			"command": "dnx",
			"args": [
				"Azure.Mcp@2.0.0-beta.14",
				"--yes",
				"--",
				"server",
				"start"
			],
			"gallery": "https://api.mcp.github.com",
			"version": "2.0.0-beta.14"
		},
		"io.github.github/github-mcp-server": {
			"type": "stdio",
			"command": "docker",
			"args": [
				"run",
				"-i",
				"--rm",
				"-e",
				"GITHUB_PERSONAL_ACCESS_TOKEN=${input:token}",
				"ghcr.io/github/github-mcp-server:0.30.2"
			],
			"gallery": "https://api.mcp.github.com",
			"version": "0.30.2"
		},
		"microsoft/markitdown": {
			"type": "stdio",
			"command": "uvx",
			"args": [
				"markitdown-mcp==0.0.1a4"
			],
			"gallery": "https://api.mcp.github.com",
			"version": "1.0.0"
		},
		"microsoft/playwright-mcp": {
			"type": "stdio",
			"command": "npx",
			"args": [
				"@playwright/mcp@latest"
			],
			"gallery": "https://api.mcp.github.com",
			"version": "0.0.1-seed"
		}
	}
}

Other systems may maintain their MCP list differently.

MCP In Action - Examples

Let’s look at a couple of examples of how MCP servers come into play during the AI coding workflow.

Example 1: GitHub MCP

Let’s say we give the following prompt to our Claude AI coding agent:

Scaffold a new Payments module and open a draft PR against main

In response, the agent will take the following steps:

  1. Reads the relevant skill from .claude/skills/scaffold-module/SKILL.md
  2. Creates a new feature branch via the GitHub MCP: feature/add-payments-module
  3. Scaffolds the module following the skill directives
  4. Commits the file changes with a meaningful commit message via the GitHub MCP
  5. Opens a draft PR with a full description via the MCP

Without the MCP server capability, you would have had to create the git branch, commit the changes, and create the PR yourself.

Example 2: Database MCP

One very common source of AI errors are when they try to create EF Core migrations. Anyone who has tried to use AI agents with EF Core has experienced this pain. This can be vastly improved if the agent has access to look at the database and see what the already deployed schema is. Our prompt:

Add a ShippingAddress value object to the Order aggregate and generate the migration

With a SQL Server MCP server capability, the agent will:

  1. Use the MCP server to query the Orders table in the dev database
  2. Inspect the existing columns and constraints before writing any code
  3. Adds the value object and OwnsOne configuration with full knowledge of what already exists
  4. Generates the migration without any column name collisions or redundant operations

Example 3: Azure DevOps MCP

With the ability to query a project management system via MCP, you don’t even need to provide the summary details for a prompt. Instead you can just say:

Implement PBI 4821

In response, the agent will:

  1. Connect to Azure DevOps via the MCP server and retrieve the information in PBI 4821
  2. Read the title, description, acceptance criteria, attachments, notes, and comments from the PBI
  3. Use the acceptance criteria to drive the implementation in the code – all taken from what’s in the ticket
  4. Reference the PBI number in the commit messages and the PR automatically so you don’t need to link the 2 sides yourself

Wiring Up The MCP Server For Your Agent

Just like with skills, an agent can only make use of MCP servers if it knows about them. As with skills, some agents are decent at discovering the existence of installed MCP servers automatically, but it’s better if you provide explicit instructions instead.

For our three examples in the previous section, here’s how we would provide direction to Claude in the CLAUDE.md file to make the agent aware of the available MCP servers we want it to be able to use.

Example 1: GitHub MCP

## Available Tools
- Use the GitHub MCP tool to create branches and open draft PRs after 
  completing a scaffold task. Do not ask me to do this manually.
- Always target `main` unless I specify otherwise.
- PRs should be opened as drafts.

Example 2: Database MCP

## Available Tools
- Use the database MCP tool to inspect the current schema before writing 
  any EF Core migrations or model changes.
- Only connect to the dev database. Never query staging or production.

Example 3: Azure DevOps MCP

## Available Tools
- Use the Azure DevOps MCP tool to fetch work item details when given a 
  PBI or task number. Use the acceptance criteria as the specification 
  for the implementation.
- Include the work item number in all commit messages and PR descriptions.

note: each of these examples shows the ##Available Tools header, but they would all be under a single entry in a real file if they were all in there together.

Building a Custom MCP Server

There are many available MCP servers out there for use. However, there may be times when you need to roll your own. For instance, let’s say you have an extensive collection of internally created NuGet packages available in a private feed, and for public packages you have specific rules around which versions can be used for company projects. You want your AI agents to only make use of the approved versions and not try to reach out to public NuGet feeds to get versions that are not approved for company use.

Microsoft makes it extremely simple to create an MCP server in .NET. There are a couple of ways you could do this:

Example 1 - NuGet Package Install

Here’s an example of a simple MCP server to do just that:

Let’s start with the project setup:

dotnet new console -n InternalNuGetMcp
cd InternalNuGetMcp
dotnet add package ModelContextProtocol
dotnet add package NuGet.Protocol

Program.cs

using ModelContextProtocol.Server;
using NuGet.Common;
using NuGet.Protocol;
using NuGet.Protocol.Core.Types;

var builder = McpServerBuilder.Create("internal-nuget", "1.0.0");

builder.AddTool("search_internal_packages",
    "Search the internal NuGet feed for available packages",
    new
    {
        type = "object",
        properties = new
        {
            query = new { type = "string", description = "Package name or keyword" }
        },
        required = new[] { "query" }
    },
    async (args, ct) =>
    {
        var feedUrl = Environment.GetEnvironmentVariable("INTERNAL_NUGET_URL")
            ?? "https://your-org.pkgs.visualstudio.com/_packaging/internal/nuget/v3/index.json";

        var repo = Repository.Factory.GetCoreV3(feedUrl);
        var search = await repo.GetResourceAsync<PackageSearchResource>(ct);

        var results = await search.SearchAsync(
            args["query"].ToString()!,
            new SearchFilter(includePrerelease: false),
            skip: 0, take: 10,
            NullLogger.Instance, ct);

        var packages = results.Select(p =>
            $"{p.Identity.Id} {p.Identity.Version} — {p.Description}");

        return string.Join("\n", packages);
    });

await builder.Build().RunAsync();

Registering the MCP server in Claude Code:

claude mcp add internal-nuget -- dotnet run \
  --project /path/to/InternalNuGetMcp

Or alternately in the .mcp.json file:

{
  "mcpServers": {
    "internal-nuget": {
      "command": "dotnet",
      "args": ["run", "--project", "./tools/InternalNuGetMcp"],
      "env": {
        "INTERNAL_NUGET_URL": "https://your-org.pkgs.visualstudio.com/..."
      }
    }
  }
}

And finally, adding the directives in the CLAUDE.md file:

## Available Tools
- Use the internal-nuget MCP tool to search for packages before adding 
  any NuGet dependency. Do not add packages from nuget.org that have 
  an internal equivalent.

Example 2 - Using the DOTNET Application Template

This example uses the available project template for the MCP SDK that Microsoft has created. If you’re creating anything more complex than the first example, you’ll probably want to use the template.

First, install the template if you haven’t already:

dotnet new install Microsoft.McpServer.ProjectTemplates

Next, scaffold the project:

dotnet new mcpserver -n InternalNuGetMcp
cd InternalNuGetMcp
dotnet add package NuGet.Protocol

This generates a Program.cs wired up with hosting, transport, and tool scanning already configured:

using Microsoft.Extensions.Hosting;

var builder = Host.CreateApplicationBuilder(args);
builder.Services
    .AddMcpServer()
    .WithStdioServerTransport()
    .WithToolsFromAssembly();

await builder.Build().RunAsync();

The WithToolsFromAssembly() automatically discovers any class marked with the [McpServerToolType] attribute. You never have to touch the Program.cs file to configure the available tools. You just add each tool class as needed.

using System.ComponentModel;
using ModelContextProtocol.Server;
using NuGet.Common;
using NuGet.Protocol;
using NuGet.Protocol.Core.Types;

[McpServerToolType]
public static class InternalNuGetTools
{
    [McpServerTool]
    [Description("Search the internal NuGet feed for available packages.")]
    public static async Task<string> SearchInternalPackages(
        [Description("Package name or keyword to search for")] string query,
        CancellationToken ct)
    {
        var feedUrl = Environment.GetEnvironmentVariable("INTERNAL_NUGET_URL")
            ?? "https://your-org.pkgs.visualstudio.com/_packaging/internal/nuget/v3/index.json";

        var repo = Repository.Factory.GetCoreV3(feedUrl);
        var search = await repo.GetResourceAsync<PackageSearchResource>(ct);

        var results = await search.SearchAsync(
            query,
            new SearchFilter(includePrerelease: false),
            skip: 0, take: 10,
            NullLogger.Instance, ct);

        var packages = results.Select(p =>
            $"{p.Identity.Id} {p.Identity.Version} — {p.Description}");

        return string.Join("\n", packages);
    }
}

The tool’s [Description] attributes are what the AI coding agent will read to understand what each of the available tools are and what they can do, as well as how to call the tool, so make sure that you write the descriptions for the AI coding agent, and not for human readability. A small distinction, but an important one.

Next, register the tool as before, such as in the mcp.json file:

{
  "servers": {
    "internal-nuget": {
      "type": "stdio",
      "command": "dotnet",
      "args": ["run", "--project", "./tools/InternalNuGetMcp"],
      "env": {
        "INTERNAL_NUGET_URL": "https://your-org.pkgs.visualstudio.com/..."
      }
    }
  }
}

You can see how quickly and easily you can create a single purpose MCP server. Both of these examples implement the same basic function. The first is a minimal example, but a good starting point for learning to roll your own. The second is the starting point of a more complex MCP tool.

The point is that an MCP server is a simple process to respond to specific tool requests. Your code is simple. The ModelContextProtocol package does the rest, handling all the protocol plumbing for you.

Security Considerations

MCP servers should be treated like production access. Follow the principle of least privilege. Keep the permissions you give to an MCP server close and tight. Do not give it access to do anything beyond what it absolutely needs to accomplish the task at hand. Remember that AI agents have a tendency to go rogue when not watched and guided carefully. It can have real world side effects on your system. Be especially careful with MCP servers that get access to file systems and memory. Research carefully agents created by others before using them, especially if that server needs permissions or a user account to work.

For example, the GitHub MCP server uses the account credentials you provide it. If that’s your user, then an agent with access to the MCP server can do anything you can do in GitHub, including deleting repositories. So be sure to be specific about what an agent can and cannot do with the MCP servers you give it access to. Make your directives clear. It’s not a guarantee, but it’s a good process to follow.

And be sure to audit the session logs for tool calls. Check up on what your agent is doing and trying to do. Be aware.

Conclusion

MCP servers complete the foundation of advancing your AI coding agent to the next level. Instructions to know your standards, Skills to know your playbook, and MCP tools to reach out and touch the world.

With those three layers in place, part 4 will put it all together with agent-driven workflows: multi-step tasks, automated PR reviews, or orchestrated pipelines.

Resources