Argha.dev.McpServer 1.0.0

The owner has unlisted this package. This could mean that the package is deprecated, has security vulnerabilities or shouldn't be used anymore.
dotnet tool install --global Argha.dev.McpServer --version 1.0.0
                    
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest
                    
if you are setting up this repo
dotnet tool install --local Argha.dev.McpServer --version 1.0.0
                    
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=Argha.dev.McpServer&version=1.0.0
                    
nuke :add-package Argha.dev.McpServer --version 1.0.0
                    

πŸ”Œ dotnet-mcp-server

A Model Context Protocol (MCP) server built with .NET 8 that exposes enterprise tools to AI assistants like Claude Desktop, VS Code (Copilot/Continue/Cline), Cursor, Windsurf, and more.

MCP is Anthropic's open protocol that lets AI assistants connect to external data sources and tools. This project brings MCP to the .NET ecosystem. It works with any MCP-compatible client β€” not just Claude Desktop.

.NET C# MCP License CI


What is MCP?

The Model Context Protocol allows AI assistants to:

  • πŸ” Query your databases
  • πŸ“ Read files from your system
  • 🌐 Call external APIs
  • ⏰ Get real-time information

Instead of copying data into prompts, the AI can directly access the tools it needs.


Features

This server provides nine enterprise-ready tools:

Tool Description
πŸ• datetime Get current time, convert between timezones
πŸ“ filesystem Read files, list directories (within allowed paths)
πŸ—„οΈ sql_query Execute read-only SQL queries against configured databases
🌐 http_request Make GET/POST requests to allowed APIs
πŸ“ text Regex match/replace, word count, text diff, format JSON/XML
πŸ”„ data_transform JSON query, CSV/JSON/XML conversion, base64, hashing
🌍 environment Get/list/check environment variables (sensitive values masked)
πŸ’» system_info OS details, running processes, network interfaces
πŸ”€ git Read-only Git: status, log, diff, branches, blame

Security Features

  • βœ… File access restricted to configured directories only
  • βœ… SQL queries are read-only (SELECT only, dangerous keywords blocked)
  • βœ… HTTP requests limited to allowed hosts
  • βœ… Environment variables with sensitive value masking (passwords, tokens, keys)
  • βœ… Git operations are read-only with path validation and argument sanitization
  • βœ… Regex timeout protection against ReDoS attacks
  • βœ… XXE prevention in XML parsing
  • βœ… No arbitrary code execution

Quick Start

Prerequisites

dotnet tool install -g Argha.dev.McpServer

Then run the interactive setup wizard to create your config:

dotnet-mcp-server --init

The wizard writes appsettings.json to your user config directory:

  • Windows: %APPDATA%\dotnet-mcp-server\appsettings.json
  • Linux/macOS: ~/.config/dotnet-mcp-server/appsettings.json

After configuring, you can verify everything is working:

dotnet-mcp-server --validate

To update to the latest version later:

dotnet tool update -g Argha.dev.McpServer

Option B β€” Clone and Build

git clone https://github.com/Argha713/dotnet-mcp-server.git
cd dotnet-mcp-server
dotnet build

Configure (Option B only)

Edit src/McpServer/appsettings.json:

{
  "FileSystem": {
    "AllowedPaths": [
      "C:\\Users\\YourName\\Documents",
      "C:\\Projects"
    ]
  },
  "Sql": {
    "Connections": {
      "MyDB": {
        "ConnectionString": "Server=localhost;Database=MyDB;Trusted_Connection=True;",
        "Description": "My local database"
      }
    }
  },
  "Http": {
    "AllowedHosts": [
      "api.github.com",
      "jsonplaceholder.typicode.com"
    ]
  }
}

3. Connect to Your MCP Client

Pick your client below and follow the setup instructions.

Note: All client config examples below use the global tool command dotnet-mcp-server. If you are using Option B (clone & build), replace "command": "dotnet-mcp-server" with "command": "dotnet", "args": ["run", "--project", "C:\\path\\to\\dotnet-mcp-server\\src\\McpServer"] instead.


Supported Clients

Claude Desktop

Config file location: | OS | Path | |----|------| | Windows | %APPDATA%\Claude\claude_desktop_config.json | | macOS | ~/Library/Application Support/Claude/claude_desktop_config.json |

Add this to the config file:

{
  "mcpServers": {
    "dotnet-mcp-server": {
      "command": "dotnet-mcp-server"
    }
  }
}

Restart Claude Desktop. You should see the tools available in the chat.


VS Code β€” GitHub Copilot (Built-in)

VS Code has native MCP support via GitHub Copilot (agent mode). No extension needed β€” just VS Code 1.99+ with Copilot enabled.

