@@ -242,11 +242,17 @@ without editing a profile file.
242
242
243
243
## Accessing other workloads on the same container network
244
244
245
+ ToolHive allows you to configure both outbound and inbound network access for
246
+ MCP servers. This is commonly needed when your MCP server needs to communicate
247
+ with databases, APIs, or other services that are running on your local host
248
+ during development, or when other containers need to communicate with your MCP
249
+ server.
250
+
251
+ ### Outbound access: MCP server to other workloads
252
+
245
253
To allow an MCP server to access other workloads on the same network, you need
246
- to configure network isolation to include the appropriate hostnames and ports.
247
- This is commonly needed when your MCP server needs to communicate with
248
- databases, APIs, or other services that are running on your local host during
249
- development.
254
+ to configure outbound network isolation to include the appropriate hostnames and
255
+ ports.
250
256
251
257
For example, in Docker environments, you can add ` host.docker.internal ` to
252
258
access services on the host. ` host.docker.internal ` is a special hostname
@@ -273,6 +279,45 @@ Run the MCP server with this profile:
273
279
thv run --isolate-network --permission-profile ./internal-access-profile.json < SERVER>
274
280
```
275
281
282
+ ### Inbound access: Other containers to MCP server
283
+
284
+ By default, the ingress proxy only allows traffic from the container's own
285
+ hostname, ` localhost ` , and ` 127.0.0.1 ` . If you need to allow other containers or
286
+ workloads to communicate with your MCP server, configure the
287
+ ` network.inbound.allow_host ` setting in your permission profile.
288
+
289
+ This is useful when:
290
+
291
+ - Other containers need to call your MCP server's API
292
+ - You're running multiple services that need to communicate with each other
293
+ - You need to allow traffic from specific internal hostnames or domains
294
+
295
+ Create a permission profile that allows specific inbound hostnames:
296
+
297
+ ``` json title="inbound-access-profile.json"
298
+ {
299
+ "network" : {
300
+ "inbound" : {
301
+ "allow_host" : [" host.docker.internal" , " localhost" ]
302
+ }
303
+ }
304
+ }
305
+ ```
306
+
307
+ Run the MCP server with this profile:
308
+
309
+ ``` bash
310
+ thv run --isolate-network --permission-profile ./inbound-access-profile.json < SERVER>
311
+ ```
312
+
313
+ :::info
314
+
315
+ If no ` network.inbound ` configuration is specified, the ingress proxy uses the
316
+ default behavior of allowing traffic only from the container's own hostname,
317
+ ` localhost ` , and ` 127.0.0.1 ` .
318
+
319
+ :::
320
+
276
321
## Related information
277
322
278
323
- [ ` thv run ` command reference] ( ../reference/cli/thv_run.md )
0 commit comments