Skip to content

fix(tray): path-escape server names in tray API requests - #1752

Merged
Dumbris merged 1 commit into
smart-mcp-proxy:mainfrom
rudycelekli:fix/tray-escape-20261023-01
Oct 26, 2026
Merged

Dumbris merged 1 commit into
smart-mcp-proxy:mainfrom
rudycelekli:fix/tray-escape-20261023-01

Conversation

@rudycelekli

Copy link
Copy Markdown
Contributor

Pull Request

Description

Same class as MCP-1118, on the tray side. The core decodes a %2F-encoded {id} on /api/v1/servers/{id}/*, but cmd/mcpproxy-tray/internal/api/client.go builds its per-server endpoints with a raw fmt.Sprintf("/api/v1/servers/%s/...", serverName). For an official-registry server (io.github.owner/repo) the slash splits the name across path segments, so the request hits a different route.

Trigger. Reachable from the tray menu: Enable / Disable (EnableServer), Quarantine (QuarantineServer) and Sign in (TriggerOAuthLogin) via internal/tray/managers.go and internal/tray/tray.go:1907 → api.ServerAdapter. RestartServer and GetServerTools use the same shape and are fixed in the same way.

buildURL keeps the escape: url.Parse records it in RawPath and ResolveReference goes through EscapedPath, so %2F reaches the wire. The test checks this end to end.

Testing

  • I have tested these changes locally
  • I have added/updated tests that prove my fix is effective or my feature works
  • All existing tests pass

TestClientServerActions_EscapeSlashServerName (cmd/mcpproxy-tray/internal/api/server_path_escape_test.go) calls all six methods against an httptest server and checks r.URL.EscapedPath().

go test ./cmd/mcpproxy-tray/internal/api -count=1                                      # ok
# with client.go reverted:
go test ./cmd/mcpproxy-tray/internal/api -run TestClientServerActions -count=1         # FAIL, 6 of 6
   enable: request path = "/api/v1/servers/io.github.owner/repo/enable", want ".../io.github.owner%2Frepo/enable"
gofmt -l cmd/mcpproxy-tray/internal/api                                                # clean

(Run with SDKROOT=.../MacOSX26.5.sdk because my local Command Line Tools linker cannot read the 27.0 SDK stubs; unrelated to this change.)

Co-authored-by: Cursor <cursoragent@cursor.com>
@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@Dumbris Dumbris left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Verified: the PR test fails on main for the reason described and passes on this branch merged with main; race tests for the touched packages and CI lint (bare and server tags) are clean. Also built and tested together with the rest of this batch, independently reviewed, and cross-reviewed with a second model.

@Dumbris
Dumbris merged commit e9181a1 into smart-mcp-proxy:main Oct 26, 2026
46 checks passed
@Dumbris

Dumbris commented Oct 26, 2026

Copy link
Copy Markdown
Member

Merged. Thank you, @rudycelekli! Tray Enable/Disable/Quarantine/Sign in now work for namespace/name servers.

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