A C#–based Model Context Protocol (MCP) server that executes arbitrary C# scripts.
This project depends on the dotnet-script tool. Ensure it is installed globally on your system:
# Install dotnet-script globally
> dotnet tool install dotnet-script -gTo build the project, navigate to the root directory and run:
> dotnet buildTo run the server, you need to configure the AI agent with the following settings:
"mcp": {
"servers": {
"CSharpSandBox": {
"type": "stdio",
"command": "dotnet",
"args": [
"run",
"--project",
"{PROJECT-PATH}\\csharp-code-sandbox-mcp\\src\\MCPServer\\MCPServer.csproj",
"--no-build"
]
}
}
}Replace {PROJECT-PATH} with the absolute path to the project directory.
Thanks to the project node-code-sandbox-mcp by alfonsograziano for the inspiration behind this work.
This project is licensed under the MIT License. See the LICENSE file for details.
