mcp-sse

This repository demonstrates an SSE-based Model Context Protocol (MCP) server and client pattern, enabling decoupled processes for cloud-native agent interactions with tools like weather forecasting. It uses tools from the

209
18

SSE-based Server and Client for MCP

smithery badge

This project demonstrates a Server-Sent Events (SSE) based implementation of the Model Context Protocol (MCP) for both the server and client sides. It allows standalone MCP clients to interact with MCP servers, addressing a discussion initiated here.

Usage

Note: Ensure ANTHROPIC_API_KEY is set in .env or as an environment variable.

uv run weather.py

uv run client.py http://0.0.0.0:8080/sse

Why?

The SSE-based architecture enables decoupled processes for MCP servers and clients, allowing them to connect, utilize tools, and disconnect independently, even on separate nodes. This "cloud-native" approach contrasts with the STDIO pattern where the client spawns the server as a subprocess.

Installing via Smithery

To install automatically via Smithery:

npx -y @smithery/cli install @sidharthrajaram/mcp-sse --client claude

Server

weather.py is an SSE-based MCP server offering tools based on the National Weather Service APIs, adapted from the MCP documentation's example STDIO server implementation. It runs on 0.0.0.0:8080 by default, configurable via command-line arguments.

Client

client.py is an MCP client that connects to and uses tools from the SSE-based MCP server, adapted from the MCP documentation's example STDIO client implementation. It connects to the SSE endpoint specified in the command-line argument.

Repository

SI
sidharthrajaram

sidharthrajaram/mcp-sse

Created

January 27, 2025

Updated

March 28, 2025

Language

Python

Category

Communication