A professional, MCP-based alternative to Claude Code built in C# with clean architecture and enterprise-grade patterns.
- MCP Integration: Full Model Context Protocol support for extensible tools
- Multiple Transports: Stdio, HTTP, and WebSocket support
- Language-Specific Servers: Dedicated MCP servers per programming language
- Streaming Responses: Real-time response streaming from Claude
- Subscription Authentication: Use your Claude Pro/Max subscription instead of API credits
- Professional Architecture: Clean separation of concerns with proper abstractions
- Clean Architecture: Abstractions, implementations, and CLI layers
- Dependency Injection: Full DI container with configuration
- Modern C#: .NET 9, nullable reference types, file-scoped namespaces
- Enterprise Patterns: Proper error handling, logging, and configuration
- Performance Optimized: Async/await throughout, memory efficient
- .NET 9 SDK
- Claude Pro/Max subscription OR Anthropic API key
- MCP servers (optional but recommended)
git clone https://github.com/CyberdineDevelopment/claude-code-sharp.git
cd claude-code-sharp
dotnet buildChoose one of these authentication methods:
# Login with your Claude Pro/Max subscription
dotnet run --project src/CyberdineDevelopment.ClaudeCode.CLI -- auth login
# Check authentication status
dotnet run --project src/CyberdineDevelopment.ClaudeCode.CLI -- auth status
# Logout when done
dotnet run --project src/CyberdineDevelopment.ClaudeCode.CLI -- auth logoutEnvironment Variable:
export ANTHROPIC_API_KEY="your-anthropic-api-key-here"
# OR
export CLAUDECODE__ANTHROPIC__APIKEY="your-anthropic-api-key-here"Configuration File:
Copy appsettings.example.json to appsettings.json and update:
{
"ClaudeCode": {
"Anthropic": {
"ApiKey": "your-anthropic-api-key-here"
}
}
}User Secrets (Development):
dotnet user-secrets set "ClaudeCode:Anthropic:ApiKey" "your-api-key" --project src/CyberdineDevelopment.ClaudeCode.CLIdotnet run --project src/CyberdineDevelopment.ClaudeCode.CLI -- chat -m "Explain async/await in C#"dotnet run --project src/CyberdineDevelopment.ClaudeCode.CLI -- chatdotnet run --project src/CyberdineDevelopment.ClaudeCode.CLI -- chat -m "Hello" --model claude-3-opus-20240229# Login with subscription
dotnet run --project src/CyberdineDevelopment.ClaudeCode.CLI -- auth login
# Check auth status
dotnet run --project src/CyberdineDevelopment.ClaudeCode.CLI -- auth status
# Logout
dotnet run --project src/CyberdineDevelopment.ClaudeCode.CLI -- auth logout# List configured MCP servers
dotnet run --project src/CyberdineDevelopment.ClaudeCode.CLI -- server list
# Check server status
dotnet run --project src/CyberdineDevelopment.ClaudeCode.CLI -- server statusdotnet run --project src/CyberdineDevelopment.ClaudeCode.CLI -- config showsrc/
βββ CyberdineDevelopment.ClaudeCode.Abstractions/ # Core interfaces and contracts
βββ CyberdineDevelopment.ClaudeCode.MCP/ # MCP protocol implementation
βββ CyberdineDevelopment.ClaudeCode.Anthropic/ # Anthropic API client
βββ CyberdineDevelopment.ClaudeCode.CLI/ # Command-line interface
IMcpClient- MCP protocol client contractIAnthropicClient- Anthropic API client contractIAuthenticationService- OAuth subscription authentication- Transport abstractions and DTOs
- JSON-RPC 2.0 transport layer
- Stdio transport for process communication
- Full MCP protocol support (tools, resources, etc.)
- Native HTTP client for Anthropic API
- Support for both API key and subscription authentication
- Automatic client selection based on authentication method
- Streaming response support
- Proper error handling and retry logic
- System.CommandLine integration
- OAuth authentication flow for subscription login
- Configuration management
- Interactive and batch modes
Configure MCP servers in appsettings.json:
{
"ClaudeCode": {
"Servers": {
"csharp-tools": {
"Name": "C# Development Tools",
"Description": "Tools for C# development",
"Command": "mcp-server-csharp",
"Arguments": ["--workspace", "."],
"AutoStart": true
}
}
}
}{
"ClaudeCode": {
"DefaultModel": "claude-3-5-sonnet-20241022",
"MaxTokens": 4096,
"Temperature": 0.7
}
}dotnet builddotnet testdotnet publish src/CyberdineDevelopment.ClaudeCode.CLI -c Release -r win-x64 --self-containedThis implementation supports MCP version 2024-11-05 with:
- Tools: Call server-provided tools
- Resources: Read server-managed resources
- Initialization: Proper handshake and capability negotiation
- Error Handling: Structured error responses
- Streaming: Real-time bidirectional communication
{
"filesystem": {
"Name": "File System Tools",
"Command": "npx",
"Arguments": ["@modelcontextprotocol/server-filesystem", "/path/to/workspace"],
"AutoStart": true
}
}- API keys stored securely via configuration
- Process isolation for MCP servers
- Input validation throughout
- No hardcoded credentials
- Complete MCP server lifecycle management
- Add HTTP/WebSocket transport support
- Implement conversation history
- Add plugin system for custom tools
- Create language-specific MCP server templates
- Add comprehensive test suite
- Performance optimizations
- Docker containerization
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
- Anthropic for the Claude API
- Model Context Protocol specification
- System.CommandLine for CLI framework
Note: This is an independent implementation and is not affiliated with Anthropic's official Claude Code project.