MCP.so
Sign In

MCP HTTP Client Example

@slavashvets

About MCP HTTP Client Example

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. Built with the official MCP Python SDK, it is intended for developers learning MCP integration or testing server implementations.

How to use MCP HTTP Client Example?

Clone the repository and run uv run -- main.py <server_url>, replacing <server_url> with your MCP server’s SSE endpoint. For example, uv run -- main.py http://localhost:8000/sse. The client requires uv to be installed. It will connect to the server, list available capabilities, and print them as JSON.

Key features of MCP HTTP Client Example

  • Connects to MCP servers over SSE transport
  • Lists available tools, resources, and prompts
  • Handles connection lifecycle with async context managers
  • Prints server capabilities as JSON

Use cases of MCP HTTP Client Example

  • Learning how to connect to an MCP server via SSE transport
  • Quickly verifying an MCP server’s advertised capabilities
  • Testing MCP server implementations during development

FAQ from MCP HTTP Client Example

What do I need to run MCP HTTP Client Example?

You need uv installed and an MCP server that supports SSE transport.

How do I connect to an MCP server using this client?

Run uv run -- main.py <server_url> where <server_url> is the server’s SSE endpoint, for example http://localhost:8000/sse.

What does the client actually do?

It connects to the specified MCP server, retrieves the list of available tools, resources, and prompts, and prints them as JSON to the console.

Does it support other transports, like stdio?

No, this example client only supports HTTP transport via Server-Sent Events (SSE). It does not implement stdio transport.

Is this client intended for production use?

No, it is a basic example provided to demonstrate MCP connectivity and protocol interaction. Production applications would require more robust error handling and customization.

Comments

More Agent Frameworks MCP clients