🐞 Bug Summary
When a virtual server is set to visibility=team (or private) and oauth_enabled=true, the MCP endpoint tells the client to fetch OAuth protected resource metadata using the resource_metadata value in the WWW-Authenticate header.
But when the client tries to fetch that metadata URL, Context Forge returns 404 Server not found unless the virtual server is public.
This seems to break the normal OAuth discovery flow for clients that rely on RFC 9728 / MCP OAuth discovery, because the server advertises a metadata URL that is not actually reachable for team/private servers.
🧩 Affected Component
🔁 Steps to Reproduce
- Create a virtual server with:
visibility=team
enabled=true
oauth_enabled=true
- valid
oauth_config.authorization_servers
- Access the MCP endpoint without authentication:
GET /servers/{server_id}/mcp
- Observe the response:
401 Unauthorized
WWW-Authenticate: Bearer resource_metadata="https://<host>/.well-known/oauth-protected-resource/servers/{server_id}/mcp"
- Fetch that
resource_metadata URL
- Observe that it returns:
- Change the same virtual server to
visibility=public
- Fetch the same metadata URL again
- Observe that it now works
🤔 Expected Behavior
If a virtual server is oauth_enabled=true and the MCP endpoint advertises a resource_metadata URL, that metadata URL should be reachable even for team or private servers.
The metadata response should only expose the OAuth discovery information needed by the client, for example:
resource
authorization_servers
- supported scopes / bearer methods
It should not make the server, tools, prompts, or resources public.
The actual MCP endpoint (/servers/{server_id}/mcp) should still continue to enforce:
- OAuth authentication
- normal user/team/private authorization rules
📓 Actual Behavior
Right now, the OAuth-enabled team/private virtual server advertises a resource_metadata URL, but that URL returns 404 because the metadata endpoint only allows public servers.
So from the client point of view:
- the server says “use this metadata URL to discover OAuth”
- but the metadata URL is not accessible
This makes the OAuth discovery flow fail for team/private virtual servers.
📓 Logs / Error Output
Example pattern:
401 Unauthorized
WWW-Authenticate: Bearer resource_metadata="https://<host>/.well-known/oauth-protected-resource/servers/<server_id>/mcp"
- Metadata request returns:
🧠 Environment Info
| Key |
Value |
| Version or commit |
ghcr.io/ibm/mcp-context-forge:v1.0.0-RC-3 |
| Runtime |
Docker |
| Platform / OS |
Linux |
| Container |
Docker |
🧩 Additional Context
🐞 Bug Summary
When a virtual server is set to
visibility=team(or private) andoauth_enabled=true, the MCP endpoint tells the client to fetch OAuth protected resource metadata using theresource_metadatavalue in theWWW-Authenticateheader.But when the client tries to fetch that metadata URL, Context Forge returns 404 Server not found unless the virtual server is public.
This seems to break the normal OAuth discovery flow for clients that rely on RFC 9728 / MCP OAuth discovery, because the server advertises a metadata URL that is not actually reachable for team/private servers.
🧩 Affected Component
mcpgateway- API🔁 Steps to Reproduce
visibility=teamenabled=trueoauth_enabled=trueoauth_config.authorization_serversGET /servers/{server_id}/mcp401 UnauthorizedWWW-Authenticate: Bearer resource_metadata="https://<host>/.well-known/oauth-protected-resource/servers/{server_id}/mcp"resource_metadataURL404 Server not foundvisibility=public🤔 Expected Behavior
If a virtual server is
oauth_enabled=trueand the MCP endpoint advertises aresource_metadataURL, that metadata URL should be reachable even forteamorprivateservers.The metadata response should only expose the OAuth discovery information needed by the client, for example:
resourceauthorization_serversIt should not make the server, tools, prompts, or resources public.
The actual MCP endpoint (
/servers/{server_id}/mcp) should still continue to enforce:📓 Actual Behavior
Right now, the OAuth-enabled team/private virtual server advertises a
resource_metadataURL, but that URL returns 404 because the metadata endpoint only allows public servers.So from the client point of view:
This makes the OAuth discovery flow fail for team/private virtual servers.
📓 Logs / Error Output
Example pattern:
404 Server not found🧠 Environment Info
ghcr.io/ibm/mcp-context-forge:v1.0.0-RC-3🧩 Additional Context