kend/mcp_sse 是一个从 https://github.com/kend/mcp_sse. 导入的 MCP 服务器候选
概览
kend/mcp_sse 是一个从 https://github.com/kend/mcp_sse. 导入的 MCP 服务器候选
概述(AI 翻译)
该库提供了基于服务器发送事件(SSE)的模型上下文协议(MCP)的简单实现。
欲了解更多关于模型上下文协议的信息,请访问: 模型上下文协议文档。
目录
- 特色
- 创建您自己的MCP服务器
- 安装
- 凤凰应用
- 用于Bandit的插拔应用
- 使用情况
- 与MCP检查员合作
- 带光标
- 配置
- 端口和HTTPS
- 路径
- 保活
- 快速演示
- 其他注释
- 客户端使用示例
- 会话管理
- MCP 响应格式化
- 贡献
特色
- 完整的MCP服务器实现
- SSE 连接管理
- JSON-RPC 消息处理
- 工具注册与执行
- 会话管理
- 自动ping/keepalive(自动ping/keepalive)
- 错误处理与验证
创建您自己的MCP服务器
你必须实现MCPServer行为。
你只需实现所需的回调(handle_ping/1 和 handle_initialize/2)以及你想支持的功能所需的可选回调。
use MCPServer 宏提供:
- 内置消息路由
- 协议版本验证
- 可选回调的默认实现
- JSON-RPC 错误处理
本页由 AI 翻译,技术细节请以原文为准。
README
以下为原文 README 节选,完整内容请查看原文。
MCP over SSE
This library provides a simple implementation of the Model Context Protocol (MCP) over Server-Sent Events (SSE).
For more information about the Model Context Protocol, visit: Model Context Protocol Documentation.
Table of Contents
- Features
- Create your own MCP server
- Installation
- Usage
- Configuration
- Quick Demo
- Other Notes
- Contributing
Features
- Full MCP server implementation
- SSE connection management
- JSON-RPC message handling
- Tool registration and execution
- Session management
- Automatic ping/keepalive
- Error handling and validation
Create your own MCP server
You must implement the MCPServer behaviour.
You only need to implement the required callbacks (handle_ping/1 and handle_initialize/2) and any optional callbacks for features you want to support.
The use MCPServer macro provides:
- Built-in message routing
- Protocol version validation
- Default implementations for optional callbacks
- JSON-RPC error handling
- Logging
See DefaultServer for a default implementation of the MCPServer behaviour.
Installation
For Phoenix Applications:
- Add the required configuration to
config/config.exs:
# Configure MIME types for SSE
config :mime, :types, %{
"text/event-stream" => ["sse"]
}
# Configure the MCP Server
config :mcp_sse, :mcp_server, YourApp.YourMCPServer
- Add to your dependencies in
mix.exs:
def deps do
[
安装
This server does not publish a one-line install command.
Open the repository installation guide 新手?先看 mcpskill.org 教程 →配置
{
"mcpServers": {
"your-mcp-server": {
"url": "http://localhost:4000/sse"
}
}
}