@@ -73,7 +73,7 @@ flowchart TB
7373- One of the following container runtimes:
7474 - macOS: Docker Desktop, Podman Desktop, or Rancher Desktop (using dockerd)
7575 - Windows: Docker Desktop or Rancher Desktop (using dockerd)
76- - Linux: Not currently supported
76+ - Linux: any container runtime (see [ Linux setup ] ( #linux-setup ) )
7777- ToolHive UI version 0.12.0 or later
7878
7979## Step 1: Install MCP servers in a ToolHive group
@@ -212,7 +212,9 @@ reconnects them to the MCP Optimizer group.
212212<TabItem value = ' cli' label = ' ToolHive CLI' >
213213
214214The ToolHive UI is the recommended way to set up MCP Optimizer, but you can also
215- do it manually with the ToolHive CLI.
215+ do it manually with the ToolHive CLI. If you are on Linux with native
216+ containers, follow the steps below but see [ Linux setup] ( #linux-setup ) for the
217+ modified ` thv run ` command.
216218
217219** Step 3.1: Run the API server**
218220
@@ -313,6 +315,68 @@ To check your token savings, you can ask the optimizer:
313315
314316- "How many tokens did I save using MCP Optimizer?"
315317
318+ ## Linux setup
319+
320+ The setup depends on which type of container runtime you are using.
321+
322+ ### VM-based container runtimes
323+
324+ If you are using a container runtime that runs containers inside a virtual
325+ machine (such as Docker Desktop for Linux), the setup is the same as on macOS
326+ and Windows. No additional configuration is needed - follow the UI or CLI tabs
327+ in the steps above.
328+
329+ ### Native containers (Docker, Podman, Rancher Desktop, and others)
330+
331+ :::note
332+
333+ Before running the command below, complete the following using the CLI tabs:
334+
335+ 1 . [ Step 1] ( #step-1-install-mcp-servers-in-a-toolhive-group ) - install your MCP
336+ servers
337+ 2 . [ Step 2] ( #step-2-connect-your-ai-client ) - connect your AI client
338+ 3 . [ Step 3] ( #step-3-enable-mcp-optimizer ) - start the API server, create the
339+ optimizer group, and reconfigure your client. When you reach the
340+ ` thv run mcp-optimizer ` command, use the Linux-specific command below
341+ instead.
342+
343+ :::
344+
345+ Most Linux container runtimes run containers natively on the host kernel.
346+ Because containers run directly on the host kernel, ` host.docker.internal ` is
347+ not automatically configured - unlike on macOS and Windows, where Docker Desktop
348+ sets it up to let containers reach the host from inside a virtual machine.
349+ Instead, you need to pass a couple of extra flags:
350+
351+ ``` bash
352+ # Run mcp-optimizer with host networking
353+ thv run --group optimizer --network host \
354+ -e TOOLHIVE_HOST=127.0.0.1 \
355+ -e ALLOWED_GROUPS=default \
356+ mcp-optimizer
357+ ```
358+
359+ - ` --network host ` lets the container reach the host directly, achieving the
360+ same result as the automatic bridge Docker Desktop sets up on macOS and
361+ Windows.
362+ - ` TOOLHIVE_PORT ` specifies the port the API server is listening on. If you
363+ started it manually with a custom port in Step 3.1, pass
364+ ` -e TOOLHIVE_PORT=<PORT> ` here as well. Omit it if you are using the ToolHive
365+ UI to run the API server.
366+ - ` TOOLHIVE_HOST ` tells ` mcp-optimizer ` to connect to ` 127.0.0.1 ` instead of
367+ ` host.docker.internal ` .
368+ - ` ALLOWED_GROUPS ` tells the optimizer which group's MCP servers to discover,
369+ index, and route requests to. Replace ` default ` with the name of the group you
370+ want to optimize.
371+
372+ To change which groups MCP Optimizer can optimize after initial setup, remove
373+ the workload and run the command again with the updated ` ALLOWED_GROUPS ` value
374+ (see [ Remove a server] ( ../guides-cli/manage-mcp-servers.mdx#remove-a-server ) ),
375+ or edit the configuration directly via the ToolHive UI (see
376+ [ Manage MCP servers] ( ../guides-ui/run-mcp-servers.mdx#manage-mcp-servers ) ).
377+
378+ See [ Step 4: Sample prompts] ( #step-4-sample-prompts ) to verify the setup.
379+
316380## What's next?
317381
318382Now that you've set up MCP Optimizer, consider exploring these next steps:
0 commit comments