Skip to content

Session Terminated for OpenAI Responses call #28

@OliverEberlei

Description

@OliverEberlei

Hi, thank you for this project.

I set up a test server, which works great using the inspector.
When I add my own MCP server to an OpenAI responses call, it successfully can get the tool list.
But then the session is terminated before the actual tool call. This results in an mcp_protocol_error on the OpenAI side.

The log from my server also shows that the session is terminated before the actual tool call is received. Here is the log, which shows that the session is deleted before the request is received. I am sure I missed something. Can you point me in the right direction to configure it properly?

[2025-07-07 09:46:52] production.DEBUG: GET SSE stream closed. {"sessionId":"c8d83df5451575b4a64f0aa8a4ea4c49"}
[2025-07-07 09:46:52] production.INFO: Client disconnected {"clientId":"c8d83df5451575b4a64f0aa8a4ea4c49","reason":"Session terminated by DELETE request"}
[2025-07-07 09:46:52] production.INFO: Session deleted {"sessionId":"c8d83df5451575b4a64f0aa8a4ea4c49"}
[2025-07-07 09:46:53] production.DEBUG: Request received {"method":"POST","path":"/mcp","target":"/mcp"}

[2025-07-07 09:46:51] production.INFO: Client connected {"sessionId":"c8d83df5451575b4a64f0aa8a4ea4c49"} [2025-07-07 09:46:51] production.INFO: Session created {"sessionId":"c8d83df5451575b4a64f0aa8a4ea4c49"} [2025-07-07 09:46:51] production.DEBUG: Message received. {"sessionId":"c8d83df5451575b4a64f0aa8a4ea4c49","message":{"PhpMcp\\Schema\\JsonRpc\\Request":{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"protocolVersion":"2025-03-26","capabilities":[],"clientInfo":{"name":"openai-mcp","version":"1.0.0"}}}}} [2025-07-07 09:46:51] production.DEBUG: Response sent. {"sessionId":"c8d83df5451575b4a64f0aa8a4ea4c49","payload":{"PhpMcp\\Schema\\JsonRpc\\Response":{"jsonrpc":"2.0","id":0,"result":{"protocolVersion":"2025-03-26","capabilities":{"logging":{},"completions":{},"prompts":{"listChanged":true},"resources":{"subscribe":true,"listChanged":true},"tools":{"listChanged":true}},"serverInfo":{"name":"Laravel MCP","version":"1.0.0"}}}}} [2025-07-07 09:46:51] production.DEBUG: Request received {"method":"POST","path":"/mcp","target":"/mcp"} [2025-07-07 09:46:51] production.DEBUG: Message received. {"sessionId":"c8d83df5451575b4a64f0aa8a4ea4c49","message":{"PhpMcp\\Schema\\JsonRpc\\Notification":{"jsonrpc":"2.0","method":"notifications/initialized"}}} [2025-07-07 09:46:51] production.DEBUG: Request received {"method":"GET","path":"/mcp","target":"/mcp"} [2025-07-07 09:46:51] production.DEBUG: Request received {"method":"POST","path":"/mcp","target":"/mcp"} [2025-07-07 09:46:51] production.DEBUG: Message received. {"sessionId":"c8d83df5451575b4a64f0aa8a4ea4c49","message":{"PhpMcp\\Schema\\JsonRpc\\Request":{"jsonrpc":"2.0","id":1,"method":"tools/list"}}} [2025-07-07 09:46:51] production.DEBUG: Response sent. {"sessionId":"c8d83df5451575b4a64f0aa8a4ea4c49","payload":{"PhpMcp\\Schema\\JsonRpc\\Response":{"jsonrpc":"2.0","id":1,"result":{"tools":[{"name":"find_shows","inputSchema":{"type":"object","properties":{"bandName":{"type":"string"}},"required":["bandName"]},"description":"Find shows, concercts, and festivals for a band"}]}}}} [2025-07-07 09:46:52] production.DEBUG: Request received {"method":"DELETE","path":"/mcp","target":"/mcp"} [2025-07-07 09:46:52] production.DEBUG: GET SSE stream closed. {"sessionId":"c8d83df5451575b4a64f0aa8a4ea4c49"} [2025-07-07 09:46:52] production.INFO: Client disconnected {"clientId":"c8d83df5451575b4a64f0aa8a4ea4c49","reason":"Session terminated by DELETE request"} [2025-07-07 09:46:52] production.INFO: Session deleted {"sessionId":"c8d83df5451575b4a64f0aa8a4ea4c49"} [2025-07-07 09:46:53] production.DEBUG: Request received {"method":"POST","path":"/mcp","target":"/mcp"} [2025-07-07 09:46:53] production.DEBUG: Message received. {"sessionId":"c8d83df5451575b4a64f0aa8a4ea4c49","message":{"PhpMcp\\Schema\\JsonRpc\\Request":{"jsonrpc":"2.0","id":0,"method":"tools/call","params":{"name":"find_shows","arguments":{"bandName":"Metallica"}}}}} [2025-07-07 09:46:53] production.DEBUG: Response sent. {"sessionId":"c8d83df5451575b4a64f0aa8a4ea4c49","payload":{"PhpMcp\\Schema\\JsonRpc\\Error":{"jsonrpc":"2.0","id":0,"error":{"code":-32600,"message":"Invalid or expired session. Please re-initialize the session."}}},"context":{"is_initialize_request":false,"type":"post_json","pending_request_id":"ad3b5f39fee7c6f758751cfd3047e021","status_code":404}}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions