@@ -17,16 +17,60 @@ want to run. The server name is the same as its name in the registry.
1717thv run < SERVER_NAME>
1818```
1919
20- For example, to run the ` fetch ` server, which is a simple MCP server that
21- fetches website contents:
20+ The ToolHive registry contains both local containerized MCP servers and remote
21+ MCP servers. ToolHive automatically handles the appropriate setup based on the
22+ server type.
23+
24+ ### Local containerized servers
25+
26+ For example, to run the ` fetch ` server, which is a local containerized MCP
27+ server that fetches website contents:
2228
2329``` bash
2430thv run fetch
2531```
2632
33+ ### Remote MCP servers
34+
35+ Remote MCP servers in the registry don't run as local containers but instead use
36+ ToolHive's transparent HTTP proxy to forward requests to remote servers. For
37+ example:
38+
39+ ``` bash
40+ thv run neon
41+ thv run stripe
42+ ```
43+
44+ When you run a remote server from the registry, ToolHive uses the pre-configured
45+ remote URL and authentication settings.
46+
47+ :::note[ Naming convention]
48+
49+ Remote MCP servers use the ` -remote ` suffix ** when they have a local
50+ containerized counterpart** to distinguish between the two versions. For
51+ example:
52+
53+ - ` notion-remote ` indicates this is the remote version of a server that also has
54+ a local ` notion ` version
55+ - ` neon ` and ` stripe ` don't have local counterparts, so they don't use the
56+ ` -remote ` suffix
57+
58+ To run a remote notion mcp server, you should use the ` notion-remote ` name.
59+
60+ ``` bash
61+ thv run notion-remote
62+ ```
63+
64+ Use ` thv search <NAME> ` or ` thv registry list ` to discover available servers.
65+
66+ :::
67+
2768:::info[ What's happening?]
2869
29- When you run an MCP server from the registry, ToolHive:
70+ When you run an MCP server from the registry, ToolHive handles different server
71+ types automatically:
72+
73+ ** For local containerized servers:**
3074
31751 . Pulls the image and launches a container using the configuration from the
3276 registry.
@@ -38,10 +82,21 @@ When you run an MCP server from the registry, ToolHive:
3882 toolhive-name : <SERVER_NAME>
3983 ` ` `
4084
85+ **For remote MCP servers:**
86+
87+ 1. Uses the pre-configured remote URL from the registry.
88+ 2. Automatically detects if the remote server requires authentication.
89+ 3. Handles OAuth/OIDC authentication flows if needed.
90+ 4. Starts an HTTP proxy process on a random port to forward client requests to
91+ the remote server.
92+ 5. Manages the server like any other ToolHive workload. No container is created
93+ for remote MCP servers.
94+
4195:::
4296
4397See [Run a custom MCP server](#run-a-custom-mcp-server) to run a server that is
44- not in the registry.
98+ not in the registry, or [Run a remote MCP server](#run-a-remote-mcp-server) for
99+ more details about remote server configuration.
45100
46101## Customize server settings
47102
@@ -538,6 +593,146 @@ thv run uvx://some-package
538593thv run --ca-cert /path/to/special-ca.crt uvx://other-package
539594` ` `
540595
596+ # # Run a remote MCP server
597+
598+ You can run remote MCP servers directly by providing their URL. This allows you
599+ to connect to MCP servers hosted elsewhere without needing to manage containers
600+ locally. ToolHive creates a transparent proxy that handles authentication and
601+ forwards requests to the remote server.
602+
603+ # ## Basic remote server setup
604+
605+ To run a remote MCP server, simply provide its URL :
606+
607+ ` ` ` bash
608+ thv run <URL> [--name <SERVER_NAME>]
609+ ` ` `
610+
611+ For example :
612+
613+ ` ` ` bash
614+ thv run https://api.example.com/mcp
615+ ` ` `
616+
617+ If you don't specify a name with `--name`, ToolHive will automatically derive a
618+ name from the URL by extracting the main domain name (e.g., `notion` from
619+ ` https://api.notion.com/mcp` ).
620+
621+ By default, remote servers use the `streamable-http` transport. If the server
622+ uses Server-Sent Events (SSE), specify the transport flag :
623+
624+ ` ` ` bash
625+ thv run https://api.example.com/sse --transport sse
626+ ` ` `
627+
628+ :::info[What's happening?]
629+
630+ When you run a remote MCP server, ToolHive :
631+
632+ 1. Automatically detects if the remote server requires authentication.
633+ 2. Handles OAuth/OIDC authentication flows if needed.
634+ 3. Starts an HTTP proxy process on a random port to forward client requests to
635+ the remote server.
636+ 4. Manages the server like any other ToolHive workload. No container is created
637+ for remote MCP servers.
638+
639+ :: :
640+
641+ # ## Authentication setup
642+
643+ Many remote MCP servers require authentication. ToolHive supports automatic
644+ authentication detection and OAuth/OIDC flows.
645+
646+ # ### Auto-detect authentication
647+
648+ ToolHive can automatically detect if a remote server requires authentication by
649+ examining the server's response headers and status codes :
650+
651+ ` ` ` bash
652+ thv run https://protected-api.com/mcp --name my-server
653+ ` ` `
654+
655+ If authentication is required, ToolHive will prompt you to complete the OAuth
656+ flow. When no client credentials are provided, ToolHive automatically registers
657+ an OAuth client with the authorization server using RFC 7591 dynamic client
658+ registration, eliminating the need to pre-configure client ID and secret.
659+
660+ # ### OIDC authentication
661+
662+ For servers using OpenID Connect (OIDC), provide the issuer URL, client ID, and
663+ client secret obtained from the application provider :
664+
665+ ` ` ` bash
666+ thv run https://api.example.com/mcp \
667+ --name my-server \
668+ --remote-auth-issuer https://auth.example.com \
669+ --remote-auth-client-id my-client-id \
670+ --remote-auth-client-secret my-client-secret
671+ ` ` `
672+
673+ # ### OAuth2 authentication
674+
675+ For servers using OAuth2, specify the authorization and token URLs along with
676+ the client ID and secret obtained from the application provider :
677+
678+ ` ` ` bash
679+ thv run https://api.example.com/mcp \
680+ --name my-server \
681+ --remote-auth-authorize-url https://auth.example.com/oauth/authorize \
682+ --remote-auth-token-url https://auth.example.com/oauth/token \
683+ --remote-auth-client-id my-client-id \
684+ --remote-auth-client-secret my-client-secret
685+ ` ` `
686+
687+ # ### Automatic token refresh
688+
689+ ToolHive automatically handles OAuth token refresh for remote MCP servers. When
690+ you authenticate with a remote server, ToolHive stores both the access token and
691+ refresh token securely. The refresh token is used to automatically obtain new
692+ access tokens when they expire, ensuring uninterrupted service without requiring
693+ manual re-authentication.
694+
695+ # ## Advanced remote server configuration
696+
697+ # ### OAuth scopes and parameters
698+
699+ Specify custom OAuth scopes for the authentication flow :
700+
701+ ` ` ` bash
702+ thv run https://api.example.com/mcp \
703+ ... \
704+ --remote-auth-scopes read,write,admin
705+ ` ` `
706+
707+ # ### Custom authentication timeout
708+
709+ Adjust the authentication timeout for slow networks :
710+
711+ ` ` ` bash
712+ thv run https://api.example.com/mcp \
713+ ... \
714+ --remote-auth-timeout 2m
715+ ` ` `
716+
717+ # ### Skip browser authentication
718+
719+ For headless environments, skip the browser-based OAuth flow :
720+
721+ ` ` ` bash
722+ thv run https://api.example.com/mcp \
723+ ... \
724+ --remote-auth-skip-browser
725+ ` ` `
726+
727+ # ## Remote server management
728+
729+ Remote MCP servers are managed like any other ToolHive workload :
730+
731+ - **List servers**: `thv list` shows remote servers with their target URLs
732+ - **View logs**: `thv logs <SERVER_NAME>` shows proxy and authentication logs
733+ - **Stop/restart**: `thv stop <SERVER_NAME>` and `thv restart <SERVER_NAME>`
734+ - **Remove**: `thv rm <SERVER_NAME>` removes the proxy and configuration
735+
541736# # Share and reuse server configurations
542737
543738ToolHive allows you to export a server's configuration and run servers using
@@ -657,3 +852,55 @@ If a server crashes or exits unexpectedly:
6578524. Verify the server's configuration and arguments
658853
659854</details>
855+
856+ <details>
857+ <summary>Remote server authentication fails</summary>
858+
859+ If a remote MCP server authentication fails :
860+
861+ 1. Check the server logs for authentication errors (see
862+ [View server logs](./manage-mcp-servers.md#view-server-logs) for the correct
863+ log file path on your platform)
864+
865+ 2. Verify the issuer URL is correct and accessible
866+
867+ 3. Check if the OAuth client ID and secret are valid
868+
869+ 4. Ensure the remote server supports the OAuth flow you're using
870+
871+ 5. Try re-authenticating by restarting the server :
872+
873+ ` ` ` bash
874+ thv restart <SERVER_NAME>
875+ ` ` `
876+
877+ </details>
878+
879+ <details>
880+ <summary>Remote server connection issues</summary>
881+
882+ If you can't connect to a remote MCP server :
883+
884+ 1. Verify the remote server URL is correct and accessible
885+
886+ 2. Check your network connectivity :
887+
888+ ` ` ` bash
889+ curl -I https://api.example.com/mcp
890+ ` ` `
891+
892+ 3. Check if the remote server requires specific headers or authentication
893+
894+ 4. Review the server logs for connection errors :
895+
896+ ` ` ` bash
897+ thv logs <SERVER_NAME>
898+ ` ` `
899+
900+ 5. Try running with debug mode for more detailed logs :
901+
902+ ` ` ` bash
903+ thv run --debug https://api.example.com/mcp --name my-server
904+ ` ` `
905+
906+ </details>
0 commit comments