You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Per @rumpl's review feedback on #2925: the LLM has no agency over the
OAuth flow — it can't trigger it, grant it, or recover from it. Every
OAuth-related string the catalog exposes to the model is a leaky
abstraction, and the original bug (model stops and asks the user to
repeat themselves after enabling an OAuth-protected server) is a direct
consequence of leaking 'auth: OAuth — elicited on the next turn' in
the enable result.
This commit removes OAuth as a model-visible concept from every
LLM-facing string in the catalog:
- handleEnable: drop the per-auth-type switch. The success message
is now a single line saying 'tools will appear on your next turn,
proceed with the user's original request'. The only conditional
emission is the WARNING for unresolved env vars, which is the one
case the model has actual agency over (it can ask the user to set
the variable and retry).
- Instructions() workflow: step 2 drops the 'Authentication (OAuth
or API key) is deferred' sentence; step 3 drops 'do not narrate
the OAuth flow' (the model no longer learns OAuth exists, so the
instruction can shrink to 'do not narrate connection setup');
step 5 reframes reset_remote_mcp_server_auth as 'if a previously
enabled server starts rejecting requests, clear any persisted
credentials' without mentioning OAuth tokens or authorization
URLs.
- Tool descriptions: enable_remote_mcp_server no longer mentions
'OAuth flow or API-key check'; reset_remote_mcp_server_auth no
longer mentions 'OAuth credentials' or 'fresh authorization
flow'.
- ResetAuthArgs jsonschema and handleResetAuth result strings: drop
every 'OAuth credentials' and 'fresh authorization flow'
reference.
Internal field names (oauthSuccessHandler, managedOAuth, etc.), Go
package-doc comments, and slog debug messages still mention OAuth —
those are developer-facing, not LLM-facing, and removing them would
obscure intent for anyone reading the package.
Tests updated:
- TestEnableAddsServerAndFiresChangeNotification now asserts the
result does NOT contain 'OAuth' or 'authorization', protecting
against a regression where someone re-adds the leaky wording.
- TestEnableAPIKeyEnvPresent no longer expects 'auth: API key' (the
line is gone); still asserts no WARNING.
- TestResetAuthClearsCredentials and TestResetAuthNoOpForNonOAuth
updated for the new 'cleared credentials' / 'no persisted
credentials' wording.
The unresolved-header WARNING test still passes because the WARNING
branch survived the rewrite under the unified 'len(missing) > 0' check.
Description: "Activate a remote MCP server from the catalog by id. Connection (and any required OAuth flow or API-key check) is deferred until the host next lists the agent's tools.",
313
+
Description: "Activate a remote MCP server from the catalog by id. Connection setup is deferred until the host next enumerates tools; the server's tools become available on the next turn.",
Description: "Clear persisted OAuth credentials (access token, refresh token, dynamic-client-registration data) for a catalog server. The next enable will trigger a fresh authorization flow. No-op for api_key/none servers.",
350
+
Description: "Clear any persisted credentials for a catalog server so the next enable starts a fresh connection. Use when a previously enabled server starts rejecting requests. No-op for servers with no persisted credentials.",
fmt.Fprintf(&msg, "enabled %q (%s) — connection deferred until the host next enumerates tools.\n", id, server.Title)
598
+
fmt.Fprintf(&msg, "enabled %q (%s) — the server's tools will appear on your next turn. Proceed with the user's original request; the host handles any required connection setup.\n", id, server.Title)
604
599
fmt.Fprintf(&msg, "endpoint: %s\n", server.URL)
605
-
switchserver.Auth.Type {
606
-
case"oauth":
607
-
msg.WriteString("auth: OAuth — the host will surface any required authorization (browser redirect or in-app dialog) the first time the server's tools are used, and resume the tool call once access is granted. On your next turn, continue with the user's original request; do not pause to announce the OAuth flow.\n")
608
-
case"api_key":
609
-
iflen(missing) >0 {
610
-
fmt.Fprintf(&msg, "auth: API key — WARNING: the following env vars are NOT set: %s. Set them, then call %s and %s for this id again, otherwise tool calls will fail.\n",
// Only surface unresolved env vars — the model can act on those by
601
+
// asking the user to set the variable and retrying. Every other auth
602
+
// detail (OAuth flow type, redirect URI, token persistence) is the
603
+
// host's concern and is intentionally not exposed to the model; the
604
+
// previous wording leaked "auth: OAuth — elicited on the next turn"
605
+
// and led the model to stop and ask the user to repeat themselves.
606
+
iflen(missing) >0 {
607
+
fmt.Fprintf(&msg, "WARNING: the following env var(s) are NOT set: %s. Ask the user to set them, then call %s and %s for this id again, otherwise tool calls will fail.\n",
0 commit comments