MCP ExplorerExplorer

Mcp Sse Server Sample

@edom18on 9 months ago
1 MIT
FreeCommunity
AI Systems
MCP-SSE-Server-Sample is a simple server implementation using Server Sent Events (SSE) for the Model Context Protocol (MCP). It demonstrates basic SSE functionality, making it an excellent resource for understanding server-client communication with minimal complexity.

Overview

What is Mcp Sse Server Sample

MCP-SSE-Server-Sample is a sample implementation of a server utilizing Server Sent Events (SSE) within the Model Context Protocol (MCP). It serves as a basic example to understand how an SSE server operates.

Use cases

Use cases for MCP-SSE-Server-Sample include real-time data feeds for dashboards, live updates in collaborative applications, and any application needing efficient server-to-client communication without the overhead of WebSockets.

How to use

To use MCP-SSE-Server-Sample, first launch the server using the command: uv run mcp_server_sample --port 8080 --transport sse. After the server is running, execute the client script with python client.py.

Key features

Key features include a simple implementation of an SSE server, providing basic functionality to demonstrate the workings of SSE in conjunction with MCP. The server is based on official sample code, making it easy to understand.

Where to use

MCP-SSE-Server-Sample can be used in web applications that require real-time data updates from the server to the client, such as live notifications, chat applications, or any scenario where continuous data streaming is beneficial.

Content

Sample code for Model Context Protocl (MCP) with Server Sent Event (SSE)

This repository is a sample for using SSE server. This server provides two unhelpful methods but this implementation is very simple and useful for understanding how work the SSE server.

This serer implementation is based on official sample code.

How to use

First, you must launch the server with uv command like below. This sample code has standard I/O version but this repository is just showing how to use SSE server then I don’t explain the normal version. If you want to know about that please refer to the official code.

$ uv run mcp_server_sample --port 8080 --transport sse

Next, just execute client.py.

$ python client.py

Model Context Protocol (MCP) の Server Sent Event (SSE) を利用したサンプルコード

MCP の SSE での動作サンプルを実装したリポジトリです。実装自体はテキストを逆順にしたり upper case にしたりと実用的な動作はしませんが、大まかな動作の理解に役立つように実装したサンプルコードです。

サーバ側の実装は公式のサンプルを元にしています。

使い方

まずサーバサイドを起動します。サンプルでは SSE と標準入出力バージョンがありますが、このサンプルは SSE 向けなので SSE のみを紹介します。それ以外は公式サンプルをご覧ください。

uv コマンドを利用して以下のようにサーバを起動します。

$ uv run mcp_server_sample --port 8080 --transport sse

続いて、クライアント側を普通に実行します。

$ python client.py

Tools

No tools

Comments

Recommend MCP Servers

View All MCP Servers