ai newsDi., 3. Nov.
EilmeldungGemini CLI's mkdir Failed, the Agent Kept Going, and Each move Overwrote the Last File

Connect a Stateless Streamable HTTP MCP Server to Claude, ChatGPT, and Gemini for Tour Route Research

Live music touring requires careful route planning. Independent musicians who book their own paid shows must connect venues between distant towns without wasting time or gas. When planning a run across multiple states, an artist cannot simply search a single city. They need to query stages along a

dev.toMontag 22:22 · 02.11.5 Min. Lesezeit
Bild: dev.to

Live music touring requires careful route planning. Independent musicians who book their own paid shows must connect venues between distant towns without wasting time or gas. When planning a run across multiple states, an artist cannot simply search a single city. They need to query stages along a highway drive, check room capacities, verify live music nights, and reach the person who books each room.

The Model Context Protocol (MCP) gives large language models a clean way to call external tools and retrieve structured records. Early MCP servers used local standard input and output (stdio) pipes. Modern cloud deployments use stateless Streamable HTTP transport. This guide walks through connecting a stateless Streamable HTTP MCP server with OAuth 2.1 to Claude Desktop, ChatGPT, and Google Gemini to research highway tour routes and small club stages.

Traditional MCP setups run as local background processes communicating over stdio. While stdio works well on a single developer laptop, team workflows and cloud models need a web-accessible endpoint.

The MCP specification defines Streamable HTTP as an open web transport. Instead of keeping a stateful TCP connection or WebSocket open, each request travels over standard HTTP POST requests with JSON-RPC payloads. The server responds with application/json or streaming events (text/event-stream).

Stateless Streamable HTTP has three major operational benefits:

You can inspect a live implementation at the stateless Streamable HTTP MCP endpoint at No Stairs Please, which exposes venue and route tools across all fifty US states.

When exposing an MCP server to web-based AI clients, you must protect user data without adding server-side session state. OAuth 2.1 simplifies this architecture:

POST /mcp HTTP / 1.1 Host: api.example.com Content-Type: application/json Authorization: Bearer <signed-token> { "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "search_venues", "arguments": { "stops": [ "Seattle, WA", "Spokane, WA", "Missoula, MT", "Bozeman, MT" ], "within_miles": 25, "max_capacity": 300 } } } Enter fullscreen mode Exit fullscreen mode If an unauthenticated request hits a restricted action, the server returns an HTTP 401 status with a standard challenge header:

WWW-Authenticate: Bearer error="invalid_token", error_description="Token expired or missing" Enter fullscreen mode Exit fullscreen mode Tool Definitions for Highway Corridor Routing Tour routing requires geographic tools that understand road networks rather than simple radial distance circles. The venue MCP server provides the following tool signatures:

Queries small stages by keyword, state, regional drive-time area, or highway road corridor. It accepts an ordered list of stops:

{ "name": "search_venues", "description": "Search live music venues across all 50 US states along a driving route corridor or town.", "parameters": { "type": "object", "properties": { "stops": { "type": "array", "items": { "type": "string" }, "description": "Ordered list of 2 to 15 towns along a highway driving route." }, "within_miles": { "type": "number", "description": "Corridor buffer width in miles (default 25)." }, "venue_type": { "type": "string", "description": "Category such as 'Music venue', 'Bar & pub', or 'Brewery & taproom'." }, "max_capacity": { "type": "number", "description": "Maximum room capacity limit." }, "music_days": { "type": "array", "items": { "type": "string" }, "description": "Filter by usual live music days of the week." } } } } Enter fullscreen mode Exit fullscreen mode 2. get_venue and reveal_venue Retrieves stage dimensions, soundboard specs, past performance history, and direct talent buyer contact details for a specific stage.

Looks up which stages similar touring bands have played along the same geographic corridor.

Claude Desktop connects to remote Streamable HTTP MCP servers using the local mcp-remote bridge or direct HTTP server blocks in your configuration file.

{ "mcpServers": { "venue-router": { "command": "npx", "args": [ "-y", "mcp-remote", "https://api.example.com/mcp" ] } } } Enter fullscreen mode Exit fullscreen mode Restart Claude Desktop. The hammer icon appears in the bottom right corner of the prompt box. You can now prompt Claude:

"Plan a 4-city tour starting in Seattle, WA and driving through Spokane, WA, Missoula, MT, and Bozeman, MT. Find rooms under 300 capacity that host live music on Thursday, Friday, and Saturday nights."

Claude invokes search_venues with the ordered stop list, maps the road corridor, and outputs a daily routing schedule with matching venues.

OpenAI supports external tools through Custom GPT Actions and the OpenAI Apps SDK.

Google Gemini models connect to MCP endpoints through the Gemini Python SDK using custom tool wrappers.

Here is a complete Python script showing how to wrap the Streamable HTTP MCP server into Gemini function declarations:

import os import requests import google.generativeai as genai genai. configure ( api_key = os. environ [ " GEMINI_API_KEY " ]) def query_mcp_tool ( tool_name: str, arguments: dict ) -> dict: url = " https://api.example.com/mcp " headers = { " Content-Type ": " application/json ", " Authorization ": f " Bearer { os. environ. get ( ' MCP_BEARER_TOKEN ', '' ) } " } payload = { " jsonrpc ": " 2.0 ", " id ": 1, " method ": " tools/call ", " params ": { " name ": tool_name, " arguments ": arguments } } response = requests. post ( url, json = payload, headers = headers, timeout = 15 ) response. raise_for_status () return response. json (). get ( " result ", {}) def search_venues_along_tour ( stops: list [ str ], within_miles: int = 25 ) -> dict: """ Search music venues along a multi-stop highway corridor. """ return query_mcp_tool ( " search_venues ", { " stops ": stops, " within_miles ": within_miles }) model = genai. GenerativeModel ( model_name = " gemini-1.5-pro ", tools = [ search_venues_along_tour ] ) chat = model. start_chat ( enable_automatic_function_calling = True ) response = chat. send_message ( " Find venues along Interstate 90 from Seattle to Bozeman with stops in Spokane and Missoula.

" ) print ( response. text ) Enter fullscreen mode Exit fullscreen mode Gemini examines the tool schema, detects the multi-stop highway intent, calls search_venues_along_tour, and formats the final tour itinerary.

When building autonomous tour-booking agents, account for these real-world data constraints:

Stateless Streamable HTTP provides a robust, fast foundation for Model Context Protocol servers. By pairing OAuth 2.1 authentication with clean JSON-RPC tool definitions, you can expose rich geographic and business data to Claude Desktop, ChatGPT, and Google Gemini simultaneously. Musicians save days of manual searching, and agents deliver structured tour itineraries ready for direct booking outreach.

AI agents wrote this post and checked its facts against our own listings and sources.

Quelle: dev.to (dev.to). Original öffnen