owenqian_mcp_server_manager

owenqian_mcp_server_manager

by OwenQian
A Python-based tool to manage and configure multiple Model Context Protocol (MCP) servers with Supergateway integration.

Model Context Protocol Server Manager

A Python script to manage Model Context Protocol (MCP) servers with Supergateway as SSE servers.

Features

  • Configure and manage multiple MCP servers
  • Automatically wraps stdio servers with Supergateway to expose them as SSE servers
  • Run multiple servers simultaneously with background mode
  • Support for both stdio and SSE MCP servers
  • Properly manage and clean up background processes

QuickStart

1. Set Up Environment

# 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

2. Run the MCP Inspector

# Start the MCP Inspector server
make run-inspector

# In a web browser, navigate to:
# http://localhost:5173

3. Run All MCP Servers

# 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

4. Configure Cursor to Use MCP Servers

Create or edit the Cursor MCP configuration file at ~/.cursor/mcp.json.

5. Test Connectivity

In the MCP Inspector web interface:

  1. Connect to an SSE endpoint (e.g., http://localhost:8090/sse)
  2. Try using one of the available MCP services

6. Stopping Servers

# Stop MCP Inspector
make stop-inspector

# Stop all other MCP servers
make stop-servers

Installation

Prerequisites

  • Python 3.6+
  • Supergateway must be installed and available in your PATH
  • python-dotenv package (pip install python-dotenv)
  • psutil package (pip install psutil)

Environment Setup

Copy the example environment file and fill in your API keys:

cp .env.example .env
# Then edit .env to add your actual API keys

MCP Inspector Server

Running the MCP Inspector Server with Make

# 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

Configuration Options

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

Port Conflict Detection

The MCP Inspector now automatically checks if required ports are available before starting.

Managing MCP Servers

Adding a new MCP server configuration

python mcp_servers.py add --name <server_name> --cmd <command> [--args arg1 arg2 ...] [--env KEY1=VALUE1 KEY2=VALUE2 ...] [--port <port>] [--type stdio|sse]

Listing configured servers

python mcp_servers.py list

Running servers

Run all servers:

# 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

Run a single server:

python mcp_servers.py run <server_name>

Run multiple specific servers:

python mcp_servers.py run <server1_name> <server2_name> ... <serverN_name>

Stopping servers

# Stop all servers (sends interrupt signal)
make stop-servers

Removing a server configuration

python mcp_servers.py remove <server_name>

Using a different configuration file

python mcp_servers.py <command> --config custom_config.json

Configuration Format

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"
    }
  ]
}

Using with Cursor

Cursor Configuration

  1. Create or edit the Cursor MCP configuration file at ~/.cursor/mcp.json
  2. Add your MCP servers as shown in the example below:
{
  "mcpServers": {
    "filesystem": {
      "url": "http://localhost:8090/sse"
    },
    "youtube": {
      "url": "http://localhost:8092/sse"
    }
  }
}

Available MCP Servers

Depending on your configuration, you may have access to servers like:

  • filesystem (port 8090): Access to your local file system
  • youtube (port 8092): Search and fetch YouTube videos
  • fetch (port 8093): Make HTTP requests
  • github (port 8094): Interact with GitHub repos
  • brave-search (port 8096): Web search capabilities
  • google-maps (port 8098): Mapping and location services
  • And more...

Testing MCP Servers in Cursor

Once you've configured Cursor to use your MCP servers:

  1. Open Cursor
  2. Start a new chat and ask a question that would use one of the configured MCP servers
  3. Cursor should now be able to use these servers to access additional functionality

For example:

  • With the filesystem server, ask "List files in my Downloads folder"
  • With the brave-search server, ask "Search the web for the latest news about AI"

Features & Capabilities

Categories
mcp_server model_context_protocol python supergateway sse api_integration server_management cursor

Implementation Details

Stats

0 Views
2 GitHub Stars

Repository Info

OwenQian Organization

Similar MCP Servers

continuedev_continue by continuedev
25049
21423
9300