# Getting Started with Roslyn-Stone Development This guide covers advanced setup options, development workflows, and technical details for contributors and developers working on Roslyn-Stone. For basic usage, see the main [README.md](README.md). ## Table of Contents - [Local Development Setup](#local-development-setup) - [Transport Modes](#transport-modes) - [Development Environments](#development-environments) - [Advanced Configuration](#advanced-configuration) - [Development Tools](#development-tools) - [Testing](#testing) - [Project Structure](#project-structure) - [Adding New MCP Tools](#adding-new-mcp-tools) - [Testing and Debugging](#testing-and-debugging) ## Local Development Setup ### Prerequisites - .NET 10.0 SDK or later - C# 13 - Docker (for containerized deployment) - VS Code with Dev Containers extension (optional) - .NET Aspire workload (optional, for local orchestration) ### Building from Source ```bash # Clone the repository git clone https://github.com/dylanlangston/Roslyn-Stone.git cd Roslyn-Stone # Build the solution dotnet build # Run tests dotnet test # Run the MCP server (stdio transport - default) cd src/RoslynStone.Api dotnet run ``` ## Transport Modes Roslyn-Stone supports two MCP transport modes: ### Stdio Transport (Default) - Best for local, single-machine integrations - Used by Claude Desktop and other local MCP clients - Communication via stdin/stdout - No network ports required ### HTTP Transport - Best for remote access and web-based integrations - Accessible over the network via HTTP/SSE - Endpoint at `/mcp` (e.g., `http://localhost:8080/mcp`) - ⚠️ **WARNING**: Do not expose publicly without authentication, authorization, and network restrictions. This server can execute arbitrary C# code. To switch transport modes, set the `MCP_TRANSPORT` environment variable: ```bash # Stdio (default) MCP_TRANSPORT=stdio dotnet run # HTTP MCP_TRANSPORT=http dotnet run --urls "http://localhost:8080" ``` ## Development Environments ### With Aspire (Orchestrated) ```bash # Install Aspire workload dotnet workload install aspire # Run with Aspire dashboard for observability cd src/RoslynStone.AppHost dotnet run ``` This will start: - **Aspire Dashboard** at `http://localhost:18888` - View logs, metrics, and traces - **MCP Inspector UI** at `http://localhost:6274` - Interactive tool testing interface (development mode only) - **MCP Proxy** at `http://localhost:6277` - Protocol bridge for the inspector - **MCP Server (stdio)** - Stdio transport instance for local testing - **MCP Server (HTTP)** at `http://localhost:8080/mcp` - HTTP transport instance for remote access The MCP Inspector is automatically started in development mode, providing a web-based interface to test and debug MCP tools in real-time. ### Development Container The repository includes a fully configured devcontainer with Docker-in-Docker support for isolated development: ```bash # Open the repo in VS Code code . # Press F1 and select "Dev Containers: Reopen in Container" # The container will automatically build, restore dependencies, and build the project ``` See [`.devcontainer/README.md`](.devcontainer/README.md) for more details about the devcontainer setup. ### Docker Compose ```bash # Build and run both stdio and HTTP variants with Docker Compose docker-compose up --build # Run only the stdio variant docker-compose up roslyn-stone-mcp-stdio # Run only the HTTP variant docker-compose up roslyn-stone-mcp-http # Access Aspire dashboard at http://localhost:18888 # Access HTTP MCP endpoint at http://localhost:8080/mcp ``` The server supports both stdio and HTTP transport modes: - **Stdio transport**: Reads JSON-RPC messages from stdin and writes responses to stdout, with logging to stderr - **HTTP transport**: Exposes MCP endpoints via HTTP/SSE for remote access at `/mcp` ## Advanced Configuration ### Custom MCP Server Configurations For local development without Docker: **Claude Desktop:** ```json { "mcpServers": { "roslyn-stone": { "command": "dotnet", "args": ["run", "--project", "/path/to/Roslyn-Stone/src/RoslynStone.Api"], "env": { "DOTNET_ENVIRONMENT": "Development", "MCP_TRANSPORT": "stdio" } } } } ``` ### HTTP Transport Configuration For remote MCP servers or web-based integrations, use HTTP transport: **Local HTTP Server:** ```bash # Start the server with HTTP transport cd src/RoslynStone.Api MCP_TRANSPORT=http ASPNETCORE_URLS=http://localhost:8080 dotnet run ``` **Docker HTTP Server:** ```bash # Run with HTTP transport docker run -e MCP_TRANSPORT=http -e ASPNETCORE_URLS=http://+:8080 -p 8080:8080 ghcr.io/dylanlangston/roslyn-stone:latest ``` **MCP Client Configuration (HTTP):** ```json { "mcpServers": { "roslyn-stone-http": { "type": "http", "url": "http://localhost:8080/mcp" } } } ``` The HTTP endpoint supports: - **Server-Sent Events (SSE)** for streaming responses - **CORS** support for web-based clients - ⚠️ Configure strict origin allowlists in production. Never use wildcard (*) CORS for code execution endpoints. - **Standard MCP protocol** over HTTP See `.github/MCP_CONFIGURATION.md` for more configuration examples. ### OpenTelemetry Configuration Configure OpenTelemetry export with environment variables: ```bash # OTLP endpoint (default: Aspire dashboard) OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:18889 # Service name OTEL_SERVICE_NAME=roslyn-stone-mcp # Additional resource attributes OTEL_RESOURCE_ATTRIBUTES=service.namespace=roslyn-stone,deployment.environment=production ``` ### Production Deployment For production, configure the OTLP endpoint to send telemetry to your monitoring solution: - Azure Monitor / Application Insights - AWS CloudWatch - Google Cloud Operations - Grafana / Prometheus / Jaeger - Any OTLP-compatible collector ## Development Tools This project uses several development tools: - **CSharpier** - Code formatter (`dotnet csharpier `) - **ReSharper CLI** - Code analysis (`jb `) - **Cake** - Build automation (`dotnet cake