Cover image
Try Now
2025-03-01

MCP2HTTP ist ein minimaler Transportadapter, der MCP -Clients mit STDIO mit staatenlosen HTTP -Servern überbrückt.

3 years

Works with Finder

1

Github Watches

1

Github Forks

2

Github Stars

MCP2HTTP

A minimal transport adapter for connecting stdio MCP clients to stateless HTTP MCP servers.

Overview

MCP2HTTP enables Model Context Protocol clients using stdio transport to communicate with MCP servers over stateless HTTP. While MCP typically uses either stdio (for local processes) or Server-Sent Events (SSE) transport, this adapter bridges to regular HTTP endpoints, enabling new integration possibilities.

The adapter only handles basic transport layer conversion while providing optional state tracking through a client-generated UUID Session-Id header. It preserves protocol semantics, allowing clients and servers to interact directly without the need for SSE, thus working seamlessly with serverless platforms and legacy systems.

Usage

Configure your MCP client to call this command with arguments in this format:

npx -y mcp2http <endpoint-url> ["Header: Value"...]

For example, in your Claude Desktop configuration file (claude_desktop_config.json):

{
  "mcpServers": {
    "my-mcp-server": {
      "command": "npx",
      "args": [
        "-y",
        "mcp2http",
        "http://localhost:3000/mcp"
      ]
    }
  }
}

You may additionally include any number of HTTP headers as arguments. For example, to include an auth token:

{
  "mcpServers": {
    "my-mcp-server": {
      "command": "npx",
      "args": [
        "-y",
        "mcp2http",
        "https://example.com/mcp",
        "Authorization: Bearer token123"
      ]
    }
  }
}

You will need a functional MCP HTTP endpoint. An example server will be provided soon.

Features

Client-Generated Session Tracking

The adapter automatically generates a UUID and includes it as a Session-Id header with each request. While having clients generate session IDs might seem counterintuitive, this aspect resembles a 1996 proposal for Session-Id never formally adopted into HTTP standards. This mechanism offers remarkable simplicity and is intended to complement (not replace) proper authentication.

The 128-bit hex UUID format provides collision resistance and leverages a ubiquitous identifier standard, making it ideal for correlating requests in stateless HTTP environments. To prevent fragmentation and ensure consistent behavior, server implementations conforming with this design should reject non-128-bit hex Session-Id values (with or without dashes).

Servers can safely ignore the Session-Id header entirely if they don't need session tracking. This feature is optional and provided as a convenience for implementations that want correlation between requests without additional complexity.

Capability Filtering

The adapter tracks server capabilities from the initialize response and blocks requests for unsupported capabilities. This feature addresses an issue with some MCP clients that repeatedly poll for unadvertised capabilities several times per minute. By filtering these requests before they reach the server, this adapter reduces unnecessary load when a server only supports specific capabilities, i.e. tools, while the client silently continues its polling behavior.

Notification Handling

Notifications (messages with no ID) are silently dropped. This approach naturally aligns with HTTP's request/response architecture. When implementing MCP over stateless HTTP, dropping notifications emerges as a sensible choice, a conclusion reached by other implementations like the mcp-golang HTTP transport. While notifications/initialized may give pause, the practical benefits of consistent notification handling should triumph. Nevertheless, HTTP MCP servers may still desire to handle notifications gracefully, in case other implementations do forward them.

License

MIT

相关推荐

  • NiKole Maxwell
  • I craft unique cereal names, stories, and ridiculously cute Cereal Baby images.

  • Bora Yalcin
  • Evaluator for marketplace product descriptions, checks for relevancy and keyword stuffing.

  • Joshua Armstrong
  • Confidential guide on numerology and astrology, based of GG33 Public information

  • https://suefel.com
  • Latest advice and best practices for custom GPT development.

  • Callycode Limited
  • A geek-themed horoscope generator blending Bitcoin prices, tech jargon, and astrological whimsy.

  • Emmet Halm
  • Converts Figma frames into front-end code for various mobile frameworks.

  • Khalid kalib
  • Write professional emails

  • Elijah Ng Shi Yi
  • Advanced software engineer GPT that excels through nailing the basics.

  • Beniyam Berhanu
  • Therapist adept at identifying core issues and offering practical advice with images.

  • https://maiplestudio.com
  • Find Exhibitors, Speakers and more

  • apappascs
  • Entdecken Sie die umfassendste und aktuellste Sammlung von MCP-Servern auf dem Markt. Dieses Repository dient als zentraler Hub und bietet einen umfangreichen Katalog von Open-Source- und Proprietary MCP-Servern mit Funktionen, Dokumentationslinks und Mitwirkenden.

  • OffchainLabs
  • GO -Umsetzung des Ethereum -Beweises des Anteils

  • huahuayu
  • Ein einheitliches API-Gateway zur Integration mehrerer Ethercan-ähnlicher Blockchain-Explorer-APIs mit Modellkontextprotokoll (MCP) für AI-Assistenten.

  • deemkeen
  • Steuern Sie Ihren MBOT2 mit einer Power Combo: MQTT+MCP+LLM

    Reviews

    1 (1)
    Avatar
    user_XwRkwr0h
    2025-04-16

    I've been using mcp2http by tekorex and it has significantly simplified my workflow. The integration is seamless, enabling efficient connectivity between different systems. The project is well-documented on GitHub and tekorex has provided excellent support. Highly recommend for anyone needing robust HTTP communication in their applications.