Model Context Protocol .NET Template
@NikiforovAll
About Model Context Protocol .NET Template
This repository contains a template for creating a Model Context Protocol (MCP) applications in .NET.
Config
Add this server to your MCP-compatible client using the configuration below.
{
"mcpServers": {
"mcp-template-dotnet": {
"command": "npx",
"args": [
"@modelcontextprotocol/inspector",
"-e",
"DOTNET_ENVIRONMENT=Production",
"dotnet",
"$(PWD)/Artefacts/MyAwesomeMCPServer.dll"
]
}
}
}Tools
No tools detected
Fetch the live tool list by running this server in a temporary sandbox using the button above.
Overview
What is Model Context Protocol .NET Template?
A NuGet template for creating Model Context Protocol (MCP) applications in .NET. It provides a basic project structure and example code to help developers build MCP-enabled servers that integrate LLM applications with external data sources.
How to use Model Context Protocol .NET Template?
Install the template using dotnet new install Nall.ModelContextProtocol.Template, then create a new project with commands like dotnet new mcp-server -o MyProject -n MyProject. The generated code registers tools marked with the [McpServerTool] attribute automatically. Build and run locally, or distribute as a .NET tool.
Key features of Model Context Protocol .NET Template
- Four templates: mcp-server, mcp-server-http, mcp-server-http-auth, and mcp-server-hybrid
- Supports both Stdio and HTTP transport modes
- Automatic tool discovery with
WithToolsFromAssembly() - Can be packaged and distributed as a global .NET tool
- Integrates with Aspire hosting for cloud-native scenarios
Use cases of Model Context Protocol .NET Template
- Building a simple echo server to test MCP basics
- Creating production MCP servers in .NET with tool registration
- Switching between Stdio and HTTP modes for different deployment needs
- Distributing MCP servers as globally installable .NET tools
- Hosting MCP servers in Aspire orchestrations
FAQ from Model Context Protocol .NET Template
What is the Model Context Protocol (MCP)?
A protocol for seamless integration between LLM applications and external data sources. The .NET template helps you create servers that implement this protocol.
What templates are available?
Four templates: mcp-server (Stdio), mcp-server-http (HTTP), mcp-server-http-auth (HTTP with authentication), and mcp-server-hybrid (supports both Stdio and HTTP modes). The hybrid template is recommended for flexibility.
How do I run the server locally?
Build the project with dotnet build, then use the inspector: npx @modelcontextprotocol/inspector -e DOTNET_ENVIRONMENT=Production dotnet <path-to-dll>. Alternatively, package as a .NET tool and run directly.
Can I distribute the server as a .NET tool?
Yes. Pack with dotnet pack, then install globally with dotnet tool install --global --add-source <path>. The tool will be available system-wide.
How does Aspire hosting work?
Add the server project and the MCP inspector to your AppHost. Use WithStdio<Projects.MCPServer>() for Stdio mode or WithMcp(project) for HTTP mode.
Frequently asked questions
What is the Model Context Protocol (MCP)?
A protocol for seamless integration between LLM applications and external data sources. The .NET template helps you create servers that implement this protocol.
What templates are available?
Four templates: `mcp-server` (Stdio), `mcp-server-http` (HTTP), `mcp-server-http-auth` (HTTP with authentication), and `mcp-server-hybrid` (supports both Stdio and HTTP modes). The hybrid template is recommended for flexibility.
How do I run the server locally?
Build the project with `dotnet build`, then use the inspector: `npx @modelcontextprotocol/inspector -e DOTNET_ENVIRONMENT=Production dotnet <path-to-dll>`. Alternatively, package as a .NET tool and run directly.
Can I distribute the server as a .NET tool?
Yes. Pack with `dotnet pack`, then install globally with `dotnet tool install --global --add-source <path>`. The tool will be available system-wide.
How does Aspire hosting work?
Add the server project and the MCP inspector to your AppHost. Use `WithStdio<Projects.MCPServer>()` for Stdio mode or `WithMcp(project)` for HTTP mode.
Basic information
More Developer Tools MCP servers

Codex Pets
astandrikPublic read-only MCP server for discovering, inspecting, installing, and sharing approved Codex-compatible animated pet packs.
Vibgrate MCP
VibgrateQuery your team's drift, vulnerability, and migration data from any AI assistant. Vibgrate MCP connects Cursor, Claude, ChatGPT, Windsurf, or VS Code to Vibgrate Cloud: 51 tools for DriftScores, CVEs and EOL runtimes, up

Termany
thinkany-aiAgent-Native Terminal
Altronis
sypherinMCP server + CLI for Altronis — Singapore AI consulting. Ask the Lyra consultant, generate a grant-matched AI transformation plan, pull curated SG AI events/news. Read-only, wraps altronis.sg.

Reelier
Maxime HouleAgents make claims. Reelier writes receipts — record an agent's tool-call workflow once, replay it deterministically at 0 tokens, and diff runs to catch drift.
Comments