# pzalutski-pixel/sharplens-mcp [Health: Active]

**Category:** 💰 Finance & Fintech  
**Repository:** https://github.com/pzalutski-pixel/sharplens-mcp  
**GitHub Stars:** 32  
**npm Downloads (last month):** 565  
**Views:** 4  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/pzalutski-pixel-sharplens-mcp

## Description
⃣ 🏠 - 58 semantic C/.NET analysis tools via Roslyn. Navigation, refactoring, find usages, and code intelligence for AI agents.

## Tools
Capabilities this server exposes over MCP:

- **get_symbol_info** — Semantic info at position
- **go_to_definition** — Jump to symbol definition
- **find_references** — All references; each classified read/write/invocation/cast/typeof/nameof/attribute; optional `kind` filter
- **find_implementations** — Interface/abstract implementations
- **find_callers** — Impact analysis - who calls this?
- **get_call_graph** — Multi-hop callers/callees graph with depth bound + cycle detection
- **find_path_between** — Reachability + the connecting call path(s) between two methods; follows dispatch, with barriers and a checkpoint
- **get_type_hierarchy** — Inheritance chain
- **search_symbols** — Glob pattern search (`*Handler`, `Get*`)
- **semantic_query** — Multi-filter search (async, public, etc.)
- **get_type_members** — All members by type name
- **get_type_members_batch** — Multiple types in one call
- **get_method_signature** — Detailed signature by name
- **get_derived_types** — Find all subclasses
- **get_base_types** — Full inheritance chain
- **get_attributes** — List attributes on a symbol
- **get_containing_member** — Enclosing symbol at position
- **get_method_overloads** — All overloads of a method
- **find_attribute_usages** — Find types/members by attribute
- **get_external_type_info** — Inspect NuGet/BCL/external assembly types — members + XML docs
- **resolve_stack_trace** — Map a pasted stack trace to file/line/symbol, mangling undone
- **get_extension_methods** — Extensions applying to a type — classic and C# 14 blocks
- **get_documentation** — Full XML docs for a symbol with `<inheritdoc>` expanded
- **get_super_method** — Navigate to the base member / interface members a member implements
- **get_diagnostics** — Compiler errors/warnings + configured analyzer findings (StyleCop, Roslynator, NetAnalyzers); matches CI
- **diff_api_surface** — Public-API breaking-change report vs a git ref
- **get_exception_flow** — Which exceptions can escape a method, and where they're caught
- **find_similar_code** — Structural similarity search (token-shingle fingerprints)
- **remove_unused_code** — Compute dead-code removals + newly unused usings (generation-only)
- **find_dead_branches** — Unreachable basic blocks per method (real CFG, not heuristics)
- **add_missing_imports** — Compute the usings that fix CS0246/CS0103 (generation-only)
- **analyze_data_flow** — Variable assignments and usage
- **analyze_control_flow** — Branching/reachability
- **analyze_change_impact** — What breaks if changed?
- **check_type_compatibility** — Can A assign to B?
- **get_outgoing_calls** — What does this method call?
- **find_unused_code** — Dead code detection
- **validate_code** — Compile check without writing
- **get_complexity_metrics** — Cyclomatic, nesting, LOC, cognitive
- **find_circular_dependencies** — Project and namespace cycle detection
- **get_missing_members** — Unimplemented interface/abstract members
- **rename_symbol** — Safe rename across solution
- **change_signature** — Add/remove/reorder parameters
- **extract_method** — Extract with data flow analysis
- **extract_interface** — Generate interface from class
- **generate_constructor** — From fields/properties
- **move_type_to_file** — Compute the contents to move a type into its own file (generation-only)
- **split_type** — Compute a partial-class split for selected members (generation-only)
- **organize_usings** — Sort and remove unused
- **organize_usings_batch** — Batch organize multiple files
- **format_document_batch** — Batch format files in project
- **get_code_actions_at_position** — All Roslyn refactorings at position
- **apply_code_action_by_title** — Apply any refactoring by title
- **implement_missing_members** — Generate interface stubs
- **encapsulate_field** — Field to property
- **inline_variable** — Inline temp variable
- **extract_variable** — Extract expression to variable
- **add_null_checks** — Generate ArgumentNullException guards
- **generate_equality_members** — Equals/GetHashCode/operators
- **generate_test_stub** — Compilable test skeleton for a method (framework auto-detected)
- **get_type_overview** — Full type info in one call
- **analyze_method** — Signature + callers + outgoing calls + location
- **get_file_overview** — File summary with diagnostics
- **get_method_source** — Source code by name
- **get_method_source_batch** — Multiple method sources in one call
- **get_instantiation_options** — How to create a type
- **get_project_health** — Composite audit dashboard: diagnostics + unused + coupling + coverage per project
- **find_god_objects** — Detect over-coupled types via efferent + afferent coupling + member-count thresholds
- **find_untested_code** — Find public surface not reached by any [Fact]/[Theory]/[Test]/[TestMethod]
- **find_tests** — Which tests cover a symbol — the inverse of find_untested_code
- **find_type_instantiations** — Where a type is constructed (`new T`)
- **find_pattern_usages** — Where a type appears in is/as/pattern matches
- **find_throw_sites** — Where an exception type is thrown (optionally derived)
- **find_catch_blocks** — Where an exception type is caught (optionally via a base clause)
- **find_async_issues** — async void / blocking-on-async / unforwarded CancellationToken
- **check_architecture** — Enforce namespace/project dependency rules over the type graph
- **find_naming_violations** — Naming audit honoring .editorconfig rules, with conventional defaults
- **get_di_registrations** — Scan DI service registrations
- **find_reflection_usage** — Detect reflection/dynamic usage
- **find_interceptors** — Surface [InterceptsLocation] call rerouting, generated code included

