
Elixir 的简单 MCP 服务器库。
概览
Vancouver 让你轻松地将模型上下文协议(MCP)功能添加到你的 Phoenix/Bandit 服务器。Vancouver 负责初始化、请求验证,并提供辅助功能,简化 MCP 工具和提示的创建。 例如,对于Claude Desktop,你可以修改配置设置 -> 开发者 -> 编辑配置如下: { “mcpServers”: { “MyApp”: { “command”: “npx”, “args”: [ “mcp-remote”, “http://localhost:4000/mcp" } } 运行你的服务器,重启Claude,让它开始使用你的MCP工具。🚀 - 工具 - 提示 - 同步响应(无流媒体) 不过,这个库足够简单,你应该可以根据需要进行修改。 有关协议本身的更多信息,请参见MCP用户指南。 不。这个库还处于早期开发阶段。预计会有重大变动。
概述(AI 翻译)
Vancouver 让你轻松地将模型上下文协议(MCP)功能添加到你的 Phoenix/Bandit 服务器。Vancouver 负责初始化、请求验证,并提供辅助功能,简化 MCP 工具和提示的创建。
开始
1.添加依赖
在mix.exs中:
2.创建你的工具/提示
你可以实施以下工具:
还有像这样的提示:
3.添加配置
在config.ex中:
4.添加你的MCP路线
在router.ex中:
5.(可选)添加到你的MCP客户端
例如,对于 Claude Desktop,你可以修改配置 Settings -> Developer -> Edit config:
{ “mcpServers”: { “MyApp”:{ “命令”:“NPX”, “ARGS”: [ “MCP-遥控器”, “http://localhost:4000/mcp" ] } } }
运行你的服务器,重启Claude,让它开始使用你的MCP工具。🚀
常见问题解答
温哥华是否支持模型上下文协议规范的所有部分?
还没有。温哥华目前支持:
- 工具
- 提示
- 同步响应(无流媒体)
不过,这个库足够简单,你应该可以根据需要进行修改。
有关协议本身的更多信息,请参见MCP用户指南。
温哥华稳定吗/准备开拍?
不。
本页由 AI 翻译,技术细节请以原文为准。
README
以下为原文 README 节选,完整内容请查看原文。
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.
安装
npx mcp-remote http://localhost:4000/mcp