Skip to content

Invoke MCP gateway /close endpoint before kill in stop script#9522

Merged
pelikhan merged 4 commits into
mainfrom
copilot/update-close-gateway-script
Jan 10, 2026
Merged

Invoke MCP gateway /close endpoint before kill in stop script#9522
pelikhan merged 4 commits into
mainfrom
copilot/update-close-gateway-script

Conversation

Copilot AI commented Jan 10, 2026

Copy link
Copy Markdown
Contributor

The MCP gateway stop script was directly killing the gateway process without attempting graceful shutdown via the /close endpoint specified in MCP Gateway Specification v1.1.0 §5.1.3.

Changes

  • stop_mcp_gateway.sh: Invoke /close endpoint before kill

    • POST to http://localhost:${MCP_GATEWAY_PORT}/close with Authorization header
    • Wait 10 seconds for graceful container termination
    • Fallback to SIGTERM → SIGKILL if endpoint fails or unavailable
  • start_mcp_gateway.sh: Export gateway configuration to step outputs

    • Save gateway-port and gateway-api-key to $GITHUB_OUTPUT
    • Enable stop step to authenticate and invoke close endpoint
  • Compiler: Wire gateway configuration to stop step

    • Pass MCP_GATEWAY_PORT and MCP_GATEWAY_API_KEY as environment variables
    • Read from start-mcp-gateway step outputs

Behavior

# Stop script now attempts graceful shutdown first
curl -X POST -H "Authorization: ${API_KEY}" http://localhost:${PORT}/close
# Gateway terminates containers, cleans up resources, exits gracefully
# Only falls back to kill if endpoint unreachable or times out

Per spec, the /close endpoint stops accepting requests, completes in-flight operations, terminates containers (SIGTERM → SIGKILL), and exits cleanly.

Original prompt

Update close MCP gateway script to try to invoke the /close endpoint before issuing a kill message.

See MCP gateway specification


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 3 commits January 10, 2026 17:07
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Update close MCP gateway script to invoke /close endpoint first Invoke MCP gateway /close endpoint before kill in stop script Jan 10, 2026
Copilot AI requested a review from pelikhan January 10, 2026 17:22
@pelikhan pelikhan added the smoke label Jan 10, 2026
@github-actions

github-actions Bot commented Jan 10, 2026

Copy link
Copy Markdown
Contributor

🌑 The shadows whisper... Smoke Codex failed. The oracle requires further meditation...

@github-actions

github-actions Bot commented Jan 10, 2026

Copy link
Copy Markdown
Contributor

💫 TO BE CONTINUED... Smoke Claude failed! Our hero faces unexpected challenges...

@github-actions

github-actions Bot commented Jan 10, 2026

Copy link
Copy Markdown
Contributor

💀 Blimey! Changeset Generator failed and walked the plank! No treasure today, matey! ☠️

@github-actions

github-actions Bot commented Jan 10, 2026

Copy link
Copy Markdown
Contributor

📰 DEVELOPING STORY: Smoke Copilot reports failed. Our correspondents are investigating the incident...

@pelikhan pelikhan marked this pull request as ready for review January 10, 2026 17:25
@pelikhan pelikhan merged commit 4e2b043 into main Jan 10, 2026
145 of 149 checks passed
@pelikhan pelikhan deleted the copilot/update-close-gateway-script branch January 10, 2026 17:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants