How to Create MCP Server

v1.0.0Developer Toolsstable

This guide will help you set up a basic MCP (Model Context Protocol) server in .NET, configure it in VS Code, and interact with it using Copilot Chat.

dotnetmcpmcp-clientmcp-dotnetmcp-server
Share:
38
Stars
0
Downloads
0
Weekly
0/5

What is How to Create MCP Server?

How to Create MCP Server is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to this guide will help you set up a basic mcp (model context protocol) server in .net, configure it in vs code, and interact with it using copilot chat.

This guide will help you set up a basic MCP (Model Context Protocol) server in .NET, configure it in VS Code, and interact with it using Copilot Chat.

This server falls under the Developer Tools category on MCPgee, the world's largest MCP server directory with 33,000+ servers.

Features

  • This guide will help you set up a basic MCP (Model Context P

Use Cases

Set up a basic MCP server in .NET, configure it in VS Code, and interact with it using Copilot Chat.
LicenseMIT
Languagetypescript
Versionv1.0.0
UpdatedMay 9, 2026
Statushealthy
Maintenanceactive

Works with

ClaudeOpenAIwindowsmacoslinux

Installation

Manual Installation

npx how-to-create-mcp-server

Configuration

Configuration Details

Config File

claude_desktop_config.json

Performance

Response Metrics

Response Time< 200ms
ThroughputMedium

Resource Usage

Memory UsageLow
CPU UsageLow

How to Set Up and Use How to Create MCP Server

The How-to-Create-MCP-Server repository is a step-by-step tutorial project that guides .NET developers through building, configuring, and deploying a basic MCP server using the official ModelContextProtocol NuGet package and Microsoft.Extensions.Hosting. The sample server exposes a single HelloTool that responds to natural-language invocations via GitHub Copilot Chat in VS Code, demonstrating how to define MCP tools with C# attributes, wire them into a hosted service, and configure the VS Code mcp.json to launch the server automatically. It is designed as a learning resource — developers clone and study it to understand the MCP server building blocks in the .NET ecosystem before building their own production tools.

Prerequisites

  • .NET SDK 8.0 or newer installed
  • Visual Studio Code with the C# Dev Kit extension installed
  • GitHub Copilot subscription with access to Copilot Chat in VS Code
  • Git for cloning the repository
  • Basic familiarity with C# and ASP.NET hosted services
1

Clone the tutorial repository

Clone the How-To-Create-MCP-Server project from GitHub to get the complete sample code.

git clone https://github.com/nisalgunawardhana/How-To-Create-MCP-Server.git
cd How-To-Create-MCP-Server
2

Add the MCP NuGet packages

Navigate into the HelloSriLankaServer project directory and add the required NuGet packages for MCP support and hosting.

cd HelloSriLankaServer
dotnet add package ModelContextProtocol --prerelease
dotnet add package Microsoft.Extensions.Hosting
3

Review the HelloTool implementation

Open HelloSriLankaServer/HelloTool.cs to see how the [McpServerToolType] and [McpServerTool] attributes are used to declare an MCP tool. This is the pattern you will replicate for your own tools.

4

Configure VS Code mcp.json

Create or update the .vscode/mcp.json file in your workspace to register the server with VS Code so Copilot Chat can discover and invoke it.

{
  "servers": {
    "Hello-SriLankaServer": {
      "type": "stdio",
      "command": "dotnet",
      "args": [
        "run",
        "--project",
        "${workspaceFolder}/HelloSriLankaServer/HelloSriLankaServer.csproj"
      ]
    }
  }
}
5

Test with Copilot Chat

Open the GitHub Copilot Chat panel in VS Code and send a message that triggers the HelloTool. Copilot will invoke the MCP tool and return the server's response.

How to Create MCP Server Examples

VS Code mcp.json configuration

The .vscode/mcp.json file that registers the Hello-SriLankaServer MCP server with VS Code. The dotnet run command builds and starts the server on demand.

{
  "servers": {
    "Hello-SriLankaServer": {
      "type": "stdio",
      "command": "dotnet",
      "args": [
        "run",
        "--project",
        "${workspaceFolder}/HelloSriLankaServer/HelloSriLankaServer.csproj"
      ]
    }
  }
}

Prompts to try

Use these prompts in GitHub Copilot Chat to invoke the HelloTool exposed by the sample MCP server.

- "Can you say hello to Sri Lanka?"
- "Invoke the HelloTool and show me the response."
- "What MCP tools are available from the Hello-SriLankaServer?"

Troubleshooting How to Create MCP Server

Copilot Chat does not show the MCP server tools.

Ensure the .vscode/mcp.json file is saved in the workspace root. Reload VS Code (Developer: Reload Window) and verify that the C# Dev Kit and Copilot Chat extensions are enabled. The server only appears in the tools list after at least one successful dotnet build.

dotnet run fails with 'SDK not found' or 'project not found' errors.

Confirm that .NET SDK 8.0+ is installed by running 'dotnet --version'. Make sure the ${workspaceFolder} variable resolves to the directory containing the How-To-Create-MCP-Server repository. Open the workspace from that folder in VS Code.

ModelContextProtocol package cannot be resolved during dotnet add package.

The package is in prerelease. Use the --prerelease flag: 'dotnet add package ModelContextProtocol --prerelease'. If the package still fails to resolve, ensure your NuGet source includes nuget.org and run 'dotnet nuget list source' to verify.

Frequently Asked Questions about How to Create MCP Server

What is How to Create MCP Server?

How to Create MCP Server is a Model Context Protocol (MCP) server that this guide will help you set up a basic mcp (model context protocol) server in .net, configure it in vs code, and interact with it using copilot chat. It connects AI assistants to external tools and data sources through a standardized interface.

How do I install How to Create MCP Server?

Follow the installation instructions on the How to Create MCP Server GitHub repository. Clone the repo, install dependencies, and add the server config to your AI client.

Which AI clients work with How to Create MCP Server?

How to Create MCP Server works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.

Is How to Create MCP Server free to use?

Yes, How to Create MCP Server is open source and available under the MIT license. You can use it freely in both personal and commercial projects.

Browse More Developer Tools MCP Servers

Explore all developer tools servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.

Quick Config Preview

{ "mcpServers": { "how-to-create-mcp-server": { "command": "npx", "args": ["-y", "how-to-create-mcp-server"] } } }

Add this to your claude_desktop_config.json or .cursor/mcp.json

Read the full setup guide →

Ready to use How to Create MCP Server?

Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.

33,000+ ServersFree & Open SourceStep-by-Step Guides