Step 1: Open your project in VS Code.

Step 2: Create a .vscode/mcp.json file in your workspace root:

{
  "servers": {
    "dotnet-mcp-server": {
      "command": "dotnet-mcp-server"
    }
  }
}

Step 3: Open the Copilot Chat panel (Ctrl+Shift+I or Cmd+Shift+I).

Step 4: Switch to Agent mode (click the dropdown at the top of the chat panel and select "Agent").

Step 5: You should see the MCP tools listed. Ask Copilot questions like "What time is it in Tokyo?" or "List files in my Documents folder".

Tip: You can also add the server globally via VS Code settings (settings.json):

{
  "mcp": {
    "servers": {
      "dotnet-mcp-server": {
        "command": "dotnet-mcp-server"
      }
    }
  }
}

VS Code β€” Continue.dev (Open Source)

Continue is a free, open-source AI coding assistant for VS Code and JetBrains.

Step 1: Install the Continue extension from VS Code Marketplace.

Step 2: Open Continue config: press Ctrl+Shift+P β†’ type Continue: Open Config β†’ select it.

Step 3: This opens ~/.continue/config.json. Add the MCP server under mcpServers:

{
  "mcpServers": [
    {
      "name": "dotnet-mcp-server",
      "command": "dotnet-mcp-server"
    }
  ]
}

Step 4: Reload VS Code (Ctrl+Shift+P β†’ Developer: Reload Window).

Step 5: Open Continue chat panel. The tools will be available in agent mode.


VS Code β€” Cline (Open Source)

Cline is a free, open-source autonomous AI coding agent for VS Code.

Step 1: Install the Cline extension from VS Code Marketplace.

Step 2: Open Cline settings: click the Cline icon in the sidebar β†’ click the gear icon β†’ go to MCP Servers.

Step 3: Click "Edit MCP Settings" which opens ~/Documents/Cline/cline_mcp_settings.json. Add:

{
  "mcpServers": {
    "dotnet-mcp-server": {
      "command": "dotnet-mcp-server"
    }
  }
}

Step 4: Restart Cline. The tools should appear in the MCP Servers section.


Cursor

Cursor is an AI-first code editor with built-in MCP support.

Step 1: Open Cursor Settings β†’ go to MCP section (or press Ctrl+Shift+J).

Step 2: Click "Add new MCP Server".

Step 3: Alternatively, create/edit ~/.cursor/mcp.json:

{
  "mcpServers": {
    "dotnet-mcp-server": {
      "command": "dotnet-mcp-server"
    }
  }
}

Step 4: Restart Cursor. Use the tools in Composer (Agent mode).


Windsurf (Codeium)

Windsurf is an AI-powered editor by Codeium with MCP support.

Step 1: Open Windsurf and go to Settings β†’ MCP.

Step 2: Click "Add Server" and configure:

{
  "mcpServers": {
    "dotnet-mcp-server": {
      "command": "dotnet-mcp-server"
    }
  }
}

Step 3: Restart Windsurf. Tools are available in Cascade (the AI chat).


Claude Code (CLI)

Claude Code is Anthropic's CLI tool. It supports MCP servers natively.

claude mcp add dotnet-mcp-server dotnet-mcp-server

That's it β€” Claude Code will auto-start the server when needed.


ChatGPT Desktop

OpenAI's ChatGPT desktop app supports MCP servers (requires Plus plan).

Step 1: Open ChatGPT Desktop β†’ Settings β†’ Beta Features β†’ enable MCP Servers.

Step 2: Go to Settings β†’ MCP Servers β†’ click "Add Server".

Step 3: Configure:

  • Name: dotnet-mcp-server
  • Command: dotnet-mcp-server
  • Arguments: (leave blank)

Step 4: Restart ChatGPT. Tools appear in the chat.


Manual Testing (No Client Needed)

You can test the server directly from any terminal:

dotnet run --project src/McpServer

Then paste JSON-RPC messages line by line:

{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","clientInfo":{"name":"manual-test","version":"1.0"}}}
{"jsonrpc":"2.0","method":"notifications/initialized"}
{"jsonrpc":"2.0","id":2,"method":"tools/list"}
{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"datetime","arguments":{"action":"now"}}}

Note: Replace C:\path\to\dotnet-mcp-server with the actual path where you cloned the repo in all examples above.


Tool Usage Examples

DateTime Tool

Ask Claude:

  • "What time is it in Tokyo?"
  • "Convert 3pm EST to IST"
  • "What's the current UTC time?"

File System Tool

Ask Claude:

  • "List files in my Documents folder"
  • "Read the contents of README.md"
  • "Search for all .cs files in my projects"

