MCP Server Manager is a daemon tool for managing multiple server processes (startup, shutdown, monitoring, and automatic restart) based on the configuration file mcp_server.conf.
Each server process is automatically assigned a unique ID based on its startup command. Using the mcpctl command-line tool, you can operate individual servers by specifying their IDs.
It operates as a systemd service and enhances service availability by automatically restarting processes that terminate unexpectedly.
- Simple Configuration File: Simply describe the commands of servers you want to manage in
mcp_server.conf. - Flexible ID Management: Each server command is automatically assigned a unique ID (hash) based on its content, or you can specify custom IDs.
- Command-line Operations: Use
mcpctlto check IDs withstatusand operate individual servers withstart,stop, andrestart. - Automatic Process Restart: When a process terminates for reasons other than
mcpctl stop, the daemon automatically restarts it. - systemd Integration: Easy service registration using
mcp-manager.service.
- Configuration: Edit
/etc/mcp/mcp_server.confto describe the startup commands of servers you want to manage, one per line. - Reload: Execute
sudo systemctl restart mcp-manager.serviceto reflect configuration changes to the daemon. - Check: Run
mcpctl statusto check the status and automatically generated IDs of each server. - Operations: Use the confirmed IDs with commands like
mcpctl start <ID>ormcpctl stop <ID>to manage individual servers.
-
Install systemd-mcp Manager
sudo ./install.sh
This script automatically performs the following tasks:
- Creates necessary directories (
/usr/local/lib/mcp-manager/,/etc/mcp/) - Copies
mcp_manager.pyto/usr/local/lib/mcp-manager/ - Copies
mcpctlto/usr/local/bin/(adds to PATH) - Copies configuration file with examples to
/etc/mcp/mcp_server.conf - Installs and registers systemd service file
- Prompts to enable and start the service (defaults to Yes)
- Creates necessary directories (
-
Optional: Install MCP Server for AI Integration
cd mcp sudo ./install.shThis provides systemd control tools for AI assistants like Claude Desktop.
-
Verify Installation
mcpctl status
If the service is running, you should see "No servers are defined in the configuration file." (normal for fresh install)
For manual installation, follow these steps:
-
Grant Execute Permissions Grant execute permissions to scripts in the project.
chmod +x mcp_manager.py mcpctl mcp_server.sh install.sh uninstall.sh
-
Create Directories
sudo mkdir -p /usr/local/lib/mcp-manager sudo mkdir -p /etc/mcp
-
Deploy Files
sudo cp mcp_manager.py /usr/local/lib/mcp-manager/ sudo cp mcpctl /usr/local/bin/ sudo cp mcp_server.conf /etc/mcp/mcp_server.conf
-
Edit Configuration File The configuration file includes sample configurations that you can uncomment and modify:
sudo nano /etc/mcp/mcp_server.conf
Sample configurations included:
# id=web-server /usr/bin/python3 -m http.server 8080 # id=api-server node /path/to/api/server.js --port 3000 # /usr/bin/python3 /path/to/worker.py # Auto-generated hash ID # id=database redis-server /etc/redis/redis.conf -
Verify and Start systemd Service File Open
mcp-manager.serviceand verify the paths are correct. Then start the service as follows:sudo cp mcp-manager.service /etc/systemd/system/ sudo systemctl daemon-reload sudo systemctl start mcp-manager.service sudo systemctl enable mcp-manager.service
To completely remove MCP Server Manager from the system:
sudo ./uninstall.shThis script performs the following tasks:
- Stops and disables the systemd service
- Removes service files
- Removes installed files
- Removes configuration files (with confirmation)
-
Check Status: Displays the status and IDs of all servers described in
mcp_server.conf.mcpctl status
Example Output:
ID STATUS PID UPTIME COMMAND -------- --------- ------- --------------- -------------------------------- a1b2c3d Running 12345 0 days, 0:10:30 /data/systemd-mcp/mcp_server.sh e4f5g6h Stopped N/A N/A /usr/bin/python3 /path/to/another/server -
Start Server: Use ID to start a stopped (
Stopped) or idle (Idle) server.mcpctl start e4f5g6h
-
Start All Servers from Configuration File: Reload the configuration file and start all servers.
mcpctl apply
-
Stop Server: Use ID to stop a running (
Running) server. Servers stopped this way are excluded from automatic restart.mcpctl stop a1b2c3d
-
Restart Server: Use ID to restart a running server.
mcpctl restart a1b2c3d