MCPSERV.CLUB
tekorex

Mcp2Http

MCP Server

Bridge MCP stdio clients to stateless HTTP servers

Stale(65)
2stars
1views
Updated Mar 19, 2025

About

Mcp2Http is a lightweight adapter that converts stdio-based Model Context Protocol clients into HTTP requests, enabling them to communicate with stateless MCP servers. It adds optional session tracking and capability filtering for efficient integration.

Capabilities

Resources
Access data sources
Tools
Execute functions
Prompts
Pre-built templates
Sampling
AI model interactions

Overview

MCP2HTTP is a lightweight transport adapter that lets standard MCP clients—those that normally communicate over stdio—talk to stateless HTTP‑based MCP servers. By converting the simple request/response pattern of HTTP into the stream‑oriented semantics expected by MCP, it unlocks a new class of deployment scenarios: serverless functions, legacy web services, and any environment where persistent sockets or SSE are impractical. The adapter is intentionally minimal; it does not alter the protocol itself, only the underlying transport layer.

At its core, MCP2HTTP receives a command line invocation containing an endpoint URL and optional HTTP headers. It then serializes the incoming MCP messages, sends them as a single POST request to the target URL, and streams back the server’s response. This approach preserves all MCP capabilities—initialization, requests, responses, and streaming of partial results—while keeping the HTTP interaction stateless. Because each client instance generates a unique UUID and injects it as a header, developers can correlate logs or trace requests across distributed systems without needing dedicated session management logic on the server side.

Key features that set MCP2HTTP apart include:

  • Client‑Generated Session Tracking – A 128‑bit hex UUID is automatically added to every request. This simple identifier gives developers an out‑of‑the‑box correlation mechanism that works even when the server itself is stateless, and can be ignored if not needed.
  • Capability Filtering – The adapter caches the server’s advertised capabilities from the initial handshake and blocks any subsequent requests for unsupported features. This prevents needless traffic caused by clients repeatedly polling for capabilities that the server never offers.
  • Notification Handling – MCP notifications (messages without an ID) are silently dropped, aligning with the HTTP request/response paradigm and simplifying server logic. Servers that still wish to process notifications can do so explicitly if required.

These capabilities make MCP2HTTP especially useful in modern DevOps workflows. For example, a CI/CD pipeline can invoke an MCP‑enabled serverless function to generate code snippets or validate configurations, all over HTTPS. Legacy web applications can expose MCP endpoints behind existing HTTP infrastructure without adding new protocols or sockets. Moreover, the adapter’s statelessness ensures that scaling decisions—such as spinning up new containers or functions—do not require maintaining client connections, simplifying load balancing and autoscaling.

In summary, MCP2HTTP bridges the gap between traditional stdio MCP clients and HTTP‑based services. By handling transport conversion, session correlation, capability filtering, and notification semantics transparently, it enables developers to integrate AI assistants into a wide range of cloud‑native and legacy environments with minimal friction.