README.md•7.9 kB
# Solid Multi-Tenant DevOps MCP Server
AI-first DevOps tooling for managing your Solid SaaS platform with thousands of tenant instances.
## Overview
This MCP server provides comprehensive monitoring and management capabilities for your multi-tenant Solid platform through Claude Desktop. Monitor thousands of company instances, track AI agent performance, handle errors, and provision new tenants - all through natural language conversation with Claude.
## Features
### 🏢 **Tenant Management** (Thousands of Customers)
- List all tenant companies with pagination
- Get detailed tenant information
- Search tenants by name, email, or ID
- Platform-wide analytics across all tenants
- Bulk health checks for multiple tenants
### 🤖 **AI Agent Monitoring** (Per Tenant)
- Monitor all 12 AI agents (ADA, Sarah, Jake, Sophia, Marcus, Alex, Jordan, Maya, Riley, Casey, Annie, Devon)
- Track inter-agent communication
- View agent status and performance metrics
- Monitor token usage and costs per tenant
### 💰 **Token Billing & Analytics**
- Track AI token usage per tenant
- Monitor costs with 2.5x markup
- View budget status and alerts
- Cost savings analysis (AI vs Human employees)
### 🔍 **Error Monitoring**
- List recent errors across all tenants
- Filter by tenant, severity, or time range
- Get detailed error information with stack traces
- Mark errors as resolved with notes
### ⚡ **Performance Monitoring**
- System-wide performance metrics
- Identify slow API endpoints
- Database query analysis
- Real-time health checks
### 🐳 **Docker Management**
- Monitor PostgreSQL, Redis, and Backend containers
- Check container health status
- View container logs
### 🚀 **Tenant Provisioning**
- Provision new tenant companies
- Configure subscription plans (starter, professional, enterprise)
- Enable demo mode with sample data
- Automated setup workflow
## Installation
### 1. Install Dependencies
```bash
cd solid-mcp-server
npm install
```
### 2. Configure Environment
The `.env` file is already created with your local endpoints:
```bash
BACKEND_URL=http://localhost:8090
FRONTEND_URL=http://localhost:3000
CMS_URL=http://localhost:3001
SUPER_ADMIN_URL=http://localhost:8080
AGENTS_URL=http://localhost:8091
```
### 3. Configure Claude Desktop
Add this to your Claude Desktop config file:
**macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
```json
{
"mcpServers": {
"solid-devops": {
"command": "node",
"args": ["/Users/adamcampbell/Desktop/Solid/solid-mcp-server/src/index.js"],
"env": {}
}
}
}
```
### 4. Restart Claude Desktop
Quit Claude Desktop completely and reopen it.
## Available Tools
### Tenant Management
- `list_all_tenants` - List all tenant companies (with pagination)
- `get_tenant_details` - Get detailed info about a specific tenant
- `get_platform_analytics` - Platform-wide analytics
- `search_tenants` - Search by name, email, or ID
- `bulk_check_tenant_health` - Health check multiple tenants at once
### System Health
- `check_all_services_health` - Check Backend, Agents, Docker services
- `check_docker_containers` - Check PostgreSQL, Redis, Backend containers
### Tenant-Specific Monitoring
- `get_tenant_agents` - All AI agents for a tenant
- `get_tenant_agent_messages` - Inter-agent communication
- `get_tenant_products` - Products/inventory for a tenant
- `get_tenant_token_usage` - AI token usage and billing
### Error Monitoring
- `list_recent_errors` - Recent errors (all tenants or specific)
- `get_error_details` - Detailed error information
- `resolve_error` - Mark error as resolved
### Performance Monitoring
- `get_performance_summary` - Overall system performance
- `get_slow_endpoints` - Find slow API endpoints
### Tenant Provisioning
- `provision_new_tenant` - Create new tenant company
### Database Operations
- `execute_raw_query` - Execute raw SQL (READ-ONLY for safety)
## Usage Examples
### Example 1: List All Tenants
```
You: Show me all tenants in the system
Claude will call: list_all_tenants(limit=100, offset=0)
```
### Example 2: Check Tenant Health
```
You: Check the health of company ID 1, 2, and 3
Claude will call: bulk_check_tenant_health(company_ids=[1, 2, 3])
```
### Example 3: Monitor AI Agents
```
You: Show me all AI agents for company 5 and their status
Claude will call: get_tenant_agents(company_id=5)
```
### Example 4: View Recent Errors
```
You: Show me critical errors from the last hour
Claude will call: list_recent_errors(severity="critical", limit=50)
```
### Example 5: Provision New Tenant
```
You: Create a new tenant for Acme Corp with email admin@acme.com on the professional plan
Claude will call: provision_new_tenant(
company_name="Acme Corp",
owner_email="admin@acme.com",
plan="professional"
)
```
### Example 6: Monitor Performance
```
You: Find slow API endpoints that take longer than 2 seconds
Claude will call: get_slow_endpoints(threshold_ms=2000, limit=20)
```
## Architecture
### Multi-Tenant Design
- Each tenant is a `Company` with a unique `company_id`
- All data is scoped per company/tenant
- Agents, products, users, orders all belong to a company
- Platform admins can monitor all tenants from http://localhost:8080/admin
### Service Endpoints
- **Backend**: http://localhost:8090 - Main API server
- **Super Admin**: http://localhost:8080 - Platform management dashboard
- **Agents**: http://localhost:8091 - AI agent execution server
- **Frontend**: http://localhost:3000 - Customer-facing UI
- **CMS**: http://localhost:3001 - Public CMS
### Database
- **PostgreSQL**: Company data, agents, products, orders
- **Redis**: Caching, event bus, performance monitoring
## Workflow Examples
### Morning Health Check
```
1. Check all services health
2. View platform analytics
3. Check for critical errors overnight
4. Review slow endpoints that need optimization
```
### Tenant Onboarding
```
1. Provision new tenant
2. Verify agents are created
3. Check initial setup completed
4. Monitor first customer interactions
```
### Performance Investigation
```
1. Get performance summary
2. Identify slow endpoints
3. Check specific tenant experiencing issues
4. Review error logs for that tenant
```
### Scaling Monitoring
```
1. List all tenants with pagination
2. Bulk check health of top 50 tenants
3. Review token usage trends
4. Identify tenants needing plan upgrades
```
## Troubleshooting
### MCP Server Not Appearing in Claude Desktop
1. Check config file location: `~/Library/Application Support/Claude/claude_desktop_config.json`
2. Verify path to index.js is absolute (not relative)
3. Restart Claude Desktop completely
4. Check logs in Claude Desktop Developer Tools
### Connection Errors
1. Ensure all Solid services are running: `./start-all.sh`
2. Check services are accessible:
```bash
curl http://localhost:8090/
curl http://localhost:8091/health
```
3. Verify Docker containers are running:
```bash
docker ps
```
### Tool Execution Errors
- Check the specific endpoint exists in your backend
- Some tools may return "Not Found" if the endpoint isn't implemented yet
- Backend logs: `tail -f logs/backend.log`
## Development
### Add New Tools
Edit `src/index.js` and:
1. Add tool definition to `ListToolsRequestSchema` handler
2. Add tool implementation to `CallToolRequestSchema` handler
3. Test with Claude Desktop
### Update Endpoints
Edit `.env` file to point to different service URLs (staging, production, etc.)
## System Requirements
- Node.js 18+
- Running Solid services (Backend, Agents, Docker)
- Claude Desktop
## Support
For issues or questions:
- Check backend logs: `tail -f logs/backend.log`
- Check agent logs: `tail -f logs/agents.log`
- View Docker logs: `docker-compose logs -f`
---
**Status**: ✅ Ready for AI-first DevOps monitoring of thousands of tenant instances
**Version**: 1.0.0