MCP SSE 서버 및 클라이언트 예제
이 저장소에는 SSE(Server-Sent Events) 기반 MCP(Model Context Protocol) 서버와 클라이언트의 완전한 예제 구현이 포함되어 있습니다.
개요
모델 컨텍스트 프로토콜(MCP)은 AI 시스템을 위해 설계된 통신 프로토콜입니다. 이 구현은 클라이언트와의 실시간 통신을 위해 서버 전송 이벤트(SSE)를 사용하는 MCP 서버를 생성하는 방법을 보여줍니다.
특징
- SSE 기반 MCP 서버 : Express.js와 MCP SDK의 SSEServerTransport를 사용하여 서버를 구현합니다.
- 대화형 MCP 클라이언트 : SSE 서버에 연결하는 클라이언트 구현을 제공합니다.
- 도구 구현 : 적절한 설명과 함께 예시 도구(추가, 곱하기)가 포함됩니다.
- 동적 리소스 : URI 패턴을 사용하여 동적 리소스 템플릿을 보여줍니다.
- 디버깅 지원 : 자세한 로깅 및 디버깅 구성 포함
구성 요소
server.js
- StdioServerTransport를 사용하는 기본 MCP 서버sse-server.js
- Express.js와 함께 SSEServerTransport를 사용하는 MCP 서버client.js
- 기본 서버용 클라이언트sse-client.js
- SSE 서버용 클라이언트
시작하기
- 종속성 설치:지엑스피1
- SSE 서버를 시작합니다.
- 다른 터미널에서 SSE 클라이언트를 실행합니다.
서버 기능
SSE 서버는 다음을 제공합니다.
- 덧셈과 곱셈을 위한 도구 끝점
- 템플릿 지원이 포함된 동적 인사말 리소스
- 여러 클라이언트에 대한 적절한 세션 관리
- 디버깅을 위한 자세한 로깅
클라이언트 기능
SSE 클라이언트는 다음을 보여줍니다.
- SSE 서버에 연결
- 사용 가능한 도구 및 리소스 나열
- 매개변수를 사용하여 도구 호출
- 동적 매개변수를 사용하여 리소스 읽기
URI 템플릿
서버는 URI 템플릿을 클라이언트에 노출하는 방법을 보여주며, 이를 통해 클라이언트가 리소스 URI를 동적으로 구성하는 방법을 이해할 수 있도록 합니다.
특허
MIT
You must be authenticated.
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
Tools
실시간 통신을 위한 SSE(Server-Sent Events)를 사용하는 MCP(Model Context Protocol) 서버 구현으로, 계산 및 동적 리소스 템플릿을 위한 도구를 제공합니다.
Related MCP Servers
- -securityAlicense-qualityMCP Server simplifies the implementation of the Model Context Protocol by providing a user-friendly API to create custom tools and manage server workflows efficiently.Last updated -43TypeScriptMIT License
- -securityAlicense-qualityThis server implements the Model Context Protocol (MCP) to handle asynchronous tasks with real-time status tracking, robust error handling, and automatic resource management.Last updated -21JavaScriptMIT License
- -security-license-qualityA specialized server that helps users create new Model Context Protocol (MCP) servers by providing tools and templates for scaffolding projects with various capabilities.Last updated -1TypeScript
- AsecurityFlicenseAqualityA Model Context Protocol (MCP) server that interacts with system APIs, allowing users to check connections, search employees, register breakfast, and update chemical information by shifts.Last updated -2142JavaScript