How to Create MCP Server
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.
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
Maintainer
Works with
Installation
Manual Installation
npx how-to-create-mcp-serverConfiguration
Configuration Details
claude_desktop_config.json
Performance
Response Metrics
Resource Usage
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
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-ServerAdd 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.HostingReview 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.
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"
]
}
}
}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.
How to Create MCP Server Alternatives — Similar Developer Tools Servers
Looking for alternatives to How to Create MCP Server? Here are other popular developer tools servers you can use with Claude, Cursor, and VS Code.
Ecc
★ 188.2kThe agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.
Javaguide
★ 155.8kJava 面试 & 后端通用面试指南,覆盖计算机基础、数据库、分布式、高并发、系统设计与 AI 应用开发
Gemini CLI
★ 104.5kA secure MCP server that wraps the Google Gemini CLI, allowing clients to query Gemini models using local OAuth sessions without requiring an API key. It provides tools for model interaction and diagnostics with built-in protection against command in
Awesome MCP Servers
★ 87.3k⭐ Curated list of Model Context Protocol (MCP) servers - tools that extend Claude Desktop, Cursor, Windsurf, and other MCP clients with custom capabilities.
MCP Servers
★ 86.0kModel Context Protocol Servers
CC Switch
★ 77.5kA cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Gemini CLI & Hermes Agent. Only official website: ccswitch.io
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.
Set Up How to Create MCP Server in Your Editor
Choose your AI client for step-by-step setup instructions.
Quick Config Preview
Add this to your claude_desktop_config.json or .cursor/mcp.json
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.