Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 6, 2026

The MCP gateway already implements resource listing and reading (lines 796-814 in pkg/awmg/gateway.go), but lacked tests validating this functionality.

Changes

Enhanced test mock server (gateway_streamable_http_test.go):

  • Added resources/list and resources/read method handlers
  • Updated server capabilities to advertise resource support

Added resource operation tests to three existing test functions:

  • TestStreamableHTTPTransport_GatewayConnection - validates resources from real backend
  • TestStreamableHTTPTransport_GoSDKClient - validates mock server resource handling
  • TestStreamableHTTPTransport_GatewayWithSDKClient - validates end-to-end proxy behavior

Test Coverage

Tests validate:

  • Resource listing from backend MCP servers
  • Resource reading via gateway proxy
  • Metadata preservation (URI, name, description, MIME type)
  • Content transmission (text field)
  • Proper forwarding of operations to backends

Example test pattern:

// List resources from backend
resourcesResult, err := session.ListResources(ctx, &mcp.ListResourcesParams{})

// Read a specific resource
readResult, err := session.ReadResource(ctx, &mcp.ReadResourceParams{
    URI: "file:///test/resource.txt",
})

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/user
    • Triggering command: /usr/bin/gh gh api user --jq .login -json GO111MODULE ux-amd64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE rg/[email protected] GOINSECURE GOMOD GOMODCACHE go (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

Add support for resources in gateway.go


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

Copilot AI changed the title [WIP] Add support for resources in gateway.go Add resource operation tests for MCP gateway Jan 6, 2026
Copilot AI requested a review from pelikhan January 6, 2026 02:25
@pelikhan pelikhan marked this pull request as ready for review January 6, 2026 02:26
@pelikhan
Copy link
Contributor

pelikhan commented Jan 6, 2026

@copilot format, lint go

Copy link
Contributor Author

Copilot AI commented Jan 6, 2026

@copilot format, lint go

Done. The code was already properly formatted and passes all lint checks:

  • gofmt - no formatting changes needed
  • go vet - passes
  • golangci-lint - 0 issues
  • make fmt - all files formatted correctly
  • make lint - all validations passed

The file pkg/awmg/gateway_streamable_http_test.go is clean.

@pelikhan pelikhan merged commit 3eed418 into main Jan 6, 2026
210 of 211 checks passed
@pelikhan pelikhan deleted the copilot/add-support-for-resources branch January 6, 2026 02:37
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.

2 participants