MCP ExplorerExplorer

Mcp Http Client Example

@slavashvetson a year ago
15 Apache-2.0
FreeCommunity
AI Systems
Simple example client demonstrating how to connect to MCP servers over HTTP (SSE)

Overview

What is Mcp Http Client Example

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

Use cases

Use cases for mcp-http-client-example include connecting to an MCP server to retrieve available capabilities, integrating with applications that require dynamic resource management, and developing client-side applications that leverage the Model Context Protocol for enhanced interactivity.

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>. For instance, use uv run -- main.py http://localhost:8000/sse to connect to a local MCP server.

Key features

Key features include the ability to connect to MCP servers over SSE transport, list available tools, resources, and prompts, and manage connection lifecycle effectively 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 systems, or any service that utilizes the Model Context Protocol.

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