Sandbox
@jameslong/vancouver

Elixir MCP server library for Phoenix apps

Vancouver adds Model Context Protocol support to Phoenix/Bandit servers. It gives you helpers for defining tools and prompts, then wires them into an MCP route with request handling and validation.

38 starsโ€ข2 forksโ€ขElixirโ€ขUpdated 1y ago
Who it's for

Builders who want to add MCP tools and prompts to an Elixir app.

What it delivers

You can turn a Phoenix app into an MCP server without hand-building the protocol plumbing.

What it does

Tool definitions

`use Vancouver.Tool` lets you define a tool name, description, input schema, and `run/2` handler.

Prompt definitions

`use Vancouver.Prompt` lets you define prompt names, arguments, and a `run/2` handler that returns prompt text.

Router integration

`Vancouver.Router` mounts MCP endpoints in your Phoenix router with lists of tools and prompts.

MCP request handling

The library handles initialization and request validation for MCP calls.

Claude Desktop setup example

The README shows how to point Claude Desktop at the MCP route through `mcp-remote`.

README

CI Hex.pm Hexdocs.pm Hex.pm Hex.pm

Vancouver

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.

Getting started

1. Add dependency

In mix.exs:

defp deps do
  [
    {:vancouver, "~> 0.3"}
  ]
end

2. Create your tools/prompts

You can implement 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

And 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

3. Add config

In config.ex:

config :vancouver,
  name: "My MCP Server",
  version: "1.0.0"

4. Add your MCP route

In router.ex:

forward "/mcp", Vancouver.Router, 
  tools: [MyApp.Tools.CalculateSum],
  prompts: [MyApp.Prompts.CodeReview]

5. (Optional) Add to your MCP client

E.g. For Claude Desktop, you can modify your config Settings -> Developer -> Edit config as follows:

{
    "mcpServers": {
        "MyApp": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "http://localhost:4000/mcp"
            ]
        }
    }
}

Run your server, and restart Claude to starting using your MCP tools. ๐Ÿš€

FAQ

Does Vancouver support all parts of the Model Context Protocol specification?

Not yet. Vancouver currently supports:

  • tools
  • prompts
  • sync responses (no streaming)

However, the library is simple enough that you should be able to modify it for your needs.

For more info on the protocol itself, see the MCP User Guide.

Is Vancouver stable / ready for production?

No. This library is in early development. Expect breaking changes.

Why is this library called Vancouver?

Vancouver is the natural home of MCP (Mountain, Coffee, and Phoenix).

Files in the repo

Repository payloadโ€ข11 top-level entries
  • .github
  • lib
  • priv
  • test
  • .formatter.exs
  • .gitignore
  • CHANGELOG.md
  • LICENSE
  • mix.exs
  • mix.lock
  • README.md

Discussion (0)

Ask about usage, or say what you built with it

Sign in to join the discussion.

No comments yet. Be the first to say what this is good for.

More frameworks & sdks

HKUDS/nanobotFrameworks & SDKs

Ultra-lightweight, open-source, self-hosted personal AI agent framework in Python with WebUI, tools, memory, MCP, multi-agent workflows, automation, and chat apps

48k
microsoft/
SkillOpt
microsoft/SkillOptFrameworks & SDKs

SkillOpt is a text-space optimizer that trains reusable natural-language skills for frozen LLM agents through trajectory-driven edits, validation-gated updates, and deployable best_skill.md artifacts.

17k
omnigent-ai/omnigentFrameworks & SDKs

Omnigent is an open-source AI agent framework and meta-harness: orchestrate Claude Code, Codex, Cursor, Pi, and custom agents โ€” swap harnesses without rewriting, enforce policies and sandboxing, and collaborate in real time from any device.

9.8k
kyegomez/
OpenMythos
kyegomez/OpenMythosFrameworks & SDKs

A theoretical reconstruction of the Claude Mythos architecture, built from first principles using the available research literature.

15k
D4Vinci/ScraplingFrameworks & SDKs

๐Ÿ•ท๏ธ An adaptive Web Scraping framework that handles everything from a single request to a full-scale crawl!

80k