RoslynSense
A Model Context Protocol (MCP) server that provides C# code analysis, navigation, refactoring, testing, and debugging capabilities using the Roslyn compiler platform. Includes extensible support for WebForms (ASPX/ASCX) and Razor (.razor/.cshtml) files.
Inspired by egorpavlikhin/roslyn-mcp.
Install
Step 1 — Install the .NET tool
dotnet tool install --global RoslynSense
Update an existing install:
dotnet tool update --global RoslynSense
Step 2 — Configure your agent
Claude Code
Via the plugin marketplace (recommended):
claude plugin marketplace add GerardSmit/RoslynSense && claude plugin install roslyn-sense@roslyn-sense
Or add the MCP server directly (project-scoped):
claude mcp add RoslynSense --transport stdio -- roslyn-sense
For a global installation available in all projects, add --scope user:
claude mcp add --scope user RoslynSense --transport stdio -- roslyn-sense
Cursor
Add to .cursor/mcp.json in your project root (or ~/.cursor/mcp.json for global):
{
"mcpServers": {
"RoslynSense": {
"command": "roslyn-sense"
}
}
}
Windsurf
Add to ~/.codeium/windsurf/mcp_config.json:
{
"mcpServers": {
"RoslynSense": {
"command": "roslyn-sense"
}
}
}
VS Code (Cline / Continue / Copilot)
Add to .vscode/mcp.json in your project root, or open the command palette and run MCP: Open User Configuration to configure it globally:
{
"servers": {
"RoslynSense": {
"type": "stdio",
"command": "roslyn-sense"
}
}
}
Visual Studio
Add to .mcp.json in your solution root (committed to source control) or %USERPROFILE%\.mcp.json for a global configuration:
{
"servers": {
"RoslynSense": {
"type": "stdio",
"command": "roslyn-sense"
}
}
}
GitHub Copilot CLI
For a global installation, run /mcp add inside Copilot CLI and fill in the interactive form (stores to ~/.copilot/mcp-config.json). Select Local/STDIO as the server type and use roslyn-sense as the command.
For a project-scoped configuration, add to .mcp.json in your project root (v1.0.22+):
{
"mcpServers": {
"RoslynSense": {
"command": "roslyn-sense"
}
}
}
Kiro
Add to .kiro/settings/mcp.json in your project root (or ~/.kiro/settings/mcp.json for global):
{
"mcpServers": {
"RoslynSense": {
"command": "roslyn-sense",
"args": []
}
}
}
Other MCP clients
Use the following server configuration:
{
"servers": {
"RoslynSense": {
"type": "stdio",
"command": "roslyn-sense"
}
}
}
Command-Line Options
| Flag | Description |
|---|
--no-webforms | Disable WebForms (ASPX/ASCX) support. |
--no-razor | Disable Razor (.razor/.cshtml) support. |
--no-debugger | Disable all debugger tools (see Debugging). |
--no-profiling | Disable all profiling tools (see Profiling). |
--toon | Use TOON (Token-Optimized Object Notation) output format instead of markdown. Reduces token usage. |
--db <alias>=<provider>:<connstr> | Register a database connection. Repeatable. Providers: psql, mssql, sqlite. See Databases. |
--no-db | Disable all database tools. |
--no-auto-db | Disable auto-discovery of connection strings from web.config and appsettings*.json. See Databases. |
--no-preload | Disable background workspace preloading on startup. |
Example with Razor disabled:
{
"servers": {
"RoslynSense": {
"type": "stdio",
"command": "roslyn-sense",
"args": ["--no-razor"]
}
}
}
Configuration file (roslynsense.json)
Drop a roslynsense.json next to your solution (or anywhere up the tree from where the server is launched) to configure RoslynSense per-project without editing every MCP client. The server walks up from the working directory and uses the nearest file found.
{
"tools": {
"webForms": true,
"razor": true,
"debugger": true,
"profiling": true,
"database": true
},