Skip to content

feat: container-reachable MCP host for Docker harnesses - #58

Merged
jkbennitt merged 2 commits into
masterfrom
cursor/mcp-container-reachable-93bb
Sep 6, 2026
Merged

feat: container-reachable MCP host for Docker harnesses#58
jkbennitt merged 2 commits into
masterfrom
cursor/mcp-container-reachable-93bb

Conversation

@jkbennitt

Copy link
Copy Markdown
Member

Separate MCP bind host, advertised host, and port so a Linux Docker container (stock grok-build on Docker Desktop talking to host RimWorld) can reach the in-process MCP HTTP server.

Problem

McpHost bound 127.0.0.1 and picked an ephemeral port, advertising http://127.0.0.1:<port>/mcp. A container cannot reach that. Host RimWorld/RIMAPI stays on Windows :8765; the agent needs an MCP URL via host.docker.internal.

Behavior

Mode Bind Port Advertised URL
Default (unchanged) 127.0.0.1 ephemeral (0) http://127.0.0.1:<port>/mcp
Container-reachable 0.0.0.0 8766 http://host.docker.internal:8766/mcp

--docker (headless RimWorld in a container, RIMAPI on 8765) is unchanged. No Grok Dockerfiles in this repo (ADR-004).

How to enable

# .env / process env
MCP_CONTAINER_REACHABLE=true

# or harness-opt
python scripts/run_scenario.py crashlanded --harness grok-build \
  --harness-opt mcp_container_reachable=true

Overrides: MCP_BIND_HOST, MCP_ADVERTISE_HOST, MCP_PORT (same keys as --harness-opt). Harness options win over RLEConfig.

HeadlessCliHarness.setup() listens on the bind address and passes the advertised URL to start_agent.

Windows Docker Desktop / the OS firewall may prompt to allow Python on 8766. RimAPI remains localhost:8765.

Tests

URL construction and bind-vs-advertise (including an HTTP host that advertises host.docker.internal while still serving on loopback). No live Docker in CI.

Open in Web Open in Cursor 

cursoragent and others added 2 commits September 6, 2026 03:52
Separate bind host, advertised host, and port so a Linux container
(stock grok-build on Docker Desktop) can reach host-side RLE MCP while
RimAPI stays on localhost:8765. Local defaults remain 127.0.0.1 +
ephemeral port.

Co-authored-by: Jason <jkbennitt@users.noreply.github.com>
The harness-boundary CI check forbids grok-build / opencode in src/.

Co-authored-by: Jason <jkbennitt@users.noreply.github.com>
@jkbennitt
jkbennitt marked this pull request as ready for review September 6, 2026 03:53
@jkbennitt
jkbennitt merged commit 771911b into master Sep 6, 2026
5 checks passed
@jkbennitt
jkbennitt deleted the cursor/mcp-container-reachable-93bb branch September 6, 2026 03:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants