Skip to main content

SSE-based MCP Server and Client

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

iflow_mcp_sidharthrajaram_mcp_sse-0.1.1.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file iflow_mcp_sidharthrajaram_mcp_sse-0.1.1.tar.gz.

File metadata

  • Download URL: iflow_mcp_sidharthrajaram_mcp_sse-0.1.1.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using 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}

File hashes

Hashes for iflow_mcp_sidharthrajaram_mcp_sse-0.1.1.tar.gz
Algorithm Hash digest
SHA256 eeeaab43f70dd377e2c11d859083711841c78eed1bb3ece88058efb8116e2e0b
MD5 74e35881cd5035398feda976d7cb94f8
BLAKE2b-256 106c3bd6f56b729df98fd6a9ed331f35ce810fadf0ed5c59f9e44c20c7672410

See more details on using hashes here.

File details

Details for the file iflow_mcp_sidharthrajaram_mcp_sse-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: iflow_mcp_sidharthrajaram_mcp_sse-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 4.5 kB
  • Tags: Python 3
  • Uploaded using 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}

File hashes

Hashes for iflow_mcp_sidharthrajaram_mcp_sse-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4ba4617feee4c92c27abbdbe3db966bb46c2a3c0ac805aa77c7f59ab688c29ad
MD5 8f844148957f5d25beb40187a89f2345
BLAKE2b-256 973c87698cd8e05c8787f65fa30d3d63e8743caa339da827a6f60a439075717e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page