barrel_server_mcp (barrel_server v1.0.1)

View Source

The MCP endpoint: mounts livery_mcp (the Streamable HTTP bridge to the barrel_mcp engine) at /mcp inside the REST router. Configured with {barrel_server, mcp, #{...}}:

- enabled - mount the endpoint (default true) - allowed_origins - any or a list of Origin values (default any; tighten for browser-reachable deployments) - allow_missing_origin - accept requests without an Origin header (default true; non-browser MCP clients send none)

Auth: /mcp is exempt from the global bearer middleware and authenticates through barrel_server_mcp_auth instead, which covers the same server tokens plus capability (bsp_) tokens.

Also the registrar: a supervised gen_server (started before the HTTP service) that registers the barrel tools in barrel_mcp's shared registry on start and unregisters them on shutdown.

Summary

Functions

Whether the MCP endpoint is mounted.

livery_mcp handler options derived from the env.

The /mcp routes (empty when disabled). The handler serves POST (JSON-RPC), GET (the SSE notification stream), DELETE (session termination) and OPTIONS (preflight).

Functions

enabled()

-spec enabled() -> boolean().

Whether the MCP endpoint is mounted.

handler_opts()

-spec handler_opts() -> livery_mcp:opts().

livery_mcp handler options derived from the env.

routes()

-spec routes() -> [{binary(), binary(), term()}].

The /mcp routes (empty when disabled). The handler serves POST (JSON-RPC), GET (the SSE notification stream), DELETE (session termination) and OPTIONS (preflight).

start_link()

-spec start_link() -> {ok, pid()} | {error, term()}.