Skip to content

[Bug]: GET /api/v1/servers lists every server to a profile-pinned agent token (#1166 filter only covers legacy allowed_servers) #1682

Closed

Description

@james-crowley

What happened?

A token created with --profile is limited to the profile's servers on the MCP surface, but GET /api/v1/servers returns every configured server to it. The #1166 fix filters through auth.CanEnumerateServer -> AuthContext.CanAccessServer, which only consults AllowedServers. A profile-pinned token takes its scope from the profile, so the REST door does not filter it.

Metadata only (names, protocol, command, URL, non-secret env values, connection state). Secret env values are masked.

Expected behavior

A profile-pinned token sees only the profile's effective servers over REST, the same subset it gets from /mcp/all, upstream_servers list, and a legacy-scoped token. GET /api/v1/servers?profile=<name> already implements that row filter, so the fix may be to apply the token's pinned profile as the implicit profile for non-admin callers.

Steps to reproduce

  1. Configure two stdio servers, a and b.
  2. mcpproxy profile create p --servers a --max-tier read
  3. mcpproxy token create --name t-profile --profile p and mcpproxy token create --name t-legacy --servers a --permissions read
  4. curl -s -H "X-API-Key: <t-profile token>" http://127.0.0.1:8080/api/v1/servers | jq '[.data.servers[].name]' returns ["a","b"] (expected ["a"]).
  5. The same call with the t-legacy token returns ["a"] (correct).
  6. For comparison, upstream_servers with {"operation":"list"} over /mcp using the profile token returns 1 server (correct). Only the REST door disagrees.

Observed on a 12-server config: profile token sees 12, legacy token sees 1, MCP upstream_servers list sees 1.

MCPProxy version

v0.71.1 (personal) linux/amd64 (release binary; sha256 matches checksums.txt)

Operating system

Linux

Relevant logs

None needed.

Additional notes

Pre-submission checklist

  • I searched existing issues and did not find a duplicate
  • I ran mcpproxy doctor and reviewed the output

Activity

  1. added a commit that references this issue on Oct 20, 2026
    d25e92b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions