aicb-roslyn-mcp
# AIContextBuilder (`aicb`)
<!-- mcp-name: io.github.gregordadera/aicb-roslyn-mcp -->
[](https://www.nuget.org/packages/aicb-roslyn-mcp)
[](https://www.nuget.org/packages/aicb-roslyn-mcp)
[](https://registry.modelcontextprotocol.io/?q=io.github.gregordadera%2Faicb-roslyn-mcp)
[](https://github.com/gregordadera/aicb-roslyn-mcp/blob/main/EULA.md)
[](https://m8ven.ai/mcp/gregordadera-aicb-zb5d9e)
**Semantic code intelligence for AI coding agents on C#/.NET.**
*Before AI changes your code, understand the impact.*
`aicb` gives coding agents a Roslyn-accurate map of your C#/.NET solution. It
answers the questions an agent has to get right before it edits code - who calls
this, what a change reaches, which tests cover it, what dependency injection
resolves, which code has side effects - and packs the code a task needs into
compact, token-budgeted Markdown. It runs locally as an MCP server and CLI for
Claude Code, Codex, OpenCode, Cursor and any other MCP client that starts a stdio
server; a Windows desktop
app adds visual context selection, analysis and editing.
| | What your agent gets | Tools |
|---|---|---|
| **Code change intelligence** | The reach of a change before the edit: direct and transitive users, the tests that cover them, a risk level, and review evidence afterwards | `impact_of_change`, `find_tests_for`, `review_context`, `verify_claim` |
| **Semantic code intelligence** | Roslyn-accurate symbol answers on large solutions - overloads, interfaces, overrides, partial and generated code - plus the dependency injection and XAML bindings the code states | `find_usages`, `find_implementations`, `resolve_injection`, `find_by_side_effects` |
| **Intelligent context engineering** | The code a task needs, within the budget the agent has, instead of a source dump - and a tool list sized to the model | `prepare_task`, `pack_for_task`, `measure`, MCP profiles |
Free for individuals, education and organizations below the
[license thresholds](#license-at-a-glance), with commercial licenses for larger
teams. This repository hosts the releases, the documentation and the license.
## Quick start
You need the .NET 10 SDK. Install the tool once, then run `aicb init` in the project
you want your agent to work on:
```sh
dotnet tool install -g aicb-roslyn-mcp
aicb init
```
Restart your coding agent and ask it to call `server_info`: the answer names the
AICB version. Details: [Install](#install), [Connect a coding agent](#connect-a-coding-agent)
and the [getting started guide](https://github.com/gregordadera/aicb-roslyn-mcp/blob/main/docs/GETTING-STARTED.md).
## Know the impact before the edit
Ask your coding agent:
> What could be affected if I change `ColorMixerService`? Use AICB.
Or call the same tool from a terminal:
```sh
aicb call impact_of_change --sln C:/repo/App.sln --arg symbol=ColorMixerService
```
Abridged output on the `ColorMixer.SelectionLab` sample that ships with the desktop app:
```json
{
"symbol": "ColorMixerService",
"resolvedKind": "type",
"directCount": 1,
"transitiveCount": 2,
"risk": "low",
"productionImpactCount": 2,
"directImpact": {
"items": [
{
"name": "DemoCompositionRoot",
"file": "ColorMixer.SelectionLab.ConsoleApp/DemoCompositionRoot.cs",
"line": 9
}
]
}
}
```
The desktop app's **MCP Usage** page records calls locally and separates guided
refusals from suspected defects:

That answer comes from the Roslyn symbol graph, not a substring search. AICB
distinguishes overloads, follows interface and override relationships, understands
partial types and records DI construction paths.
## Build context that fits the task
AICB does more than answer individual symbol questions. It can assemble a focused,
task-specific context package for an agent instead of sending an unfiltered source
dump:
| Need | Tool | What it returns |
|---|---|---|
| Read one symbol in context | `get_context` | The symbol plus its direct dependencies and callees |
| Explore a named symbol with selected surroundings | `explain_symbol` | Callers, callees, implementations, tests or other requested dimensions |
| Pack context for a natural-language goal | `pack_for_task` | Goal-named symbols and their semantic neighborhood |
| Prepare to edit | `prepare_task` | The goal-focused context plus covering tests and likely siblings such as a factory or validator |
| Check the response cost first | `measure` | A tokenizer count (cl100k_base) of one or more planned tool answers, without returning their large payloads |
The focused context tools accept a **token budget**, so a package fits the room your
agent has. The symbols you name stay in; when the budget is tight, the package
becomes less detailed around them instead of being cut off in the middle of a block,
and a leading note says which types, tests or siblings were left out. AICB can
therefore tell you that a bundle was reduced or capped; it cannot certify that what
remains is enough to solve the task correctly. Whole-document rendering can use the
same budget through a pipeline profile, with an allowance for overshoot and an
optional report of what was trimmed.
The result is **AI-Builder-MD**: structured Markdown for an LLM, containing the
selected code together with symbol relationships, architecture graphs, semantic
metadata and provenance. It can use the established tag notation or YAML. See the
[context-document guide](https://github.com/gregordadera/aicb-roslyn-mcp/blob/main/docs/manual/general/05-the-context-document-ai-builder-md.md)
and the [task-packing tools](https://github.com/gregordadera/aicb-roslyn-mcp/blob/main/docs/manual/mcp/09-tool-reference-markup-export-review-and-insights.md#92-packing-and-exporting-context).
### Add explicit meaning with AI Tags and semantic annotations
AICB works without annotations. Where source structure and conventions are not
enough, optional `<ai>` tags in XML documentation let a developer state the intended
role of a type or method explicitly:
```csharp
/// <ai
/// role="service"
/// layer="Application"
/// responsibility="Coordinates order validation and submission."
/// stability="Stable"
/// />
public sealed class OrderService
```
Annotations can describe semantics such as role, domain, architectural layer,
priority, stability, responsibility and side effects. Explicit values take
precedence over heuristic inference; sentinel values such as `none` can deliberately
suppress inference for one field. AICB preserves provenance so an agent can
distinguish source-derived facts, author-provided meaning and inferred hints. The
[AI annotation reference](https://github.com/gregordadera/aicb-roslyn-mcp/blob/main/docs/manual/general/03-core-concepts.md#39-the-ai-annotation)
documents the supported forms and fields.

## What happens after your first question
1. **The first question about a solution takes the longest.** You name a `.sln`,
`.slnx` or `.slnf`; AICB loads it the way your build would and reads its C#
code and its XAML/AXAML markup.
2. **The questions after it are quick.** Callers, implementations, tests,
injection and impact come from what the first analysis learned, as a single
answer or as a context document sized to your budget.
3. **Your saved edits are picked up.** With the shipped settings the next
question brings the analysis up to date with the saved files; an explicit
refresh does the same in every setting.
AICB analyzes the solution once and then answers each question from what it
learned: who calls what, which types use or implement which, what the markup refers
to and which code reaches outside the program. Follow-up questions therefore come
back quickly, and the context tools pick and render the part of the code a task
needs. This does **not** mean that every possible answer or runtime relationship is
known in advance.
Every agent session that starts `aicb mcp` gets its own analysis, and the desktop
app, the CLI and the server answer alike and can share configuration and saved
snapshots. After you edit source files, the next refresh picks up what changed,
usually without loading the solution again (`force: true` loads it completely). A
client that gives up waiting for a long first analysis can simply ask again: the
analysis finishes anyway, and a retry with the same arguments gets it from the
cache.
### Live sessions, snapshots and persistent codebase memory
These states serve different purposes and should not be treated as interchangeable:
| State | Lifetime and purpose | Important boundary |
|---|---|---|
| Live MCP session | In-memory graph and Roslyn workspace reused by one server process | Sees saved files, not unsaved editor buffers; another server process has a separate session |
| Remembered codebase | `remember_codebase` persists an analyzed model; `recall_codebase` can rehydrate it later or in another process without running Roslyn | A recalled session has no live workspace, no reliable line numbers and a reduced insight contract; use `refresh_remembered` when live precision is required |
| Saved snapshot | Named baseline used by `compare_with_previous` and public-contract comparison | A comparison baseline, not a live workspace |
| `<Solution>.aicb.json` | Git-trackable solution configuration | Contains rules and choices, never analysis results, sessions or credentials |
`remember_codebase`, `recall_codebase` and `refresh_remembered` are opt-in tools: no
MCP profile exposes them, so start the server with `AICB_MCP_TOOLS` naming them (or
`AICB_MCP_TOOLS=all`). `recall_codebase` reports whether the persisted model still matches the source,
payload schema and analyzer identity. It deliberately returns the recalled model
even when it is stale, with metadata that tells the agent when a live re-analysis
is necessary. See [sessions, recall and staleness](https://github.com/gregordadera/aicb-roslyn-mcp/blob/main/docs/manual/mcp/03-sessions-and-staleness.md).
### Answers that carry their own evidence
An AICB answer says not only what it found but how far it can be trusted.
**Unknown** and **verified absent** are different answers: tools such as
`assert_absence` return `confirmed`, `refuted` or `indeterminate`. Responses carry
these signals whenever they apply; an agent reads them before it acts on an empty,
short or apparently definitive result:
| Signal | Meaning | Typical response |
|---|---|---|
| `staleness` | Saved source changed after the analysis, or an automatic refresh ran or failed | Save the files and refresh if the response is not current |
| `incompleteProjects` or `verdict: "inconclusive"` | Project references could not be resolved well enough for a complete semantic graph | Restore, then call `refresh_session`; after a build, `refresh_session(force: true)` |
| `totalFound` and `truncated` | More matches exist than were returned | Narrow the scope, paginate or raise the documented cap |
| Bundle manifest or leading omission note | A token budget removed surrounding types, tests or sibling implementations | Increase the budget or request the missing axis explicitly |
| `namesakes` or `mergedNamesakes`, ambiguity or multiple candidates | A name did not resolve to one unique symbol | Repeat the query with a qualified symbol name |
| `confidence`, provenance, dynamic or unknown markers | A value is measured, author-supplied, inferred or not statically knowable | Preserve the uncertainty and verify the relevant runtime configuration when needed |
| `origin: "Recalled"` or `lineNumbersAvailable: false` | The answer came from persisted memory rather than a live Roslyn workspace | Use `refresh_remembered` before relying on live-only details |
The analysis covers statically visible C# - including the C# the Razor generator
compiles from `.cshtml` views and the code source generators add (an answer says
when generated code is missing) - together with Razor, XAML and AXAML relationships. Where a relationship exists only at runtime
(reflection, assembly scanning, dynamic configuration, an external consumer, a
registration produced at runtime), AICB marks it as dynamic or unknown instead of
inventing it, and a XAML binding whose data type is not known for certain stays
unjudged rather than reported as broken.
The MCP profile controls automatic refresh. `Off` only discloses drift,
`Reactive` refreshes before a reading tool answers and is the normal shipped
setting, while `Proactive` starts analysis after saved edits settle. Automatic
refresh never sees unsaved editor buffers. Staleness is also different from
reference incompleteness: the first needs a refresh; the second normally needs a
restore followed by a refresh (after a build, a forced one).
The question-first [architecture, limits and evidence guide](https://github.com/gregordadera/aicb-roslyn-mcp/blob/main/docs/ARCHITECTURE.md)
explains what lives in memory, how refresh and context selection work, which claims
are measured, and where the published scale benchmark stands.
## Where it helps
| Question | Tool |
|---|---|
| Who calls or uses this? | `find_usages` |
| What is the blast radius of a change? | `impact_of_change` |
| Where is this interface implemented or overridden? | `find_implementations`, `find_overrides` |
| Which tests exercise this symbol? | `find_tests_for` |
| What gets injected here? | `resolve_injection` |
| Which code has side effects or calls an external API? | `find_by_side_effects`, `calls_external` |
| What context does an agent need for this task? | `explain_symbol`, `prepare_task`, `pack_for_task` |
| How large would these answers be before I pull them? | `measure` |
| Where is this property or resource used in XAML/AXAML? | `find_binding_usages`, `find_resource_usages` |
| Which markup bindings cannot be resolved safely? | `find_unresolved_bindings` |
| What changed between two analyzed states? | `semantic_diff`, `diff_review` |
| Does this change set violate a policy or public contract? | `evaluate_change_set`, `compare_public_api` |
| Is the claim that this symbol is unused, untested or absent actually supported? | `assert_absence`, `verify_claim` |
| What evidence should a reviewer see for these changed symbols? | `review_context` |
| Where are concurrency, resource-lifetime or event-subscription risks? | `find_by_concurrency_risk`, `find_by_resource_leak`, `find_by_event_subscription` |
| Where did repeated structures, conventions or documentation drift apart? | `find_structural_twins`, `check_pattern_drift`, `check_doc_drift` |
The default profile exposes every tool in this table except `semantic_diff`,
`diff_review`, `find_by_concurrency_risk`, `find_by_resource_leak`,
`find_structural_twins`, `check_pattern_drift` and `check_doc_drift`, which need the
Full Select profile, and `compare_public_api`, which is opt-in (see
[Tool sets and Agent Skills](#tool-sets-and-agent-skills)).
These tools form a broader capability map rather than a flat search catalog:
| Capability | Examples |
|---|---|
| Semantic navigation | usages, implementations, overrides, hierarchy, DI and XAML |
| Change safety | impact, tests, diagnostics, review context and public API comparison |
| Runtime-risk indicators | concurrency, resources, events, external calls and side effects |
| Architecture and consistency | layers, cycles, structural twins, pattern drift and documentation drift |
| Verification | negative claims, baseline-to-changed claims and change-set policy |
| Context economy | task packing, measurement, token budgets and compression |
The desktop app turns code-quality, security, design and architecture findings
into an actionable review queue:

AICB is most useful for non-trivial C#/.NET solutions and semantic questions that
plain text search cannot answer reliably. It analyzes C#; selected XAML/AXAML
relationships supplement that graph. Other programming languages are out of scope.
Multi-targeted projects are loaded once per target framework by default, while
query surfaces generally deduplicate them to one logical project: each type is one
entry, and the references every target makes count for it. Setting
`analyzePreferredTfmOnly` in `<Solution>.aicb.json` reduces analysis and export work
to the newest target-framework instance. The symbols that instance declares remain
available, but a type or a fan-in edge that exists only in another target disappears,
so this is a documented precision-versus-cost choice rather than a transparent
optimization.
## A safe agent workflow
An agent can use AICB without memorizing the tool catalog:
1. Call `server_info` to verify the connection and detect binary or configuration
drift. Use `list_skills` for the complete capability map or `docs()` for the
built-in operating manual.
2. Start an edit task with `prepare_task` to collect the named symbols, relevant
context, covering tests and likely sibling implementations within one budget.
3. Before changing a symbol that other code names, call `impact_of_change`; use
`find_tests_for` when the task bundle does not give enough test evidence.
4. Read uncertainty and completeness signals before treating an empty result as
proof. Qualify ambiguous symbol names; restore and force-refresh incomplete
projects.
5. Make and save the change. Then call `refresh_session` **before**
`get_diagnostics`. Under the normal `Reactive` profile this is usually redundant,
but it remains correct in every mode and makes the intended boundary explicit.
6. Use `review_context`, `evaluate_change_set` or `verify_claim` when the task makes
a review or policy claim; do not infer absence merely from a short search result.
7. Finish with the repository's real build and test commands. `get_diagnostics`
reports Roslyn compiler diagnostics, not third-party analyzer or runtime results.
For several independent read-only questions, `batch` reuses one session and returns
one bounded response. Use `measure` first when the likely response size matters.
## Reproducible analysis, CI and review
| Need | AICB workflow |
|---|---|
| Version the portable solution rules | Commit `<Solution>.aicb.json` next to the solution. It can carry layer rules, namespace exclusions, test definitions, suppressions, auto-init flags and analysis scope. Each surface consumes only the axes documented for it; the sidecar contains configuration, not analysis results, sessions, snapshots or credentials. Use `solution_config_status` → `init_solution_config` → `apply_solution_config`; `aicb init` does not create this file. |
| Enforce a quality threshold in CI | Run `aicb analyze -s App.sln -o context.md --fail-on "critical>0 OR debt>120min"`. A failed gate returns exit code `6` and still writes the context document for diagnosis. |
| Compare an in-place change with a baseline | Call `save_session` before the edit, then `refresh_session` and `compare_with_previous`; use `diff_public_contract` (Full Select profile) when the public API is the contract that matters. |
| Review two live analyzed states | `semantic_diff` reports structural changes. `diff_review` adds blast radius, tests and newly introduced findings with a policy verdict. These two-session tools require the Full Select profile. |
| Reuse an analyzed model across processes | `remember_codebase` persists it, `recall_codebase` loads it without Roslyn, and `refresh_remembered` restores a full live analysis when required. These three are opt-in tools (`AICB_MCP_TOOLS`). |
| Curate context visually | The Windows app adds a solution tree, manual context selection, detail and token controls, AI-Builder-MD preview/export, snapshots, Insights, LLM runs and a source editor. |
In GitHub Actions the gate is one step. The action at the root of this repository sets up
the .NET 10 SDK, installs the published tool, restores the solution and runs
`aicb analyze`; a failed gate fails the step with exit code `6`, and the document is still
written:
```yaml
- uses: gregordadera/aicb-roslyn-mcp@v0.5.530.1
with:
version: 0.5.530.1
solution: App.sln
output: artifacts/context.md
fail-on: "critical>0 OR debt>120min"
```
The example pins both halves: `@v0.5.530.1` fixes the action, `version` fixes the package it
installs. Without `version` the action installs the newest published package, and `@main`
follows every change to the action, so neither belongs in a build you depend on. A release
tag can in principle be moved; the full commit SHA of that tag is the immutable form. Further
inputs are `dotnet-version`, `restore` and `args` for other
`aicb analyze` options; the outputs are `output` and `exit-code`. See
[`action.yml`](https://github.com/gregordadera/aicb-roslyn-mcp/blob/main/action.yml).
Configuration precedence is axis- and surface-specific. For example, headless layer
mapping can fall back to the sidecar, while headless test detection currently resolves
from the database or built-in rules rather than the sidecar's test axis. The exact
matrix is in the
[configuration guide](https://github.com/gregordadera/aicb-roslyn-mcp/blob/main/docs/manual/general/07-profiles-master-data-and-solution-configuration.md#which-axis-wins).
A running MCP session keeps the configuration it was analyzed with; after editing the
sidecar, start a new analysis instead of assuming `refresh_session` re-reads it.
Suppressions hide accepted findings from suppression-aware reading surfaces, but
`solution_metrics` and the CLI quality gate continue to count them. A shared
suppression is therefore an explicit review decision, not a way to lower the gate.
## From semantic engine to human-in-the-loop workspace
The MCP server is currently AICB's most complete and operationally mature
integration surface. Its 82 registered tools cover semantic navigation, change
impact, dependency injection, test discovery, architecture, quality, context
packing, review and session management. Profiles expose a curated 54-tool default
or the 72-tool Full Select set, while sessions, staleness signals and bounded
responses make the surface practical for coding agents.
The active MCP profile also selects task-oriented facets: each facet connects agent
guidance, a context-template slot and the corresponding tool subset. `list_skills`
is the runtime source of truth for which tools are exposed, which are callable, and
which additional registered tools sit outside the active pool.
The Windows app complements that agent-facing surface with a visual workspace for
people: solution navigation, manual context selection, detail and token controls,
AI-Builder-MD preview and export, snapshots, Insights, reusable configuration and
manual LLM runs.
### Quality and solution-specific analysis profiles
A **Quality Profile** controls which insight producers run and the thresholds they
use, such as method length, cyclomatic complexity and class size. It does not by
itself define finding severity or the CLI quality gate.

Each solution also has three independent analysis axes:
| Axis | Question it answers | What it controls |
|---|---|---|
| **Layer Profile** | Where does this code belong architecturally? | Ordered namespace-pattern-to-layer mappings for layers such as Domain, Application and Infrastructure. The first matching rule wins. The profile also determines whether a detected cross-layer violation is `Advisory` (warning) or `Strict` (critical). |
| **Exclude Namespaces** | What should stay outside the analysis? | Named namespace patterns skipped by the analyzer, using `Contains`, `StartsWith`, `EndsWith` or `Exact` matching. This keeps configured framework or vendor dependencies from dominating the semantic graph; shipped presets cover the BCL and SAP Business One. |
| **Test Profile** | What counts as test code? | Project-name rules plus method-attribute markers. The built-in profiles recognize xUnit, NUnit and MSTest conventions, and production-focused tools can exclude the detected test code by default. |
The desktop app presents these three pickers side by side for the selected
solution. The Settings pages are the library editors; the Workspace pickers choose
which library entry applies to this particular solution. A per-solution choice wins
over the global default.

#### Initialize the three axes
You do not have to set the three axes up by hand. When the desktop Context
Builder loads a solution, AICB offers a setup for every axis that is still open
and whose automatic setup you have not switched off:
- If a `<SolutionName>.aicb.json` beside the solution already covers the axis,
it offers to take the setting from there, without asking a model.
- Otherwise, if a default model profile is set up, it asks the model once for a
layer map and an exclusion list and shows you the proposal. The request has
been sent by the time you see the dialog; you decide whether the proposal is
applied. Test code is recognized on your machine, without a model.
- An axis can stay open: without a model profile, without detected tests, or
when you decline. Choices you already made are never overwritten.
Successful GUI auto-initialization stores the chosen profiles in the local database.
It does **not** create `<SolutionName>.aicb.json` automatically. Use `Workspace →
Profiles → Export Config` to write that portable sidecar, then commit it. A later GUI
can restore the supported axes from it without an LLM call; headless consumers apply
the per-axis rules described in the configuration matrix. `Initialize Now` performs
only an immediate sidecar restore - it does not call a model or analyze the solution.
An agent can guide the same setup explicitly:
1. `solution_config_status` reports which axes are initialized and whether their
active values come from the local database, the sidecar or neither.
2. `init_solution_config` returns proposal material: declared namespaces for the
layer map, referenced namespaces for exclusions, and detected test projects and
attributes for the test profile.
3. After reviewing or adapting that proposal, `apply_solution_config` creates and
activates the custom entries, marks the axes initialized and writes both the
local configuration database and `<SolutionName>.aicb.json` beside the solution.
4. Commit the sidecar so the portable solution configuration travels with the
repository. Each consumer applies the supported axes described above; do not
assume every surface resolves every field identically. Later,
`check_solution_config_drift` reports namespaces or test projects no longer
covered by that configuration.
`aicb init` is a different operation: it connects a repository to the MCP server
and installs the agent skill and optional symbol guard. It does **not** initialize
these three solution axes or create `<SolutionName>.aicb.json`.
See [profiles and solution configuration](https://github.com/gregordadera/aicb-roslyn-mcp/blob/main/docs/manual/general/07-profiles-master-data-and-solution-configuration.md)
for precedence, the sidecar schema and the full initialization behavior.
### Context templates and run templates
The two template types have different responsibilities:
| Template type | Purpose |
|---|---|
| **Context Template** (`Templates`) | Defines what goes into an export: prompt, Markdown profile, detail presets, expansion strategies, compression, quality settings and export switches |
| **Run Template** (`Run Templates`) | Defines how a task is executed: run type, selected context template, model defaults and run-specific options |
Detail Presets, Markdown Profiles, Expansion Strategies, Compression Rules,
Pipeline Profiles and Quality Profiles are reusable building blocks referenced by
a context template; a run template selects that context template.

### Where the desktop app is heading
The desktop app is growing into a **human-in-the-loop orchestration workspace**: a
developer selects and constrains context, inspects intermediate results, approves
decisions and controls what an AI model runs next. Today it runs `Manual` runs;
further run types that process selected nodes one by one or let a model narrow the
context first are planned.
## Install
Install **one** form per machine:
| You want | Install | Platform |
|---|---|---|
| MCP server and CLI | [.NET global tool `aicb-roslyn-mcp`](https://www.nuget.org/packages/aicb-roslyn-mcp) | Windows, Linux, macOS |
| Desktop app plus the same MCP server and CLI | [Windows installer or portable ZIP](https://github.com/gregordadera/aicb-roslyn-mcp/releases/latest) | Windows |
The .NET tool runs on .NET 10. Installing it needs the **.NET 10 SDK**, which also provides the
MSBuild the analysis uses. Without .NET 10 it runs on the next newer .NET on the machine and
needs that version's SDK. A machine that has only .NET 8 or .NET 9 cannot start it.
```sh
dotnet tool install -g aicb-roslyn-mcp
aicb --version
```
Then register the server with your MCP client. For clients that read `.mcp.json`:
```json
{
"mcpServers": {
"aicb": {
"command": "aicb",
"args": ["mcp"]
}
}
}
```
`aicb init` writes this file for you; see [Connect a coding agent](#connect-a-coding-agent).
Up to 0.5.465.1 the package was called `AIContextBuilder`. An update does not cross that
rename: remove the old package first, then install the new one as above.
```sh
dotnet tool uninstall -g AIContextBuilder
```
Update it later with `dotnet tool update -g aicb-roslyn-mcp`. For a container, the
repository's [`Dockerfile`](https://github.com/gregordadera/aicb-roslyn-mcp/blob/main/Dockerfile)
installs the same .NET tool and serves MCP over stdio. The container runs as a non-root
user, and analysis writes `obj/` into the mounted solution, so run it as the owner of the
mount and restore the solution inside the container first:
```sh
docker run --rm --user "$(id -u):$(id -g)" -v "$PWD:/src" \
-v aicb-nuget:/home/aicb/.nuget/packages --entrypoint dotnet aicb restore /src/App.sln
docker run --rm -i --user "$(id -u):$(id -g)" -v "$PWD:/src" \
-v aicb-nuget:/home/aicb/.nuget/packages aicb
```
The Dockerfile header explains why the restore has to run in the container.
If the tool reports that MSBuild could not be registered, the .NET it runs on found no SDK it
can use: an SDK newer than that .NET does not count (for example a .NET 10 runtime next to only
the .NET 11 SDK). Install the .NET 10 SDK; beside a .NET 10 runtime the .NET 8 and .NET 9 SDKs
work as well. Or set the environment variable `DOTNET_ROLL_FORWARD=LatestMajor` so that the tool
runs on the newest .NET - a preview .NET additionally needs
`DOTNET_ROLL_FORWARD_TO_PRERELEASE=1`.
The Windows downloads are self-contained, but analyzing a solution still needs
MSBuild from a .NET SDK or Visual Studio. The installer and the programs are
code-signed (publisher: Gregor Dadera); Windows SmartScreen can still warn about a new
release until it has enough download history. Every release provides SHA-256 checksums.
## Connect a coding agent
Run this from the project you want the agent to work on:
```sh
aicb init
```
It writes `.mcp.json`, the MCP configuration Claude Code reads, and the
`aicb-csharp-context` agent skill under `.claude/skills/`. Files you wrote
yourself are not overwritten; a skill file aicb wrote earlier is brought in step
with the tools the server serves (`aicb skills sync` does it on request). If the project uses Codex or OpenCode (a `.codex/` or `.opencode/`
folder), it also registers the server in that client's own configuration and
writes the skill to `.agents/skills/`, where both read skills. If it detects
Claude Code, Codex or OpenCode project configuration, it also installs a
**symbol guard** that blocks C# symbol searches by grep and redirects the agent
to the semantic tool. This intentionally changes agent behavior. For Claude Code
it also adds a session-start hook that keeps the aicb skill files in step with
the served tools (`aicb skills sync`). Opt out of both with:
```sh
aicb init --hooks none
```
`--hooks none` skips only the guard and the session-start hook; the server and
the skill are still set up. To wire a
client whose folder does not exist yet, name it: `aicb init --hooks codex` or
`aicb init --hooks opencode`.
Client-specific status:
| Client | MCP setup | Skill and guard |
|---|---|---|
| Claude Code | `.mcp.json` written by `aicb init` | Skill and optional guard installed |
| Codex | `.codex/config.toml` written by `aicb init`; Codex reads it only in a project you have trusted | Skill in `.agents/skills/` and optional guard installed |
| OpenCode | `opencode.json` written by `aicb init` | Skill in `.agents/skills/` and optional guard installed |
| Other stdio clients (Cursor, Cline) | Command `aicb`, argument `mcp` | Use the published skill if the client supports Agent Skills |
Manual `.mcp.json` configuration for clients that read it:
```json
{
"mcpServers": {
"aicb": {
"command": "aicb",
"args": ["mcp"]
}
}
}
```
Verify the connection by asking the client to call `server_info`. Every analysis
tool accepts an absolute `.sln`, `.slnx` or `.slnf` path as its session, so no
separate analyze step is required. See the [five-minute guide](https://github.com/gregordadera/aicb-roslyn-mcp/blob/main/docs/GETTING-STARTED.md)
for setup, first questions and troubleshooting.
## Tools
The questions an agent asks most, and the tool that answers each one:
| Tool | What it answers |
|---|---|
| `find_usages` | Who uses this type, method or property? |
| `impact_of_change` | What else is affected if I change this symbol, and how risky is it? |
| `find_implementations` | Which types implement this interface? |
| `find_tests_for` | Which tests cover this symbol? |
| `resolve_injection` | What is registered for this service, with which lifetime, and where? |
| `find_by_side_effects` | Which code touches files, the network or a database, and which code is pure? |
| `find_dead_code` | Which code does nothing reach? |
| `get_diagnostics` | Which compiler errors and warnings are there, without a build? |
| `find_symbol` | Where is the type or member with this name? |
| `explain_symbol` | What does this symbol do, with its source and its surroundings in one answer? |
| `architecture_overview` | How is the solution structured, without reading all of its source? |
| `find_binding_usages` | Which XAML bindings name this view-model member? |
| `prepare_task` | What do I need to read before I edit code for this task? |
| `server_info` | Is the server running, and which version is it? |
The default tools with their parameters: [docs/TOOLS.md](https://github.com/gregordadera/aicb-roslyn-mcp/blob/main/docs/TOOLS.md); all 82: the [MCP server manual](https://github.com/gregordadera/aicb-roslyn-mcp/blob/main/docs/manual/mcp/README.md).
## Tool sets and Agent Skills
| Set | Size | Purpose |
|---|---:|---|
| Local profile | 30 tools | The tools agents call most, with compact descriptions, for a model whose context window makes every tool definition expensive |
| Default MCP profile | 54 tools | Curated semantic and structural tools for normal agent work |
| Full Select profile | 72 tools | Default set plus the measured long tail |
| Complete server surface | 82 tools | Full Select plus the opt-in session-memory, database and API-comparison tools |
Start the Local profile with `aicb mcp --mcp-profile mcp-profile/local` and the
Full Select profile with `aicb mcp --mcp-profile mcp-profile/full`. Set `AICB_MCP_TOOLS=all` to add
the opt-in tools as well. The generated [tool reference](https://github.com/gregordadera/aicb-roslyn-mcp/blob/main/docs/TOOLS.md) documents
the default set; the [MCP server manual](https://github.com/gregordadera/aicb-roslyn-mcp/blob/main/docs/manual/mcp/README.md)
documents all 82 tools and their parameters, and alongside them sessions and
staleness, profiles, pools and facets, and what `aicb init` writes - twelve
chapters in Markdown, readable in the browser and by an agent, and also
published as a [PDF](https://github.com/gregordadera/aicb-roslyn-mcp/blob/main/docs/manual/mcp/AICB-MCP-Server.pdf).
The published counts are starting points, not fixed editions. In the
desktop **MCP Profiles** editor you can create or duplicate a profile, enable only
the task facets you want, and select individual core and facet tools. Every core
tool can be removed except the locked diagnostic `server_info`, so even a very
small task-specific `tools/list` is possible. The server's fixed lead-in is
standing agent guidance, not another selectable tool group. For headless setup,
`AICB_MCP_TOOLS=methods:<tool>,<tool>,...` exposes exactly the named functions;
class lists, `lean` and `all` are also supported. Profile and environment changes
take effect at the next server start. `list_skills` shows the resulting in-pool and
out-of-pool tools. See [profiles, pools and facets](https://github.com/gregordadera/aicb-roslyn-mcp/blob/main/docs/manual/mcp/04-profiles-pools-and-facets.md).
Five Agent Skills ship in [`skills/`](https://github.com/gregordadera/aicb-roslyn-mcp/tree/main/skills):
- `aicb-csharp-context` routes semantic C# questions to the right tool.
- `aicb-code-review` checks a completed change for correctness.
- `aicb-code-simplifier` looks for unnecessary complexity.
- `aicb-usage-check` reports what this server was actually reached for.
- `aicb-smoke-test` runs read-only checks on your own solution, sorts the findings into HIGH, MID and LOW, and drafts reproducible issues for the maintainer. It files nothing until you confirm.
The last four are opt-in: `aicb init --skills=all`.
## Scale, releases and compatibility
AICB is built for large solutions. On RavenDB, about 1.76 million lines of C#, the
first analysis takes about 75 seconds and a repeated question about 2 seconds, at a
peak of about 4.1 GB of RAM; on Serilog, about 25,000 lines, the first analysis takes
about 15 seconds and a repeated question about 0.14 seconds (medians on one
machine, measured 2026-11-06). The full table, with
revisions, machine and method, is in the
[architecture and evidence guide](https://github.com/gregordadera/aicb-roslyn-mcp/blob/main/docs/ARCHITECTURE.md#how-does-aicb-scale-on-large-solutions).
Follow-up questions reuse the warm analysis; saved C# edits are usually picked up
incrementally, while changes to project or solution files take a full reload.
For a very large repository, a `.slnf` reduces what MSBuild loads and
`analyzePreferredTfmOnly` avoids analyzing every target framework. `summaryOnly`,
query scopes and token budgets keep responses small. The desktop `load-perf.log` and
MCP `usage_report` measure your own solution locally.
The changelog records every release. `server_info` reports version, build and
configuration drift; persisted analyses carry their schema and analyzer identity and
fall back to a live analysis when they are incompatible; and the desktop app never
writes to a database created by a newer version. Database migrations are one-way, so
back up the database before an update if you may want to roll back. Commercial
agreements can add support, response-time and version-maintenance commitments; see
[Support](#support-and-continued-development).
## CLI at a glance
```text
aicb init Connect a project to the MCP server and install the agent skill.
aicb analyze Analyze a solution and emit context Markdown.
aicb export Re-render Markdown from an existing session database.
aicb import Import a constellation JSON.
aicb list List built-in and custom profiles and presets.
aicb mcp Start the stdio MCP server.
aicb call Invoke one MCP tool without an MCP client.
```
Run `aicb <command> --help` for options.
## Local by default
- The CLI and MCP server make no outbound network connection of their own and do
not modify the source code they analyze. The MSBuild logic and source generators
of the analyzed solution run in the same process, so they can reach the network
if that solution's own build does (see the last point).
- There is no **outbound** telemetry, analytics, update check, account or license
server. The MCP server records its tool calls locally for `usage_report` and the
desktop app's **MCP Usage** page; that log never leaves the machine.
- The desktop app can contact only an LLM endpoint you configure: for a manual run,
a model-profile connection test, or first-load proposals for Layer Profile and
Exclude Namespaces when those auto-init flags are armed. The endpoint may be a
local model. The Details tab is also a real editor and saves a file only when you
explicitly use Save.
- Opening a solution runs its MSBuild logic to resolve references, and building its
compilation runs the source generators its projects reference, as in an IDE or
`dotnet build`. Analyze only solutions you trust. AICB does not run third-party
Roslyn analyzers, with one opt-in exception: `get_diagnostics` with
`runSuppressors: true` runs the projects' diagnostic suppressors, as a real
build does.
A small number of explicitly named tools can write configuration or an export;
their tool descriptions state this. The complete threat model and private
reporting route are in [`SECURITY.md`](https://github.com/gregordadera/aicb-roslyn-mcp/blob/main/SECURITY.md).
## License at a glance
Use is free for:
- private, hobby and educational use by natural persons,
- accredited educational institutions for teaching, learning and
non-commercial research,
- organizations that reach **none** of these thresholds: 100 employees,
EUR 10 million annual turnover, 21 developers.
The thresholds apply to your organization, not to your clients. After first
reaching any one threshold, you have 90 days to agree a commercial license; use
remains free during that period. The 90 days are contractual text only: AICB
starts no license timer, sends no threshold or deadline data, blocks no feature
and does not technically stop working when the period ends. Commercial licenses
start at EUR 25 per licensed developer per month; the exact price and scope depend
on the number of users, the requested support level and any agreed priority for
improvement requests. A commercial agreement can include support, defined response
or maintenance commitments, prioritized consideration or
implementation of improvements - for example, making a generally useful analyzer
handle patterns found in the customer's code more accurately. Such work improves
the general AICB product; it does not create a customer-specific fork or specialize
AICB to one codebase. Customer code is never collected or used for improvement
automatically; examining it requires material or access deliberately provided by
the customer and a separate agreement on scope and confidentiality. Exact
deliverables, priorities and guarantees exist only when written into the individual
agreement. Connecting AICB to MCP clients, agent harnesses, scripts, build systems
and CI through its documented interfaces is permitted. Redistributing, modifying,
repackaging, reselling or offering the AICB binaries as a hosted service is not.
Contact `aicb@dadera.de`. See the [plain-language guide](https://github.com/gregordadera/aicb-roslyn-mcp/blob/main/docs/LICENSING.md),
[`LICENSE.txt`](https://github.com/gregordadera/aicb-roslyn-mcp/blob/main/LICENSE.txt) and the full bilingual [`EULA.md`](https://github.com/gregordadera/aicb-roslyn-mcp/blob/main/EULA.md).
## Support and continued development
AICB is under active development: the
[changelog](https://github.com/gregordadera/aicb-roslyn-mcp/blob/main/CHANGELOG.md) records every
release, and published releases appear on the
[Releases](https://github.com/gregordadera/aicb-roslyn-mcp/releases) page.
Support follows the license:
| | Free | Commercial agreement |
| --- | --- | --- |
| Who | Everyone below the [thresholds](#license-at-a-glance) | Organizations at or above a threshold, or anyone who wants stronger terms |
| Channel | [GitHub Discussions](https://github.com/gregordadera/aicb-roslyn-mcp/discussions), [Issues](https://github.com/gregordadera/aicb-roslyn-mcp/issues) | Direct contact plus the public channels |
| Response target | Best effort | ≤ 2 business days |
| Security fixes | Shipped through public releases | Fix target ≤ 10 business days for confirmed vulnerabilities |
| Version maintenance | Current release | Individually agreed maintenance window |
| Improvement requests | Community-driven | Prioritized consideration; agreed priorities are written into the contract |
| Source access | None | Code review under NDA can be agreed |
The targets in this table are typical values an individual agreement can include;
they bind only when written into the agreement, and payment alone creates no
unstated SLA. Prices are in [License at a glance](#license-at-a-glance). Contact
`aicb@dadera.de`.
Questions and feature requests are welcome in
[GitHub Discussions](https://github.com/gregordadera/aicb-roslyn-mcp/discussions). Report bugs
through [GitHub Issues](https://github.com/gregordadera/aicb-roslyn-mcp/issues) and include
`aicb --version` and, for MCP problems, the output of `server_info`. Report security
issues privately as described in [`SECURITY.md`](https://github.com/gregordadera/aicb-roslyn-mcp/blob/main/SECURITY.md).
## Documentation
Everything above is the short version. The three manuals below hold the full reference
in 35 chapters.
- [Getting started](https://github.com/gregordadera/aicb-roslyn-mcp/blob/main/docs/GETTING-STARTED.md) - install, connect and ask the first question
- [Tool reference](https://github.com/gregordadera/aicb-roslyn-mcp/blob/main/docs/TOOLS.md) - generated reference for the default MCP profile
- [Architecture, limits and evidence](https://github.com/gregordadera/aicb-roslyn-mcp/blob/main/docs/ARCHITECTURE.md) - in-memory model, refresh, context selection, static-analysis boundaries and benchmark status
- **[MCP server manual](https://github.com/gregordadera/aicb-roslyn-mcp/blob/main/docs/manual/mcp/README.md)** - the full reference in twelve Markdown chapters: connecting a client, `aicb init`, sessions and staleness, profiles and facets, every tool, troubleshooting
- **[General reference manual](https://github.com/gregordadera/aicb-roslyn-mcp/blob/main/docs/manual/general/README.md)** - the full reference in twelve Markdown chapters, with the printable PDF in the same folder
- **[Desktop app reference manual](https://github.com/gregordadera/aicb-roslyn-mcp/blob/main/docs/manual/desktop-app/README.md)** - the full reference in eleven Markdown chapters, with the printable PDF in the same folder
- [Changelog](https://github.com/gregordadera/aicb-roslyn-mcp/blob/main/CHANGELOG.md) and [latest release](https://github.com/gregordadera/aicb-roslyn-mcp/releases/latest)
"AIContextBuilder" and "AIContextBuilder for .NET" are product names used by
Gregor Dadera; no registration is claimed.
TDQS
Scored across 54 tools
Most tools have clearly distinct query intents (find_usages vs impact_of_change vs call_graph, find_implementations vs find_overrides vs get_type_hierarchy) and descriptions explicitly state which tool to prefer. The weak spot is the family of context-bundling tools — get_context, explain_symbol, pack_for_task, prepare_task, review_context, architecture_overview, export_markdown — which overlap in 'give me a slice of code' territory and only careful reading of the prose separates them. The find_by_* family (attribute, semantics, side effects, event subscription) is likewise differentiated mainly by long prose rather than name.
All names are snake_case, and verb_noun dominates (find_*, get_*, list_*, analyze_solution, apply_solution_config, install_agent_hooks, detect_circular_dependencies). A sizeable minority are bare noun phrases with no verb (architecture_overview, coverage_gaps, symbol_metrics, call_graph, server_info, docs, batch, measure), so the pattern is predictable but not uniform.
54 tools is far past the 3-15 sweet spot; the surface sprawls across navigation, quality, config, snapshots, diffing, DI resolution, XAML markup, telemetry and meta tooling. The pool/profile system (list_skills, list_mcp_profiles, batch/measure) is an admission that the default set is too large, and several tools (verify_claim, assert_absence, evaluate_change_set, usage_report) are long-tail. Each tool does answer a real question, which keeps it from being a 1.
Coverage of the Roslyn/C# analysis domain is remarkably full: symbol discovery, fan-in/fan-out, inheritance, DI, dead code, tests, coverage, complexity, insights, architecture, markup bindings, snapshot diffing, config lifecycle and session refresh all exist with no obvious dead ends. Even meta concerns (tool usage telemetry, docs, hook installation, token budgeting) are covered.