Skip to content

Commit 4301e2d

Browse files
committed
Add documentation for groups
1 parent 6a63ecb commit 4301e2d

File tree

5 files changed

+166
-0
lines changed

5 files changed

+166
-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: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
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:/workspace: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+
## Configure client access to groups
62+
63+
You can configure MCP clients to access specific groups, giving you control over
64+
which tools are available in different contexts.
65+
66+
### Configure a client for a specific group
67+
68+
When registering a client, you can specify which group it should access:
69+
70+
```bash
71+
thv client register --group development
72+
```
73+
74+
This configures the client to only access servers in the `development` group.
75+
76+
## Example workflows
77+
78+
### Project-based organization
79+
80+
```bash
81+
# Create groups for different projects
82+
thv group create webapp-frontend
83+
thv group create webapp-backend
84+
85+
# Run project-specific servers
86+
thv run --group webapp-frontend mcp-react-tools
87+
thv run --group webapp-backend mcp-database-tools
88+
89+
# Configure clients with appropriate access
90+
thv client register --client vscode --group webapp-frontend
91+
thv client register --client cursor --group webapp-backend
92+
```
93+
94+
## Manage groups
95+
96+
### Remove a group
97+
98+
Remove a group and move its servers to the default group:
99+
100+
```bash
101+
thv group rm development
102+
```
103+
104+
Remove a group and delete all its servers:
105+
106+
```bash
107+
thv group rm development --with-workloads
108+
```
109+
110+
:::warning
111+
112+
Using `--with-workloads` permanently deletes all servers in the group.
113+
114+
:::
115+
116+
## Related information
117+
118+
- [Client configuration](client-configuration.mdx)
119+
- [Run MCP servers](run-mcp-servers.mdx)
120+
- [`thv group` command reference](../reference/cli/thv_group.md)
121+
- [`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: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,20 @@ 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 The group must exist before you can run a server in it. :::
110+
111+
See [Group management](./group-management.md) for more details on organizing
112+
servers into groups and configuring client access.
113+
100114
### Mount a local file or directory
101115

102116
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)