CSharpMCP
About
A Roslyn-based mcp server for dynamically executing C# code snippets
Details
- Author
- li-zhixin
- Downloads
- 294
- Categories
- Other
Jump to
- Execute C# code snippets with Roslyn
- State (variables) preserved across calls
- Clear execution context and reset state
- Retrieve previously executed code history
- Support for referencing external compiled DLLs
To use CSharpMCP, configure it as an MCP server in your MCP client application. To reference existing projects, compile the project and pass the path of the resulting DLL as a startup parameter; the server will add those assemblies as references. Invoke the provided tools (RunAsync, CleanExecuteContext, GetHistoryCode) from your MCP client.
CSharpMCP
The CSharpMCP is a mcp server designed for executing C# code base roslyn.
> Warning: This will execute code on the local machine. Use with caution.
Available Tools
- RunAsync: Execute the provided C# code, and the state (like variables) will be preserved each time.
- CleanExecuteContext: Clean the code execution context, all states will be cleared.
- GetHistoryCode: Get the history code.
How to reference existing projects
1. Compile the existing project
2. Use the path of the compiled dll as the startup parameter of CSharpMCP (references will be added automatically)
Sign in to leave a review
Use Google, GitHub, or an email account so ratings stay tied to real people.
No reviews posted yet.



