Template Dotnet
БесплатноНе проверенThis repository contains a template for creating a Model Context Protocol (MCP) applications in .NET.
Описание
This repository contains a template for creating a Model Context Protocol (MCP) applications in .NET.
README
A protocol for seamless integration between LLM applications and external data sources
Documentation | Specification | Discussions
This repository contains a template for creating a Model Context Protocol (MCP) application in .NET. It provides a basic structure and example code to help you get started with building your own MCP-enabled applications.
| Package | Version | Description |
|---|---|---|
Nall.ModelContextProtocol.Template |
Nuget | Templates |
Nall.ModelContextProtocol.Inspector.Aspire.Hosting |
Nuget | Aspire Hosting Integration |
Getting Started
Install:
dotnet new install Nall.ModelContextProtocol.Template
# dotnet new install ./Artefact/Nall.ModelContextProtocol.Template
Verify installation:
dotnet new list mcp
# These templates matched your input: 'mcp'
# Template Name Short Name Language Tags
# ----------------- ----------------- -------- -------------
# Template Name Short Name Language Tags
# -------------------- -------------------- -------- -------------
# MCP Server mcp-server [C#] dotnet/ai/mcp
# MCP Server HTTP mcp-server-http [C#] dotnet/ai/mcp
# MCP Server HTTP Auth mcp-server-http-auth [C#] dotnet/ai/mcp
# MCP Server Hybrid mcp-server-hybrid [C#] dotnet/ai/mcp
[!TIP] Practically, you want to switch between modes, so I recommend using the
mcp-server-hybridtemplate. It allows you to run the server in both Stdio and HTTP modes.
Verify output:
dotnet new mcp-server -o MyAwesomeMCPServer -n MyAwesomeMCPServer --dry-run
# File actions would have been taken:
# Create: MyAwesomeMCPServer\.vscode\launch.json
# Create: MyAwesomeMCPServer\MyAwesomeMCPServer.csproj
# Create: MyAwesomeMCPServer\Program.cs
# Create: MyAwesomeMCPServer\Properties\launchSettings.json
# Create: MyAwesomeMCPServer\README.md
# Create: MyAwesomeMCPServer\appsettings.Development.json
# Create: MyAwesomeMCPServer\appsettings.json
Create from template:
dotnet new mcp-server -o MyAwesomeMCPServer -n MyAwesomeMCPServer
Here is a content of Program.cs:
using Microsoft.Extensions.Hosting;
var builder = Host.CreateApplicationBuilder(args);
builder.Services
.AddMcpServer()
.WithStdioServerTransport()
.WithToolsFromAssembly();
await builder.Build().RunAsync();
[McpServerToolType]
public static class EchoTool
{
[McpServerTool, Description("Echoes the message back to the client.")]
public static string Echo(string message) => $"hello {message}";
}
It is a simple echo server that listens for incoming messages and responds with a greeting. You can add more tools by creating additional methods with the [McpServerTool] attribute. The WithToolsFromAssembly() method automatically registers all tools in the assembly.
Run Locally
Build from the project directory:
dotnet build -o Artefacts -c Release
Run the inspector:
npx @modelcontextprotocol/inspector -e DOTNET_ENVIRONMENT=Production dotnet "$(PWD)/Artefacts/MyAwesomeMCPServer.dll"
Open inspector in your browser and test the server:
Distribute as .NET Tool
Pack from the project directory:
dotnet pack -o Artefacts -c Release
Install the tool globally:
dotnet tool install --global --add-source ./Artefacts MyAwesomeMCPServer
Now, after you installed this tool globally, you can run it from anywhere on your system. The tool will be available as MyAwesomeMCPServer (or myawesomemcpserver) in your terminal.
💡 You can also create local tool manifest and install MCPs as tools locally.
Run the inspector:
npx @modelcontextprotocol/inspector -e DOTNET_ENVIRONMENT=Production myawesomemcpserver
Run with Aspire
In Stdio mode
In AppHost/Program.cs:
var builder = DistributedApplication.CreateBuilder(args);
builder.AddMCPInspector().WithStdio<Projects.MCPServer>();
builder.Build().Run();
In HTTP mode
In AppHost/Program.cs:
var builder = DistributedApplication.CreateBuilder(args);
var mcp = builder.AddProject<Projects.MCPServerRemote>("server");
builder.AddMCPInspector().WithMcp(mcp);
builder.Build().Run();
Reference
Установка Template Dotnet
У этого сервера нет опубликованного пакета — он собирается из исходников. Открой репозиторий и следуй инструкции в README.
▸ github.com/NikiforovAll/mcp-template-dotnetFAQ
Template Dotnet MCP бесплатный?
Да, Template Dotnet MCP бесплатный — установка в пару кликов через Unyly без оплаты.
Нужен ли API-ключ для Template Dotnet?
Нет, Template Dotnet работает без API-ключей и переменных окружения.
Template Dotnet — hosted или self-hosted?
Self-hosted: сервер запускается локально на твоей машине командой из раздела установки.
Как установить Template Dotnet в Claude Desktop, Claude Code или Cursor?
Открой Template Dotnet на unyly.org, выбери вкладку своего клиента (Claude Desktop, Claude Code, Cursor) и нажми Install — конфиг сгенерируется автоматически, без правки JSON.
Похожие MCP
GitHub
PRs, issues, code search, CI status
автор: GitHubFilesystem
Secure file operations with configurable access controls.
Memory
Knowledge graph-based persistent memory system.
Template MCP Server
A CLI tool to create a new Model Context Protocol server project with TypeScript support, dual transport options, and an extensible structure
автор: mcpdotdirectCompare Template Dotnet with
Не уверен что выбрать?
Найди свой стек за 60 секунд
Автор?
Embed-бейдж для README
Похожее
Все в категории development
