Aggregates ConduitMcp.Component modules into a full MCP server.
The Endpoint implements the ConduitMcp.Server behaviour by generating
all required callbacks at compile time from registered components.
It also carries declarative configuration for rate limiting, message
limiting, and authentication that transports auto-extract.
Example
defmodule MyApp.MCPServer do
use ConduitMcp.Endpoint,
name: "My Server",
version: "1.0.0",
rate_limit: [backend: MyApp.RateLimiter, limit: 60, scale: 60_000],
message_rate_limit: [backend: MyApp.RateLimiter, limit: 50, scale: 300_000]
component MyApp.Echo
component MyApp.ReadUser
component MyApp.CodeReviewPrompt
endThen wire it up with a transport — the Endpoint config is auto-extracted:
{Bandit,
plug: {ConduitMcp.Transport.StreamableHTTP, server_module: MyApp.MCPServer},
port: 4001}Options
:name— Server name for the MCPinitializeresponse:version— Server version for the MCPinitializeresponse:rate_limit— HTTP rate limiting config (same format as transport opts):message_rate_limit— Message-level rate limiting config:auth— Authentication config (same format as transport opts)
How It Works
At compile time, the @before_compile hook:
- Validates all registered components (existence, uniqueness, types)
- Groups components by type (tool, resource, prompt)
- Generates all
ConduitMcp.Servercallbacks:handle_list_tools/1,handle_call_tool/3handle_list_resources/1,handle_read_resource/2handle_list_prompts/1,handle_get_prompt/3
- Generates validation schema lookups for the existing validation pipeline
- Generates
__endpoint_config__/0for transport auto-extraction - Generates
__capabilities__/0for selective capability advertisement
Because the Endpoint implements ConduitMcp.Server, it works with the
existing ConduitMcp.Handler and all transports without modification.
Summary
Functions
Registers a component module with the endpoint.