Agentic Coding Coaching: AI-assisted Engineering für agile Teams. 1 Tag KI-Training + 4 Tage Live-Coaching für 1.500 € p. P.
Jetzt informieren 
Data Engineering

Bridge the Gap: Running Native Windows MCP Servers Inside Sandboxed AI Agents (Claude & Gemini CLI)

Lesezeit
4 ​​min

TL;DR:

Problem: Sandboxed Linux container agents in WSL2 (Claude Code, Gemini CLI) cannot natively execute Windows MCP servers (like Power BI Modeling MCP) due stdio transport limitations across OS boundaries, Hyper-V Firewall blocks on port 3000, and JSON-RPC stream framing issues.

Solution: A Node.js proxy script running on the Windows host receives HTTP requests from the container, translates them to native host stdio process communication, aggregates fragmented JSON payloads, and safely handles asynchronous notifications.

Integrating Model Context Protocol (MCP) servers with developer tooling provides language models with direct, structured context from local environments. When paired with tools like Microsoft’s Power BI Modeling MCP, CLI agents such as Claude Code (claude) and Gemini CLI (gemini) can inspect tabular models, execute DAX queries, and modify TMDL definitions in real time against local Power BI Desktop instances.

However, security best practices dictate that AI CLI agents run inside sandboxed environments (such as Podman or Docker Linux containers). This creates a sharp conflict when trying to execute Windows-native binaries from within an isolated Linux runtime.

This article details the architectural barriers involved—including Windows 11 Hyper-V Firewall restrictions—and provides a lightweight Node.js proxy script that bridges communication between sandboxed CLI agents and native Windows executables.

Technical Challenges on Windows Host Systems

When running agent CLIs with container sandboxing enabled, four key friction points emerge:

  1. Operating System and DLL Incompatibilities
    The Power BI Modeling MCP server binary (.exe) relies on Windows system libraries like iphlpapi.dll (IP Helper API) to discover running Power BI Desktop instances. Inside a Linux container sandbox, these Windows libraries do not exist, causing standard Linux execution attempts to fail immediately.
  2. Transport Layer Disconnect (stdio vs. HTTP/SSE)
    MCP servers typically communicate via Standard Input/Output (stdio). A containerized sandbox cannot attach native stdio streams directly to an executable running on the host OS. Communication must be converted to network protocols like HTTP or SSE.
  3. Hyper-V Firewall Restrictions (Windows 11 22H2+)
    The Hyper-V Firewall filters traffic flowing through virtual network adapters created for container runtimes and WSL. Even if standard Windows Defender Firewall ports are open, inbound traffic from the container virtual switch to the host will be dropped by default unless explicitly allowed.
  4. Stream Framing and JSON-RPC Protocol Differences
    MCP implementations on Windows frequently frame JSON payloads across fragmented data chunks or attach length headers. Raw TCP forwarding leads to parsing failures such as Unexpected end of JSON input. Additionally, standard JSON-RPC notification methods (such as notifications/initialized) do not expect responses, causing synchronous listeners to time out.

The rough outline for Claude and for gemini are shown below:

Implementation Guide

Step 1: Configure Windows Hyper-V Firewall Rules

Because container traffic is routed through a Hyper-V Virtual Switch, execute the following command in PowerShell as Administrator to permit inbound traffic on port 3000 from the container switch:

Step 2: Deploy the Node.js Bridge Script (bridge.js)

Save this proxy script on your Windows host. It handles non-blocking notifications, aggregates fragmented stdout buffers, and exposes the executable over HTTP.

Step 3: Configure Your CLI Clients

Option A: Gemini CLI (gemini) Configuration

Add the bridge entry to your settings.json file:

Option B: Claude CLI (claude / Claude Code) Configuration

Add the bridge entry to your .mcp.json or ~/.claude.json file:

Step 4: Verification and Workflow

  1. Start the bridge on the Windows host:

  2. Trigger tool discovery in your CLI client of choice:
  • For Gemini CLI: /mcp refresh
  • For Claude CLI: claude mcp list or /mcp

Conclusion

By combining targeted Hyper-V Firewall rules with a Node.js proxy bridge, sandboxed CLI agents like Claude CLI and Gemini CLI can interact seamlessly with Windows-native MCP servers. This setup preserves full container isolation while granting your AI agents full access to local Power BI models.

Jobs bei inovex Freie Stellen
*Gender, Herkunft etc. sind keine Bewertungskriterien. Hauptsache, du bist genauso technologiebegeistert wie wir.

Hat dir der Beitrag gefallen?

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert

inoNews

5 gute Gründe für den inovex Newsletter:

  • Exklusive Insights & Tipps unserer inovexperts
  • Infos und Updates zu IT-Trend-Themen & Angeboten
  • Trainingsrabatte & Eventeinladungen
  • Gratis Whitepapers & Infosheets
  • Austausch- & Beratungsoptionen

Zur Newsletter-Anmeldung