- Home
- MCP servers
- CodeAnalysisMCP Server
CodeAnalysisMCP Server
- other
0
GitHub Stars
other
Language
7 months ago
First Indexed
3 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
Installation
Add the following to your MCP client configuration file.
Configuration
View docs{
"mcpServers": {
"trite-codeanalysismcp": {
"command": "dotnet",
"args": [
"run",
"--project",
"CodeAnalysisMCP/CodeAnalysisMCP.csproj"
]
}
}
}This MCP server provides code analysis capabilities for .NET C# projects using Roslyn. It helps you find unreferenced code, understand solution structures, and generate detailed results to improve code quality across single projects or entire solutions.
How to use
You interact with the code analysis MCP server through an MCP-compatible client. Start the server, then issue analysis requests to identify unreferenced symbols and related insights for your C# codebase.
How to install
Prerequisites: you need the .NET 9.0 SDK or later and MSBuild (included with Visual Studio or the .NET SDK). Ensure your environment can build and restore projects before analysis.
-
Install the required .NET SDK if you don’t already have it.
-
Build the MCP server project.
-
Run the server to start listening for MCP client requests.
Configuration and execution notes
Run the server via the .NET toolchain using the following command to start the MCP service locally.
dotnet run
If you configure the server in Claude Desktop, you can point to the runtime command like this.
{
"mcpServers": {
"code_analysis": {
"command": "dotnet",
"args": [
"run",
"--project",
"C:\\path\\to\\CodeAnalysisMCP\\CodeAnalysisMCP.csproj"
]
}
}
}
What you can do with the server
-
Detect unreferenced code: find classes, methods, properties, and fields that are declared but never referenced in your codebase.
-
Scope control: analyze entire solutions, specific projects, or filter by file paths.
-
Entry point awareness: optionally exclude entry points such as Main methods, tests, or controllers from results.
-
Public member filtering: decide whether to include or exclude public members in the analysis.
-
Detailed results: receive report data with file paths, line numbers, member types, and accessibility levels.
Notes and limitations
-
This MCP server analyzes C# code via Roslyn. It requires buildable projects and MSBuild to restore dependencies.
-
Analysis focuses on unreferenced symbols and may be slower for very large solutions. You can speed up by applying project or file filters.
-
The server reports on unreferenced symbols rather than unreachable code that follows return statements.
Troubleshooting
If analysis results seem incomplete, verify that your solution or project can be loaded by Roslyn’s MSBuildWorkspace and that all dependencies restore correctly.
Ensure you are using .NET 9.0+ and that MSBuild is available in your environment.
Tools and capabilities
The server exposes these core analysis capabilities: AnalyzeSolution, AnalyzeProject, and GetSolutionInfo. They enable comprehensive solution-wide checks, project-specific analysis, and quick solution metadata retrieval.
Available tools
AnalyzeSolution
Analyzes a .NET solution for unreferenced code members with optional filters for public members, entry points, projects, and files.
AnalyzeProject
Analyzes a single .csproj for unreferenced code members with optional filters for public members, entry points, and file paths.
GetSolutionInfo
Retrieves summary information about projects contained in a .sln file.