Back to Catalog
#

Setup Guide

Get started with single-file MCP servers

.NET 10 Preview 4 Any LLM Single File

Prerequisites

What you need before getting started

  • • .NET 10 Preview 4 installed
  • • An LLM client that supports MCP (Visual Studio, Claude Desktop, etc.)
  • • A single .cs file from the catalog

Basic Configuration

Create .mcp.json in your project root

Note: This example is for Visual Studio and similar clients. For Claude Code, use mcpServers instead of servers.

{
  "servers": {
    "MyUtilityServer": {
      "type": "stdio",
      "command": "dotnet",
      "args": ["run", "C:\\\\path\\\\to\\\\your\\\\mcp-server.cs"]
    }
  }
}

Environment Variables

Pass tokens and authentication keys securely

Note: These examples are for Visual Studio and similar clients. For Claude Code, use mcpServers instead of servers.

Configuration with inputs:

{
  "inputs": [
    {
      "id": "user_email",
      "description": "Your email",
      "type": "promptString",
      "password": true
    }
  ],
  "servers": {
    "DotnetMcpFile": {
      "type": "stdio",
      "command": "dotnet",
      "args": ["run", "C:\\\\path\\\\to\\\\your\\\\mcp-server.cs"],
      "env": {
        "USER_EMAIL": "${input:user_email}"
      }
    }
  }
}

Using environment variables in C#:

[McpServerToolType]
public static class EnvironmentExamples
{
    [McpServerTool, Description("Gets environment variable value")]
    public static string GetEnvironmentVariable(string variableName, string? defaultValue = null)
    {
        var value = Environment.GetEnvironmentVariable(variableName);
        
        if (string.IsNullOrEmpty(value))
        {
            if (defaultValue != null)
                return $"Environment variable '{variableName}' not found, using default: {defaultValue}";
            else
                return $"Environment variable '{variableName}' not found";
        }
        
        return $"{variableName} = {value}";
    }
}

Docker Deployment

For containerized environments

FROM mcr.microsoft.com/dotnet/sdk:10.0-preview-alpine
WORKDIR /app
COPY mcp-server.cs .
ENTRYPOINT ["dotnet", "run", "mcp-server.cs"]

Quick Start

Get up and running in 3 steps

  1. 1 Copy a .cs file from the catalog
  2. 2 Create .mcp.json with the configuration above
  3. 3 Restart your LLM client and start using the tools