Skip to content

Commit 0a34440

Browse files
committed
Update secrets management docs
- New setup workflow - Can now list 1Password secrets - Minor polishing
1 parent b52d4d0 commit 0a34440

File tree

2 files changed

+79
-48
lines changed

2 files changed

+79
-48
lines changed

docs/toolhive/guides-cli/install.mdx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,39 +262,49 @@ To uninstall ToolHive:
262262
rm -rf ~/Library/Application\ Support/toolhive/
263263
# Linux:
264264
rm -rf ~/.config/toolhive/
265+
# Windows:
266+
Remove-Item "$env:LOCALAPPDATA\toolhive" -Recurse -Force
265267
```
266268

267269
3. Remove the ToolHive CLI:
268270

269271
{/* prettier-ignore */}
270272
<Tabs groupId='installer' queryString='installer'>
271273
<TabItem value='homebrew' label='Homebrew (macOS)' default>
274+
272275
If you installed ToolHive via Homebrew, uninstall it with:
273276

274277
```bash
275278
brew uninstall thv
276279
```
280+
277281
</TabItem>
278282
<TabItem value='winget' label='WinGet (Windows)'>
283+
279284
If you installed ToolHive via WinGet, uninstall it with:
280285

281286
```bash
282287
winget uninstall stacklok.thv
283288
```
289+
284290
</TabItem>
285291
<TabItem value='binary' label='Pre-compiled binaries'>
292+
286293
Delete the binary from your PATH:
287294

288295
```bash
289296
sudo rm /usr/local/bin/thv
290297
```
298+
291299
</TabItem>
292300
<TabItem value='source' label='Build from source'>
301+
293302
Remove the binary from your `$GOPATH`:
294303

295304
```bash
296305
rm $(go env GOPATH)/bin/thv
297306
```
307+
298308
</TabItem>
299309

300310
</Tabs>

docs/toolhive/guides-cli/secrets-management.mdx

Lines changed: 69 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -15,84 +15,82 @@ configuration files.
1515

1616
## Secrets providers
1717

18-
ToolHive supports multiple secret providers:
18+
ToolHive supports multiple secret providers to fit different security and
19+
workflow requirements:
1920

20-
- `encrypted` (default) - ToolHive encrypts secrets using a password that it
21-
stores in your operating system's keyring.
22-
- `1password` - ToolHive retrieves secrets from a 1Password vault.
21+
- `encrypted` - ToolHive encrypts secrets using a password stored in your
22+
operating system's keyring
23+
- `1password` - ToolHive retrieves secrets from a 1Password vault
2324

24-
<Tabs groupId='secrets-provider' queryString='secrets-provider'>
25-
<TabItem value='encrypted' label='Encrypted (default)' default>
25+
You can use only one provider at a time. To select your preferred provider, run:
2626

27-
The `encrypted` provider is the default secrets provider. When you use a
28-
[`thv secret`](../reference/cli/thv_secret.md) command for the first time,
29-
ToolHive prompts you for a password to encrypt and decrypt your secrets.
27+
```bash
28+
thv secret setup
29+
```
3030

31-
ToolHive stores the encryption password in your operating system's keyring
32-
(Keychain Access on macOS, dbus/Gnome Keyring on Linux). This means you don't
33-
need to enter it every time you use a
34-
[`thv secret`](../reference/cli/thv_secret.md) command.
31+
If you plan to use 1Password, first set up a 1Password service account and
32+
obtain an API token. See the 1Password tab below for details.
3533

36-
To explicitly use the `encrypted` provider (or switch back to it from another
37-
provider), run:
34+
<Tabs groupId='secrets-provider'>
35+
<TabItem value='encrypted' label='Encrypted' default>
3836

39-
```bash
40-
thv config secrets-provider encrypted
41-
```
37+
When you select the `encrypted` provider, ToolHive prompts you to create an
38+
encryption password that protects your secrets.
39+
40+
ToolHive stores this encryption password in your operating system's keyring
41+
(Keychain Access on macOS, Credential Manager on Windows, and dbus/Gnome Keyring
42+
on Linux). This means you don't need to enter the password every time you use a
43+
[`thv secret`](../reference/cli/thv_secret.md) command.
4244

4345
</TabItem>
4446
<TabItem value='1password' label='1Password'>
4547

4648
:::note
4749

48-
The `list`, `set`, and `delete` operations aren't currently supported with
49-
1Password.
50-
51-
You can retrieve secrets using the
52-
[`thv secret get`](../reference/cli/thv_secret_get.md) command and the
53-
`--secret` parameter for [`thv run`](../reference/cli/thv_run.md), but the
54-
secret must already exist in 1Password.
50+
The 1Password provider is read-only. You can list and view secrets, but you
51+
can't create or delete them through ToolHive. Secrets must already exist in your
52+
1Password vault.
5553

56-
If you'd like to see more functionality, please
54+
If you'd like to see write operations added, please
5755
[open an issue](https://github.com/stacklok/toolhive/issues) or join the
5856
`#toolhive-developers` channel in [Discord](https://discord.gg/stacklok).
59-
Contributions are also welcome!
57+
Contributions are welcome!
6058

