fix the issue when configuring remote MCP servers, hint for naming#380
Open
fix the issue when configuring remote MCP servers, hint for naming#380
Conversation
…xtract actual errors) Signed-off-by: Peter Jausovec <peter.jausovec@solo.io>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves remote MCP server handling in the local agent-gateway configuration and makes CLI/API client errors more human-readable by extracting meaningful messages from Huma-style JSON error responses.
Changes:
- Switch local agent-gateway config generation for remote MCP servers from
ssetargets tomcptargets (to avoid incorrect TLS-handshake behavior). - Add reverse-DNS “hint” messaging when remote URL hostnames don’t match an invalid/non-reverse-DNS namespace.
- Extract and display server-provided API error messages (instead of dumping raw JSON) and enhance HTTP status parsing.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| internal/registry/validators/validators.go | Improves namespace/remote URL mismatch errors with a reverse-DNS hint helper. |
| internal/registry/platforms/local/deployment_adapter_local_platform.go | Builds remote MCP target URLs and emits mcp targets for remote servers. |
| internal/registry/platforms/local/deployment_adapter_local_platform_test.go | Adds unit tests for remote MCP URL building behavior. |
| internal/client/client.go | Extracts human-readable API error messages and broadens HTTP status detection. |
| internal/client/client_test.go | Adds tests for API error extraction and HTTP status parsing. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+267
to
+280
| func buildRemoteMCPURL(remote *platformtypes.RemoteMCPServer) string { | ||
| scheme := "https" | ||
| host := remote.Host | ||
| port := remote.Port | ||
| path := remote.Path | ||
|
|
||
| if port == 80 { | ||
| scheme = "http" | ||
| } | ||
|
|
||
| portSuffix := "" | ||
| if (scheme == "https" && port != 443) || (scheme == "http" && port != 80) { | ||
| portSuffix = fmt.Sprintf(":%d", port) | ||
| } |
Comment on lines
+277
to
+283
| portSuffix := "" | ||
| if (scheme == "https" && port != 443) || (scheme == "http" && port != 80) { | ||
| portSuffix = fmt.Sprintf(":%d", port) | ||
| } | ||
|
|
||
| return fmt.Sprintf("%s://%s%s%s", scheme, host, portSuffix, path) | ||
| } |
| {"https standard port", &platformtypes.RemoteMCPServer{Host: "example.com", Port: 443, Path: "/mcp"}, "https://example.com/mcp"}, | ||
| {"https custom port", &platformtypes.RemoteMCPServer{Host: "example.com", Port: 8443, Path: "/mcp"}, "https://example.com:8443/mcp"}, | ||
| {"http standard port", &platformtypes.RemoteMCPServer{Host: "example.com", Port: 80, Path: "/sse"}, "http://example.com/sse"}, | ||
| {"http custom port", &platformtypes.RemoteMCPServer{Host: "localhost", Port: 3005, Path: "/mcp/"}, "https://localhost:3005/mcp/"}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
fix the issue when configuring remote MCP servers (use the
mcpinstead ofsseas it tries to do a tls handshake), add a hint for incorrect naming of remote servers + extract the actual errors, instead of showing the JSON.e.g.:
Change Type
Changelog