RoslynGate MCP server
Commit Nov 13, 2026Enables AI agents to perform semantic .NET symbol analysis, including finding definitions, references, and type hierarchies using the Roslyn compiler.
Also known as SammyBytes/RoslynGate
- Stars
- 3
- Tools
- 5
- Downloads, 30 days
- —
- Latest version
- —
- Last commit
- Nov 13, 2026
- License
- MIT
What is RoslynGate MCP?
RoslynGate enables AI agents to perform semantic .NET symbol analysis, including finding definitions, references, and type hierarchies using the Roslyn compiler. It exposes 5 tools, such as get_symbol_definition, find_symbol_references, get_type_hierarchy.
Summary generated from the project's README
About RoslynGate MCP server
Analyzing .NET codebases through semantic symbol queries is what RoslynGate enables for AI agents. Instead of relying on basic text searches that dump large amounts of code into a context window, this stdio MCP server uses the Roslyn compiler to provide precise, deterministic answers about code structures. It is designed specifically for developers working with medium and large .NET solutions where token efficiency is critical.
Users can integrate the server with clients like Claude Code or OpenCode using a local setup. The server requires the .NET SDK to be installed on the host machine to evaluate projects and references via MSBuild. It provides specialized tools such as get_symbol_definition, find_symbol_references, and get_type_hierarchy to navigate complex codebases. A separate TypeScript product is also available for projects using tsconfig.json or jsconfig.json files.
To maintain accuracy, the server includes a watcher that applies .cs edits incrementally, though users can call reload_workspace if structural changes occur. Results can be toggled between compact and verbose modes to manage the amount of data sent over the wire.
What you can do with it
- 1Locating symbol definitionsAn AI agent can resolve a specific symbol using its qualified name or a file and line number.
- 2Mapping type hierarchiesDevelopers can ask the agent to identify base types, interfaces, and derived types for a specific class.
- 3Finding code referencesThe agent can find all semantic references to a symbol across a solution using paginated results.
- 4Searching for symbols by nameAn agent can find symbols using name fragments before attempting to resolve them fully.
Written from the project's README. Every use case is checked against a quote from it.
RoslynGate MCP tools 5
Detected from the READMEget_symbol_definitionfind_symbol_referencesget_type_hierarchysearch_symbolsreload_workspace
Automated checks
Ran Nov 14, 2026Full report →Not verified yet. A server needs a score of 80, no serious finding, and enough data for us to check. How checks work · What to fix for more points
- Source repository linked and reachablesammybytes/roslyngate is public and reachablegithub.com/sammybytes/roslyngate ↗Pass
- Package names this repository as its sourceNot checked
- Build provenance (Sigstore attestation)Not checked
- Open source license (OSI)MITspdx.org/licenses/MIT.html ↗Pass
- Commit or release in the last yearLast commit or release 2026-11-13github.com/sammybytes/roslyngate ↗Pass
- OpenSSF ScorecardNot checked
- Package name not close to a popular packageNot checked
- No critical advisory in the package or its dependenciesNot checked
- No hidden instructions to the model5 tool descriptions and the README read; no override phrases, credential paths or hidden charactersPass
- Destructive tools are labelledNo tool named like delete, drop or execPass
- Remote endpoint answers the MCP handshakeNot checked
README
View on GitHubRoslynGate
RoslynGate is a stdio MCP server that answers .NET symbol questions with Roslyn instead of text search. It returns compact, deterministic results so an agent can find a definition, reference, or hierarchy without dumping code into the context window.
It is built for medium and large .NET solutions. On a couple of projects, the MCP schema and the extra turns can cost more than the file reads they replace. Measure before expecting a win.
Tools
| Tool | Purpose |
|---|---|
get_symbol_definition |
Resolve one symbol by qualified name or file + line. |
find_symbol_references |
Find semantic references, paginated; includeDefinition=true also returns the resolved symbol. |
get_type_hierarchy |
Base types, interfaces, derived types, implementations. |
search_symbols |
Find symbols by name fragment before resolving. |
reload_workspace |
Reload after project or structural changes. |
Every response is JSON. detail=compact (default) keeps the wire small;
detail=verbose adds namespace, container, column, and longer documentation.
When a page is truncated, find_symbol_references and search_symbols also
return nextOffset and a hint:
{
"total": 120,
"offset": 0,
"truncated": true,
"nextOffset": 50,
"hint": "Call find_symbol_references again with offset=50 and the same arguments."
}
Use parameterTypes to disambiguate overloads:
{
"name": "SampleSdk.Widget.Open",
"parameterTypes": ["string"]
}
With the default watcher, .cs edits are applied incrementally. Structural
changes set stale: true; the agent should call reload_workspace before
trusting an empty result. Disable the watcher with --no-watch.
Performance
Against rg on this repository, compact tool output used 76-92% fewer
characters for definition, references, hierarchy, and search tasks. That is
tool output, not session tokens. Warm
queries took 4-11 ms; the first query includes MSBuild loading (~11 s on this
repository). The MCP handshake takes ~0.33 s after the first run; the first run
also extracts the single-file binary (~1.4 s). See
docs/BENCHMARKS.md for methodology and caveats.
The OpenCode A/B on a two-project fixture was a token loss (232k against 81k), because the fixed MCP and skill overhead was larger than the saved reads. Use medium and large repositories for a meaningful token A/B; on small projects, judge RoslynGate by correctness and warm-query latency instead. Measure with the OpenCode or Claude A/B harness before promising a percentage.
TypeScript product (MVP)
A separate roslyngate-ts product lives under products/typescript. It uses
the TypeScript compiler API (Program, TypeChecker, LanguageService) for
.ts, .tsx, .js, and .jsx.
cd products/typescript
npm install
npm run build
node dist/cli.js --check --solution ../../fixtures/TsSample
The five MCP tools use the same contract as the .NET product, generated from
contracts/schema/tools.json. A repository with a tsconfig.json or
jsconfig.json is detected automatically; a .sln workspace returns a
teaching error that points to the roslyngate package.
npm install -g roslyngate-ts
cd /path/to/typescript-repo
roslyngate-ts setup claude --skill
Or run it without installing:
npx -y roslyngate-ts@0.3.0 --check --solution .
npx -y roslyngate-ts@0.3.0 upgrade --check
roslyngate-ts upgrade updates the global package and re-points managed
.mcp.json or opencode.jsonc entries at the current CLI. Use --dotnet or
--ts to force a product; the opposite product returns a wrong_project
error with the exact package to install.
See docs/TODO-TS.md for the remaining benchmark and
validation work.
Requirements
- .NET SDK. RoslynGate does not install or bundle the SDK; it uses the one
selected by the solution's
global.json, or the latest installed SDK. - Node.js 20 or later for the TypeScript product.
- Linux x64, Windows x64, or macOS arm64 (Apple Silicon) for the .NET binaries. Intel Macs are not supported.
The binary is self-contained, so the .NET runtime is included. The SDK is still
required because MSBuildWorkspace uses MSBuild to evaluate projects, targets,
references, and generated code.
--check shows the selected SDK:
roslyngate --solution . --check
If a global.json pins an SDK that is not installed, RoslynGate fails with the
requested version and the list of installed SDKs instead of silently using
another one.
Install
Install and configure Claude Code in one step:
npm install -g roslyngate
cd /path/to/repository
roslyngate setup claude
Or run it without installing:
npx -y roslyngate@0.3.0 setup claude
bunx roslyngate@0.3.0 setup claude
setup claude writes .mcp.json with the native binary path, solution path,
and no npx or cmd /c indirection. Open Claude Code and approve
roslyngate in /mcp.
For teams, add the opt-in project skill:
roslyngate setup claude --skill
That writes .claude/skills/roslyn-symbols/SKILL.md, which can be committed.
An existing skill is left unchanged.
For OpenCode, use:
roslyngate setup opencode --solution . --skill
That writes or merges opencode.jsonc under mcp.servers.roslyngate, with
codemode: false, the native binary path, and a strict OpenCode skill under
.opencode/skills/roslyn-symbols/SKILL.md. The skill is also added to
instructions so it is always active. Then open OpenCode and run /mcps.
To use it as a plain CLI:
roslyngate --solution /path/to/repository
The first run downloads the self-contained binary for the current platform, verifies its SHA-256 checksum, and caches it. Supported platforms are Linux x64, Windows x64, and macOS arm64. Release binaries are available on the Releases page.
You can also download the binary for your platform from
Releases and verify its
.sha256 file.
Upgrade
roslyngate upgrade
This updates the global npm package, downloads the matching binary, and
updates the roslyngate.command path in .mcp.json in the current directory
when that command is a RoslynGate-managed cache path. It does not touch its
args, timeout, or other MCP servers. Restart Claude Code or run /mcp
afterwards.
If the command is portable (for example roslyngate or npx), the config is
left unchanged. The upgrade detects whether the active command came from npm
or Bun; use --manager npm|bun to override that detection. To update only npm
and the binary:
roslyngate upgrade --no-config
Use --check to compare the installed and latest versions, or --dry-run to
see the actions without installing or writing:
roslyngate upgrade --check
roslyngate upgrade --dry-run
Build
dotnet build RoslynGate.sln -warnaserror
dotnet test RoslynGate.sln
Run
dotnet run --project src/RoslynGate.Cli -- --solution fixtures/SampleSolution
The process speaks MCP over stdin/stdout. Diagnostics go to stderr. Close stdin to stop it.
Connect
{
"mcpServers": {
"roslyngate": {
"command": "npx",
"args": ["-y", "roslyngate", "--solution", "/path/to/repository"]
}
}
}
Test with OpenCode
The repository ships opencode.jsonc, a local stdio server entry.
- Run
dotnet build. - Start OpenCode in this repository and run
/mcps. - Confirm
roslyngate connected. - Ask the agent to use
roslyngateto find a definition.
The command runs the built DLL, not dotnet run, so build output cannot
corrupt the MCP stdout stream. For a published binary, replace command with
the binary path and add --solution /path/to/repository.
See docs/CLIENTS.md for Claude Code, Cursor, VS Code, and
the generic mcpServers shape.
Check
--check validates the configuration, locates the solution, and loads it with
MSBuild without starting the protocol. It reports the project count and load
time, and exits 0 when the workspace is usable and 1 otherwise.
roslyngate --solution . --check
Configuration
Flags override environment variables, which override defaults.
| Flag | Environment | Default |
|---|---|---|
-s, --solution |
ROSLYGATE_SOLUTION |
auto-detect |
-l, --log-level |
ROSLYGATE_LOG_LEVEL |
error |
--detail |
ROSLYGATE_DETAIL |
compact |
--ref-limit |
ROSLYGATE_REF_LIMIT |
50 (max 200) |
--search-limit |
ROSLYGATE_SEARCH_LIMIT |
20 (max 50) |
--prewarm / --no-prewarm |
ROSLYGATE_PREWARM |
on |
--watch / --no-watch |
ROSLYGATE_WATCH |
on |
--check |
- | - |
-h, --help |
- | - |
-V, -v, --version |
- | - |
Exit codes: 0 normal end of input or successful check, 1 invalid
configuration or solution, 2 fatal startup failure.
Errors
Failures are self-correcting. When a call returns isError: true, read
error.hint and, if present, run error.try.
{
"error": {
"code": "symbol_not_found",
"message": "No symbol matches 'Widget.Opn'.",
"hint": "Names are case-sensitive. Search by fragment instead.",
"try": {
"tool": "search_symbols",
"arguments": { "query": "Opn", "limit": 10 }
}
}
}
Development
dotnet restore --locked-mode
dotnet restore fixtures/SampleSolution/SampleSolution.sln
dotnet build RoslynGate.sln -warnaserror
dotnet test RoslynGate.sln
dotnet format RoslynGate.sln --verify-no-changes
npm test --prefix packaging/npm
See CONTRIBUTING.md for the trunk-based workflow, CHANGELOG.md for release history, and docs/BENCHMARKS.md for token and latency measurements.
License
MIT. See LICENSE.
RoslynGate MCP questions
What tools does RoslynGate MCP provide?
It exposes 5 tools, including get_symbol_definition, find_symbol_references, get_type_hierarchy, search_symbols, reload_workspace.
What makes RoslynGate different from using grep?
RoslynGate uses the Roslyn compiler to provide semantic answers rather than simple text searches, returning compact and deterministic results.
Does RoslynGate work for TypeScript projects?
Yes, there is a separate TypeScript product called roslyngate-ts that uses the TypeScript compiler API for .ts, .tsx, .js, and .jsx files.
What are the system requirements for the .NET version?
You must have the .NET SDK installed. RoslynGate uses the SDK selected by the solution's global.json or the latest installed version.
How can I handle large numbers of symbol references?
The server provides paginated results for references and searches, returning a nextOffset and a hint to call the tool again with the new offset.