
tigranbs/bun-mcp-sse-transport
Developer toolsこのページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。 原文を見る
MCP-MCP SSEのBan Serverトランスポート実装
概要
Bun を用いたモデルコンテキストプロトコル (MCP) の Server-Sent イベント (SSE) 輸送の実装。 このパッケージは、MCP サーバーの SSE トランスポートの Bun 固有の実装を提供します。 リアルタイムで、サーバーからのワンウェイの通信をSSEプロトコルを使用してクライアントに、HTTP POSTリクエストによって処理されるクライアント・ツー・サーバーの通信を可能にします。 - バンランタイム用に特別に構築 - MCP トランスポートインターフェイスを実装 - 適切なヘッダーで SSE 接続を管理 - JSON-RPC メッセージの処理 - Bun.serve との簡単な統合 1. クライアントが/sseに接続すると、サーバーはSSE接続2を作成します。 サーバは、クライアントがPOSTメッセージ3が必要なエンドポイントURLを送信します。 クライアントはエンドポイント URL 4 に JSON-RPC メッセージを送信します。 サーバはこれらのメッセージを受信し、それらをMCPサーバー5に渡します.
概要(AI 翻訳)
Bun を用いたモデルコンテキストプロトコル (MCP) の Server-Sent イベント (SSE) 輸送の実装。
概要
このパッケージは、MCP サーバーの SSE トランスポートの Bun 固有の実装を提供します。 リアルタイムで、サーバーからのワンウェイの通信をSSEプロトコルを使用してクライアントに、HTTP POSTリクエストによって処理されるクライアント・ツー・サーバーの通信を可能にします。
主な特長
- Bunランタイムのために特に造られる
- MCP トランスポートインターフェイスを実装
- 適切なヘッダーでSSE接続を管理
- JSON-RPC メッセージの処理
- Bun.serve との簡単な統合
速い使用法
使い方
- クライアントが
/sseに接続すると、サーバーはSSE接続を作成します。 2。 サーバは、クライアントがPOSTメッセージが必要なエンドポイントURLを送信します - クライアントはエンドポイント 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 のガイドから始めましょう →