A Python script to manage Model Context Protocol (MCP) servers with Supergateway as SSE servers.
# Clone the repository and cd
cd mcp-server-manager
# Set up your environment file with API keys
cp .env.example .env
# Edit .env and add your API keys
# Install required packages
pip install -r requirements.txt
# Start the MCP Inspector server
make run-inspector
# In a web browser, navigate to:
# http://localhost:5173
# Run all configured MCP servers (with keep-alive enabled by default)
make run-servers
# Run servers without keep-alive
make run-servers KEEP_ALIVE=0
Create or edit the Cursor MCP configuration file at ~/.cursor/mcp.json
.
In the MCP Inspector web interface:
# Stop MCP Inspector
make stop-inspector
# Stop all other MCP servers
make stop-servers
pip install python-dotenv
)pip install psutil
)Copy the example environment file and fill in your API keys:
cp .env.example .env
# Then edit .env to add your actual API keys
# Check if all ports (inspector and server) are available
make check-all-ports
# Kill processes using conflicting inspector ports
make kill-conflicts
# Start the MCP Inspector server
make run-inspector
# Stop the MCP Inspector server
make stop-inspector
# Run all MCP servers
make run-servers
# Stop all running MCP servers
make stop-servers
# Force start even if ports are in use
FORCE=1 make run-inspector
# Use a custom configuration file
CONFIG_FILE=custom_config.json make check-server-ports
You can customize the MCP Inspector server by setting environment variables:
# Custom ports
CLIENT_PORT=5174 SERVER_PORT=8090 INSPECTOR_PORT=8001 make run-inspector
# Check specific ports
CLIENT_PORT=5174 SERVER_PORT=8090 INSPECTOR_PORT=8001 make check-inspector-ports
# Kill processes on specific ports
CLIENT_PORT=5174 SERVER_PORT=8090 INSPECTOR_PORT=8001 make kill-conflicts
The MCP Inspector now automatically checks if required ports are available before starting.
python mcp_servers.py add --name <server_name> --cmd <command> [--args arg1 arg2 ...] [--env KEY1=VALUE1 KEY2=VALUE2 ...] [--port <port>] [--type stdio|sse]
python mcp_servers.py list
# Run with keep-alive (default)
make run-servers
# Run without keep-alive
make run-servers KEEP_ALIVE=0
# or
python mcp_servers.py run-all
python mcp_servers.py run <server_name>
python mcp_servers.py run <server1_name> <server2_name> ... <serverN_name>
# Stop all servers (sends interrupt signal)
make stop-servers
python mcp_servers.py remove <server_name>
python mcp_servers.py <command> --config custom_config.json
The script stores server configurations in a JSON file (default: mcp_config.json
):
{
"servers": [
{
"name": "github-api",
"command": "python",
"args": ["github_mcp_server.py"],
"env": {
"API_KEY": "${GITHUB_API_KEY}"
},
"port": 8080,
"server_type": "stdio"
},
{
"name": "perplexity-api",
"command": "python",
"args": ["perplexity_mcp_server.py"],
"env": {},
"port": null,
"server_type": "sse"
}
]
}
~/.cursor/mcp.json
{
"mcpServers": {
"filesystem": {
"url": "http://localhost:8090/sse"
},
"youtube": {
"url": "http://localhost:8092/sse"
}
}
}
Depending on your configuration, you may have access to servers like:
filesystem
(port 8090): Access to your local file systemyoutube
(port 8092): Search and fetch YouTube videosfetch
(port 8093): Make HTTP requestsgithub
(port 8094): Interact with GitHub reposbrave-search
(port 8096): Web search capabilitiesgoogle-maps
(port 8098): Mapping and location servicesOnce you've configured Cursor to use your MCP servers:
For example: