CSharpMCP

li-zhixin/CSharpMCP

3.2

If you are the rightful owner of CSharpMCP and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

The CSharpMCP is a model context protocol server designed for executing C# code using the Roslyn compiler.

CSharpMCP is a specialized server that leverages the Roslyn compiler to execute C# code dynamically. It is designed to facilitate the execution of C# scripts while maintaining the state across executions. This server is particularly useful for developers who need to test and run C# code snippets in a controlled environment. The server provides tools to execute code, manage execution contexts, and retrieve code history, making it a versatile tool for C# development and testing. However, users should exercise caution as the server executes code on the local machine, which could pose security risks if untrusted code is run.

Features

  • Dynamic C# code execution using Roslyn.
  • State preservation across code executions.
  • Tools for managing execution context and code history.
  • Automatic reference addition for compiled projects.
  • Caution advised due to local code execution.

Tools

  1. RunAsync

    Execute the provided C# code, and the state (like variables) will be preserved each time.

  2. CleanExecuteContext

    Clean the code execution context, all states will be cleared.

  3. GetHistoryCode

    Get the history code.