Overview

MCPHub’s server management system allows you to centrally configure, monitor, and control multiple MCP (Model Context Protocol) servers from a single dashboard. All changes are applied in real-time without requiring server restarts.

Adding MCP Servers

Via Dashboard

  1. Access the Dashboard: Navigate to http://localhost:3000 and log in
  2. Click “Add Server”: Located in the servers section
  3. Fill Server Details:
    • Name: Unique identifier for the server
    • Command: Executable command (e.g., npx, uvx, python)
    • Arguments: Array of command arguments
    • Environment Variables: Key-value pairs for environment setup
    • Working Directory: Optional working directory for the command

Via Configuration File

Edit your mcp_settings.json file:
{
  "mcpServers": {
    "server-name": {
      "command": "command-to-run",
      "args": ["arg1", "arg2"],
      "env": {
        "API_KEY": "your-api-key",
        "CONFIG_VALUE": "some-value"
      },
      "cwd": "/optional/working/directory"
    }
  }
}

Via API

Use the REST API to add servers programmatically:
curl -X POST http://localhost:3000/api/servers \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -d '{
    "name": "fetch-server",
    "command": "uvx",
    "args": ["mcp-server-fetch"],
    "env": {}
  }'

Server Lifecycle Management

Starting Servers

Servers are automatically started when:
  • MCPHub boots up
  • A server is added via the dashboard or API
  • A server configuration is updated
  • A stopped server is manually restarted

Stopping Servers

You can stop servers:
  • Via Dashboard: Toggle the server status switch
  • Via API: Send a POST request to /api/servers/{name}/toggle
  • Automatically: Servers stop if they crash or encounter errors

Restarting Servers

Servers are automatically restarted:
  • When configuration changes are made
  • After environment variable updates
  • When manually triggered via dashboard or API

Server Status Monitoring

Status Indicators

Each server displays a status indicator:
  • 🟢 Running: Server is active and responding
  • 🟡 Starting: Server is initializing
  • 🔴 Stopped: Server is not running
  • ⚠️ Error: Server encountered an error

Real-time Logs

View server logs in real-time:
  1. Dashboard Logs: Click on a server to view its logs
  2. API Logs: Access logs via /api/logs endpoint
  3. Streaming Logs: Subscribe to log streams via WebSocket

Health Checks

MCPHub automatically performs health checks:
  • Initialization Check: Verifies server starts successfully
  • Tool Discovery: Confirms available tools are detected
  • Response Check: Tests server responsiveness
  • Resource Monitoring: Tracks CPU and memory usage

Configuration Management

Environment Variables

Servers can use environment variables for configuration:
{
  "server-name": {
    "command": "python",
    "args": ["server.py"],
    "env": {
      "API_KEY": "${YOUR_API_KEY}",
      "DEBUG": "true",
      "MAX_CONNECTIONS": "10"
    }
  }
}
Environment Variable Expansion:
  • ${VAR_NAME}: Expands to environment variable value
  • ${VAR_NAME:-default}: Uses default if variable not set
  • ${VAR_NAME:+value}: Uses value if variable is set

Command Variations

Different ways to specify server commands:
{
  "npm-server": {
    "command": "npx",
    "args": ["-y", "package-name", "--option", "value"]
  }
}

Advanced Features

Hot Reloading

MCPHub supports hot reloading of server configurations:
  1. Dashboard Updates: Immediately applies changes made through the web interface
  2. API Updates: Real-time updates via REST API calls
  3. Zero Downtime: Graceful server restarts without affecting other servers

Troubleshooting

Next Steps