InfinityFlow.CSharp.Eval 0.4.0

dotnet tool install --global InfinityFlow.CSharp.Eval --version 0.4.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 InfinityFlow.CSharp.Eval --version 0.4.0
                    
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=InfinityFlow.CSharp.Eval&version=0.4.0
                    
nuke :add-package InfinityFlow.CSharp.Eval --version 0.4.0
                    

InfinityFlow C# Eval MCP Server

An MCP (Model Context Protocol) server that evaluates and executes C# scripts using Roslyn. This tool allows AI assistants to run C# code dynamically, either from direct input or from .csx script files.

Features

  • Execute C# scripts directly or from files
  • Full Roslyn scripting support with common namespaces pre-imported
  • Console output capture (safe for MCP stdio protocol)
  • Comprehensive error handling for compilation and runtime errors
  • Available as both Docker container and dotnet tool

Tool Description

The server exposes a single tool: EvalCSharp

Parameters

  • csxFile (optional): Full path to a .csx file to execute
  • csx (optional): C# script code to execute directly

Either csxFile or csx must be provided, but not both.

Developing locally

To test this MCP server from source code (locally) without using a built MCP server package, you can configure your IDE to run the project directly using dotnet run.

{
  "servers": {
    "InfinityFlow.CSharp.Eval": {
      "type": "stdio",
      "command": "dotnet",
      "args": [
        "run",
        "--project",
        "<PATH TO PROJECT DIRECTORY>"
      ]
    }
  }
}

Testing the MCP Server

Once configured, you can ask the AI assistant to execute C# code, for example:

  • "Execute this C# code: Console.WriteLine("Hello World");"
  • "Run the C# script at /path/to/script.csx"
  • "Calculate the factorial of 10 using C#"

Publishing to NuGet.org

  1. Run dotnet pack -c Release to create the NuGet package
  2. Publish to NuGet.org with dotnet nuget push bin/Release/*.nupkg --api-key <your-api-key> --source https://api.nuget.org/v3/index.json

Using the MCP Server from NuGet.org

Once the MCP server package is published to NuGet.org, you can configure it in your preferred IDE. Both VS Code and Visual Studio use the dnx command to download and install the MCP server package from NuGet.org.

  • VS Code: Create a <WORKSPACE DIRECTORY>/.vscode/mcp.json file
  • Visual Studio: Create a <SOLUTION DIRECTORY>\.mcp.json file

For both VS Code and Visual Studio, the configuration file uses the following server definition:

{
  "servers": {
    "InfinityFlow.CSharp.Eval": {
      "type": "stdio",
      "command": "dnx",
      "args": [
        "<your package ID here>",
        "--version",
        "<your package version here>",
        "--yes"
      ]
    }
  }
}

More information

.NET MCP servers use the ModelContextProtocol C# SDK. For more information about MCP:

Refer to the VS Code or Visual Studio documentation for more information on configuring and using MCP servers:

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  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
0.4.0 166 8/22/2025
0.3.1 168 8/21/2025
0.3.0 165 8/21/2025
0.1.2 166 8/21/2025
0.1.1 153 8/21/2025
0.1.0 156 8/21/2025