Skip to content

waza serve: MCP stdio server doesn't start when stdin is a pipe (Claude Code integration) #307

@watatata

Description

@watatata

Summary

When waza serve is launched by an MCP client (e.g. Claude Code) via stdio, the MCP server never starts because term.IsTerminal(int(os.Stdin.Fd())) returns false for piped stdin. This causes an immediate MCP error -32000: Connection closed on the client side.

Reproduction

  1. Configure ~/.claude.json:
{
  "mcpServers": {
    "waza": {
      "command": "waza",
      "args": ["serve"]
    }
  }
}
  1. Launch Claude Code — waza MCP fails with Connection closed.

  2. Root cause in cmd/waza/cmd_serve.go:

if term.IsTerminal(int(os.Stdin.Fd())) {
    go func() {
        logger.Info("MCP server running on stdio")
        mcp.ServeStdio(ctx, os.Stdin, os.Stdout, logger)
    }()
}

MCP clients communicate over stdio pipes, so IsTerminal is always false — the MCP server is never started.

Proposed Solution

Add an environment variable (e.g. WAZA_MCP_STDIO=1) or a CLI flag (e.g. --mcp-stdio) to bypass the terminal check:

if term.IsTerminal(int(os.Stdin.Fd())) || os.Getenv("WAZA_MCP_STDIO") == "1" {
    go func() {
        logger.Info("MCP server running on stdio")
        mcp.ServeStdio(ctx, os.Stdin, os.Stdout, logger)
    }()
}

This would allow MCP clients like Claude Code, Copilot CLI, and others to use waza serve as an MCP server.

Environment

  • waza v0.33.0
  • macOS (darwin/arm64)
  • Claude Code (MCP client, stdio transport)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions