MCP Integration for Admin Tools
AI-powered platform administration and system management using the Model Context Protocol.
Overview
The AltSportsData MCP server provides administrators with tools for:
- User Management - Create, update, and manage user accounts
- Access Control - Configure permissions and roles
- System Monitoring - Track platform health and performance
- Audit Logging - Review system activities and changes
- Configuration Management - Update system settings and features
Quick Setup
Configure for Claude Desktop
Add to your claude_desktop_config.json:
{
"mcpServers": {
"altsportsdata-admin": {
"command": "npx",
"args": ["-y", "@altsportsdata/mcp-server"],
"env": {
"API_KEY": "your-admin-api-key",
"ROLE": "admin",
"ADMIN_LEVEL": "platform"
}
}
}
}Available Tools
1. Manage Users
Create, update, and manage user accounts.
{
"name": "manage_user",
"arguments": {
"action": "create",
"user_data": {
"email": "newuser@example.com",
"role": "league_owner",
"league_id": "regional-soccer-league",
"permissions": ["read_data", "write_data", "manage_partnerships"]
}
}
}Response:
{
"user_id": "user_abc123",
"email": "newuser@example.com",
"role": "league_owner",
"status": "active",
"created_at": "2024-11-18T10:30:00Z",
"api_key": "generated_api_key_here",
"permissions": ["read_data", "write_data", "manage_partnerships"]
}2. Configure Access Control
Manage roles, permissions, and access policies.
{
"name": "configure_access",
"arguments": {
"resource": "api_endpoint",
"resource_id": "/api/leagues/premium-data",
"access_policy": {
"allowed_roles": ["admin", "premium_partner"],
"rate_limit": "1000/hour",
"require_mfa": true
}
}
}3. Monitor System Health
Track platform performance and health metrics.
{
"name": "get_system_health",
"arguments": {
"components": ["api", "database", "cache", "queue"],
"include_metrics": true,
"timeframe": "1h"
}
}Response:
{
"overall_status": "healthy",
"timestamp": "2024-11-18T10:30:00Z",
"components": {
"api": {
"status": "healthy",
"response_time_p95": 125,
"error_rate": 0.02,
"requests_per_minute": 1250
},
"database": {
"status": "healthy",
"connection_pool": "85% utilized",
"query_time_p95": 45
},
"cache": {
"status": "healthy",
"hit_rate": 0.92,
"memory_usage": "68%"
}
},
"alerts": []
}4. Review Audit Logs
Access system activity and change logs.
{
"name": "query_audit_logs",
"arguments": {
"filters": {
"action_types": ["user_created", "permission_changed", "data_access"],
"user_roles": ["admin", "developer"],
"severity": ["medium", "high", "critical"]
},
"timeframe": "7d",
"limit": 100
}
}5. Manage Platform Configuration
Update system settings and feature flags.
{
"name": "update_config",
"arguments": {
"config_section": "rate_limits",
"updates": {
"default_rate_limit": "100/minute",
"premium_rate_limit": "1000/minute",
"burst_allowance": 20
},
"apply_immediately": true
}
}Admin Workflows
Workflow 1: User Onboarding
User: "Onboard a new sportsbook partner"
AI Agent (using MCP):
1. Creates user account with manage_user
2. Configures API access with configure_access
3. Generates API credentials with generate_credentials
4. Sets up rate limits with update_rate_limits
5. Sends welcome email with send_notification
Result: Fully configured partner account ready to useWorkflow 2: Security Incident Response
User: "Investigate suspicious API activity from user xyz123"
AI Agent (using MCP):
1. Queries audit logs with query_audit_logs
2. Analyzes access patterns with analyze_access_patterns
3. Reviews recent actions with get_user_activity
4. Checks for policy violations with check_violations
5. Recommends actions with suggest_security_actions
Result: Comprehensive security report with recommended actionsWorkflow 3: Performance Optimization
User: "API response times are slow, investigate"
AI Agent (using MCP):
1. Gets system health with get_system_health
2. Analyzes slow queries with analyze_slow_queries
3. Reviews cache performance with get_cache_stats
4. Identifies bottlenecks with find_bottlenecks
5. Suggests optimizations with recommend_optimizations
Result: Performance analysis with specific optimization stepsWorkflow 4: Feature Rollout
User: "Enable new player statistics feature for tier 1 partners"
AI Agent (using MCP):
1. Lists tier 1 partners with list_users
2. Updates feature flags with update_feature_flags
3. Configures access with configure_access
4. Tests access with validate_access
5. Notifies partners with send_announcements
Result: Feature successfully enabled for target partnersUser Management
Role Hierarchy
| Role | Access Level | Typical Use Cases |
|---|---|---|
| Super Admin | Full platform control | Platform management, critical changes |
| Admin | System configuration | User management, monitoring |
| Partner Admin | Partner account management | Manage partner users and settings |
| Developer | API access, read-only admin | Integration development, debugging |
| League Owner | League data management | Manage league information |
| Sportsbook | Data consumer | Access sports data |
| Analyst | Read-only access | Data analysis, reporting |
Permission System
{
"permissions": {
"users": ["read", "create", "update", "delete"],
"data": ["read", "write"],
"schemas": ["read", "create", "update"],
"partnerships": ["read", "create", "manage"],
"billing": ["read", "update"],
"system": ["monitor", "configure"]
}
}User Lifecycle Management
// Create user
{
"name": "create_user",
"arguments": {
"email": "user@example.com",
"role": "league_owner",
"metadata": {"league_id": "xyz"}
}
}
// Activate/deactivate
{
"name": "update_user_status",
"arguments": {
"user_id": "user_abc123",
"status": "suspended",
"reason": "Payment overdue"
}
}
// Delete user (soft delete)
{
"name": "delete_user",
"arguments": {
"user_id": "user_abc123",
"delete_type": "soft",
"retention_period": "90d"
}
}Access Control
Rate Limiting
Configure rate limits per user or role:
{
"name": "configure_rate_limit",
"arguments": {
"target": "user_abc123",
"limits": {
"requests_per_minute": 100,
"requests_per_hour": 5000,
"requests_per_day": 50000,
"burst_size": 20
},
"enforcement": "soft" // soft or hard
}
}IP Whitelisting
Restrict access by IP address:
{
"name": "manage_ip_whitelist",
"arguments": {
"user_id": "user_abc123",
"action": "add",
"ip_addresses": ["203.0.113.0/24", "198.51.100.42"],
"description": "Office and VPN IPs"
}
}API Key Management
Generate and manage API keys:
{
"name": "manage_api_key",
"arguments": {
"action": "rotate",
"user_id": "user_abc123",
"key_type": "production",
"expiry": "90d",
"notify_user": true
}
}System Monitoring
Health Checks
Monitor critical system components:
{
"name": "configure_health_checks",
"arguments": {
"checks": [
{
"name": "api_response_time",
"threshold": 200,
"alert_on": "exceed"
},
{
"name": "database_connection_pool",
"threshold": 90,
"alert_on": "exceed"
},
{
"name": "cache_hit_rate",
"threshold": 0.85,
"alert_on": "below"
}
],
"check_interval": "1m",
"alert_channels": ["email", "slack"]
}
}Performance Metrics
Track key performance indicators:
{
"name": "get_performance_metrics",
"arguments": {
"metrics": [
"api_requests_per_second",
"average_response_time",
"error_rate",
"active_users",
"database_query_time"
],
"timeframe": "24h",
"granularity": "5m"
}
}Alert Configuration
Set up automated alerts:
{
"name": "configure_alert",
"arguments": {
"alert_name": "high_error_rate",
"condition": {
"metric": "error_rate",
"operator": "greater_than",
"threshold": 0.05,
"duration": "5m"
},
"actions": [
{
"type": "slack",
"channel": "#alerts",
"message": "High error rate detected: {{value}}"
},
{
"type": "pagerduty",
"severity": "high"
}
]
}
}Audit Logging
Log Query
Search and filter audit logs:
{
"name": "query_audit_logs",
"arguments": {
"filters": {
"user_id": "user_abc123",
"actions": ["data_access", "permission_change"],
"resources": ["leagues", "matches"],
"start_date": "2024-11-01",
"end_date": "2024-11-18"
},
"include_metadata": true,
"format": "json"
}
}Compliance Reports
Generate compliance and audit reports:
{
"name": "generate_compliance_report",
"arguments": {
"report_type": "data_access",
"timeframe": "Q4_2024",
"include_sections": [
"user_activity",
"data_access_patterns",
"permission_changes",
"security_events"
],
"format": "pdf"
}
}Configuration Management
Feature Flags
Control feature rollout:
{
"name": "manage_feature_flag",
"arguments": {
"feature": "advanced_player_stats",
"enabled": true,
"rollout_strategy": {
"type": "gradual",
"percentage": 25,
"target_roles": ["premium_partner"]
}
}
}System Settings
Update platform configuration:
{
"name": "update_system_settings",
"arguments": {
"category": "data_refresh",
"settings": {
"live_match_refresh_rate": "30s",
"standings_refresh_rate": "5m",
"player_stats_refresh_rate": "1h"
}
}
}Integration Examples
TypeScript Integration
import { MCPClient } from '@modelcontextprotocol/sdk';
const adminClient = new MCPClient({
serverUrl: 'http://localhost:3000/mcp',
apiKey: process.env.ADMIN_API_KEY,
role: 'admin'
});
// Create new user
const newUser = await adminClient.call('manage_user', {
action: 'create',
user_data: {
email: 'newuser@example.com',
role: 'league_owner'
}
});
// Get system health
const health = await adminClient.call('get_system_health', {
components: ['api', 'database', 'cache'],
include_metrics: true
});Python Integration
from altsportsdata_mcp import MCPClient
client = MCPClient(
api_key=os.getenv('ADMIN_API_KEY'),
role='admin'
)
# Query audit logs
logs = client.call_tool('query_audit_logs', {
'filters': {
'action_types': ['user_created', 'permission_changed'],
'timeframe': '7d'
}
})
# Configure access
access = client.call_tool('configure_access', {
'resource': 'api_endpoint',
'resource_id': '/api/premium-data',
'access_policy': {
'allowed_roles': ['admin', 'premium_partner']
}
})Example Prompts
User Management
"Create a new sportsbook partner account"
"List all suspended users"
"Reset API key for user xyz123"System Monitoring
"Show me system health for the past hour"
"What's causing the slow API responses?"
"Alert me when error rate exceeds 5%"Security & Compliance
"Show me all failed login attempts today"
"Generate a compliance report for Q4"
"Who accessed league data in the past week?"Configuration
"Enable advanced stats feature for tier 1 partners"
"Update rate limits for premium users"
"Configure IP whitelist for partner xyz"Best Practices
Security
- Use MFA for all admin accounts
- Rotate API keys regularly
- Follow principle of least privilege
- Review audit logs weekly
- Monitor for suspicious activity
User Management
- Use descriptive role names
- Document permission changes
- Maintain user lifecycle processes
- Regular access reviews
- Automated onboarding/offboarding
Monitoring
- Set appropriate alert thresholds
- Test alert channels regularly
- Document incident response procedures
- Track key metrics over time
- Review performance trends monthly
Troubleshooting
Common Issues
Issue: User cannot access resource
Solutions:
- Verify user role and permissions
- Check resource access policy
- Review rate limit status
- Validate API key
- Check IP whitelist
Issue: Alert fatigue from too many notifications
Solutions:
- Adjust alert thresholds
- Implement alert grouping
- Use severity levels
- Set up quiet hours
- Review and disable unnecessary alerts
Issue: Slow admin operations
Solutions:
- Check database performance
- Review audit log size
- Optimize user queries
- Clear old logs
- Scale admin infrastructure