Skip to main content

Add your description here

Project description

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",
          "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"
          ]
        }
      }
    }
    
  5. Run the Client

    uv run universal_client/1-google-adk-gemini-mcp-client/cmd.py
    

    This launches an interactive command-line chat loop, connects to MCP servers via HTTP or STDIO, and interacts with the Gemini-powered ADK agent using tools discovered from each server.


4️⃣ Google OAuth–Protected Client

Location: universal_client/3-google-oauth-simple-client/

This client demonstrates how to authenticate against the Google OAuth–protected MCP server using the OAuth Proxy pattern. It:

  • Handles loopback redirect URIs.
  • Supports DCR + PKCE automatically.
  • Interacts with the protected tools (get_time, get_user_info).

Run with:

source .venv/bin/activate
uv run ./universal_client/3-google-oauth-simple-client/client.py

5️⃣ Coming Soon

🧠 Stateful Streamable Server

A stateful, streamable HTTP server using MCP that maintains state across tool invocations and enables resumable event streams.


🔧 Claude Desktop Integration

If you want to integrate these MCP servers with Claude Desktop, use the following config:

{
  "mcpServers": {
    "server1": {
      "command": "npx",
      "args": [
        "mcp-remote",
        "http://localhost:3000/mcp"
      ]
    },
    "server2": {
      "command": "npx",
      "args": [
        "mcp-remote",
        "http://localhost:3001/mcp"
      ]
    }
  }
}

Save this as claude_desktop_config.json. Warning! - This uses a third party package called mcp-remote that is not an official Anthropic or Claude package


📜 License

This repository and the code within are licensed under the GNU General Public License v3.0. See the LICENSE file for full details.

Built with ❤️ by The AI Language to teach and demonstrate how to create streamable MCP servers and agents in Python using FastMCP, Pydantic, and ADK.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file iflow_mcp_theailanguage_mcp_streamable_http-0.1.0.tar.gz.

File metadata

  • Download URL: iflow_mcp_theailanguage_mcp_streamable_http-0.1.0.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for iflow_mcp_theailanguage_mcp_streamable_http-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a0352dd6a19c1ce0c3f243aa9d6f3a08b144c35677c5fdd3341daa04e85319c4
MD5 0b1ac9c3e125cf6346e152935691dc23
BLAKE2b-256 937df24e737cd8da0170ae0cf43219389919658d1f2f4fd578b279bbc780c7fb

See more details on using hashes here.

File details

Details for the file iflow_mcp_theailanguage_mcp_streamable_http-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: iflow_mcp_theailanguage_mcp_streamable_http-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for iflow_mcp_theailanguage_mcp_streamable_http-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6f8d7c456a8a45823ca7017192438f648a217c003c57f0400fa0f0344b53ed03
MD5 befa0e77505b02a382991e1f2f7d6c35
BLAKE2b-256 d02f5cc9eeb326137b7a82436e5b2eafcdb4ab2e8d104d08193aef138a3aa221

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page