ToolHive CLI Usage Examples
Basic Workflows
Quick Start with Registry Server
# Run fetch server
thv run fetch
# Check it's running
thv list
# Get detailed status
thv status fetch
# View capabilities
thv mcp list tools --server fetch
# View logs
thv logs fetch
# Stop when done
thv stop fetch
# Clean up
thv rm fetchRun Server with Custom Configuration
# Named server with environment variables
thv run github \
--name my-github \
-e GITHUB_PERSONAL_ACCESS_TOKEN=ghp_xxxx \
-- --toolsets repos
# Server with volume mount
thv run <server> \
--name project-fs \
-v /home/user/projects:/workspace:ro
# Server with multiple labels
thv run fetch \
--name docs-fetch \
-l env=production \
-l team=backend \
-l version=1.0Protocol Scheme Examples
Python (uvx)
# From PyPI
thv run uvx://mcp-server-git
# With version
thv run uvx://mcp-server-git@1.0.0
# With arguments
thv run uvx://mcp-server-sqlite -- --db-path /data/mydb.sqliteNode.js (npx)
# From npm
thv run npx://@modelcontextprotocol/server-everything
# Scoped package
thv run npx://@modelcontextprotocol/server-filesystem
# With arguments
thv run npx://@modelcontextprotocol/server-filesystem -- /allowed/pathGo
# From module
thv run go://github.com/example/mcp-server@latest
# Local project
thv run go://./my-mcp-server
# Parent directory
thv run go://../shared/mcp-serverSecrets Management Examples
Initial Setup
# Configure encrypted provider (recommended)
thv secret setup
# Select: encrypted
# Enter password when prompted
# Or use 1Password
export OP_SERVICE_ACCOUNT_TOKEN=your-token
thv secret setup
# Select: 1passwordStore and Use Secrets
# Store interactively
thv secret set GITHUB_TOKEN
# Enter token when prompted
# Store via pipe
echo "ghp_xxxxxxxxxxxx" | thv secret set GITHUB_TOKEN
# List stored secrets
thv secret list
# Use secret when running server
thv run github --secret GITHUB_TOKEN,target=GITHUB_PERSONAL_ACCESS_TOKEN
# Multiple secrets
thv run myserver \
--secret API_KEY,target=API_KEY \
--secret DB_PASSWORD,target=DATABASE_PASSWORDGroup Management Examples
Environment-Based Groups
# Create environment groups
thv group create development
thv group create staging
thv group create production
# Run servers in specific groups
thv run fetch --name dev-fs --group development
thv run fetch --name prod-fs --group production
# List servers by group
thv list --group development
thv list --group production
# Stop all servers in a group
thv stop --group developmentClient Group Restrictions
# Register client with group restriction
thv client register claude-code --group development
# Now this client only sees servers in development groupRestart Servers
# Restart a single server
thv start fetch
thv restart fetch # Same thing (alias)
# Restart all servers in a group
thv start --group development
# Restart all servers
thv start --allDeploy Registry Groups
# Registry defines groups like "kubernetes", "devops", etc.
# Run all servers from a registry group
thv group run kubernetesRemote Server Examples
Basic Remote Server
# Simple remote server
thv run https://api.example.com/mcp --name remote-apiRemote with OIDC Authentication
# Full OIDC setup
thv run https://api.example.com/mcp --name secure-api \
--remote-auth-issuer https://auth.example.com \
--remote-auth-client-id my-client-id \
--remote-auth-client-secret-file /path/to/secret \
--remote-auth-scopes "openid profile"
# Dynamic client registration (no credentials needed)
thv run https://api.example.com/mcp --name auto-api \
--remote-auth \
--remote-auth-issuer https://auth.example.comRemote with OAuth2 (non-OIDC)
thv run https://api.example.com/mcp --name oauth-api \
--remote-auth-authorize-url https://auth.example.com/oauth/authorize \
--remote-auth-token-url https://auth.example.com/oauth/token \
--remote-auth-client-id my-client-id \
--remote-auth-client-secret my-secretRemote with Bearer Token
# From file (recommended)
thv run https://api.example.com/mcp --name token-api \
--remote-auth-bearer-token-file /path/to/token.txt
# Direct (less secure)
thv run https://api.example.com/mcp --name token-api \
--remote-auth-bearer-token "your-token-here"Building Containers
Pre-build for Kubernetes
# Build with custom tag
thv build --tag my-registry.io/mcp/filesystem:v1.0.0 \
npx://@modelcontextprotocol/server-filesystem
# Push to registry (standard docker)
docker push my-registry.io/mcp/filesystem:v1.0.0Build with Embedded Arguments
# Arguments baked into ENTRYPOINT
thv build --tag launchdarkly:latest \
npx://@launchdarkly/mcp-server -- startGenerate Dockerfile Only
# Output Dockerfile for inspection/modification
thv build --dry-run --output Dockerfile.mcp \
uvx://mcp-server-git
# Review and customize
cat Dockerfile.mcp
# Build manually
docker build -f Dockerfile.mcp -t my-mcp:custom .Export and Import Examples
Backup Configuration
# Export to JSON
thv export my-server ./backup/my-server.json
# Export to Kubernetes YAML
thv export my-server ./k8s/my-server.yaml --format k8sMigrate Configuration
# Export from one machine
thv export production-server ./config.json
# Transfer file to new machine, then import
thv run --from-config ./config.jsonShare Configuration
# Export team's standard setup
thv export team-toolkit ./team-config.json
# Team member imports
thv run --from-config ./team-config.json --name my-toolkitTool Filtering and Overrides
Filter Available Tools
# Only expose specific tools
thv run github --tools list_issues,get_issue,create_issue
# Multiple tools comma-separated
thv run fetch --tools fetch,fetch_htmlOverride Tool Names/Descriptions
Create overrides.json:
{
"toolsOverride": {
"fetch": {
"name": "docs-fetch",
"description": "Fetches content from documentation websites only"
},
"list_issues": {
"name": "get-github-issues",
"description": "Lists issues from the main repository"
}
}
}Apply:
thv run fetch --tools-override overrides.jsonDebugging Examples
Inspect Server Capabilities
# List tools
thv mcp list tools --server fetch
# List resources
thv mcp list resources --server fetch
# List prompts
thv mcp list prompts --server fetch
# JSON output for parsing
thv mcp list tools --server fetch --format jsonInvoke a Tool
# Inline JSON args
thv mcp call fetch --server fetch --args '{"url":"https://example.com"}'
# Args from a file
thv mcp call fetch --server fetch --args-file ./args.json
# Args from stdin
echo '{"url":"https://example.com"}' | thv mcp call fetch --server fetch --args-file -
# JSON output (full CallToolResult, includes content + structuredContent + isError)
thv mcp call fetch --server fetch --args '{"url":"https://example.com"}' --format json
# Tool-reported errors normally exit non-zero; flip with --ignore-tool-error
thv mcp call fetch --server fetch --args '{"url":"not-a-url"}' --ignore-tool-errorLaunch Inspector UI
# Default ports
thv inspector fetch
# UI at http://localhost:6274
# Custom ports
thv inspector fetch --ui-port 7000 --mcp-proxy-port 7001View Logs
# Container logs
thv logs fetch
# Follow in real-time
thv logs fetch --follow
# Proxy logs (for debugging HTTP/auth issues)
thv logs fetch --proxyVerify Runtime
# Check container runtime is accessible
thv runtime checkClient Registration Examples
Check Available Clients
# See all supported clients and their status
thv client statusInteractive Setup
# Guided setup for detected clients
thv client setupRegister Specific Clients
# Register Claude Code
thv client register claude-code
# Register VS Code
thv client register vscode
# Register with group restriction
thv client register cursor --group developmentManage Registrations
# List registered clients
thv client list-registered
# Remove a client
thv client remove cursorPermissions and Network Isolation
Permission Profiles
# No extra permissions (most restrictive)
thv run myserver --permission-profile none
# Network access only (no filesystem)
thv run myserver --permission-profile network
# Custom profile from JSON file
thv run myserver --permission-profile ./my-permissions.jsonNetwork Isolation (Egress Proxy)
# Isolate network — only allowlisted hosts can be reached
thv run myserver --isolate-network
# Combined with custom permissions
thv run myserver --isolate-network --permission-profile ./restricted.json.thvignore — Hide Sensitive Files
Place .thvignore in mounted directories to hide matching files from the container:
# Create .thvignore in project root
cat > /home/user/projects/.thvignore << 'EOF'
.env
.git/
*.pem
secrets/
EOF
# Mount the directory — .thvignore patterns are applied automatically
thv run <server> -v /home/user/projects:/workspace:roGlobal patterns at ~/.config/toolhive/thvignore apply to all mounts. Disable with --ignore-globally=false.
Skills Management Examples
Install and Use Skills
# Install a skill for the current user
thv skill install code-review
# Install targeting a specific client
thv skill install code-review --clients claude-code
# Install into a project (requires --project-root)
thv skill install code-review --scope project --project-root /home/user/myproject
# Force reinstall (overwrites existing)
thv skill install code-review --force
# Install and assign to a group
thv skill install code-review --group development
# Install by OCI reference
thv skill install ghcr.io/stacklok/skills/code-review:v1.0List and Inspect Skills
# List all installed skills
thv skill list
# Short alias
thv skill ls
# JSON output for scripting
thv skill list --format json
# Filter by scope, client, or group
thv skill ls --scope user
thv skill ls --client claude-code
thv skill ls --group development
# Detailed info about a skill
thv skill info code-review
thv skill info code-review --format jsonRemove Skills
# Uninstall user-scoped skill
thv skill uninstall code-review
# Uninstall project-scoped skill
thv skill uninstall code-review --scope project --project-root /home/user/myprojectAuthor and Publish Skills
# Validate a skill directory before building
thv skill validate ./my-skill
# JSON validation output
thv skill validate ./my-skill --format json
# Build into an OCI artifact
thv skill build ./my-skill
# Build with a specific tag
thv skill build ./my-skill --tag ghcr.io/myorg/my-skill:v1.0
# Push to a remote registry
thv skill push ghcr.io/myorg/my-skill:v1.0Typical Authoring Workflow
# 1. Create and validate
thv skill validate ./my-skill
# 2. Build the artifact
thv skill build ./my-skill --tag ghcr.io/myorg/my-skill:v1.0
# 3. Push to registry
thv skill push ghcr.io/myorg/my-skill:v1.0
# 4. Install from registry to verify
thv skill install ghcr.io/myorg/my-skill:v1.0 --clients claude-code
# 5. Confirm installation
thv skill info my-skillNetwork Configuration Examples
Host Networking
# Use host network (container shares host network namespace)
thv run myserver --network hostCustom Docker Network
# Create network first
docker network create mcp-network
# Run server in that network
thv run myserver --network mcp-networkAccess Host Services from Container
# For services running on host machine
# Docker Desktop (Mac/Windows):
thv run myserver -e SERVICE_URL=http://host.docker.internal:8080
# Podman:
thv run myserver -e SERVICE_URL=http://host.containers.internal:8080
# Linux (bridge network):
thv run myserver -e SERVICE_URL=http://172.17.0.1:8080AI Plugin Management Examples
Placeholders: Replace
example-plugin,example-org, paths, and versions below with reviewed values. Startthv servebefore anythv ai-plugincommand.
Inspect and Install
# Inspect installed project plugins before changing them.
thv ai-plugin list --scope project --project-root .
thv ai-plugin info example-plugin --scope project --project-root .
# Install a reviewed OCI plugin into this project and target Claude Code.
thv ai-plugin install ghcr.io/example-org/example-plugin:v1.0 \
--scope project --project-root . --clients claude-code
# A Git source can select a ref and plugin subdirectory.
thv ai-plugin install git://github.com/example-org/plugin-repo@v1.0#plugins/example-plugin \
--scope project --project-root . --clients codexFor Codex, then complete the explicit client hand-off; ToolHive does not invoke Codex or edit config.toml:
codex plugin install example-plugin@toolhiveFirst Install of an Externally Key-Signed OCI Plugin
# Supply the reviewed public key only for the first project install.
# ToolHive pins it in toolhive.lock.yaml and reuses it for sync and upgrade.
thv ai-plugin install ghcr.io/example-org/example-plugin:v1.0 \
--scope project --project-root . --public-key ./keys/example-plugin.cosign.pubCheck and Restore Project Drift
# CI-safe inspection: no install, lock-file write, or deletion.
thv ai-plugin sync --check --project-root .
# After reviewing the lock entries and prompt, restore missing/drifted plugins.
thv ai-plugin sync --project-root .Do not use --allow-unsigned for a failed signature: it only records an explicit unsigned exception and cannot validate invalid content. Do not use --prune or --yes unless explicitly approved.
Preview and Apply an Upgrade
# Show mutable-reference changes without persisting them.
thv ai-plugin upgrade --preview --project-root .
# After reviewing repositories and signer identities, confirm at the prompt.
thv ai-plugin upgrade example-plugin --project-root .--fail-on-changes is the non-mutating CI freshness check. Do not add --allow-ref-change, --allow-signer-change, or --yes without explicit approval.
Validate, Build, and Publish
# Validate before building; an invalid plugin exits non-zero.
thv ai-plugin validate ./example-plugin
# Build into the local OCI store, then inspect the local build.
thv ai-plugin build ./example-plugin --tag ghcr.io/example-org/example-plugin:v1.0
thv ai-plugin builds
# Push signed by default (keyless signing acquires an OIDC token when needed).
thv ai-plugin push ghcr.io/example-org/example-plugin:v1.0Use thv ai-plugin push --no-sign ... only when intentionally publishing unsigned content under an approved policy; do not recommend it as an installation workaround.
Uninstall Versus Removing a Local Build
# Remove the project installation; this does not delete the local OCI artifact.
thv ai-plugin uninstall example-plugin --scope project --project-root .
# Separately remove a reviewed local build by its tag.
thv ai-plugin builds remove ghcr.io/example-org/example-plugin:v1.0