SQL Query Tool

Ask Claude:

  • "Show me the tables in MyDB database"
  • "Query the top 10 customers by revenue"
  • "Describe the structure of the Orders table"

HTTP Tool

Ask Claude:

  • "Get my GitHub profile info"
  • "Fetch the latest posts from JSONPlaceholder API"
  • "What APIs can you access?"

Text Tool

Ask Claude:

  • "Find all email addresses in this text"
  • "Replace localhost:3000 with api.prod.com in my config"
  • "How many words are in this document?"
  • "Show me the diff between these two configs"
  • "Pretty-print this minified JSON"

Data Transform Tool

Ask Claude:

  • "Convert this CSV to JSON"
  • "Extract all user emails from this JSON"
  • "Base64 encode this string"
  • "Generate a SHA256 hash of this text"
  • "Convert this XML response to JSON"

Environment Tool

Ask Claude:

  • "What is my JAVA_HOME set to?"
  • "Show me all Node-related environment variables"
  • "Is DOCKER_HOST configured?"

System Info Tool

Ask Claude:

  • "How much disk space do I have?"
  • "What processes are using the most memory?"
  • "What's my OS version and .NET runtime?"
  • "Show me my network interfaces"

Git Tool

Ask Claude:

  • "What files have I changed in this repo?"
  • "Show me the last 10 commits"
  • "What's the diff of my current changes?"
  • "Who last modified line 42 of Program.cs?"

Configuration Reference

File System Settings

{
  "FileSystem": {
    "AllowedPaths": [
      "/home/user/documents",
      "/projects"
    ]
  }
}

SQL Settings

{
  "Sql": {
    "Connections": {
      "Production": {
        "ConnectionString": "Server=...;Database=...;",
        "Description": "Production database (read-only)"
      },
      "Analytics": {
        "ConnectionString": "Server=...;Database=...;",
        "Description": "Analytics warehouse"
      }
    }
  }
}

HTTP Settings

{
  "Http": {
    "AllowedHosts": [
      "api.github.com",
      "api.stripe.com",
      "your-internal-api.com"
    ],
    "TimeoutSeconds": 30
  }
}

Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚Claude Desktopβ”‚ β”‚ VS Code  β”‚ β”‚ Cursor β”‚ β”‚ ChatGPT  β”‚
β”‚              β”‚ β”‚(Copilot/ β”‚ β”‚        β”‚ β”‚ Desktop  β”‚
β”‚              β”‚ β”‚Continue/ β”‚ β”‚        β”‚ β”‚          β”‚
β”‚              β”‚ β”‚ Cline)   β”‚ β”‚        β”‚ β”‚          β”‚
β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”¬β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜
       β”‚              β”‚           β”‚            β”‚
       β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                            β”‚ JSON-RPC over stdio
                            β–Ό
                 β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                 β”‚  dotnet-mcp-server  β”‚
                 β”‚  (MCP Server)       β”‚
                 β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
                 β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
                 β”‚  β”‚ DateTime Tool β”‚  β”‚
                 β”‚  β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€  β”‚
                 β”‚  β”‚ FileSystem    β”‚  β”‚
                 β”‚  β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€  β”‚
                 β”‚  β”‚ SQL Query     β”‚  β”‚
                 β”‚  β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€  β”‚
                 β”‚  β”‚ HTTP Tool     β”‚  β”‚
                 β”‚  β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€  β”‚
                 β”‚  β”‚ Text Tool     β”‚  β”‚
                 β”‚  β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€  β”‚
                 β”‚  β”‚ Data Transformβ”‚  β”‚
                 β”‚  β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€  β”‚
                 β”‚  β”‚ Environment   β”‚  β”‚
                 β”‚  β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€  β”‚
                 β”‚  β”‚ System Info   β”‚  β”‚
                 β”‚  β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€  β”‚
                 β”‚  β”‚ Git Tool      β”‚  β”‚
                 β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
                 β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                            β”‚
               β”Œβ”€β”€β”€β”€β”¬β”€β”€β”€β”¬β”€β”€β”€β”΄β”€β”€β”€β”¬β”€β”€β”€β”€β”
               β–Ό    β–Ό   β–Ό       β–Ό    β–Ό
             Files SQL  APIs   Git  OS

Project Structure

dotnet-mcp-server/
β”œβ”€β”€ src/
β”‚   └── McpServer/
β”‚       β”œβ”€β”€ Protocol/           # MCP/JSON-RPC types
β”‚       β”œβ”€β”€ Tools/              # Tool implementations
β”‚       β”œβ”€β”€ Configuration/      # Settings classes
β”‚       β”œβ”€β”€ McpServerHandler.cs # Main server logic
β”‚       └── Program.cs          # Entry point
β”œβ”€β”€ tests/
β”‚   └── McpServer.Tests/        # Unit tests
└── README.md

