Skip to content

Add --transport flag to support SSE in addition to stdio #9

@Bortlesboat

Description

@Bortlesboat

What

The CLI currently only supports stdio transport (the default for MCP). Add a --transport flag that lets users choose between stdio (default) and sse (Server-Sent Events over HTTP).

Why

SSE transport is useful for:

  • Web-based MCP clients that cannot use stdio
  • Running bitcoin-mcp as a persistent HTTP service behind a reverse proxy
  • Development/debugging (you can curl the SSE endpoint directly)

The mcp library already supports SSE — this is just wiring up the CLI flag.

Where to look

  • src/bitcoin_mcp/server.py — the main() function at the bottom (line ~1864)
  • Currently it just calls mcp.run() which defaults to stdio
  • The FastMCP run() method accepts a transport parameter: mcp.run(transport="sse")

Implementation

parser.add_argument(
    "--transport",
    choices=["stdio", "sse"],
    default="stdio",
    help="MCP transport type (default: stdio)",
)
args = parser.parse_args()
mcp.run(transport=args.transport)

Acceptance criteria

  • bitcoin-mcp --transport stdio works (current default behavior)
  • bitcoin-mcp --transport sse starts an SSE server
  • bitcoin-mcp with no flag defaults to stdio (no breaking change)
  • Add a test in the existing TestCLI class that verifies --transport is accepted
  • Update README "Configuration" section to mention the flag

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions