Skip to content

Commit 8e13464

Browse files
authored
Add documentation for groups (#124)
1 parent 79d8f33 commit 8e13464

File tree

5 files changed

+179
-0
lines changed

5 files changed

+179
-0
lines changed

docs/toolhive/guides-cli/client-configuration.mdx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,12 @@ Example:
6767
thv client register vscode
6868
```
6969

70+
You can register a client with a specific group using the `--group` option:
71+
72+
```bash
73+
thv client register <CLIENT_NAME> --group <GROUP_NAME>
74+
```
75+
7076
Run [`thv client register --help`](../reference/cli/thv_client_register.md) for
7177
the latest list of supported clients.
7278

@@ -87,6 +93,12 @@ To remove a client configuration:
8793
thv client remove <CLIENT_NAME>
8894
```
8995

96+
To remove a client configuration from a specific group:
97+
98+
```bash
99+
thv client remove <CLIENT_NAME> --group <GROUP_NAME>
100+
```
101+
90102
## Other clients or tools
91103

92104
If you have other clients or development libraries that ToolHive doesn't
Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
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)

docs/toolhive/guides-cli/manage-mcp-servers.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,12 @@ thv stop <SERVER_NAME>
6262
This stops the server and the associated proxy process, removes the MCP server's
6363
entry from your configured clients, but keeps the container for future use.
6464

65+
Add the `--group` flag to stop all servers in a specific group:
66+
67+
```bash
68+
thv stop --group <GROUP_NAME>
69+
```
70+
6571
Add the `--all` flag to stop all running servers.
6672

6773
### Restart a server
@@ -72,6 +78,12 @@ To restart a stopped MCP server and add it back to your configured clients:
7278
thv restart <SERVER_NAME>
7379
```
7480

81+
Add the `--group` flag to restart all servers in a specific group:
82+
83+
```bash
84+
thv restart --group <GROUP_NAME>
85+
```
86+
7587
### Remove a server
7688

7789
To remove an MCP server:
@@ -84,6 +96,12 @@ This removes the container and cleans up the MCP server's entry in your
8496
configured clients. If the server is still running, it will be stopped as part
8597
of the removal.
8698

99+
Add the `--group` flag to remove all servers in a specific group:
100+
101+
```bash
102+
thv rm --group <GROUP_NAME>
103+
```
104+
87105
:::note
88106

89107
If you use `docker rm` to remove an MCP container that ToolHive created, it

docs/toolhive/guides-cli/run-mcp-servers.mdx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,24 @@ thv run --secret github,target=GITHUB_PERSONAL_ACCESS_TOKEN github
9797
See [Secrets management](./secrets-management.mdx) to learn how to manage
9898
secrets in ToolHive.
9999

100+
### Run a server within a group
101+
102+
To run an MCP server within a specific group, use the `--group` option. This
103+
allows you to organize your servers and manage them collectively.
104+
105+
```bash
106+
thv run --group <GROUP_NAME> <SERVER>
107+
```
108+
109+
:::note
110+
111+
The group must exist before you can run a server in it.
112+
113+
:::
114+
115+
See [Group management](./group-management.md) for more details on organizing
116+
servers into groups and configuring client access.
117+
100118
### Mount a local file or directory
101119

102120
To enable file system access for an MCP server, you can either use the

sidebars.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ const sidebars: SidebarsConfig = {
6767
'toolhive/guides-cli/registry',
6868
'toolhive/guides-cli/run-mcp-servers',
6969
'toolhive/guides-cli/manage-mcp-servers',
70+
'toolhive/guides-cli/group-management',
7071
'toolhive/guides-cli/secrets-management',
7172
'toolhive/guides-cli/client-configuration',
7273
{

0 commit comments

Comments
 (0)