MCP SSE Client logo

MCP SSE Client

by sidharthrajaram

This demonstrates a working pattern for SSE-based MCP servers and standalone MCP clients using tools from them. It showcases decoupled processes for cloud-native use-cases.

View on GitHub

Last updated: N/A

What is MCP SSE Client?

This is an implementation of a Server-Sent Events (SSE) based server and client for the Model Context Protocol (MCP). It allows agents (clients) to connect to a running server, utilize provided tools, and disconnect, facilitating decoupled communication suitable for cloud environments.

How to use MCP SSE Client?

  1. Ensure you have an Anthropic API key in your .env file or as an environment variable.
  2. Start the server using uv run weather.py. You can configure host and port with command-line arguments.
  3. Start the client using uv run client.py http://0.0.0.0:8080/sse, providing the server's SSE endpoint.
  4. Interact with the client by typing queries or 'quit' to exit.

Key features of MCP SSE Client

  • SSE-based communication

  • Decoupled server and client

  • Cloud-native architecture

  • Tool integration

  • MCP compatibility

Use cases of MCP SSE Client

  • Integrating with National Weather Service APIs

  • Building context-aware applications with external tools

  • Enabling remote access to tools via agents

  • Building decoupled microservices via smithery

  • Building Claude desktop assistant

FAQ from MCP SSE Client

What is MCP?

MCP stands for Model Context Protocol, which aims to standardize how language models interact with external tools and data sources.

What are SSE-based servers?

SSE-based (Server-Sent Events) servers use a protocol that enables a server to send unidirectional push updates to a client, through a single HTTP connection. Used to be real-time streaming of data.

How is this better than STDIO?

SSE allows for decoupled processes where the client doesn't need to spawn the server as a subprocess, better fitting cloud-native use-cases.

Can I customize the server tools?

Yes, weather.py is an example; you can adapt it to provide different tools based on your specific needs.

What do I need to get started?

You need to have the necessary dependencies installed (including uv), an Anthropic API key, and the weather.py and client.py files.