ExMCP.Transport.HTTPServerWithVersion (ex_mcp v1.3.0)

Copy Markdown View Source
This module is deprecated. Use ExMCP.HttpPlug instead. ExMCP.Transport.HTTPServerWithVersion will be removed in 2.0.0..

Example HTTP server configuration that includes protocol version validation.

Deprecated

This module wraps the deprecated ExMCP.Transport.HTTPServer and will be removed in 2.0.0. ExMCP.HttpPlug validates the protocol version itself; use it directly.

This module demonstrates how to integrate the protocol version plug with the existing HTTP server transport.

Usage Example

# In your Phoenix router
scope "/mcp" do
  forward "/", ExMCP.Transport.HTTPServerWithVersion,
    handler: MyMCPHandler,
    security: %{
      validate_origin: true,
      allowed_origins: ["https://app.example.com"]
    }
end

# Or with Plug.Router
defmodule MyRouter do
  use Plug.Router

  plug ExMCP.Plugs.ProtocolVersion
  plug :match
  plug :dispatch

  forward "/mcp", to: ExMCP.Transport.HTTPServer,
    init_opts: [handler: MyMCPHandler]
end

Summary

Functions

call(conn, opts) deprecated

Call implementation that forwards to HTTPServer after protocol validation.

init(opts) deprecated

Initialize with HTTPServer options.

Functions

call(conn, opts)

This function is deprecated. Use ExMCP.HttpPlug instead. ExMCP.Transport.HTTPServerWithVersion will be removed in 2.0.0..

Call implementation that forwards to HTTPServer after protocol validation.

init(opts)

This function is deprecated. Use ExMCP.HttpPlug instead. ExMCP.Transport.HTTPServerWithVersion will be removed in 2.0.0..

Initialize with HTTPServer options.