mcpField
M
MCP HTTP Client Example

MCP HTTP Client Example

github.com/slavashvetsFrameworks & SDKs17Updated 94w ago

About MCP HTTP Client Example

Example client showing how to connect to MCP servers via HTTP using Server-Sent Events transport. Uses the official MCP Python SDK for protocol communication.

Key features

  1. 01Connects to MCP servers over SSE transport
  2. 02Lists available tools, resources, and prompts
  3. 03Handles connection lifecycle with async context managers

Use cases

  1. 01Learn MCP client implementation
  2. 02Test HTTP/SSE transport connections
  3. 03Integrate MCP servers into applications

MCP support

Example client demonstrating how to connect to MCP servers via SSE transport and retrieve their available tools, resources, and prompts.

Details

From the project README

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

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.