NAME
demo - tiny cli served as MCP over Streamable HTTP
SYNOPSIS
demo
DESCRIPTION
demo over the Streamable HTTP transport (2025-03-26 MCP spec), the current remote transport. The same urfave/cli tree as the stdio serve example, but listening on a TCP socket and accepting JSON-RPC over HTTP POST instead of pipes.
How the HTTP transport differs from stdio:
- The binary binds 127.0.0.1:8080 by default (override with
ADDR env var). Front with a reverse proxy for any production
exposure; see deploy/Caddyfile.example for a real-world
Caddy-in-front shape.
- Clients POST JSON-RPC to /mcp with the Accept header set to
both application/json and text/event-stream. The server picks
the response shape based on whether the request is a single
call (JSON) or wants streaming (SSE).
- The deprecated HTTP+SSE bidirectional transport is reachable
via the SDK but not surfaced here. New integrations use
Streamable HTTP.
Operating model for an agent calling these tools over HTTP:
- Idempotent reads can POST and read the JSON response. No
session state required for a single call.
- For streamable tool calls (long-running), include
Accept: text/event-stream and read the SSE frames.
- Use mcporter to abstract the transport choice; the
baseUrl in mcporter.json switches transport without
changing call sites.
When to reach for HTTP vs stdio: stdio for editor/agent integrations on the same host, HTTP for hosted demos (like cli-mcp-go-ecosystem on fly.io) and for any cross-host call.
Usage:
demo [GLOBAL OPTIONS] [command [COMMAND OPTIONS]] [ARGUMENTS...]
COMMANDS
hello
print a greeting
--loud: shout the greeting