# Slnmap

> A local semantic code graph and MCP server that gives AI coding agents a compiler-accurate map of your entire .NET solution for precise refactoring and impact analysis.

Slnmap (sln-map) is an open-source CLI tool and MCP server built by Mahmoud Nabil that gives AI coding agents a precise, compiler-accurate map of .NET solutions. It uses the Roslyn compiler platform to build a semantic graph of every type, member, and relationship in a solution, stores it locally as a SQLite database, and serves it to agents or editors over the Model Context Protocol (MCP). The project is MIT-licensed and available on GitHub.

## What It Is

Slnmap solves a concrete problem: AI agents refactoring .NET code can only see files already in their context window, so they miss callers in other projects, misidentify dependencies, and hallucinate breaking changes. Slnmap builds a whole-solution graph — every caller, every implementation, every inheritance edge — and exposes it through fifteen read-only MCP tools so an agent can answer architecture questions correctly across every project in the solution. It runs entirely locally with no telemetry and no cloud service.

## How the Graph Is Built

Slnmap uses `MSBuildWorkspace` (Roslyn) to perform design-time builds of each project, extracting:
- **Symbols**: types, members, interfaces, events, endpoints
- **Relationships**: Calls, Implements, Inherits, References edges
- **HTTP endpoints**: ASP.NET Core Minimal APIs and attribute-routed controllers, resolved statically including `MapGroup` prefixes, `const` patterns, class-level `[Route]`, and controller base classes from packages like Ardalis.ApiEndpoints
- **Frontend call sites** (via `analyze-ts`): TypeScript/React HTTP calls resolved through const-through-barrel re-exports and template literals, linked to C# endpoints via `slnmap link`

The graph is stored in a local `slnmap.db` SQLite file. Updates are incremental and crash-safe — an interrupted run never corrupts the existing graph. The `slnmap watch` command (added in v0.10.0) keeps a warm Roslyn workspace in memory and re-analyzes on file save, bringing a one-file semantic change down to roughly one second end-to-end on a representative solution.

## MCP Tool Surface

The MCP server exposes fifteen read-only tools covering the most common agent architecture queries:
- `find_symbol`, `get_symbol_source` — locate and read any symbol by FQN
- `impact_analysis` — every symbol that transitively depends on a given one, depth 5, counts-first
- `find_usages`, `find_implementations`, `get_type_hierarchy` — reference and inheritance traversal
- `get_architecture_overview`, `get_project_dependencies`, `find_circular_dependencies` — solution-level structure
- `list_endpoints`, `find_endpoint` — HTTP endpoint discovery across Minimal APIs and controllers
- `find_orphan_calls`, `list_frontend_callsites` — cross-stack frontend→backend linking (after `slnmap link`)
- `find_tests_for_symbol` — test members that transitively exercise a symbol

Malformed calls return a structured JSON payload (`status`/`code`/`message`/`hint`) rather than opaque errors, so agents can self-correct without human intervention.

## Update: v0.12.0 — Cross-Stack Impact Analysis

The latest release (v0.12.0, published August 2026) is titled "Change a handler, see the React call sites that break." It completes the cross-stack linking feature: after running `slnmap analyze`, `slnmap analyze-ts`, and `slnmap link`, `impact_analysis` and `find_usages` on a C# handler continue straight through to its frontend callers — surfacing the exact React call sites that break when a backend handler changes, with no separate query. Earlier notable releases include v0.10.0 (`slnmap watch` for warm-workspace incremental analysis) and v0.8.0 (attribute-routed controller endpoint support).

## Privacy and Deployment Model

Slnmap is fully local by design. The README states that `analyze`, `watch`, `serve`, `viz`, `status`, and `doctor` make no network calls at all — analysis works fully offline. The one documented exception is `analyze-ts`, which fetches the `slnmap-ts` npm extractor via `npx` on first use; no source code is ever sent anywhere. Because the CLI and MCP server are open source, the no-telemetry claim is auditable from the source code. The tool runs on Windows, macOS, and Linux and requires the .NET 9 SDK; `analyze-ts` additionally requires Node.js 18+.

## Features
- Roslyn-powered semantic code graph of entire .NET solutions
- 15 read-only MCP tools for architecture queries
- Impact analysis across all projects and callers
- HTTP endpoint discovery for Minimal APIs and attribute-routed controllers
- TypeScript/React frontend call site analysis via analyze-ts
- Cross-stack frontend-to-backend linking via slnmap link
- Incremental and crash-safe graph updates
- Warm-workspace watch mode for ~1s re-analysis on file save
- Interactive HTML graph visualization export
- Fully local with no telemetry or cloud service
- Structured error payloads for agent self-correction
- Circular dependency detection
- Test-to-symbol traceability
- SQLite-backed local graph storage
- Works with any MCP client including Claude Code

## Integrations
Claude Code, MCP (Model Context Protocol), Roslyn / MSBuild, ASP.NET Core Minimal APIs, ASP.NET Core attribute-routed controllers, Ardalis.ApiEndpoints, TypeScript, React, npm / npx, NuGet, SQLite

## Platforms
WINDOWS, MACOS, LINUX, API, CLI

## Pricing
Open Source

## Version
v0.12.0

## Links
- Website: https://github.com/EMahmoudNabil/slnmap
- Documentation: https://github.com/EMahmoudNabil/slnmap#readme
- Repository: https://github.com/EMahmoudNabil/slnmap
- EveryDev.ai: https://www.everydev.ai/tools/slnmap
