MCP HTTP-stdio Proxy

MCP HTTP-stdio Proxy

A Node.js proxy that enables communication between stdio-based clients and HTTP-based Model Context Protocol servers. It facilitates protocol translation, session management, and authentication to allow remote HTTP servers to function as local stdio servers.

Category
Visit Server

README

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

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured