Contributing¶
Thank you for your interest in contributing! This page explains how to report bugs, suggest features, and submit pull requests.
Reporting Bugs¶
Use the Bug Report issue template. Include:
- Steps to reproduce
- Expected vs. actual behavior
- Error message or logs
- Your OS, .NET version, and installation method (
global tool,clone & build, ordocker)
Capture logs with:
Suggesting Features¶
Use the Feature Request template. Describe:
- The problem you want to solve
- Your proposed solution (or just the problem — a solution is not required)
- Which tool or area it affects
Development Setup¶
Prerequisites: .NET 8 SDK
git clone https://github.com/Argha713/dotnet-mcp-server.git
cd dotnet-mcp-server
dotnet build
dotnet test
Run the server locally:
Project layout:
src/
McpServer/ # Main server (entry point, handler, built-in tools)
McpServer.Plugin.Abstractions/ # ITool contract NuGet package
McpServer.Templates/ # dotnet new mcp-tool template package
tests/
McpServer.Tests/ # xUnit tests (275+)
examples/
configs/ # Ready-to-use appsettings profiles
SamplePlugin/ # Reference plugin implementation
Making a Pull Request¶
- Fork the repo and create a branch from
master - Use branch naming:
feature/short-descriptionorfix/short-description - Make your changes following the code style below
- Add or update tests for any logic you change
- Run
dotnet test— all tests must pass - Open a PR against
masterand fill in the PR template
Code Style¶
- Target framework: .NET 8 / C# 12. No new NuGet dependencies without prior discussion in an issue.
- Comment format: All code comments must follow this exact format:
- Never delete code. Comment it out using the format above:
- No auto-formatters — match the surrounding style
- No
Co-Authored-By: Claudeor similar AI attribution in commits
Running Tests¶
# All tests
dotnet test
# A single test class
dotnet test --filter "FullyQualifiedName~McpServer.Tests.DateTimeToolTests"
# A single test method
dotnet test --filter "FullyQualifiedName~McpServer.Tests.DateTimeToolTests.ExecuteAsync_Now_ShouldReturnCurrentTime"
Test framework: xUnit with FluentAssertions and Moq.
Security Constraints¶
The following constraints are intentional and must not be weakened without an issue discussion:
| Area | Constraint |
|---|---|
| FileSystem | Path allowlist; 1 MB read limit |
| SQL | SELECT-only; 17 dangerous keywords blocked; 30s timeout; max 1,000 rows |
| HTTP | Host allowlist with subdomain support; HTTP/HTTPS only; 10K char response limit |
| Git | Read-only operations; path and argument validation |
| Environment | Hardcoded blocklist for sensitive variable names |
See the Security Constraints page for the full rationale.
Adding a New Tool¶
- Create a class implementing
IToolinsrc/McpServer/Tools/ - Register it in
src/McpServer/Program.cs: - Add tests in
tests/McpServer.Tests/ - Document it in
README.md(features table + usage examples section)
For a drop-in DLL without modifying the core project, see Plugin Development.