SharpToolsMCP
A suite of MCP tools for AIs to analyze and modify C# solutions with high signal, Roslyn powered context.
claude mcp add --transport stdio kooshi-sharptoolsmcp docker run -i kooshi/sharptoolsmcp:latest \ --env PORT="8080" \ --env LOG_LEVEL="info" \ --env SSE_ENABLED="true"
How to use
SharpToolsMCP exposes a Roslyn-powered set of analysis and modification tools via the MCP interface. It offers a range of Solution, Analysis, Document, Modification, and Misc tools (for example SharpTool_LoadSolution, SharpTool_ViewDefinition, SharpTool_AddMember, and SharpTool_FindReferences) that let an AI agent load a solution, inspect and navigate code, and perform precise code edits with automated git integration. The server can communicate over Server-Sent Events for remote clients and via standard I/O for local process communication, enabling integration with agents, copilots, or automated workflows. To use it, start the Docker image (or your preferred deployment method), connect an MCP client, and invoke the SharpTool_* functions to load your project, query symbol definitions, view or modify source, and commit changes automatically with contextual diffs and compilation feedback.
How to install
Prerequisites:
- Docker installed on your host (Docker Desktop on Windows/macOS, or Docker Engine on Linux).
- Sufficient disk space for the target solution and dependencies.
Installation steps:
-
Pull the SharpTools MCP image (or build your own if you have a custom setup): docker pull kooshi/sharptoolsmcp:latest
-
Run the MCP server container: docker run -i --rm -p 8080:8080 kooshi/sharptoolsmcp:latest
-
If you need to customize environment variables (recommended for production): docker run -i --rm -p 8080:8080
-e PORT=8080
-e SSE_ENABLED=true
-e LOG_LEVEL=info
kooshi/sharptoolsmcp:latest -
Connect an MCP client to the server at http://localhost:8080 (adjust host/port as configured). Ensure your client supports MCP via SSE and Stdio as described in the README.
Optional: If you prefer a local build/debug workflow, you would need a .NET environment and expose equivalent commands; this document assumes Docker deployment for simplicity and portability.
Additional notes
Tips and notes:
- The server exposes a rich set of SharpTool_* endpoints. Use SharpTool_LoadSolution first to initialize the workspace, then explore symbols with SharpTool_GetMembers and view/modify code with SharpTool_ViewDefinition, SharpTool_AddMember, or SharpTool_OverwriteRoslynDocument.
- Changes are tracked with a dedicated sharptools/ timestamped branch and commits are made automatically. You can undo the last modification via SharpTool_Undo.
- Ensure your .NET projects follow SDK-style or legacy formats supported by SharpTools; the server aims to work with a wide range of .NET versions. Respect .editorconfig for consistent formatting.
- When running over a network, consider enabling SSE and securing access to avoid exposing the workspace to untrusted clients.
- If you encounter issues with code formatting or newline handling around overwritten members, verify the editorconfig and update prompts or prompts usage as needed.
Related MCP Servers
mssql
MSSQL Server MCP implementation written in C#
mobile-dev
This is a MCP designed to manage and interact with mobile devices and simulators.
Mcp.Net
A fully featured C# implementation of Anthropic's Model Context Protocol (MCP)
RimSearcher
A Model Context Protocol (MCP) server for fast searching and retrieval of RimWorld source code.
mcpapp-colorpicker
A Model Context Protocol (MCP) App built with .NET that provides an interactive color picker with a rich UI
RoslynMcpServer
Model Context Protocol server for Roslyn-powered C# refactoring operations