Adding Custom Tools

Create a new class implementing ITool:

public class MyCustomTool : ITool
{
    public string Name => "my_tool";
    public string Description => "Does something useful";
    
    public JsonSchema InputSchema => new()
    {
        Type = "object",
        Properties = new Dictionary<string, JsonSchemaProperty>
        {
            ["input"] = new() { Type = "string", Description = "Input value" }
        },
        Required = new List<string> { "input" }
    };

    public async Task<ToolCallResult> ExecuteAsync(
        Dictionary<string, object>? arguments, 
        CancellationToken cancellationToken)
    {
        var input = arguments?["input"]?.ToString();
        // Do something...
        return new ToolCallResult
        {
            Content = new List<ContentBlock>
            {
                new() { Type = "text", Text = $"Result: {input}" }
            }
        };
    }
}

Register in Program.cs:

services.AddSingleton<ITool, MyCustomTool>();

Troubleshooting

Problem Solution
Client doesn't see the tools Check the config file path is correct. Restart the client. Make sure the path to dotnet-mcp-server is absolute.
"Access denied" errors Add the path to AllowedPaths in appsettings.json
SQL connection fails Verify connection string. Ensure SQL Server is running.
HTTP requests blocked Add the host to AllowedHosts in appsettings.json
"Server not initialized" error Your client must send initialize before calling tools. Most clients do this automatically.
VS Code Copilot doesn't show tools Make sure you're in Agent mode (not Ask/Edit mode). Check .vscode/mcp.json syntax.
Tools not loading in Cursor Go to Settings β†’ MCP and check the server shows a green status. Restart Cursor if needed.

View Logs

Logs are written to stderr. To see them:

dotnet run 2> log.txt

Roadmap

Phase 1 β€” Security & Stability βœ… Complete

  • Fix SQL injection via subqueries (block ;, --, /* */, compound statements, 17 dangerous keywords)
  • Fix path traversal edge case (trailing separator check prevents C:\AllowedPathEvil matching C:\AllowedPath)
  • Add initialization gate (reject tools/list and tools/call before initialize handshake)
  • Config validation on startup (warn about missing paths, empty connection strings, malformed hosts)
  • Expand test coverage β€” 8 β†’ 63 tests (SqlQueryValidation, FileSystemTool, HttpTool, McpServerHandler)

Phase 2 β€” New Tools βœ… Complete

  • Text Tool β€” regex_match, regex_replace, word_count, diff_text, format_json/xml
  • Data Transform Tool β€” json_query, csv_to_json, json_to_csv, xml_to_json, base64_encode/decode, hash
  • Environment Tool β€” get, list, has (with hardcoded blocklist for sensitive vars)
  • System Info Tool β€” system_info (OS/CPU/RAM/disk), processes, network
  • Git Tool β€” status, log, diff, branch_list, blame (read-only with path validation)
  • Added 5 new tools (4 β†’ 9 total), 63 β†’ 150 tests, zero new NuGet dependencies

Phase 3 β€” Production Readiness βœ… Complete

  • Dockerfile + docker-compose (one-command setup)
  • GitHub Actions CI/CD (build, test on push/PR via ci.yml; release pipeline via release.yml)
  • Self-contained single-file executables (win-x64, linux-x64, osx-arm64 β€” published on v* tags)
  • dotnet tool install -g dotnet-mcp-server distribution
  • --init config wizard for first-run setup
  • --validate health check for all configured connections

Phase 4 β€” MCP Protocol Completeness

  • Resources support (resources/list, resources/read)
  • Prompts support (prompts/list, prompts/get) with built-in templates
  • Logging protocol (logging/setLevel, notifications/message)
  • Progress notifications for long-running operations

Phase 5 β€” Developer Experience

  • Plugin architecture (drop-in tool DLLs from /plugins folder)
  • dotnet new mcp-tool project template for custom tools
  • Documentation site (Getting Started, Tool Reference, Custom Tools guide)
  • Example configurations (developer.json, data-analyst.json, api-integrator.json)
  • CONTRIBUTING.md + issue templates

Phase 6 β€” Advanced Features

  • Multi-database support (PostgreSQL, MySQL, SQLite)
  • Response caching with configurable TTL
  • Audit logging (every tool call logged to file)
  • Rate limiting per tool
  • Tool-level authentication & permissions


License

This project is licensed under the MIT License - see the LICENSE file for details.


Author

Argha Sarkar


⭐ If you found this project helpful, please give it a star!

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

Version Downloads Last Updated