mcpField
M
MCP SSE Client-Server

MCP SSE Client-Server

Local
github.com/flyingcloud-codeDeveloper Tools0Updated 78w ago

About MCP SSE Client-Server

A Python example of an MCP client and server communicating with Server-Sent Events (SSE), for developers exploring asynchronous query flows. It includes search and web-content tools and supports OpenAI API or OpenRouter.

Key features

  1. 01SSE communication between client and server
  2. 02Search and web-content tools
  3. 03Asynchronous query processing with asyncio
  4. 04OpenAI API and OpenRouter support
  5. 05Logging and error handling

Use cases

  1. 01Build an SSE-based MCP query flow
  2. 02Find web information with search tools
  3. 03Retrieve page content for further processing

MCP support

The project includes an SSE MCP client and server, with google_search, get_web_content, get_weekday_from_date, and get_weather_for_date tools.

Configuration

Local server config is the same for every client. Copy it into your client’s MCP config file.

No install method listed yet

We haven’t collected a package or remote endpoint for this server. Follow the instructions in the project README.

Repository

Tools

No tool list yet

Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.

Details

From the project README

MCP SSE Client-Server

A Simple Python implementation of a MCP client and Server with Server-Sent Events (SSE).

Features

  • SSE-based communication between client and server
  • Integration with MCP platform tools (google_search, get_web_content)
  • Asynchronous processing of queries using Python's asyncio
  • Comprehensive logging and error handling
  • OpenAI API integration with fallback to OpenRouter
  • Environment variable configuration support

Requirements

  • Python 3.10+
  • Dependencies listed in pyproject.toml:
    • httpx for HTTP requests
    • python-dotenv for environment variables
    • openai for LLM integration
    • mcp[cli] for MCP platform integration

Installation

  1. Clone this repository
  2. Create and activate a virtual environment:
    uv venv
    # On Windows
    .venv\Scripts\activate
    # On Unix/macOS
    source .venv/bin/activate
    
  3. Install dependencies:
    uv sync .
    

Configuration

Create a .env file in the project root with your API keys:

# Required - use either OPENAI_API_KEY or OPENROUTER_API_KEY
OPENAI_API_KEY=your_api_key
OPENROUTER_API_KEY=your_api_key

# Optional - specify custom base URL
OPENAI_BASE_URL=https://your-custom-url
OPENROUTER_BASE_URL=https://your-custom-url

Usage

start mcp server firstly, which run on 8081 port. then start mcp client.

MCP Server Setup
uv run mcp-server-search.py
MCP Client Usage
uv run mcp-client-sse.py --help
usage: mcp-client-sse.py [-h] [--server SERVER] [--verbose] [--quiet]

Run MCP SSE-based client

options:
  -h, --help       show this help message and exit
  --server SERVER  MCP SSE server URL (default: http://localhost:8081/sse)
  --verbose        Enable verbose logging mode (DEBUG level)
  --quiet          Set logging to WARNING level (overrides --verbose)

uv run mcp-client-sse.py --server URL_ADDRESS-server-url:8081/sse --verbose
Available MCP Tools

The client supports these MCP tools:

  • google_search: Perform web searches
  • get_web_content: Fetch full web page content
  • get_weekday_from_date: Date utilities
  • get_weather_for_date: Weather information

Development

Logging

The client generates logs in mcp-client.log with timestamps and detailed information.

Testing

To be implemented...

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss proposed changes.

License

MIT

Comments

Markdown supported

New to MCP?

From what the protocol is to installing your first server, these answers cover most first questions.

An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.