## Claude Desktop Quick Installation
Install path detected from listing signals. Uses `npx` (confidence: high):

```json
"mcpServers": {
  "sharplens-mcp": {
    "command": "npx",
    "args": ["-y","sharplens-mcp"],
    "env": {
      "DOTNET_SOLUTION_PATH": "",
      "SHARPLENS_ABSOLUTE_PATHS": "",
      "SHARPLENS_LOG_LEVEL": "",
      "SHARPLENS_TIMEOUT_SECONDS": "",
      "SHARPLENS_MAX_DIAGNOSTICS": "",
      "SHARPLENS_ENABLE_SEMANTIC_CACHE": ""
    }
  }
}
```

**Requires environment variables:** `DOTNET_SOLUTION_PATH`, `SHARPLENS_ABSOLUTE_PATHS`, `SHARPLENS_LOG_LEVEL`, `SHARPLENS_TIMEOUT_SECONDS`, `SHARPLENS_MAX_DIAGNOSTICS`, `SHARPLENS_ENABLE_SEMANTIC_CACHE` — the values above are empty placeholders; fill in real credentials before running (see the repository for what each one is for).

## Documentation

## What pzalutski-pixel/sharplens-mcp MCP server does

The pzalutski-pixel/sharplens-mcp MCP server gives coding agents semantic access to C# and .NET solutions through Microsoft Roslyn. Rather than treating source files as plain text, it resolves symbols, types, members, overloads, inheritance, attributes, and external assembly information using the compiler’s model.

Its tool set covers navigation, discovery, diagnostics, code-quality analysis, impact assessment, and refactoring support. Examples include locating definitions and references, finding callers and implementations, constructing bounded call graphs, comparing a public API with a Git reference, tracing exception flow, identifying dead branches, and resolving pasted stack traces to source locations. Several operations support batches or preview-style generation so an agent can inspect proposed changes before applying them.

## How it works

The server maintains an in-memory representation of the loaded solution for responsive queries. Set `DOTNET_SOLUTION_PATH` to load a `.sln` or `.slnx` file at startup, or call `load_solution` before using analysis tools. Responses use a structured `success/error/data` shape and can include suggested follow-up tools. Coordinates are zero-based.

Roslyn-based resolution is useful for cases where textual matching is ambiguous, such as overloaded methods, partial types, inheritance, dispatch, or read/write reference classification. The server can also inspect NuGet, BCL, and other external assembly types when the solution provides the relevant references.

## Setup and configuration

Install the pzalutski-pixel/sharplens-mcp MCP server with the SharpLensMcp global .NET tool or run the npm package with `npx -y sharplens-mcp`. A stdio client configuration can invoke the npm package and pass `DOTNET_SOLUTION_PATH` in its environment. The README specifically documents Claude Code setup through a project `.mcp.json` file.

Supported configuration variables are:

- `DOTNET_SOLUTION_PATH`: startup solution path; if absent, use `load_solution`.
- `SHARPLENS_ABSOLUTE_PATHS`: return absolute rather than relative paths.
- `SHARPLENS_LOG_LEVEL`: set logging verbosity.
- `SHARPLENS_TIMEOUT_SECONDS`: set the long-operation timeout.
- `SHARPLENS_MAX_DIAGNOSTICS`: limit returned diagnostics.
- `SHARPLENS_ENABLE_SEMANTIC_CACHE`: enable or disable semantic caching.

## Tools and capabilities

The pzalutski-pixel/sharplens-mcp MCP server exposes tools for:

- Symbol lookup, definitions, references, implementations, callers, call graphs, and paths between methods.
- Type hierarchies, derived and base types, members, overloads, attributes, documentation, extension methods, and super methods.
- Compiler and analyzer diagnostics, API compatibility checks, data-flow and control-flow analysis, exception flow, and change-impact analysis.
- Similar-code detection, dead-code and unreachable-branch analysis, stack-trace resolution, and external type inspection.
- Refactoring and generation workflows, including safe previews and batch operations, where provided by the server.

## Limitations and notes

The in-memory model can become stale after files are changed by external editor or file tools. Call `sync_documents` for modified, created, or deleted C# files. Changes made through the server’s own refactoring tools are updated automatically; project-file changes require `load_solution` instead.

If no startup solution path is configured, analysis cannot begin until `load_solution` has been called. The README also notes that tool names no longer use the older `roslyn:` prefix; current names omit it, while prefixed aliases are retained temporarily for one migration release.

_Full upstream README: https://allmcps.com/mcp/pzalutski-pixel-sharplens-mcp/readme_

