SSE-based Server and Client for
- agent-framework
A working pattern for SSE-based MCP clients and servers
About
What is SSE-based Server and Client for MCP?
SSE-based Server and Client for MCP is a demonstration project that provides a working pattern for SSE-based MCP (Model Context Protocol) servers and standalone MCP clients that consume tools from them. It includes a reference weather server and a general‑purpose client, both written in Python, and is intended for developers building cloud‑native MCP applications.
How to use SSE-based Server and Client for MCP?
Set the ANTHROPIC_API_KEY in a .env file or as an environment variable. Run the server with uv run weather.py (optionally passing --host and --port). Then run the client with uv run client.py http://<host>:<port>/sse. The client connects to the SSE endpoint, lists available tools, and accepts natural language queries that it routes to the server’s tools.
Key features of SSE-based Server and Client for MCP
- SSE‑based MCP server and client over HTTP, not stdio.
- Client and server can run on decoupled machines or containers.
- Includes a working weather server using National Weather Service APIs.
- Client automatically discovers and calls server tools.
- Built on the Model Context Protocol Python SDK.
- Can be installed via Smithery for Claude Desktop.
Use cases of SSE-based Server and Client for MCP
- Developers prototyping an SSE‑based MCP architecture for cloud deployment.
- Connecting remote MCP servers to local or cloud‑hosted agents.
- Learning how to migrate from stdio‑based MCP to SSE‑based patterns.
FAQ from SSE-based Server and Client for MCP
What MCP servers does this client support?
The client connects to any MCP server that exposes an SSE endpoint (a URL ending in /sse). It does not require the server to be a subprocess or on the same machine.
Do I need an API key to use this?
Yes, an ANTHROPIC_API_KEY must be provided in the environment or a .env file. The client uses Anthropic’s models to interpret queries and call the server’s tools.
What is the difference between SSE‑based and stdio‑based MCP?
In the stdio pattern the client spawns the server as a subprocess. In SSE‑based MCP the server runs independently over HTTP, allowing the client and server to be on separate nodes – a better fit for cloud‑native and distributed architectures.
Does this client support other LLMs besides Anthropic’s?
The README only documents the use of ANTHROPIC_API_KEY. No other providers are mentioned.
What platforms or runtimes are supported?
The project runs in any environment with Python and uv (the Python package manager/runner). It has been tested on Linux, macOS, and Windows.
Details
- Author
- sidharthrajaram
- GitHub stars
- 273
- Category
- agent-framework
- Repository
- sidharthrajaram/mcp-sse
SSE-based Server and Client for MCP
This demonstrates a working pattern for SSE-based MCP servers and standalone MCP clients that use tools from them. Based on an original discussion here.
Usage
Note: Make sure to supply ANTHROPIC_API_KEY in .env or as an environment variable.
uv run weather.py
uv run client.py http://0.0.0.0:8080/sse
Initialized SSE client...
Listing tools...
Connected to server with tools: ['get_alerts', 'get_forecast']
MCP Client Started!
Type your queries or 'quit' to exit.
Query: whats the weather like in Spokane?
I can help you check the weather forecast for Spokane, Washington. I'll use the get_forecast function, but I'll need to use Spokane's latitude and longitude coordinates.
Spokane, WA is located at approximately 47.6587° N, 117.4260° W.
[Calling tool get_forecast with args {'latitude': 47.6587, 'longitude': -117.426}]
Based on the current forecast for Spokane:
Right now it's sunny and cold with a temperature of 37°F and ...
Why?
This means the MCP server can now be some running process that agents (clients) connect to, use, and disconnect from whenever and wherever they want. In other words, an SSE-based server and clients can be decoupled processes (potentially even, on decoupled nodes). This is different and better fits "cloud-native" use-cases compared to the STDIO-based pattern where the client itself spawns the server as a subprocess.
Installing via Smithery
To install SSE-based Server and Client for Claude Desktop automatically via Smithery:
npx -y @smithery/cli install @sidharthrajaram/mcp-sse --client claude
Server
weather.py is a SSE-based MCP server that presents some tools based on the National Weather Service APIs. Adapted from the MCP docs' example STDIO server implementation.
By default, server runs on 0.0.0.0:8080, but is configurable with command line arguments like:
uv run weather.py --host <your host> --port <your port>
Client
client.py is a MCP Client that connects to and uses tools from the SSE-based MCP server. Adapted from the MCP docs' example STDIO client implementation.
By default, client connects to SSE endpoint provided in the command line argument like:
uv run client.py http://0.0.0.0:8080/sse