|
| 1 | +--- |
| 2 | +title: Group MCP servers |
| 3 | +description: |
| 4 | + How to organize MCP servers into logical groups and configure client access. |
| 5 | +--- |
| 6 | + |
| 7 | +This guide explains how to organize your MCP servers into logical groups and |
| 8 | +configure which groups your MCP clients can access. Groups help you organize |
| 9 | +servers by project, environment, or team, and control which tools are available |
| 10 | +to different clients. |
| 11 | + |
| 12 | +## Why use groups? |
| 13 | + |
| 14 | +Groups let you organize MCP servers and control client access: |
| 15 | + |
| 16 | +- **Project isolation**: Keep development and production servers separate |
| 17 | +- **Environment management**: Organize servers by development stage |
| 18 | +- **Client customization**: Configure different tool sets for different clients |
| 19 | + |
| 20 | +:::info What's the default behavior? |
| 21 | + |
| 22 | +All MCP servers are automatically assigned to the `default` group unless you |
| 23 | +specify otherwise. MCP clients configured without a specific group can access |
| 24 | +all servers in the `default` group. |
| 25 | + |
| 26 | +::: |
| 27 | + |
| 28 | +## Create and organize groups |
| 29 | + |
| 30 | +### Create a group |
| 31 | + |
| 32 | +```bash |
| 33 | +thv group create <GROUP_NAME> |
| 34 | +``` |
| 35 | + |
| 36 | +For example, to create separate groups for different environments: |
| 37 | + |
| 38 | +```bash |
| 39 | +thv group create development |
| 40 | +thv group create production |
| 41 | +``` |
| 42 | + |
| 43 | +### Run servers in a group |
| 44 | + |
| 45 | +When running an MCP server, specify the group using the `--group` flag: |
| 46 | + |
| 47 | +```bash |
| 48 | +thv run --group development fetch |
| 49 | +thv run --group production filesystem --volume /prod/repo:/projects:ro |
| 50 | +``` |
| 51 | + |
| 52 | +:::info What's happening? |
| 53 | + |
| 54 | +When you specify a group: |
| 55 | + |
| 56 | +1. The server is assigned to that group and labeled accordingly |
| 57 | +2. The server can only be accessed by clients configured for that group |
| 58 | + |
| 59 | +::: |
| 60 | + |
| 61 | +A single workload can only belong to one group at a time. To run multiple |
| 62 | +instances of the same MCP server in different groups, use a unique name for each |
| 63 | +instance: |
| 64 | + |
| 65 | +```bash |
| 66 | +thv run --group development --name fetch-dev fetch |
| 67 | +thv run --group production --name fetch-prod fetch |
| 68 | +``` |
| 69 | + |
| 70 | +## Configure client access to groups |
| 71 | + |
| 72 | +You can configure MCP clients to access specific groups, giving you control over |
| 73 | +which tools are available in different contexts. |
| 74 | + |
| 75 | +### Configure a client for a specific group |
| 76 | + |
| 77 | +When registering a client, you can specify which group it should access: |
| 78 | + |
| 79 | +```bash |
| 80 | +thv client register <CLIENT_NAME> --group development |
| 81 | +``` |
| 82 | + |
| 83 | +This configures the client to only access servers in the `development` group. |
| 84 | + |
| 85 | +## Example workflows |
| 86 | + |
| 87 | +### Project-based organization |
| 88 | + |
| 89 | +```bash |
| 90 | +# Create groups for different projects |
| 91 | +thv group create webapp-frontend |
| 92 | +thv group create webapp-backend |
| 93 | + |
| 94 | +# Run project-specific servers |
| 95 | +thv run --group webapp-frontend mcp-react-tools |
| 96 | +thv run --group webapp-backend mcp-database-tools |
| 97 | + |
| 98 | +# Configure clients with appropriate access |
| 99 | +thv client register --client vscode --group webapp-frontend |
| 100 | +thv client register --client cursor --group webapp-backend |
| 101 | +``` |
| 102 | + |
| 103 | +## Manage groups |
| 104 | + |
| 105 | +### Remove a group |
| 106 | + |
| 107 | +Remove a group and move its servers to the default group: |
| 108 | + |
| 109 | +```bash |
| 110 | +thv group rm development |
| 111 | +``` |
| 112 | + |
| 113 | +Remove a group and delete all its servers: |
| 114 | + |
| 115 | +```bash |
| 116 | +thv group rm development --with-workloads |
| 117 | +``` |
| 118 | + |
| 119 | +:::warning |
| 120 | + |
| 121 | +Using `--with-workloads` permanently deletes all servers in the group. |
| 122 | + |
| 123 | +::: |
| 124 | + |
| 125 | +## Related information |
| 126 | + |
| 127 | +- [Client configuration](client-configuration.mdx) |
| 128 | +- [Run MCP servers](run-mcp-servers.mdx) |
| 129 | +- [`thv group` command reference](../reference/cli/thv_group.md) |
| 130 | +- [`thv client` command reference](../reference/cli/thv_client.md) |
0 commit comments