Skip to content

Implement streamable-http protocol support for awmg CLI#7427

Merged
pelikhan merged 4 commits intomainfrom
copilot/implement-streamable-http-protocol
Dec 23, 2025
Merged

Implement streamable-http protocol support for awmg CLI#7427
pelikhan merged 4 commits intomainfrom
copilot/implement-streamable-http-protocol

Conversation

Copy link
Contributor

Copilot AI commented Dec 23, 2025

  • Implement streamable-http protocol support for MCP servers with URL configuration
  • Replace the "HTTP transport not yet supported" error with actual StreamableClientTransport usage
  • Update the createMCPSession function to use mcp.StreamableClientTransport for URL-based servers
  • Update documentation to reflect the new capability
  • Run make agent-finish for validation (all tests pass)
  • Run code review (only minor nitpicks about existing code patterns)
  • Run codeql_checker (no security vulnerabilities)
  • Move mcp_gateway_command.go to pkg/awmg package per @pelikhan request
  • Add integration tests using go-sdk StreamableClientTransport

Summary

This PR implements streamable-http protocol support for the awmg (mcp-gateway) CLI using the go MCP SDK's StreamableClientTransport. Previously, the gateway returned an error for HTTP/URL-based servers. Now, it properly connects using the streamable HTTP transport which supports:

  • HTTP POST for sending messages
  • JSON or SSE responses
  • Automatic session management
  • Automatic reconnection with exponential backoff

Additionally, the gateway code has been moved to a dedicated pkg/awmg package for better organization.

New Integration Tests

Added integration tests for the streamable HTTP transport in pkg/awmg/gateway_streamable_http_test.go:

  • TestStreamableHTTPTransport_GoSDKClient: Tests the go-sdk StreamableClientTransport with a mock MCP server and verifies tool listing
  • TestStreamableHTTPTransport_URLConfigured: Verifies createMCPSession uses StreamableClientTransport for URL-configured servers
  • TestStreamableHTTPTransport_MCPInspect: Tests mcp inspect command with HTTP-based MCP configuration
  • TestStreamableHTTPTransport_GatewayConnection: End-to-end test of gateway connection via HTTP POST
Original prompt

Implement streamable-http protocol for the awmg (mcp-gateway) CLI to support MCP streamable-http using the go MCP SDK: https://github.com/modelcontextprotocol/go-sdk. Read the document carefully to figure out how to directly use the SDK To support it.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

- Add StreamableClientTransport usage for URL-based MCP servers
- Replace "HTTP transport not yet supported" with actual implementation
- Update documentation to reflect new transport support

Co-authored-by: Mossaka <5447827+Mossaka@users.noreply.github.com>
Copilot AI changed the title [WIP] Add streamable-http protocol support to awmg CLI Implement streamable-http protocol support for awmg CLI Dec 23, 2025
Copilot AI requested a review from Mossaka December 23, 2025 19:40
@@ -504,10 +504,37 @@ func (g *MCPGatewayServer) createMCPSession(serverName string, config MCPServerC

// Handle different server types
if config.URL != "" {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot move current file to awmg package

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved the gateway code to pkg/awmg package in commit 7a7d8d7. The package now contains:

  • gateway.go - main gateway implementation with streamable HTTP support
  • gateway_test.go - unit tests
  • gateway_rewrite_test.go - config rewrite tests
  • gateway_integration_test.go - integration tests
  • gateway_inspect_integration_test.go - inspect integration tests

Updated cmd/awmg/main.go to import from github.com/githubnext/gh-aw/pkg/awmg.

@pelikhan
Copy link
Contributor

@copilot add integration test using MCP inspect or go-MCP sdk

- Create new pkg/awmg package for gateway functionality
- Move gateway command, config types, and tests to pkg/awmg
- Update cmd/awmg/main.go to use the new package
- Add SetVersionInfo and GetVersion to awmg package

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
- Add TestStreamableHTTPTransport_GoSDKClient: Tests connecting to a mock
  MCP server using StreamableClientTransport and verifying tool listing
- Add TestStreamableHTTPTransport_URLConfigured: Verifies createMCPSession
  uses StreamableClientTransport for URL-configured servers
- Add TestStreamableHTTPTransport_MCPInspect: Tests mcp inspect command
  with HTTP-based MCP server configuration
- Add TestStreamableHTTPTransport_GatewayConnection: Tests end-to-end
  gateway connection with MCP endpoint via HTTP POST

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Dec 23, 2025

@copilot add integration test using MCP inspect or go-MCP sdk

Added integration tests for streamable HTTP transport in commit 35fd734:

  • TestStreamableHTTPTransport_GoSDKClient: Uses go-sdk StreamableClientTransport to connect to a mock MCP server and verify tool listing
  • TestStreamableHTTPTransport_URLConfigured: Verifies createMCPSession uses StreamableClientTransport for URL-configured servers
  • TestStreamableHTTPTransport_MCPInspect: Tests mcp inspect command with HTTP-based MCP configuration
  • TestStreamableHTTPTransport_GatewayConnection: End-to-end test of gateway connection via HTTP POST

All tests are in pkg/awmg/gateway_streamable_http_test.go with the //go:build integration tag.

@pelikhan pelikhan marked this pull request as ready for review December 23, 2025 20:59
@pelikhan pelikhan merged commit b888dea into main Dec 23, 2025
4 checks passed
@pelikhan pelikhan deleted the copilot/implement-streamable-http-protocol branch December 23, 2025 21:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants