Skip to main content

SSE-based Server and Client for MCP

smithery badge

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

Metadata

Release files for iflow-mcp-sidharthrajaram-mcp-sse 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for iflow-mcp-sidharthrajaram-mcp-sse 0.1.1
File Size Uploaded
iflow_mcp_sidharthrajaram_mcp_sse-0.1.1.tar.gz 3.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for iflow-mcp-sidharthrajaram-mcp-sse 0.1.1
File Interpreter ABI Platform
iflow_mcp_sidharthrajaram_mcp_sse-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 8.2 kB

Release files / iflow_mcp_sidharthrajaram_mcp_sse-0.1.1.tar.gz

Download URL iflow_mcp_sidharthrajaram_mcp_sse-0.1.1.tar.gz
Size 3.7 kB
Tags Source
SHA-256 checksum
How to use checksums
eeeaab43f70dd377e2c11d859083711841c78eed1bb3ece88058efb8116e2e0b
BLAKE2b-256 checksum
How to use checksums
106c3bd6f56b729df98fd6a9ed331f35ce810fadf0ed5c59f9e44c20c7672410
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.25 {"installer":{"name":"uv","version":"0.9.25","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / iflow_mcp_sidharthrajaram_mcp_sse-0.1.1-py3-none-any.whl

Download URL iflow_mcp_sidharthrajaram_mcp_sse-0.1.1-py3-none-any.whl
Size 4.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4ba4617feee4c92c27abbdbe3db966bb46c2a3c0ac805aa77c7f59ab688c29ad
BLAKE2b-256 checksum
How to use checksums
973c87698cd8e05c8787f65fa30d3d63e8743caa339da827a6f60a439075717e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.25 {"installer":{"name":"uv","version":"0.9.25","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page