Welcome to Backplane.McpProtocol MCP
Copy MarkdownWhat is MCP?
The Model Context Protocol (MCP) is an open standard that defines how AI assistants (like Claude, ChatGPT, or custom LLM applications) communicate with external tools, data sources, and services. Think of it as a universal plug for AI — instead of building custom integrations for every AI model and every tool, MCP provides a single, standardized protocol.
MCP defines three core primitives that servers can expose:
- Tools — Functions the AI can call (e.g., search, compute, send email)
- Resources — Data the AI can read (e.g., files, database records, API responses)
- Prompts — Reusable message templates for common interaction patterns
Clients connect to servers, negotiate capabilities, and then invoke these primitives on behalf of AI models. The protocol runs over multiple transports (STDIO, HTTP, WebSocket) and handles concerns like capability discovery, progress tracking, and error reporting.
The LiveView Moment for AI Development
What Phoenix LiveView did for real-time web experiences, Backplane.McpProtocol MCP does for AI assistant integration. Turn your Elixir applications into AI superpowers with the same simplicity and reliability you love about the BEAM.
The AI Integration Revolution
Your AI assistants are hungry for capabilities, but they're trapped in isolation. The Model Context Protocol (MCP) breaks down these walls, creating secure, composable bridges between AI and your applications.
Think of it this way: instead of AI assistants being isolated chatbots, they become extensions of your entire system architecture. Your Phoenix app's user management, your GenServer's real-time data processing, your OTP-supervised background jobs - all available to AI assistants through a fault-tolerant protocol.
Backplane.McpProtocol MCP makes this vision real with Elixir's battle-tested concurrency model and Phoenix's developer happiness principles.
Your First AI Connection
Let's connect to an existing MCP server in under three minutes:
# In your mix.exs
{:backplane_mcp_protocol, "~> 0.5.0"}Add a client to your supervision tree:
# In your Application.start/2
children = [
{Backplane.McpProtocol.Client,
name: MyApp.MCPClient,
transport: {:stdio, command: "npx", args: ["-y", "@modelcontextprotocol/server-everything"]},
client_info: %{"name" => "MyApp", "version" => "1.0.0"},
capabilities: %{},
protocol_version: :auto}
]
Supervisor.start_link(children, strategy: :one_for_one)Now watch the magic:
# Discover what's available
{:ok, tools} = Backplane.McpProtocol.Client.list_tools(MyApp.MCPClient)
# => Find web search, file operations, and more
# Use AI capabilities from your Elixir code
{:ok, result} = Backplane.McpProtocol.Client.call_tool(MyApp.MCPClient, "web_search", %{query: "elixir otp patterns"})
# Even read resources
{:ok, content} = Backplane.McpProtocol.Client.read_resource(MyApp.MCPClient, "file:///project/README.md")Your Elixir application now has AI-powered web search, file operations, and more. All fault-tolerant, all supervised, all feeling like native Elixir.
Modern and Legacy Peers
New clients default to protocol_version: :auto. They begin with the modern
server/discover exchange and select 2026-07-28 when the peer supports it.
They retry a mutually supported modern version when the peer reports one, and
fall back to legacy initialize only for the protocol-defined HTTP or stdio
signals that prove the peer is legacy. Transport failures, server errors, and
malformed modern replies do not silently downgrade the connection.
Use an explicit version string to pin either era. An explicit modern pin never downgrades, and an explicit legacy pin starts directly with the legacy initialization lifecycle.
After readiness, inspect the selected era and version:
:ok = Backplane.McpProtocol.Client.await_ready(MyApp.MCPClient)
%{era: era, protocol_version: version} =
Backplane.McpProtocol.Client.get_protocol_info(MyApp.MCPClient)Modern requests carry protocol version, client capabilities, and client
identity in per-request _meta. Modern Streamable HTTP also projects the
standard MCP headers. The client supplies protocol-reserved metadata itself;
application metadata passed with meta: %{...} is merged without replacing
those reserved values.
Exposing Your App to AI
The real power comes when AI assistants can use your application's capabilities. Here's how to expose your Elixir logic:
defmodule MyApp.Server do
use Backplane.McpProtocol.Server,
name: "my-app-server",
version: "1.0.0",
capabilities: [:tools]
component MyApp.UserLookup
component MyApp.DataProcessor
end
defmodule MyApp.UserLookup do
@moduledoc "Find users by email or ID"
use Backplane.McpProtocol.Server.Component, type: :tool
alias Backplane.McpProtocol.Server.Response
schema do
field :email, :string, regex: ~r/@/, format: "email", required: true
end
def execute(%{email: email}, frame) when is_binary(email) do
case MyApp.Users.get_by_email(email) do
%User{} = user ->
result = %{id: user.id, name: user.name, email: user.email}
{:reply, Response.tool() |> Response.structured(result), frame}
nil ->
{:reply, Response.tool() |> Response.error("User not found"), frame}
end
end
endStart your server:
# In your supervision tree
children = [
# Your existing app
MyApp.Repo,
MyAppWeb.Endpoint,
# Your MCP server
{MyApp.Server, transport: :stdio}
]Now any AI assistant can discover and use your user lookup functionality through the MCP protocol. They'll get proper JSON schema documentation, structured responses, and error handling - all automatically generated from your Elixir code.
Real-World Power
This is just the beginning. Backplane.McpProtocol MCP enables:
Fault-Tolerant AI Integration - Process crashes don't break your AI connections. Supervision trees ensure reliability.
Composable AI Capabilities - Mix and match different MCP servers. One for file operations, another for database access, another for your business logic.
Phoenix Integration - Expose LiveView data, trigger real-time updates, authenticate users - all through AI assistants.
OTP-Native Patterns - GenServers become AI tools. Agents become AI resources. Your entire BEAM ecosystem becomes AI-accessible.
Type Safety & Validation - Peri-powered schema validation ensures AI tools receive clean, validated data.
Progressive Enhancement - Start simple, add capabilities incrementally. No big rewrites needed.
Ready to Build?
The framework handles transport negotiation, capability discovery, error recovery, and request routing. You focus on what your application does best.
Turn your Elixir applications into AI superpowers. It's time for your AI assistants to meet the BEAM.