
tigranbs/bun-mcp-sse-transport
Developer tools이 페이지는 AI로 자동 번역되었습니다. 기술적인 세부 사항은 원문을 확인하세요. 원문 보기
MCP를 위한 Bun 서버 수송 실시 - MCP SSE
개요
Server-Sent Events (SSE)는 Bun을 사용하여 Model Context Protocol (MCP)에 대한 구현을 전송합니다. 이 패키지는 MCP 서버에 대한 SSE 운송의 특정 구현을 제공합니다. 서버에서 클라이언트가 HTTP POST 요청을 통해 처리되는 클라이언트 서버 통신과 함께 실시간, 한방향 통신을 가능하게 합니다. - Bun runtime에 특히 내장 - MCP 운송 인터페이스 구현 - 적절한 헤더와 SSE 연결을 관리 - JSON-RPC 메시지 처리 - Bun.serve와 간단한 통합 1. 클라이언트가 /sse에 연결하면 서버는 SSE 연결을 만듭니다. 2. 서버는 클라이언트가 POST 메시지 3.를해야 하는 엔드포인트 URL을 보냅니다. 클라이언트는 엔드포인트 URL에 JSON-RPC 메시지를 보냅니다. 서버는 이러한 메시지를 수신하고 MCP 서버 5.에 전달합니다.
개요(AI 번역)
Server-Sent Events (SSE)는 Bun을 사용하여 Model Context Protocol (MCP)에 대한 구현을 전송합니다.
개요
이 패키지는 MCP 서버에 대한 SSE 운송의 특정 구현을 제공합니다. 서버에서 클라이언트가 HTTP POST 요청을 통해 처리되는 클라이언트 서버 통신과 함께 실시간, 한방향 통신을 가능하게 합니다.
키 기능
- Bun runtime에 특히 내장
- MCP 운송 인터페이스 구현
- 적절한 헤더와 SSE 연결 관리
- JSON-RPC 메시지 처리
- Bun.serve와 간단한 통합
빠른 사용법
그것이 작동하는 방법
- 클라이언트가
/sse에 연결하면 서버는 SSE 연결을 만듭니다. - 서버는 클라이언트가 POST 메시지가 있는 엔드포인트 URL을 보냅니다
- 클라이언트는 endpoint URL에 JSON-RPC 메시지를 보냅니다
- 서버는 이러한 메시지를 수신하고 MCP 서버에 전달합니다.
- MCP 서버는 메시지를 처리하고 SSE 연결을 통해 응답을 보냅니다
이 구현은 효율적인 실시간 통신을 위해 Bun의 스트리밍 기능을 활용하면서 MCP 표준을 따릅니다.
이 페이지는 AI로 자동 번역되었습니다. 기술적인 세부 사항은 원문을 확인하세요.
README
bun-mcp-sse-transport
A Server-Sent Events (SSE) transport implementation for the Model Context Protocol (MCP) using Bun.
Overview
This package provides a Bun-specific implementation of SSE transport for MCP servers. It enables real-time, one-way communication from server to client using the SSE protocol, with client-to-server communication handled via HTTP POST requests.
Key Features
- Built specifically for Bun runtime
- Implements the MCP transport interface
- Manages SSE connections with proper headers
- Handles incoming JSON-RPC messages
- Simple integration with Bun.serve
Quick Usage
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { BunSSEServerTransport } from "bun-mcp-sse-transport";
// Create SSE transport
const transport = new BunSSEServerTransport("/messages");
// Connect to MCP server
const server = new McpServer({ name: "MyServer", version: "1.0.0" });
server.connect(transport);
// Set up Bun HTTP server
Bun.serve({
port: 3000,
routes: {
"/sse": () => transport.createResponse(),
"/messages": (req) => transport.handlePostMessage(req)
}
});
How It Works
- When a client connects to
/sse, the server creates an SSE connection - The server sends the endpoint URL where the client should POST messages
- The client sends JSON-RPC messages to the endpoint URL
- The server receives these messages and passes them to the MCP server
- The MCP server processes the messages and sends responses via the SSE connection
This implementation follows the MCP standard while leveraging Bun’s streaming capabilities for efficient real-time communication.
설치
This server does not publish a one-line install command.
Open the repository installation guide MCP 초보자라면? mcpskill.org 가이드부터 시작하세요 →