Tutorial

Configure Multiple MCP Servers - Run 5-10+ Servers Simultaneously

Learn how to configure and run multiple MCP servers simultaneously. Covers config examples, naming conventions, port management, and memory optimization.

Why Run Multiple MCP Servers?

The real power of the Model Context Protocol emerges when you combine multiple specialized servers. Instead of one monolithic server that does everything, the MCP ecosystem encourages small, focused servers - one for database access, one for file operations, one for web search, one for Git, and so on. Running 5-10 servers simultaneously gives your AI assistant a rich toolkit that covers most development workflows.

This guide walks you through configuring multiple servers across Claude Desktop, Cursor, and VS Code, with real config examples showing 5+ servers running together. You'll learn server naming conventions, how to avoid port conflicts, manage memory, and control startup order.

For guidance on how many servers your system can handle, see our how many MCP servers can you run guide.

Claude Desktop - Multi-Server Configuration

Claude Desktop uses a JSON configuration file to define MCP servers. Each server gets a unique key in the mcpServers object. Here's a production-ready config with 6 servers:

{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-filesystem", "/home/user/projects"],
      "env": {}
    },
    "postgres": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-postgres"],
      "env": {
        "POSTGRES_URL": "postgresql://user:pass@localhost:5432/mydb"
      }
    },
    "github": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-github"],
      "env": {
        "GITHUB_PERSONAL_ACCESS_TOKEN": "ghp_xxxxxxxxxxxx"
      }
    },
    "brave-search": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-brave-search"],
      "env": {
        "BRAVE_API_KEY": "BSAxxxxxxxxxx"
      }
    },
    "memory": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-memory"]
    },
    "puppeteer": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-puppeteer"]
    }
  }
}

Config file location: On macOS: ~/Library/Application Support/Claude/claude_desktop_config.json. On Windows: %APPDATA%\Claude\claude_desktop_config.json. On Linux: ~/.config/Claude/claude_desktop_config.json.

Cursor - Multi-Server Configuration

Cursor supports MCP servers through its settings UI and config file. Here's a config with 5 servers:

{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-filesystem", "."]
    },
    "github": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-github"],
      "env": {
        "GITHUB_PERSONAL_ACCESS_TOKEN": "ghp_xxxxxxxxxxxx"
      }
    },
    "sqlite": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-sqlite", "./data/app.db"]
    },
    "brave-search": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-brave-search"],
      "env": {
        "BRAVE_API_KEY": "BSAxxxxxxxxxx"
      }
    },
    "sequential-thinking": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-sequential-thinking"]
    }
  }
}

In Cursor, navigate to Settings > MCP to manage servers through the UI, or edit the config file directly at .cursor/mcp.json in your project root.

VS Code - Multi-Server Configuration

VS Code configures MCP servers in settings.json or .vscode/mcp.json. Here's a config with 5 servers:

// .vscode/mcp.json
{
  "servers": {
    "filesystem": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-filesystem", "${workspaceFolder}"]
    },
    "github": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-github"],
      "env": {
        "GITHUB_PERSONAL_ACCESS_TOKEN": "${input:github_token}"
      }
    },
    "postgres": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-postgres"],
      "env": {
        "POSTGRES_URL": "${input:postgres_url}"
      }
    },
    "memory": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-memory"]
    },
    "brave-search": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-brave-search"],
      "env": {
        "BRAVE_API_KEY": "${input:brave_key}"
      }
    }
  }
}

Server Naming Conventions

Consistent naming makes your config readable and prevents conflicts. Follow these conventions:

Pattern Example When to Use
Service name postgres, github One server per service
Service-environment postgres-dev, postgres-prod Multiple instances of same service
Purpose-based web-search, code-analysis Custom servers with clear purpose

Rules: Use lowercase kebab-case. Keep names short (1-3 words). Avoid generic names like server1 or my-server. The name appears in AI tool calls, so make it descriptive.

Avoiding Port Conflicts

Most MCP servers use stdio transport (communication over stdin/stdout), which means they don't need network ports at all. Port conflicts only arise when using Streamable HTTP transport or when servers themselves need to bind to ports (e.g., Puppeteer's debugging port).

If you run multiple servers that do need ports, assign explicit port numbers in your config:

{
  "mcpServers": {
    "puppeteer-main": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-puppeteer"],
      "env": {
        "PUPPETEER_CHROME_PORT": "9222"
      }
    },
    "custom-http-server": {
      "command": "node",
      "args": ["my-server.js", "--port", "3100"]
    }
  }
}

Keep a port registry for your team. Document which ports are used by which server to prevent conflicts when adding new ones.

Memory Management

Each MCP server runs as a separate process, consuming memory independently. A typical Node.js MCP server uses 30-80 MB of RAM. With 10 servers, that's 300-800 MB - significant on machines with 8 GB RAM.

Strategies for managing memory with many servers:

  • Monitor usage: Use ps aux | grep mcp or your system's activity monitor to track per-server memory.
  • Set Node.js memory limits: Add "env": { "NODE_OPTIONS": "--max-old-space-size=64" } to constrain individual servers.
  • Disable unused servers: Don't run servers you're not actively using. Comment them out or use project-specific configs.
  • Use project-scoped configs: Instead of loading all servers globally, configure servers per-project so only relevant ones start.
  • Prefer lightweight servers: Python-based servers using FastMCP tend to use less memory than equivalent Node.js servers for simple tasks.

Startup Order and Dependencies

MCP clients typically start all configured servers in parallel. This can be an issue if Server B depends on Server A being ready (e.g., a server that depends on a database server). Most clients don't support explicit startup ordering, so handle dependencies at the server level:

  • Retry on startup: Have servers retry their connections during initialization instead of failing immediately.
  • Health check endpoints: Implement health checks that report when a server is truly ready.
  • Lazy connections: Don't connect to external services until the first tool call that needs them.

Browse all available servers on our MCP servers directory to find the right combination for your workflow.

Recommended Server Combinations

Here are battle-tested combinations for common workflows:

Workflow Servers Memory
Web Development filesystem + github + postgres + puppeteer + memory ~350 MB
Data Science filesystem + postgres + sqlite + brave-search + memory ~300 MB
DevOps github + filesystem + docker + kubernetes + slack ~400 MB

Frequently Asked Questions

Related Guides

Ready to explore MCP servers?

Browse 100+ curated MCP servers
Step-by-step setup tutorials
Community-driven reviews and ratings