Model Context Protocol .NET Template

by NikiforovAll

26 391 downloads Not rated yet MIT

About

This repository contains a template for creating a Model Context Protocol (MCP) applications in .NET.

Details

License
MIT

Explore

- 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

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name Model Context Protocol .NET Template
    Command (node, npx, python, etc.)

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

dotnet new install Nall.ModelContextProtocol.Template

Verify installation:

```bash
dotnet new list mcp

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

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "model context protocol .net template": {
            "mcp-template-dotnet": {
                "command": "npx",
                "args": [
                    "@modelcontextprotocol/inspector",
                    "-e",
                    "DOTNET_ENVIRONMENT=Production",
                    "dotnet",
                    "$(PWD)/Artefacts/MyAwesomeMCPServer.dll"
                ]
            }
        }
    }
}

McpServers

{
    "mcp-template-dotnet": {
        "command": "npx",
        "args": [
            "@modelcontextprotocol/inspector",
            "-e",
            "DOTNET_ENVIRONMENT=Production",
            "dotnet",
            "$(PWD)/Artefacts/MyAwesomeMCPServer.dll"
        ]
    }
}

<p align="center">
MCP Logo
</p>

<p align="center">
<strong>A protocol for seamless integration between LLM applications and external data sources</strong>
</p>

<p align="center">
<a href="https://modelcontextprotocol.io">Documentation</a> |
<a href="https://spec.modelcontextprotocol.io">Specification</a> |
<a href="https://github.com/orgs/modelcontextprotocol/discussions">Discussions</a>
</p>

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:

```bash
dotnet new install Nall.ModelContextProtocol.Template

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.