diff --git a/docs/toolhive/guides-cli/run-mcp-servers.mdx b/docs/toolhive/guides-cli/run-mcp-servers.mdx index e4ee541a..27d3b9d4 100644 --- a/docs/toolhive/guides-cli/run-mcp-servers.mdx +++ b/docs/toolhive/guides-cli/run-mcp-servers.mdx @@ -447,6 +447,57 @@ 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 +``` + +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 +``` + +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. + ## Next steps See [Monitor and manage MCP servers](./manage-mcp-servers.md) to monitor and diff --git a/docs/toolhive/tutorials/quickstart-cli.mdx b/docs/toolhive/tutorials/quickstart-cli.mdx index 5747451b..b98fce95 100644 --- a/docs/toolhive/tutorials/quickstart-cli.mdx +++ b/docs/toolhive/tutorials/quickstart-cli.mdx @@ -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)