MCP HTTP-stdio Proxy MCP Server

1

Add it to Claude Code

Run this in a terminal.

Run in terminal
claude mcp add mcp-http-stdio -- npx -y kiennh/mcp-http-stdio https://your-remote-mcp-server.com/mcp
README.md

Bridge stdio-based clients to HTTP-based MCP servers

MCP HTTP-stdio Proxy

A Node.js implementation of a Model Context Protocol (MCP) proxy that enables communication between stdio-based clients (like Antigravity) and HTTP-based MCP servers (running with streamableHttp).

Overview

This proxy allows you to use remote or HTTP-hosted MCP servers as if they were local stdio servers. It handles the JSON-RPC communication, session management, and optional authentication seamlessly.

graph LR
    Client[Antigravity / Stdio Client] -->|stdio| Proxy[MCP Proxy]
    Proxy -->|HTTP JSON-RPC| Upstream[Upstream MCP Server]

Features

  • Protocol Translation: Bridges MCP over stdio to MCP over HTTP.
  • Session Management:
    • Automatically handles upstream initialization.
    • Persists session IDs in ~/.mcp-session-cache for continuity.
    • Automatic retries on session expiration or "Not Initialized" errors.
  • Dynamic Tool List: Automatically injects an update tool to manually refresh the upstream connection and clear the session cache.
  • Broad Support: Proxies tools, resources, prompts, completions, and logging levels.
  • Authentication: Supports optional authorization headers for secure upstream servers.
  • Timeout Support: Configurable request timeouts.

Installation

  1. Clone or copy the project files.
  2. Install dependencies:
    npm install
    

Configuration

The proxy can be configured using environment variables or a .env file:

Variable Description Default
UPSTREAM_MCP_URL The URL of the target HTTP MCP server. http://localhost:8080/mcp
UPSTREAM_AUTH Optional authentication header value (e.g., Bearer ...). (none)
MCP_TIMEOUT_MS Timeout for upstream requests in milliseconds. 15000
MCP_SESSION_ID Manually specify an initial session ID. (none)

Usage

Direct Execution

You can run the proxy directly and optionally pass the upstream URL as the first argument:

node mcp-proxy.js https://your-remote-mcp-server.com/mcp

Run using npx (from GitHub)

You can run the proxy directly without cloning using npx:

npx -y kiennh/mcp-http-stdio https://your-remote-mcp-server.com/mcp

Run using Docker

The proxy is available as a Docker image:

docker run -i --rm \
  -e UPSTREAM_MCP_URL="https://your-remote-mcp-server.com/mcp" \
  -e UPSTREAM_AUTH="Bearer YOUR_TOKEN" \
  ghcr.io/kiennh/mcp-http-stdio:latest

Integration with Antigravity

To use this proxy with Antigravity, add it to your mcp_config.json:

{
  "mcpServers": {
    "my-remote-server": {
      "command": "npx",
      "args": ["-y", "kiennh/mcp-http-stdio", "https://api.example.com/mcp"],
      "env": {
        "UPSTREAM_AUTH": "Bearer YOUR_TOKEN"
      }
    }
  }
}

Custom 'update' Tool

The proxy automatically adds a tool named update to the list of available tools. Calling update will:

  1. Clear the local session cache (~/.mcp-session-cache).
  2. Force a re-initialization of the upstream server on the next request.
  3. This is useful if the upstream server's tools have changed or the session has become desynchronized.

License

ISC

Tools (1)

updateClears the local session cache and forces a re-initialization of the upstream server on the next request.

Environment Variables

UPSTREAM_MCP_URLThe URL of the target HTTP MCP server.
UPSTREAM_AUTHOptional authentication header value (e.g., Bearer ...).
MCP_TIMEOUT_MSTimeout for upstream requests in milliseconds.
MCP_SESSION_IDManually specify an initial session ID.

Configuration

claude_desktop_config.json
{"mcpServers": {"my-remote-server": {"command": "npx", "args": ["-y", "kiennh/mcp-http-stdio", "https://api.example.com/mcp"], "env": {"UPSTREAM_AUTH": "Bearer YOUR_TOKEN"}}}}

Try it

Run the update tool to refresh the connection to my remote MCP server.
Can you re-initialize the upstream server connection using the update tool?
Please clear the local session cache for the remote MCP server.

Frequently Asked Questions

What are the key features of MCP HTTP-stdio Proxy?

Bridges MCP over stdio to MCP over HTTP. Persists session IDs in ~/.mcp-session-cache for continuity. Automatic retries on session expiration or initialization errors. Supports optional authorization headers for secure upstream servers. Automatically injects an update tool to refresh upstream connections.

What can I use MCP HTTP-stdio Proxy for?

Connecting local AI clients to remote-hosted MCP servers. Managing sessions for HTTP-based MCP servers that require authentication. Refreshing tool definitions from a remote server without restarting the client. Standardizing communication for MCP servers running in containerized environments.

How do I install MCP HTTP-stdio Proxy?

Install MCP HTTP-stdio Proxy by running: npx -y kiennh/mcp-http-stdio https://your-remote-mcp-server.com/mcp

What MCP clients work with MCP HTTP-stdio Proxy?

MCP HTTP-stdio Proxy works with any MCP-compatible client including Claude Desktop, Claude Code, Cursor, and other editors with MCP support.

Turn this server into reusable context

Keep MCP HTTP-stdio Proxy docs, env vars, and workflow notes in Conare so your agent carries them across sessions.

Need the old visual installer? Open Conare IDE.
Open Conare