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. - Automatic ID Generation: Each server command is automatically assigned a unique ID (hash) based on its content.
- 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.
-
Run the Installation Script
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
mcp_server.confto/etc/mcp/ - Installs and registers systemd service file
- Starts the service and enables automatic startup
- Creates necessary directories (
-
Verify Installation
mcpctl status
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 Edit the configuration file as needed.
sudo vi /etc/mcp/mcp_server.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