SuperAPI AI Directory

roslyn-codelens-mcp

#️⃣ 🏠 🍎 🪟 🐧 - Roslyn-based .NET code intelligence: type hierarchies, call graphs, DI registrations, diagnostics, code fixes and complexity metrics from pre-built indexes.

Open website

About this tool

Roslyn CodeLens MCP Server is a Roslyn-based MCP (Model Context Protocol) server designed to let AI agents deeply understand the semantic structure of .NET/C# codebases. The project provides a total of 67 tools, covering navigation, call graphs, diagnostics and code fixes, safe refactoring, code quality auditing, test intelligence, dependency injection graphs, and IL/external assembly inspection, among others. The repository description mentions that a hosted deployment exists, located at Fronteir AI.

Main capabilities

Navigation and references: find_implementations finds types that implement an interface or inherit from a class; find_callers finds all call sites of a method, property, or constructor; find_event_subscribers finds where an event is subscribed/unsubscribed; find_references finds all references to any symbol, tagged and deduplicated by kind such as read, write, readwrite, invocation, etc.; go_to_definition finds definition locations; get_method_source retrieves the complete declaration source of one or more members at once.

Types and project structure: get_type_hierarchy traverses base classes, interfaces, and derived types; get_di_registrations scans dependency injection service registrations; get_instantiation_options aggregates all options for constructing a type (constructors, static factory methods, DI registrations, required members); get_project_dependencies retrieves the project reference graph; get_symbol_context exports the context of any type at once; get_public_api_surface enumerates all public/protected types and members in production projects; find_breaking_changes compares against a baseline JSON or DLL to report breaking changes; find_reflection_usage detects dynamic/reflection usage.

Exception and flow analysis: get_exception_flow analyzes exceptions that may escape a method and their propagation paths; find_throw_sites finds where exception types are thrown; find_catch_blocks finds catch blocks and flags filters, rethrows, and empty catches; analyze_data_flow analyzes variable reads, writes, and captures; analyze_control_flow analyzes branch and loop reachability; analyze_change_impact shows the files, projects, and call sites affected by modifying a symbol.

Diagnostics and code fixes: get_diagnostics lists compiler errors, warnings, and Roslyn analyzer diagnostics; get_code_fixes retrieves available code fixes with structured text edits; resolve_stack_trace maps .NET stack traces to file/line/symbol, handling name rewriting such as async/iterator state machines.

Code quality and architecture: get_complexity_metrics provides cyclomatic complexity, cognitive complexity, and maximum nesting depth; find_naming_violations checks naming conventions; find_async_violations detects synchronous waiting on async, misuse of async void, etc.; find_disposable_misuse detects IDisposable/IAsyncDisposable that are not properly disposed; find_large_classes and find_god_objects identify oversized types and god objects; find_unused_symbols detects dead code through reference analysis; check_architecture checks the real semantic type graph according to custom layering rules (forbid and allowOnly); find_circular_dependencies detects circular dependencies; get_project_health aggregates audit results across 7 quality dimensions.

Refactoring operations: get_code_actions discovers refactorings and fixes available at any location; apply_code_action executes Roslyn refactorings by title and supports a preview mode; rename_symbol performs solution-wide safe renaming via the Roslyn Renamer; change_signature adds, removes, or modifies method parameters and rewrites all call sites.

Test intelligence: find_tests_for_symbol finds test methods that cover a production symbol; get_test_summary provides a test inventory for each project; find_uncovered_symbols finds public symbols without test coverage andSorted by complexity; generate_test_skeleton generates a compilable test class skeleton and automatically identifies xUnit/NUnit/MSTest.

External assemblies and IL: inspect_external_assembly browses the types, members, and XML documentation of closed-source NuGet packages and referenced assemblies; peek_il uses ICSharpCode.Decompiler to decompile methods into ilasm-style IL.

Solution and task management: list_solutions, set_active_solution, load_solution, unload_solution, rebuild_solution manage solutions; start_background_task, get_task_status, list_running_tasks manage background tasks; trust_solution, list_trusted_paths, revoke_trust manage analyzer trust.

Composite and shortcut tools: get_type_overview, analyze_method, get_overloads, get_extension_methods, get_operators, get_call_graph, get_file_overview, etc.

Output format and errors All tools that return lists use a unified envelope structure; when truncated is true, it indicates that the first N items in natural sort order are returned. Some tools include a summary aggregate, for example the { error, warning, info, hidden } counts of get_diagnostics. Error responses are isError: true content blocks carrying structured JSON; error codes include SymbolNotFound, SolutionNotTrusted, AmbiguousMatch, FileNotFound, ProjectNotFound, InvalidArgument, Internal. MCP native cancellation is supported.

External assemblies and origins Metadata-origin symbols are first-class citizens: first-layer navigation, second-layer inspection, third-layer IL. Results that return a location include an Origin field (source or metadata) and an IsGenerated flag.

Runtime configuration and security The environment variable ROSLYN_CODELENS_OPEN_PROJECT_TIMEOUT_SECONDS controls the MSBuild load timeout for each project (default 300 seconds); projects that time out are recorded as SkippedProjects entries. For security, a VS/Rider-style trust model is used: a solution passed in when the CLI starts is automatically trusted for the current session, while other solutions must be explicitly trusted via trust_solution; analyzer DLLs must come from the user's NuGet global packages folder, the dotnet SDK installation directory, or the solution directory.

Applicable scenarios and limitations Suitable for scenarios where an AI agent needs to perform semantic-level navigation, analysis, refactoring, and quality auditing of .NET/C# codebases. Specific pricing, licensing, platform support, and hosted deployment details are not yet provided.