Packages
backplane_mcp_protocol
0.3.1
1.10.5
1.10.4
1.10.3
1.10.2
1.10.1
1.10.0
1.9.0
1.8.3
1.8.2
1.8.1
1.8.0
1.7.9
1.7.8
1.7.7
1.7.6
1.7.5
1.7.4
1.7.3
1.7.2
1.7.1
1.7.0
1.6.3
retired
1.6.0
1.5.0
1.4.0
1.3.0
1.2.0
1.1.0
1.0.1
1.0.0
0.11.0
0.10.0
0.9.0
0.8.0
0.7.0
0.6.4
0.6.3
0.6.2
0.6.1
0.6.0
0.5.0
0.4.4
0.4.3
0.4.2
0.4.1
0.4.0
0.3.1
0.3.0
Model Context Protocol (MCP) implementation in Elixir with Phoenix integration
Current section
Files
Jump to
Current section
Files
backplane_mcp_protocol
README.md
README.md
# Backplane.McpProtocol MCP
[](https://hex.pm/packages/backplane_mcp_protocol)
[](https://hexdocs.pm/backplane_mcp_protocol)
[](https://hex.pm/packages/backplane_mcp_protocol)
Backplane-local Model Context Protocol (MCP) implementation in Elixir.
## Overview
Backplane.McpProtocol is the umbrella-local MCP protocol app used by Backplane. It provides client and server implementations for the [Model Context Protocol](https://spec.modelcontextprotocol.io/) under the `Backplane.McpProtocol` namespace.
## Installation
```elixir
def deps do
[
{:backplane_mcp_protocol, in_umbrella: true}
]
end
```
## Quick Start
### Server
```elixir
# Define a tool as a Component (compile-time registration)
defmodule MyApp.Echo do
@moduledoc "Echoes everything the user says to the LLM"
use Backplane.McpProtocol.Server.Component, type: :tool
alias Backplane.McpProtocol.Server.Response
schema do
field :text, :string, required: true, max_length: 150, description: "the text to be echoed"
end
@impl true
def execute(%{text: text}, frame) do
{:reply, Response.text(Response.tool(), text), frame}
end
end
defmodule MyApp.MCPServer do
use Backplane.McpProtocol.Server,
name: "My Server",
version: "1.0.0",
capabilities: [:tools]
# Static component registration — dispatches to MyApp.Echo.execute/2
component MyApp.Echo
@impl true
def init(_client_info, frame) do
# You can also register tools dynamically at runtime via the Frame:
# frame = register_tool(frame, "dynamic_tool", description: "...", input_schema: %{...})
{:ok, frame}
end
end
# Add to your application supervisor
children = [
{MyApp.MCPServer, transport: :streamable_http}
]
# Add to your Phoenix router (if using HTTP)
forward "/mcp", Backplane.McpProtocol.Server.Transport.StreamableHTTP.Plug, server: MyApp.MCPServer
# Or if using only Plug router
forward "/mcp", to: Backplane.McpProtocol.Server.Transport.StreamableHTTP.Plug, init_opts: [server: MyApp.MCPServer]
```
Now you can achieve your MCP server on `http://localhost:<port>/mcp`
### Client
```elixir
# Add to your application supervisor
children = [
{Backplane.McpProtocol.Client,
name: MyApp.MCPClient,
transport: {:streamable_http, base_url: "http://localhost:4000"},
client_info: %{"name" => "MyApp", "version" => "1.0.0"},
protocol_version: "2025-06-18"}
]
# Use the client
{:ok, result} = Backplane.McpProtocol.Client.call_tool(MyApp.MCPClient, "echo", %{text: "this will be echoed!"})
```
## Documentation
For detailed guides and examples, see the files in `pages/`.
## Examples
The app includes Elixir implementation examples using `plug` and `phoenix` apps:
1. [upcase-server](/priv/dev/upcase/README.md): `plug` based MCP server using streamable_http
2. [echo-elixir](/priv/dev/echo-elixir/README.md): `phoenix` based MCP server using sse
3. [ascii-server](/priv/dev/ascii/README.md): `phoenix_live_view` based MCP server using streamable_http and UI
## License
LGPL-v3 License. See [LICENSE](./LICENSE) for details.