MCP ExplorerExplorer

Mcp Http Clilent Example

@slavashvetson a year ago
15 Apache-2.0
FreeCommunity
AI Systems
# Simple Example Client A simple example client that demonstrates how to connect to the MCP server via HTTP (SSE).

Overview

What is Mcp Http Clilent Example

mcp-http-client-example is a simple example client that demonstrates how to connect to MCP servers over HTTP using Server-Sent Events (SSE) transport.

Use cases

Use cases include connecting to local or remote MCP servers to retrieve capabilities, integrating with other services that utilize the Model Context Protocol, and developing applications that require dynamic updates from the server.

How to use

To use mcp-http-client-example, clone the repository and run the example client with the command: uv run -- main.py <server_url>, replacing <server_url> with the URL of the MCP server you want to connect to.

Key features

Key features include the ability to connect to MCP servers over SSE transport, list available tools and resources, and manage the connection lifecycle using async context managers.

Where to use

mcp-http-client-example can be used in applications that require real-time communication with MCP servers, such as data processing, monitoring tools, or interactive applications.

Content

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:

  1. Connect to the specified MCP server
  2. List its available capabilities
  3. Print them as JSON

Documentation

Tools

No tools

Comments

Recommend MCP Servers

View All MCP Servers