Urchin.Endpoint (Urchin v0.2.0)

Copy Markdown View Source

A standalone HTTP endpoint that serves an MCP server with Bandit.

This is both a Plug (routing the configured path to Urchin.Transport.StreamableHTTP) and a supervisable process.

children = [{Urchin.Endpoint, server: MyServer, port: 4000, path: "/mcp"}]

or, for a quick start, Urchin.start_link/2.

Options

  • :server (required) - the Urchin.Server module
  • :port - listen port (default 4000)
  • :ip - listen address (default {127, 0, 0, 1}; bind localhost only)
  • :path - the MCP endpoint path (default "/mcp")
  • :scheme - :http or :https (default :http)

Remaining options are forwarded to Urchin.Transport.StreamableHTTP. Requires the optional :bandit dependency.

When the forwarded :auth option is set, this endpoint also serves the OAuth 2.1 Protected Resource Metadata document (RFC 9728) at its well-known URI, so MCP clients can discover the authorization server. See Urchin.Auth.

Summary

Functions

Starts the endpoint linked to the calling process.

Functions

start_link(opts)

@spec start_link(keyword()) :: {:ok, pid()} | {:error, term()}

Starts the endpoint linked to the calling process.