roslyn-codex.mcp 1.3.0

The owner has unlisted this package. This could mean that the package is deprecated, has security vulnerabilities or shouldn't be used anymore.
dotnet tool install --global roslyn-codex.mcp --version 1.3.0
                    
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest
                    
if you are setting up this repo
dotnet tool install --local roslyn-codex.mcp --version 1.3.0
                    
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=roslyn-codex.mcp&version=1.3.0
                    
nuke :add-package roslyn-codex.mcp --version 1.3.0
                    

roslyn-codex

A Model Context Protocol (MCP) server providing semantic C# codebase analysis via Microsoft Roslyn. Enables AI assistants to navigate types, methods, references, call graphs, and inheritance hierarchies with full compiler-level accuracy.

Installation

roslyn-codex is distributed as a .NET tool via NuGet. This means:

  • One command to install
  • Automatic PATH setup
  • Easy updates with dotnet tool update
  • Works on Windows, macOS, and Linux
dotnet tool install --global roslyn-codex.mcp

The tool is installed to ~/.dotnet/tools and added to your PATH. You can run it from anywhere:

roslyn-codex --help

Updating

dotnet tool update --global roslyn-codex.mcp

Local Tool (Version-Pinned for Teams)

For team projects where everyone needs the same version:

cd YourProject
dotnet new tool-manifest                    # Creates .config/dotnet-tools.json
dotnet tool install roslyn-codex.mcp        # Installs and pins version

The manifest file (.config/dotnet-tools.json) should be committed to source control:

{
  "version": 1,
  "isRoot": true,
  "tools": {
    "roslyn-codex.mcp": {
      "version": "1.2.0",
      "commands": ["roslyn-codex"]
    }
  }
}

Team members restore the pinned version after clone/pull:

dotnet tool restore

MCP Configuration

MCP servers are configured in JSON files. The location depends on your MCP client:

Claude Desktop

Platform Configuration File
macOS ~/Library/Application Support/Claude/claude_desktop_config.json
Windows %APPDATA%\Claude\claude_desktop_config.json

Claude Code (CLI)

Use the claude mcp add command (recommended):

claude mcp add roslyn-codex --command roslyn-codex

Or manually edit the MCP configuration:

Scope Configuration File
Project .mcp.json in project root
User ~/.claude/mcp.json

Configuration Examples

Global tool installation (simplest):

{
  "mcpServers": {
    "roslyn-codex": {
      "command": "roslyn-codex"
    }
  }
}

Local tool installation (for version-pinned projects):

{
  "mcpServers": {
    "roslyn-codex": {
      "command": "dotnet",
      "args": ["tool", "run", "roslyn-codex"]
    }
  }
}

With explicit solution path:

{
  "mcpServers": {
    "roslyn-codex": {
      "command": "roslyn-codex",
      "args": ["--solution", "/path/to/Your.sln"]
    }
  }
}

The server auto-discovers .sln files in the current or parent directories if no path is specified.

How NuGet Distribution Works

Package Sources

NuGet packages can come from multiple sources:

Source URL Use Case
NuGet.org https://nuget.org Public packages (production)
Local folder C:\path\to\packages Development/testing
Private feed Azure Artifacts, GitHub Packages Enterprise/team packages

Global vs Local Tools

Aspect Global Tool Local Tool
Install location ~/.dotnet/tools Project's .config/dotnet-tools.json
Scope Machine-wide Per-project
Version control User manages updates Project controls version
Install command dotnet tool install --global dotnet tool install (in project)
Run command roslyn-codex dotnet tool run roslyn-codex
Best for Personal machines Teams, CI/CD

Version Management

# Check installed version
dotnet tool list --global

# Update to latest
dotnet tool update --global roslyn-codex.mcp

# Install specific version
dotnet tool install --global roslyn-codex.mcp --version 1.2.0

# Downgrade (uninstall first)
dotnet tool uninstall --global roslyn-codex.mcp
dotnet tool install --global roslyn-codex.mcp --version 1.0.0

Features

20 Semantic Analysis Tools

Category Tools
Navigation roslyn_get_status, roslyn_find_type, roslyn_get_type_info, roslyn_find_method, roslyn_get_file_types, roslyn_get_namespaces, roslyn_get_projects
References roslyn_find_usages, roslyn_get_callers, roslyn_get_callees, roslyn_get_dependencies, roslyn_get_dependents
Content Search roslyn_search_content (XML docs, comments, string literals)
Hierarchy roslyn_get_hierarchy, roslyn_get_implementations, roslyn_get_overrides, roslyn_find_by_attribute
Source Access roslyn_get_definition, roslyn_get_source
Analysis roslyn_analyze_dependencies, roslyn_get_statistics

Key Capabilities

  • Live Analysis: Maintains a live Roslyn workspace that updates automatically when files change
  • Semantic Accuracy: Full compiler-level understanding of types, generics, overloads, and inheritance
  • Cross-Project: Analyzes entire solutions with multiple projects
  • Pattern Matching: Find types/methods using wildcards (*Service) or regex (/.*Controller$/)
  • Call Graphs: Trace callers and callees through the codebase
  • Impact Analysis: Find all usages before refactoring

Pattern Matching

All search tools support three pattern types:

Pattern Type Example Matches
Exact MyClass Case-insensitive exact match
Wildcard *Service, Get*, I*able * = any chars, ? = single char
Regex /.*Controller$/ Full regex (enclosed in /)

Command Line Options

Option Description
--solution, -s Path to solution file (.sln)
--project, -p Path to project file (.csproj)
--no-watch Disable file system watching
--help, -h Show help message

Requirements

  • .NET 9.0 SDK or later
  • Visual Studio 2022 or .NET SDK with MSBuild

Troubleshooting

Problem Solution
roslyn-codex not found Ensure ~/.dotnet/tools is in PATH, or restart terminal
"Could not locate MSBuild" Install Visual Studio or .NET SDK
Slow initial load Normal for large solutions; subsequent queries are fast
Stale data after file changes Check file watcher logs or restart server

Development

# Clone and build
git clone https://github.com/stoicstudio/RoslynCodex.Mcp
cd RoslynCodex.Mcp
dotnet build

# Run tests (109 Ouroboros self-analysis tests)
dotnet test

# Run directly from source
dotnet run --project src/RoslynCodex.Mcp -- --solution /path/to/Your.sln

License

MIT

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

Version Downloads Last Updated