
nerding-io/mcp-sse-example
Developer tools이 페이지는 AI로 자동 번역되었습니다. 기술적인 세부 사항은 원문을 확인하세요. 원문 보기
nerding-io/mcp-sse-example는 https://github.com/nerding-io/mcp-sse-example.]에서 가져온 MCP 서버 후보입니다
개요
nerding-io/mcp-sse-example는 https://github.com/nerding-io/mcp-sse-example.]에서 가져온 MCP 서버 후보입니다
개요(AI 번역)
Server-Sent Events (SSE)를 사용하여 웹 애플리케이션에 Model Context Protocol (MCP) 기능을 통합하기위한 참조 구현.
개요
이 프로젝트는 SSE 운송 프로토콜을 사용하여 고객과 통신하는 MCP 서버를 만드는 방법을 설명합니다. AI 모델과 실시간 통신에 대한 지속적인 연결을 유지하면서 강력한 MCP 기능을 액세스 할 수있는 웹 응용 프로그램을 가능하게합니다.
주요 특징:
- 웹 호환성을 위한 Server-Sent Events를 이용한 MCP 서버 구현
- 웹 클라이언트에서 액세스 할 수있는 사용자 정의 MCP 도구 만들기
- SSE 기반 서버에 MCP 호환 클라이언트를 연결
- 표준화 된 프로토콜을 통해 웹 기반 기능을 갖춘 AI 조수
MCP SSE는 무엇입니까?
모형 Context 의정서 (MCP)는 웹 신청을 위해 이상적 인 SSE와 더불어 다수 수송 기계장치를, 지원합니다:
- Server-Sent Events (SSE): 서버가 고객에게 업데이트를 푸시할 수 있는 단방향 연결을 설정하기위한 웹 표준
- **SSE 이상 MCP **: SSE를 운송 레이어로 사용하여 MCP 프로토콜을 구현하고 MCP 서버와 상호 작용할 수 있는 웹 클라이언트를 가능하게 합니다
이 페이지는 AI로 자동 번역되었습니다. 기술적인 세부 사항은 원문을 확인하세요.
README
원문 README의 일부입니다. 원문 보기.
MCP Server-Sent Events (SSE) - Example
A reference implementation for integrating Model Context Protocol (MCP) capabilities into web applications using Server-Sent Events (SSE) as the transport layer.
Overview
This project demonstrates how to create an MCP server that communicates with clients using the SSE transport protocol. It enables web applications to access powerful MCP capabilities while maintaining a persistent connection for real-time communication with AI models.
Key features:
- Implement MCP servers using Server-Sent Events for web compatibility
- Create custom MCP tools that can be accessed from web clients
- Connect any MCP-compatible client to your SSE-based server
- Extend AI assistants with web-based capabilities through standardized protocols
What is MCP SSE?
The Model Context Protocol (MCP) supports multiple transport mechanisms, with SSE being ideal for web applications:
- Server-Sent Events (SSE): A web standard for establishing a unidirectional connection where servers can push updates to clients
- MCP over SSE: Implements the MCP protocol using SSE as the transport layer, enabling web clients to interact with MCP servers
- Real-time AI interactions: Allows continuous streaming of AI responses while maintaining tool execution capabilities
Getting Started
Prerequisites
- Node.js (v18 or higher)
- NPM or Yarn
- A Brave Search API key for the example search tool
Installation
# Clone the repository
git clone https://github.com/yourusername/mcp-sse-example.git
cd mcp-sse-example
# Install backend dependencies
cd backend
npm install
Configuration
Create a .env file in the backend directory with your API credentials:
BRAVE_API_KEY=your_api_key_here
Usage
Starting the Server
# Build and start the server
npm run build
npm run start
The MCP SSE server will be available at http://localhost:3001.
Docker Deployment
# From the project root
docker-compose up -d
How It Works
This implementation uses:
- Express.js as the web server
- SSEServerTransport from the MCP SDK to handle the SSE protocol
- McpServer to register and manage tools
The server exposes two main endpoints:
/sse- For establishing SSE connections/messages- For receiving messages from clients
Example Implementation
The core server implementation:
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { SSEServerTransport } from "@modelcontextprotocol/sdk/server/sse.js";
import express from "express";
const server = new McpServer({
name: "Example SSE Server",
version: "1.0.0",
});
// Register tools
server.tool("example_tool", { param: z.string() }, async ({ param }) => ({
content: [{ type: "text", text: `Processed: ${param}` }],
}));
const app = express();
let transport: SSEServerTransport;
app.get("/sse", async (req, res) => {
설치
This server does not publish a one-line install command.
Open the repository installation guide MCP 초보자라면? mcpskill.org 가이드부터 시작하세요 →