@@ -12,10 +12,13 @@ clients and MCP servers. It provides tool discovery, unified access to multiple
1212MCP servers through a single endpoint, and intelligent routing of requests to
1313appropriate MCP tools.
1414
15- :::info [ Status ]
15+ :::note [ Moving to vMCP ]
1616
17- The MCP Optimizer is currently experimental. If you try it out, please share
18- your feedback on the [ Stacklok Discord community] ( https://discord.gg/stacklok ) .
17+ The optimizer is now integrated into
18+ [ Virtual MCP Server (vMCP)] ( ../guides-vmcp/optimizer.mdx ) , which provides the
19+ same tool filtering and token reduction at the team level. You can deploy it in
20+ Kubernetes today, and a local experience is coming soon. This tutorial covers
21+ the standalone CLI approach in the meantime.
1922
2023:::
2124
@@ -74,38 +77,16 @@ flowchart TB
7477 - macOS: Docker Desktop, Podman Desktop, or Rancher Desktop (using dockerd)
7578 - Windows: Docker Desktop or Rancher Desktop (using dockerd)
7679 - Linux: any container runtime (see [ Linux setup] ( #linux-setup ) )
77- - ToolHive UI version 0.12.0 or later
80+ - ToolHive CLI
7881
7982## Step 1: Install MCP servers in a ToolHive group
8083
8184Before you can use MCP Optimizer, you need to have one or more MCP servers
8285running in a ToolHive group. If you don't have any MCP servers set up yet,
8386follow these steps:
8487
85- <Tabs groupId = ' mode' queryString = ' mode' >
86- <TabItem value = ' ui' label = ' ToolHive UI' default >
87-
88- 1 . Open the ToolHive UI and go to the ** MCP Servers** screen
89- 2 . Ensure you're in the ` default ` group (or create a new group if desired)
90- 3 . Run one or more MCP servers by clicking the ** Add an MCP Server** button and
91- selecting from the registry or using a custom server image
92-
93- For this tutorial, you can run the following example MCP servers:
94- - ` github ` : Provides tools for interacting with GitHub repositories
95- ([ guide] ( ../guides-mcp/github.mdx?mode=ui ) )
96- - ` fetch ` : Provides a web search tool to fetch recent news articles
97- - ` time ` : Provides a tool to get the current time in various time zones
98-
99- 4 . Wait for the MCP servers to start and become healthy
100-
101- See the [ Run MCP servers] ( ../guides-ui/run-mcp-servers.mdx ) guide for more
102- details.
103-
104- </TabItem >
105- <TabItem value = ' cli' label = ' ToolHive CLI' >
106-
107- Run one or more MCP servers in the ` default ` group using the ToolHive CLI. For
108- this tutorial, you can run the following example MCP servers:
88+ Run one or more MCP servers in the ` default ` group. For this tutorial, you can
89+ run the following example MCP servers:
10990
11091- ` github ` : Provides tools for interacting with GitHub repositories
11192 ([ guide] ( ../guides-mcp/github.mdx?mode=cli ) )
@@ -127,9 +108,6 @@ Verify the MCP servers are running:
127108thv list
128109```
129110
130- </TabItem >
131- </Tabs >
132-
133111## Step 2: Connect your AI client
134112
135113Connect your AI client to the ToolHive group where the MCP servers are running
@@ -143,19 +121,6 @@ the groups to avoid unpredictable behavior.
143121
144122:::
145123
146- <Tabs groupId = ' mode' queryString = ' mode' >
147- <TabItem value = ' ui' label = ' ToolHive UI' default >
148-
149- Open the ToolHive UI and use the ** Manage Clients** button on the main MCP
150- Servers screen to register your AI client with the appropriate group (for
151- example, ` default ` ).
152-
153- See the [ Client configuration] ( ../guides-ui/client-configuration.mdx ) guide for
154- more details.
155-
156- </TabItem >
157- <TabItem value = ' cli' label = ' ToolHive CLI' >
158-
159124Run the following command to register your AI client with the ToolHive group
160125where the MCP servers are running (for example, ` default ` ):
161126
@@ -166,55 +131,14 @@ thv client setup
166131See the [ Client configuration] ( ../guides-cli/client-configuration.mdx ) guide for
167132more details.
168133
169- </TabItem >
170- </Tabs >
171-
172134Open your AI client and verify that it is connected to the correct MCP servers.
173135If you installed the ` github ` , ` fetch ` , and ` time ` servers, you should see
174136almost 50 tools available.
175137
176138## Step 3: Enable MCP Optimizer
177139
178- <Tabs groupId = ' mode' queryString = ' mode' >
179- <TabItem value = ' ui' label = ' ToolHive UI' default >
180-
181- The ToolHive UI automates the setup of the MCP Optimizer.
182-
183- 1 . Open the ** Settings** (⚙️) screen and enable ** MCP Optimizer** under
184- ** Experimental Features**
185- 2 . Click the ** Configure** button on the notification that pops up, or go to the
186- main ** MCP Servers** screen and click ** MCP Optimizer** in the left sidebar
187- 3 . Select the group that contains the MCP servers you want to optimize and click
188- ** Apply Changes**
189-
190- ToolHive automatically updates clients that were registered with the selected
191- group to use the MCP Optimizer. If you want to connect a new client, go to the
192- ` default ` group and use the ** Manage Clients** button to register it.
193-
194- Open your AI client and check its MCP configuration. You should see a single MCP
195- server named ` toolhive-mcp-optimizer ` .
196-
197- :::info[ What's happening?]
198-
199- When you enable MCP Optimizer, ToolHive automatically creates an internal group
200- and runs the ` mcp-optimizer ` MCP server in that group.
201-
202- The MCP Optimizer server discovers the MCP servers in the selected group and
203- builds an index of their tools for intelligent routing. Automatic polling keeps
204- the index up to date as servers are added or removed from the optimized group.
205-
206- ToolHive also disconnects your AI clients from the original MCP server group and
207- reconnects them to the MCP Optimizer group.
208-
209- :::
210-
211- </TabItem >
212- <TabItem value = ' cli' label = ' ToolHive CLI' >
213-
214- The ToolHive UI is the recommended way to set up MCP Optimizer, but you can also
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.
140+ If you are on Linux with native containers, follow the steps below but see
141+ [ Linux setup] ( #linux-setup ) for the modified ` thv run ` command.
218142
219143** Step 3.1: Run the API server**
220144
@@ -291,9 +215,6 @@ flowchart TB
291215 client x-. 🚫 .-x def
292216```
293217
294- </TabItem >
295- </Tabs >
296-
297218## Step 4: Sample prompts
298219
299220After you configure and run MCP Optimizer, you can use the same prompts you
@@ -323,14 +244,13 @@ The setup depends on which type of container runtime you are using.
323244
324245If you are using a container runtime that runs containers inside a virtual
325246machine (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.
247+ and Windows. No additional configuration is needed - follow the steps above.
328248
329249### Native containers (Docker, Podman, Rancher Desktop, and others)
330250
331251:::note
332252
333- Before running the command below, complete the following using the CLI tabs :
253+ Before running the command below, complete the following:
334254
3352551 . [ Step 1] ( #step-1-install-mcp-servers-in-a-toolhive-group ) - install your MCP
336256 servers
@@ -371,28 +291,20 @@ thv run --group optimizer --network host \
371291
372292To change which groups MCP Optimizer can optimize after initial setup, remove
373293the 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 ) ).
294+ (see [ Remove a server] ( ../guides-cli/manage-mcp-servers.mdx#remove-a-server ) ).
377295
378296See [ Step 4: Sample prompts] ( #step-4-sample-prompts ) to verify the setup.
379297
380298## What's next?
381299
382- Now that you've set up MCP Optimizer, consider exploring these next steps:
383-
384300- Experiment with different MCP servers to see how MCP Optimizer enhances tool
385301 selection and reduces token usage
386- - Monitor the performance and effectiveness of MCP Optimizer in your AI
387- applications
388- - Use the [ ToolHive Playground] ( ../guides-ui/playground.mdx ) to test and refine
389- your prompts with MCP Optimizer
390- - Provide feedback on your experience with MCP Optimizer on the
391- [ Stacklok Discord community] ( https://discord.gg/stacklok )
302+ - Explore the [ vMCP optimizer] ( ../guides-vmcp/optimizer.mdx ) for team-level
303+ optimization in Kubernetes
392304
393305## Related information
394306
395- - [ MCP Optimizer UI guide] ( ../guides-ui/mcp-optimizer.mdx )
396307- [ Optimize tool discovery in vMCP] ( ../guides-vmcp/optimizer.mdx ) - Kubernetes
397308 operator approach
398- - [ Organize MCP servers into groups] ( ../guides-ui/group-management.mdx )
309+ - [ Optimizing LLM context] ( ../concepts/tool-optimization.mdx ) - background on
310+ tool filtering and context pollution
0 commit comments