mcp-http-client-example

このMCP HTTPクライアントの例は、HTTPを介してMCPサーバーに接続する方法を示しています。Server-Sent Events(SSE)を使用して、非同期コンテキストマネージャーで接続ライフサイクルを適切に管理します。MCP Python SDKを利用して、サーバーの機能をリストし、JSON形式で出力します。

GitHubスター

17

ユーザー評価

未評価

お気に入り

0

閲覧数

12

フォーク

1

イシュー

0

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