Skip to content

ChatGPT CLI v1.10.1

Choose a tag to compare

@kardolus kardolus released this 10 Jan 16:00
· 63 commits to main since this release

New Features:

  • MCP over STDIO:
    • Added a new MCP transport that communicates with MCP servers via stdio, enabling invocation of tools from local subprocesses (e.g., Python-based FastMCP).
    • New endpoint format: --mcp "stdio:", for example:
      • --mcp "stdio:python test/mcp/stdio/mcp_stdio_server.py"
    • Code references: api/client/mcp.go (MCPStdioTransport), test/mcp/stdio/*
  • Unified MCP transport factory:
    • Introduced NewMCPTransport, which automatically selects the correct transport based on the endpoint scheme (http/https or stdio).
    • Code reference: api/client/mcp.go

Improvements:

  • Automatic MCP Session Management (HTTP only):
    • The CLI now initializes, caches, attaches, and renews MCP session identifiers for HTTP(S) MCP servers when required.
    • Session logic is bypassed for non-HTTP transports (e.g., stdio).
    • If you provide an explicit mcp-session-id header, the CLI respects it and skips automatic handling.
    • Code references: api/client/mcp.go (SessionTransport), README updates
  • Safer HTTP transport construction:
    • NewMCPHTTPTransport defensively copies headers to avoid unintended side effects from external map mutations.
    • Code reference: api/client/mcp.go
  • Developer UX for local MCP testing:
    • Make targets for local FastMCP servers (mcp-http, mcp-sse) now activate the local Python virtual environment automatically and use the python executable.
    • Code reference: Makefile
  • Documentation:
    • Expanded README with clearer MCP instructions:
      • Provider-agnostic overview
      • Structured flag documentation (--mcp, --mcp-tool, --mcp-header, --mcp-param/--mcp-params)
      • New stdio example
      • Dedicated MCP Session Management section
      • Refined examples and formatting
    • Code reference: README.md

Bug Fixes:

  • Correct session handling for non-HTTP MCP endpoints:
    • Session headers are no longer injected when using non-HTTP schemes (e.g., stdio), preventing invalid header behavior.
    • Code references: api/client/mcp.go (SessionTransport.Call), api/client/mcp_test.go (testSessionTransportNonHTTP)
  • Improved constructor naming and routing:
    • Resolved ambiguity by introducing NewMCPHTTPTransport for HTTP(S) and making NewMCPTransport scheme-aware to return the appropriate transport.
    • Code reference: api/client/mcp.go

Other Changes:

  • Tests:
    • Added tests for the new transport factory and non-HTTP session bypass behavior.
    • Code references: api/client/client_test.go, api/client/mcp_test.go
  • Sample stdio server:
    • Added a minimal FastMCP-based stdio server and requirements for local testing.
    • Code references: test/mcp/stdio/mcp_stdio_server.py, test/mcp/stdio/requirements.txt
  • Dependency updates:
    • golang.org/x/text upgraded to v0.33.0
    • golang.org/x/tools upgraded to v0.40.0
    • Code references: go.mod, go.sum

Upgrade Notes:

  • CLI users:
    • To upgrade, run: brew upgrade chatgpt-cli
    • Alternatively, download the latest binaries for your OS from the releases page and replace your existing executable.
  • Go API consumers:
    • NewMCPTransport now returns the interface MCPTransport and supports both HTTP(S) and stdio schemes.
    • If you specifically need the HTTP transport, use NewMCPHTTPTransport.
    • Session handling is applied only for HTTP(S). For stdio, no headers are injected and sessions are not managed.