TM

theailanguage/mcp_streamable_http

Developer tools

이 페이지는 AI로 자동 번역되었습니다. 기술적인 세부 사항은 원문을 확인하세요. 원문 보기

30 stars 12 forks 품질 52 트렌드 0NOASSERTION

MCP 간소화 가능한 HTTP 서버 및 클라이언트를 위한 교육 repo

개요

이 프로젝트는 Python에서 HTTP 서버와 클라이언트를 간소화하고 상호 작용하는 방법을 보여줍니다. 그것은 무인 서버, Google OAuth-protected 서버 및 MCP 도구와 상호 작용 할 수있는 Gemini-powered ADK 클라이언트를 포함합니다. streamable http server/1-stateless-streamable/ 이 는 Model Context Protocol (MCP) 을 이용하여 내장된 HTTP 서버입니다. Stateless는 메모리 또는 세션이 도구 통화를 통해 유지되지 않습니다. * server1.py: add numbers 및 subtract numbers 도구를 제공합니다. * server2.py: multiply numbers 및 split numbers 도구를 제공합니다. * main.py: CLI에서 server1 또는 server2를 실행하기 위한 Launchpad 스크립트. streamable http server/2-google-oauth 서버/ 이 서버는 . 그것은 Google OAuth 2.0 뒤에 MCP 서버를 보호하고 MCP 클라이언트가 동적으로 사용, 및 . * server.py: MCP 리소스 서버는 Google에 OAuth 프록시 역할을 합니다. * README.md : 설정, 환경 변수 및 흐름의 상세한 설명.

개요(AI 번역)

이 프로젝트는 ** Model Context Protocol (MCP)**과 Python의 HTTP 서버 및 클라이언트를 구축하고 상호 작용하는 방법을 보여줍니다. 그것은 무인 서버, Google OAuth-protected 서버 및 MCP 도구와 상호 작용 할 수있는 Gemini-powered ADK 클라이언트를 포함합니다.


1️ 스테이트리스 스트리밍 서버

위치: streamable_http_server/1-stateless-streamable/

이 ** Stateless**, streamable HTTP 서버는 Model Context Protocol (MCP)을 사용하여 구축했습니다. Stateless는 메모리 또는 세션이 도구 통화를 통해 유지되지 않습니다.

내용

  • server1.py: add_numbers] 및 subtract_numbers] 도구를 제공합니다.
  • server2.py: multiply_numbers] 및 divide_numbers] 도구를 제공합니다.
  • main.py: CLI에서 server1 또는 server2]를 실행하는 Launchpad 스크립트.

##🚀 Getting 시작

  1. ** 루트 디렉토리에서 가상 환경을 관리 **

  2. [T10]]에 대한 모든 요구 사항

  3. ** 서버 **

*Run server1 (Add + Subtract):

*Run server2 (멀티 + Divide):


2️ Google OAuth-Protected 서버

위치: [[T13]

이 페이지는 AI로 자동 번역되었습니다. 기술적인 세부 사항은 원문을 확인하세요.

README

원문 README의 일부입니다. 원문 보기.

MCP Streamable HTTP Servers & Client

This project demonstrates how to build and interact with Model Context Protocol (MCP) streamable HTTP servers and clients in Python. It includes stateless servers, a Google OAuth–protected server, and a Gemini-powered ADK client capable of interacting with MCP toolsets.


1️⃣ Stateless Streamable Servers

Location: streamable_http_server/1-stateless-streamable/

These are stateless, streamable HTTP servers built using the Model Context Protocol (MCP). Stateless means no memory or session is retained across tool calls.

Contents

  • server1.py: Provides add_numbers and subtract_numbers tools.
  • server2.py: Provides multiply_numbers and divide_numbers tools.
  • main.py: Launchpad script to run either server1 or server2 from CLI.

🚀 Getting Started

  1. Create a virtual environment from the root directory

    # macOS / Linux
    uv venv
    source ./.venv/bin/activate
    
    # Windows (PowerShell)
    uv venv
    .venv\scripts\activate
    
  2. Install requirements with uv

    uv sync --all-groups
    
  3. Run a Server

    • Run server1 (Add + Subtract):

      uv run --active streamable_http_server/1-stateless-streamable/main.py --server server1
      
    • Run server2 (Multiply + Divide):

      uv run --active streamable_http_server/1-stateless-streamable/main.py --server server2
      

2️⃣ Google OAuth–Protected Server

Location: streamable_http_server/2-google-oauth-simple-server/

This server demonstrates the OAuth Proxy pattern with Google as the upstream provider. It protects an MCP server behind Google OAuth 2.0, allowing MCP clients to authenticate dynamically using DCR (Dynamic Client Registration), PKCE, and loopback redirect URIs.

  • server.py: MCP Resource Server acting as an OAuth Proxy to Google.
  • README.md: Detailed explanation of setup, environment variables, and flow.

3️⃣ MCP Streamable HTTP Client

Location: streamable_http_client/

This is an educational project that demonstrates how to connect to a Model Context Protocol (MCP) streamable HTTP server, discover tools from the server, and interact with those tools using a Google ADK agent powered by Google Gemini.

⚙️ Setup Instructions

  1. Create a virtual environment

    # macOS / Linux
    uv venv
    source ./.venv/bin/activate
    
    # Windows (PowerShell)
    uv venv
    .venv\scripts\activate
    
  2. Install dependencies

    uv sync --all-groups
    
  3. Set environment variables

    Create a .env file inside streamable_http_client:

    GOOGLE_API_KEY=your-google-api-key
    
  4. Configure MCP Servers

    Edit the streamable_http_client/theailanguage_config.json file:

    {
      "mcpServers": {
        "server1": {
          "type": "http",
GitHub에서 전체 README 보기

설치

npx mcp-remote http://localhost:3000/mcp
MCP 초보자라면? mcpskill.org 가이드부터 시작하세요 →

설정

{ "mcpServers": { "server1": { "type": "http", "url": "http://localhost:3000/mcp" }, "server2": { "type": "http", "url": "http://localhost:3001/mcp" }, "terminal": { "type": "stdio", "command": "/Users/theailanguage/.local/bin/uv", "args": [ "--directory", "/Users/theailanguage/mcp/mcp_stremable_http/stdio_server/1-terminal-server", "run", "terminal_server.py" ] } } }