MCP Manager Architecture
Overview
MCP Manager uses Clean Architecture with separation of concerns across multiple layers. Each layer can be tested independently, and the design supports extension without modifying existing code. Runs as desktop app, web server, or container.
Architecture Layers
┌─────────────────────────────────────────┐
│ Presentation Layer │
│ (McpManager.Web - Blazor) │
├─────────────────────────────────────────┤
│ Application Layer │
│ (McpManager.Application - Services) │
├─────────────────────────────────────────┤
│ Infrastructure Layer │
│ (McpManager.Infrastructure - Adapters) │
├─────────────────────────────────────────┤
│ Core/Domain Layer │
│ (McpManager.Core - Models/Interfaces) │
└─────────────────────────────────────────┘
Core Layer (McpManager.Core)
The innermost layer containing:
Domain Models
McpServer: Represents an MCP serverAgent: Represents an AI agent (Claude, Copilot, etc.)ServerInstallation: Links servers to agentsServerHealthStatus: Health monitoring data
Interfaces
IServerManager: Server CRUD operationsIAgentManager: Agent detection and managementIAgentConnector: Agent-specific operations (extensibility point)IInstallationManager: Server-agent relationship managementIServerRegistry: Server discovery and searchIServerMonitor: Health monitoring
Key Principles:
- No dependencies on other layers
- Pure domain logic
- Framework-agnostic
Application Layer (McpManager.Application)
Business logic and orchestration:
Services
ServerManager: Implements server management logicAgentManager: Orchestrates agent detection across connectorsInstallationManager: Manages server-agent relationshipsServerMonitor: Implements health monitoring
Key Principles:
- Depends only on Core layer
- Contains business rules
- No framework-specific code
Infrastructure Layer (McpManager.Infrastructure)
External concerns and adapters:
Agent Connectors
ClaudeConnector: Claude Desktop integrationCopilotConnector: GitHub Copilot integration- Extensible for new agents
Registries
MockServerRegistry: Demo registry (replace with npm, GitHub, etc.)
Key Principles:
- Implements Core interfaces
- Handles external dependencies
- File I/O, network calls, etc.
Presentation Layer (McpManager.Web)
User interface built with Blazor Server:
Pages
Home.razor: Dashboard overviewBrowseServers.razor: Search and install serversInstalledServers.razor: Manage installed serversAgents.razor: View detected agentsAgentDetails.razor: Agent-specific server management
Key Principles:
- Depends on Application and Core layers
- Handles user interaction
- Responsive, intuitive UI
SOLID Principles in Action
Single Responsibility Principle
Each service has one reason to change:
ServerManageronly manages serversAgentManageronly manages agentsInstallationManageronly manages relationships
Open/Closed Principle
The system is open for extension, closed for modification:
- Add new agents by implementing
IAgentConnector - Add new registries by implementing
IServerRegistry - No need to modify existing code
Liskov Substitution Principle
All implementations can be substituted:
- Any
IAgentConnectorworks the same way - Any
IServerRegistryprovides consistent search
Interface Segregation Principle
Interfaces are focused and specific:
IServerManageronly has server operationsIAgentConnectoronly has agent-specific operations- No client is forced to depend on unused methods
Dependency Inversion Principle
High-level modules don't depend on low-level modules:
- Application depends on Core abstractions
- Infrastructure implements Core interfaces
- Web depends on Application services
Data Flow
Example: Installing a Server for an Agent
User clicks "Add to Agent"
↓
AgentDetails.razor (Web Layer)
↓
InstallationManager (Application Layer)
↓
IAgentConnector (Core Interface)
↓
ClaudeConnector (Infrastructure Layer)
↓
Write to agent config file
Extension Points
Adding a New Agent
- Create connector in Infrastructure:
public class NewAgentConnector : IAgentConnector
{
// Implement interface methods
}
- Register in Program.cs:
builder.Services.AddSingleton<IAgentConnector, NewAgentConnector>();
Adding a New Registry
- Create registry in Infrastructure:
public class NpmRegistry : IServerRegistry
{
// Implement interface methods
}
- Register in Program.cs:
builder.Services.AddSingleton<IServerRegistry, NpmRegistry>();
Testing Strategy
Unit Tests
- Services tested in isolation using mocks
- Domain logic tested without dependencies
Integration Tests
- Infrastructure adapters tested with real I/O
- Database and file operations verified
E2E Tests
- Complete user workflows tested
- UI interactions verified
Deployment Scenarios
Desktop Executable
dotnet publish -c Release -r win-x64 --self-contained
- Self-contained executable
- Runs locally on user's machine
- Direct access to agent configs
Web Server
dotnet run --project src/McpManager.Web
- Hosted web application
- Remote access via browser
- Centralized management
Docker Container
docker build -t mcp-manager .
docker run -p 8080:8080 mcp-manager
- Containerized deployment
- Easy scaling
- Cloud-ready architecture
Security Considerations
- File Access: Agent configurations contain sensitive data
- Authentication: Web deployment should add auth
- Validation: Input validation on all user inputs
- Isolation: Container deployment provides process isolation
Performance
- In-memory state for fast operations
- Async/await for non-blocking I/O
- Lazy loading
- Registry results could be cached
Future Enhancements
- Persistence: Add database for state management
- Authentication: OAuth/OIDC for web deployment
- Real Registries: Connect to npm, GitHub registries
- Monitoring: Enhanced server health monitoring
- Notifications: Alert on server failures
- Backup/Restore: Configuration backup features