Navigate and safely change C#/.NET code with the aicb MCP server (Roslyn-backed) instead of text search. Use whenever a task touches a C# symbol - who calls this method, what breaks if I change this interface/enum/DTO, where is this interface implemented, what overrides what, which tests cover it, what gets injected where, dead code, dependency cycles, side effects, live compiler errors - or when packing codebase context for an LLM. Also states when plain grep is still the right tool.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Aicb Csharp Context?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/gregordadera-aicb-csharp-context)
---
name: aicb-csharp-context
description: Navigate and safely change C#/.NET code with the aicb MCP server (Roslyn-backed) instead of text search. Use whenever a task touches a C# symbol - who calls this method, what breaks if I change this interface/enum/DTO, where is this interface implemented, what overrides what, which tests cover it, what gets injected where, dead code, dependency cycles, side effects, live compiler errors - or when packing codebase context for an LLM. Also states when plain grep is still the right tool.
compatibility: Requires the .NET 10 SDK (without .NET 10, the next newer .NET installed and that version's SDK) and the `aicb` dotnet tool wired up as an MCP server. Analyzes C# solutions (.sln/.slnx) only.
metadata:
project: AIContextBuilder
version: "1.0"
---
# C# code navigation with aicb
`aicb` is a read-only MCP server that answers questions about a C# solution from
the Roslyn semantic model. Text search cannot answer those questions correctly:
grep matches substrings and therefore misses overloads, aliased usings, `partial`
types, interface dispatch and inherited members - while happily matching comments
and unrelated identifiers.
Tool names below are unprefixed. Your host may namespace them (for example
`mcp__aicb__find_usages`); use whatever form your tool list shows.
## Setup (once per machine)
The server is the `aicb` dotnet tool (requires the .NET 10 SDK; without .NET 10 it
runs on the next newer .NET installed and needs that version's SDK; .NET 8 or
.NET 9 alone cannot start it), published on nuget.org as `aicb-roslyn-mcp`:
```sh
dotnet tool install -g aicb-roslyn-mcp
```
If aicb reports that MSBuild could not be registered, install the .NET 10 SDK, or
set `DOTNET_ROLL_FORWARD=LatestMajor` so that it runs on the newest .NET (a
preview .NET additionally needs `DOTNET_ROLL_FORWARD_TO_PRERELEASE=1`).
`dotnet tool update -g aicb-roslyn-mcp` updates it; a machine that still has the
package under its former name first runs `dotnet tool uninstall -g AIContextBuilder`.
On Windows with the desktop
app, install the Windows installer INSTEAD: it contains this same server, and one
`aicb` per machine keeps updates from reaching a copy nothing runs. Documentation
and releases: https://github.com/gregordadera/aicb-roslyn-mcp
Then register the server with your agent, e.g. `.mcp.json` in the project root:
```json
{ "mcpServers": { "aicb": { "command": "aicb", "args": ["mcp"] } } }
```
## Step 0 - the session
Every tool accepts the **absolute `.sln` path directly as `session_id`**
(self-init). No separate analyze step is needed. The first call pays the Roslyn
load; every later call reuses the warm session, so keep passing the same value.
The server reads **live source, including uncommitted work**.
## Which tool answers which question
| Question | Tool |
|---|---|
| Who calls / uses X? | `find_usages` |
| What breaks if I change X? (transitive) | `impact_of_change` |
| Where is this interface implemented? | `find_implementations` |
| What overrides X / what is the base chain? | `find_overrides`, `get_type_hierarchy` |
| Which tests cover X? Where are the gaps? | `find_tests_for`, `coverage_gaps` |
| What is injected here? Where is it constructed? | `resolve_injection`, `instantiation_sites` |
| What does X look like? What does it do? | `symbol_signature`, `explain_symbol` |
| Where is the symbol named X? | `find_symbol` |
| Who uses SEVERAL symbols at once? (one round trip, up to 16) | `batch` with N `find_usages`/`find_symbol` sub-queries - the semantic form of a multi-name search; a tool takes exactly ONE symbol per call |
| Does the code compile right now? | `refresh_session`, then `get_diagnostics` (see "After you edit") |
| What findings would this change introduce? (in-memory, nothing written) | `evaluate_change_set` |
| Unused private methods? | `find_dead_code` |
| Namespace dependency cycles? | `detect_circular_dependencies` |
| Side effects (I/O, database, network)? | `find_by_side_effects` |
| Which external (BCL / NuGet) members are called, and where? | `calls_external` |
| Which members carry attribute X? | `find_by_attribute` |
| Size and complexity metrics of a symbol? | `symbol_metrics` |
| Code smells and design findings? | `list_insights` |
| How is this solution laid out? | `architecture_overview` |
| Give me the source of one symbol, fast | `get_context` |
| Give me context for a reading task | `pack_for_task` |
| Give me edit-ready context (covering tests + naming siblings bundled) | `prepare_task` |
| Give me the whole solution as Markdown | `export_markdown` |
About to **edit**, not just read? `prepare_task` bundles the covering tests and the
naming/file-convention siblings and renders through the active facet template -
prefer it before a change.
`get_context` is the fastest single-symbol retrieval.
`export_markdown` is the whole-solution firehose, rarely the right call.
Call `list_skills` for the full map of tool bundles - one cheap call instead of
reading many schemas. It also lists specialized tools beyond the table above
(structural twins, call-path tracing, API-surface diffs, XAML binding checks).
If a tool it names is not in your tool list, the active profile does not expose
it: start the server with `AICB_MCP_TOOLS=all` for the full surface.
`server_info` reports version and configuration.
## The pre-edit gate
Before **any** edit that changes a symbol other code names - a rename, a
signature, a default value, a visibility change, a deletion, or a shared enum,
interface, DTO or registration list - the **first** call is `impact_of_change`.
The trigger is how far the symbol *reaches*, not what kind of edit it is. A
rename is the case that slips: it looks like mechanical text work, and the
compiler does catch every renamed reference - so the gate feels unnecessary. But
a compiler checks names, not assumptions, and the consumers listed below are
exactly the ones it never sees.
It returns the transitive fan-in, including consumers the compiler will not flag:
- a count assertion in a test (`Should().HaveCount(7)`),
- a non-exhaustive `switch` *statement* that silently skips a new enum case,
- a parallel list somewhere else that must grow with yours.
`find_usages` shows only direct callers; the compiler shows only type errors.
Neither is the same question.
Then check the two channels the C# fan-in does not carry, markup and pinned
text. Both are where a careful fan-in analysis still misses a site.
**Markup**: `find_binding_usages` for a property a view binds,
`find_resource_usages` for a resource key.
**Pinned text**: a test that asserts a doc comment, a tool description or an
error message as a string pins the WORDING, not the symbol - search the old
wording before you change it.
Treat the reported `risk` level as a measure of **fan-in size, not of your
change**. A purely additive change to a high-fan-in type is expected to read
"high" - that is not a stop sign. Check instead whether any consumer relies on
the specific value or on completeness. The risk level is calibrated on
**production** fan-in (`productionImpactCount`); test callers are excluded,
because updating them is mechanical. On an interface or abstract member or type
the answer lists `implementers`, and `risk` then reads `riskBasis`: the same
count plus the production types that implement it, since a signature change
breaks those too (on a type only the ones naming it in their own base list;
the ones inheriting it through a base class are listed under `indirect`).
## How far to trust an answer
The tools are not equally reliable, and the ranking runs **against** usage: the
ones called least are the ones that misled most. Measured 2026-09-02 over 975
corpus entries against 12 638 recorded calls, as misleading mentions per 100
calls (direct calls plus `batch` sub-queries).
| Tool | per 100 calls | What to do about it |
|---|---|---|
| `find_production_dead` | **7.4** | Worst of the family. Prefer `find_dead_code` (0.27) and read a "dead" verdict as a hypothesis to disprove - never as license to delete. |
| `find_structural_twins` | **6.2** | Reports similarity, not equivalence. Read both candidates before merging anything. |
| `find_by_resource_leak` | **5.1** | Low volume, weak precision. Cross-check the disposal path by hand. |
| `find_by_concurrency_risk` | **3.5** | The signal has changed direction three times across milestone analyses. Treat as a pointer, not a finding. |
| `instantiation_sites` | 2.3 | Blind to container and reflection construction. Pair with `resolve_injection`. |
| `find_by_side_effects` | 2.0 | Needs a **built and restored** solution. On an unbuilt tree it reports 0 effects - which reads exactly like a clean result. |
| `coverage_gaps` | 1.8 | Answers a narrower question than its name suggests; read the disclosed denominators. |
| `find_binding_usages` | 1.6 | Answers a narrower question than its name suggests; read the disclosed denominators. |
| `find_tests_for` | 1.6 | Its strong tier walks **two** hops: a `-via` reason is second-hand, through one helper. For a type, `constructs` counts a test that only builds it - the type is exercised, not every member. |
| `find_usages` · `impact_of_change` · `refresh_session` · `server_info` | **0.2 - 0.5** | The reliable core. This is where the forced switch earns its keep. |
| `find_dead_code` | 0.27 | Reliable as well, and deliberately narrow (see below). |
Two things this table does not say. It is a **rank order, not an error rate**:
the numerator counts entries that named a tool as misleading, the denominator
counts calls, and those are different populations. And a tool absent from the
table was not *proven* clean - 39 of the 73 tools simply never drew a complaint,
most of them because they are barely called.
The practical rule: **the further down a tool sits in the call counts, the more
its answer is a lead rather than a fact.** A result from the reliable core can
carry a conclusion on its own; a result from the long tail needs a second source
before you act on it.
## Reading the results
**An empty result is not proof of absence.** If `find_usages` resolves a symbol
but returns no users, or `impact_of_change` reports `risk: none`, the symbol
exists and has no *statically detectable* fan-in. It may still be reached
through XAML data binding, a DI registration, reflection, or a source generator
- none of which static analysis sees. Empty means "verify elsewhere", never
"safe to delete". `resolvedKind: "not_found"` is the different answer: the name
resolved to nothing (the response then suggests the nearest declared name).
**Results are capped, totals are not.** `find_usages` returns at most 100 items
but reports `totalFound` and `truncated`; `impact_of_change` caps its item list
at 20 while `directCount` / `transitiveCount` stay true totals. Read the counts,
not the list length.
**`find_dead_code` is deliberately narrow**: private methods with zero callers,
test projects excluded by default. Public and internal members are omitted
precisely because of the framework escapes above.
## After you edit
1. `refresh_session` - re-analyze. **Everything below depends on this, including
`get_diagnostics`.** Usually the incremental path: document texts replayed
into the warm snapshot, no MSBuild reload.
2. `get_diagnostics` - compiler errors and warnings in seconds; a cheap gate
before a real build. Compiler diagnostics only: third-party analyzers are not
run, and diagnostics that a source generator reports itself are not included.
**That order is not cosmetic.** `get_diagnostics` compiles the *session's*
document snapshot, not the files on disk - so without the refresh it describes
the code as it was *before* your edit. Measured: a freshly written `CS0029`
answers `errorCount: 0`, and the same call after `refresh_session` answers `1`.
Such an answer leads with `verdict: "stale"` and says so, but the caveat is
cheaper to avoid than to read.
For a structural change, call `save_session` before and `compare_with_previous`
after to see what actually moved.
## Symbol or text? (when grep is still right)
Ask this before every text search:
- **A PascalCase C# identifier** - type, method, interface, property, field - is
a **symbol**. Use the table above, not grep.
- **A multi-name alternation (`A|B|C`) is text by construction**: no MCP tool
accepts a multi-name pattern. If it was a usage question on several names, the
semantic form is one `batch` call with N `find_usages` sub-queries; for finding
test methods / assertion sites / model fields by name, grep stays the right tool.
- **Text stays text**: string literals, comments, log messages, config keys,
version strings, SQL, regexes.
- **Non-C# files stay grep**: `.xaml`, `.json`, `.csproj`, `.md`, `.yml`. The
fan-in graph covers C# edges plus the markup forms listed under "Limits worth
knowing" below; source-generated code is not walked.
- Reading a file you are about to edit is always fine.
`aicb` is **read-only**. It never writes; make changes with your normal edit
tools, and use your shell for build, test and git.
## First run on an unfamiliar solution
`solution_config_status` reports whether namespace exclusions, test detection and
layer mapping are set up. If a slot is uninitialized, run `init_solution_config`
and then `apply_solution_config` - this is persisted to the config DB and to a
git-tracked `<Solution>.aicb.json` next to the `.sln`, so the setup travels with
the repository.
## Limits worth knowing
- C# only, one solution per session.
- Opening a solution runs its MSBuild logic to resolve references, exactly like
an IDE - analyze only solutions you trust.
- Results reflect the last analysis: after **your own** edits, `refresh_session`.
- The fan-in graph records these markup forms (`.xaml` and `.axaml`): a
`{Binding}` ROOT member (low-confidence, tagged `(xaml)`, against the resolved
view-model), an event wire to a code-behind method (`Click=` and the other event
attributes), an `{x:Static}` member, an attached-property accessor, a property
site (attribute, property element, `Setter`/`Trigger` `Property=`), a
`{TemplateBinding}` member, and a TYPE reference. Not in it: a resource key, a
`{Binding}` inside a Style or ControlTemplate other than the element's own
inline style (unless its member is on the page view-model), and anything
activated by name at runtime. An empty `find_usages` answer names these gaps in
its `note` - read it before concluding "unused".
- A resource key's users: `find_resource_usages`.
- For "who binds X in markup", `find_binding_usages` is still the direct question.
- Broken `{Binding}` members are a separate, opt-in check:
`find_unresolved_bindings`.