Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions docs/toolhive/guides-cli/run-mcp-servers.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,71 @@ thv run uvx://some-package
thv run --ca-cert /path/to/special-ca.crt uvx://other-package
```

## Share and reuse server configurations

ToolHive allows you to export a server's configuration and run servers using
previously exported configurations. This is useful for:

- Sharing server setups with team members
- Creating backups of complex configurations
- Running identical server instances across different environments

### Export a server configuration

To export a running server's configuration to a file, use the
[`thv export`](../reference/cli/thv_export.md) command:

```bash
thv export <server-name> <output-file>
```

For example, to export the configuration of a running server named "fetch":

```bash
thv export fetch ./fetch-config.json
```

This creates a JSON file containing all the server's configuration, including:

- Container image and version
- Environment variables and secrets references
- Volume mounts and permissions
- Network settings
- Transport configuration

### Run a server from an exported configuration

To run a server using a previously exported configuration, use the
[`thv run`](../reference/cli/thv_run.md) command with the `--from-config` flag:

```bash
thv run --from-config <config-file>
```

For example, to run a server using the exported configuration:

```bash
thv run --from-config ./fetch-config.json
```

This creates a new server instance with identical settings to the original. If
the original server used secrets, you must have the same secrets available in
your ToolHive secrets store.

:::info

When running from a configuration file, you can still override specific settings
using command-line flags. For example:

```bash
thv run --from-config ./fetch-config.json --name custom-fetch --proxy-port 8080
```

This runs the server with the exported configuration but uses a custom name and
port.

:::

## Next steps

See [Monitor and manage MCP servers](./manage-mcp-servers.md) to monitor and
Expand Down
3 changes: 3 additions & 0 deletions docs/toolhive/tutorials/quickstart-cli.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,9 @@ server. Here are some next steps to explore:
servers that require authentication
- Explore [custom permissions](../guides-cli/custom-permissions.mdx) for MCP
servers
- Learn how to
[share and reuse server configurations](../guides-cli/run-mcp-servers.mdx#share-and-reuse-server-configurations)
using the export and import functionality
- Set up [shell completion](../guides-cli/install.mdx#enable-shell-completion)
to make ToolHive commands easier to use
- Learn how to [upgrade ToolHive](../guides-cli/install.mdx#upgrade-toolhive)
Expand Down