Skip to content

Socket hang up error when using MCP server: fails on both gpt5_generate and gpt5_messages with https://api.openai.com/v1/responses #1

Description

@beetz12

Body:
I’ve encountered a persistent “socket hang up” error when using the MCP server with GPT-5:

  • OS/Environment: (Mac OS X Sequoia 15.5, Node.js 24.5, Local)
  • Server version: (@dannyboy2042/gpt5-mcp-server npm / git SHA if built from source)
  • OpenAI API: GPT-5 access confirmed, key verified (works fine with direct curl calls)

Steps to Reproduce:

  1. Register the MCP server in Claude Code using the recommended command, supplying my valid API key.
  2. MCP server reports successful registration and shows as connected.
  3. Initiate a search (e.g., text generation or conversation).
  4. Result:
    First tries gpt5_generate → returns:
    https://api.openai.com/v1/responses failed, reason: socket hang up
    
    Falls back to gpt5_messages → same error.

I’ve attached a screenshot showing the error dialog (see below).

Additional Info:

  • Direct curl requests to the same endpoint with the same key work perfectly.
  • The issue occurs immediately after attempting to use the MCP server—but only with the MCP, not with direct OpenAI API use.
  • Confirmed the API key and setup are correct in .env and config.
  • No apparent network/firewall issues (other outbound requests function).
  • MCP server confirms “connected” before making the request.

Screenshots:

Image

Troubleshooting already attempted:

  • Fresh API key
  • Reinstalled/updated server
  • Short and simple prompts for testing

Expected behavior:
MCP server should successfully relay the prompt to GPT-5 and return results, as happens when using curl directly.

Actual behavior:
Fails with “socket hang up” after successful connection and upon first use.

Any ideas or similar experiences? Would appreciate debugging and/or guidance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions