
MCP HTTP Client Example
Simple example client demonstrating how to connect to MCP servers over HTTP (SSE)
what is MCP HTTP Client Example?
MCP HTTP Client Example is a simple client that demonstrates how to connect to Model Context Protocol (MCP) servers over HTTP using Server-Sent Events (SSE) transport.
how to use MCP HTTP Client Example?
To use the MCP HTTP Client Example, clone the repository and run the example client with the command: uv run -- main.py <server_url>
. For instance, you can connect to a local server using uv run -- main.py http://localhost:8000/sse
.
key features of MCP HTTP Client Example?
- Connects to MCP servers over SSE transport
- Lists available tools, resources, and prompts
- Properly handles connection lifecycle with async context managers
use cases of MCP HTTP Client Example?
- Connecting to MCP servers for real-time data streaming.
- Listing and interacting with available tools and resources on MCP servers.
- Demonstrating the use of the MCP Python SDK for protocol communication.
FAQ from MCP HTTP Client Example?
- What is the MCP?
The Model Context Protocol (MCP) is a protocol for real-time communication with AI models and services.
- What are the requirements to run this client?
You need to have the
uv
package installed to run the client.
- Is this client officially supported?
No, this client is an example and not officially supported.
MCP HTTP Client Example
Simple example client demonstrating how to connect to Model Context Protocol (MCP) servers over HTTP using Server-Sent Events (SSE) transport.
Uses the official MCP Python SDK to handle protocol communication and server interactions.
Features
- Connects to MCP servers over SSE transport
- Lists available tools, resources and prompts
- Properly handles connection lifecycle with async context managers
Requirements
Usage
Clone this repository, then run the example client:
uv run -- main.py <server_url>
For example:
uv run -- main.py http://localhost:8000/sse
The client will:
- Connect to the specified MCP server
- List its available capabilities
- Print them as JSON