6159
:::
6260

6361
To use 1Password as your secrets provider, set up a 1Password service account.
6462
For detailed instructions, see the
6563
[1Password documentation](https://developer.1password.com/docs/service-accounts/get-started#create-a-service-account).
6664

67-
Next, set the `OP_SERVICE_ACCOUNT_TOKEN` environment variable to the 1Password
68-
service account's API token, which is displayed during the service account
69-
creation process. This token is required for all
70-
[`thv secret`](../reference/cli/thv_secret.md) commands.
65+
Next, set the `OP_SERVICE_ACCOUNT_TOKEN` environment variable to your service
66+
account's API token (displayed during the service account creation process).
67+
This token is required for all [`thv secret`](../reference/cli/thv_secret.md)
68+
commands:
7169

7270
```bash
7371
export OP_SERVICE_ACCOUNT_TOKEN=<your-service-account-token>
7472
```
7573

76-
Then, set 1Password as your ToolHive secrets provider:
74+
Then, run `thv secret setup` and select `1password` when prompted.
7775

78-
```bash
79-
thv config secrets-provider 1password
80-
```
81-
82-
To reference a secret, use the
76+
To reference a secret from 1Password, use the
8377
[1Password secret reference](https://developer.1password.com/docs/cli/secret-reference-syntax)
8478
URI format:
8579

8680
```text
8781
op://<vault-name>/<item-name>/[section-name/]<field-name>
8882
```
8983

90-
For example, to retrieve a secret named `github` from the `MCPVault` vault:
84+
For example, to retrieve the `password` field from the `github` item in the
85+
`MCPVault` vault:
9186

9287
```bash
9388
thv secret get op://MCPVault/github/password
9489
```
9590

91+
Run [`thv secret list`](../reference/cli/thv_secret_list.md) to see all secrets
92+
accessible to your service account, along with their URIs.
93+
9694
</TabItem>
9795
</Tabs>
9896

@@ -172,17 +170,32 @@ thv secret reset-keyring
172170

173171
Then, delete the encrypted secrets file:
174172

175-
On macOS:
173+
<Tabs groupId='os'>
174+
<TabItem value='macos' label='macOS' default>
175+
176+
```bash
177+
rm ~/Library/Application\ Support/toolhive/secrets_encrypted
178+
```
176179

177-
```bash
178-
rm ~/Library/Application\ Support/toolhive/secrets_encrypted
179-
```
180+
</TabItem>
181+
<TabItem value='linux' label='Linux'>
180182

181-
On Linux:
183+
```bash
184+
rm ~/.config/toolhive/secrets_encrypted
185+
```
182186

183-
```bash
184-
rm ~/.config/toolhive/secrets_encrypted
185-
```
187+
</TabItem>
188+
<TabItem value='windows' label='Windows'>
189+
190+
```powershell
191+
Remove-Item "$env:LOCALAPPDATA\toolhive\secrets_encrypted"
192+
```
193+
194+
</TabItem>
195+
</Tabs>
196+
197+
The next time you run a `thv secret` command, ToolHive prompts you to create a
198+
new encryption password and starts with a fresh secret store.
186199

187200
## Use secrets with MCP servers
188201

@@ -328,7 +341,15 @@ If you can't access 1Password secrets:
328341
```
329342

330343
2. Check that the token is valid and has the necessary permissions to access the
331-
vault and item.
344+
vault and item:
345+
346+
```bash
347+
thv secret list
348+
```
332349

333350
3. Make sure the secret reference URI is correct and matches the vault, item,
334-
and field names in 1Password.
351+
and field names in 1Password:
352+
353+
```bash
354+
thv secret get op://<vault-name>/<item-name>/[section-name/]<field-name>
355+
```

0 commit comments

Comments
 (0)