Vancouver makes it easy to add Model Context Protocol (MCP) functionality to your Phoenix/Bandit server. Vancouver handles initialization, request validation, and offers helper functions to simplify the creation of MCP tools and prompts.
The goal is to let you create MCP servers with working tools/prompts in minutes, without needing to know much about the MCP protocol.
How it works
You create tools like this:
defmodule MyApp.Tools.CalculateSum do
use Vancouver.Tool
def name, do: "calculate_sum"
def description, do: "Add two numbers together"
def input_schema do
%{
"type" => "object",
"properties" => %{
"a" => %{"type" => "number"},
"b" => %{"type" => "number"}
},
"required" => ["a", "b"]
}
end
def run(conn, %{"a" => a, "b" => b}) do
send_text(conn, "#{a + b}")
end
end
create prompts like this:
defmodule MyApp.Prompts.CodeReview do
use Vancouver.Prompt
def name, do: "code_review"
def description, do: "Asks the LLM to analyze code quality and suggest improvements"
def arguments do
[
%{
"name" => "code",
"description" => "The code to review",
"required" => true
}
]
end
def run(conn, %{"code" => code}) do
send_text(conn, "Please review this code: #{code}")
end
end
and configure via your (phoenix) router like this:
forward "/mcp", Vancouver.Router,
tools: [MyApp.Tools.CalculateSum],
prompts: [MyApp.Prompts.CodeReview]
To use your tools locally with e.g. Claude Desktop, you can update your claude_desktop_config.json
file (see below), run your server, and refresh Claude Desktop.
{
"mcpServers": {
"MyApp": {
"command": "npx",
"args": [
"mcp-remote",
"http://localhost:4000/mcp"
]
}
}
}