Skip to content

KAS (kiro-cli 3.5.0): grant vault refuses the new kiro-path-client key, so remote OAuth MCP servers fail with "could not be read from the secret store" and never get a sign-in banner #39425

Open

Description

@izendejas

Existing issues

  • I searched open issues and this is not already reported.

Related but different: #32715 (Windows read race in the same vault), #24614 (named-server sign-in trigger), #30531.

KiroCrew version

0.12.2. The same _KEY_RE is still on main and v0.13.0-rc.5.

Release channel

Stable

How is it installed?

Desktop app

Platform

macOS (arm64), kiro-cli 3.5.0 (released 2026-11-17)

What is broken

kiro-cli 3.5.0 added a new kind of MCP OAuth secret key, kiro.mcp.<sha256>.kiro-path-client. Kiro Crew's grant vault accepts only client, tokens, verifier and discovery. It refuses the new key, KAS reads the refusal as a failed secret-store read, and the server is reported failed instead of "needs sign-in". Kiro Crew offers sign-in only for failedAuthorization, so no Authorize banner appears and the server's tools never load.

This hits every remote server declared as a plain URL with agent.kas_persist_mcp_sign_in=true (the default):

{ "mcpServers": { "example": { "url": "https://mcp.example.com/mcp" } } }

Steps to reproduce

  1. Install kiro-cli 3.5.0 and use the KAS backend with default settings.
  2. Add a remote OAuth MCP server as a plain { "url": ... } entry, with no oauth.clientId, oauth.redirectUri or oauth.clientMetadataUrl.
  3. Start a new chat whose first message names the server, e.g. sign in to example.

Expected

The server reaches "needs sign-in" and a banner with an Authorize link appears (the named-server trigger from #24614).

Actual

The server is failed with failedAuthorization: false and this message:

The sign-in could not be read from the secret store. It is kept; retry the server when the secret store answers again.

No banner appears and the server has no tools. Retrying gives the same result.

Evidence

Observed (gateway log with agent.log_level=INFO; the default WARNING level hides the refusal)

  • Each new chat logs MCP grant store request refused: key is outside the MCP sign-in namespace three times. This is the only refusal reason in the log.
  • WARNING: MCP servers unusable in this session — failed to start: <server> (The sign-in could not be read from the secret store. ...).
  • From the Connections page: OAuth mint for '<server>' on KAS failed: mint_server_failed.

Kiro Crew 0.12.2 package (kiro_crew/ in the app's backend)

  • acp/kas_secret_storage.py:89: _KEY_RE = re.compile(r"\Akiro\.mcp\.[0-9a-f]{64}\.(client|tokens|verifier|discovery)\Z").
  • acp/kas_secret_storage.py:91: _PERSISTED_KINDS = frozenset({"client", "tokens"}).
  • acp/kas_secret_storage.py:226-227: answer() raises SecretStorageRefused("key is outside the MCP sign-in namespace") for any key that misses _KEY_RE. This covers get, store and delete alike.
  • acp/runtime_host_requests.py:586-589: the refusal is logged only at INFO (MCP grant store request refused: %s) and returned as JSON-RPC error -32000 (_MCP_SECRET_REFUSED, line 72).
  • acp/session_handle_mcp.py:641-642: a server enters _mcp_sign_in_needed only when failedAuthorization is True.
  • acp/session_handle_mcp.py:662-669: a failed server is re-attempted only if is_recoverable_auth_failure(errorMessage) matches (acp/mcp_reattempt.py:43-66, plus acp/transport_errors.py:618-700). From reading those patterns, the secret-store message above matches none of them. I did not run the classifier.
  • acp/session_handle_mcp.py:835-862: _offer_mcp_sign_in starts a sign-in only for servers in both _mcp_sign_in_wanted and _mcp_sign_in_needed. want_mcp_sign_in_named (line 772) is the opt-in trigger from KAS chats offer MCP sign-in for every unsigned server, unprompted, in every chat #24614.

KAS 3.5.0 (node_modules/@kiro/agent/dist/server/acp-server.js in kiro-cli's kas/3.5.0-* directory; minified, line numbers are physical lines)

  • Line 16980: var G0l=["client","kiro-path-client","tokens","verifier","discovery"].
  • Line 16980, CredentialStorageManager: keyPrefix="kiro.mcp", clientKind=S9n(n?.oauth)?"kiro-path-client":"client", keyFor(e){return\${this.keyPrefix}.${this.connectionHash}.${e}`}`.
  • Line 2183: function S9n(t){return t?.redirectUri===void 0&&!sH(t)&&t?.clientMetadataUrl===void 0}, where sH checks for a non-empty oauth.clientId. So any server without clientId, redirectUri or clientMetadataUrl uses the new kind.
  • Line 16980: readStored wraps any secretStorage.get error in SecretReadError (dJ).
  • Line 16982: loadStoredClient() calls loadClientRegistration() (the kiro-path-client key) first. It calls loadLegacyClientRegistration() (the old client key, which Crew accepts) only if the first returns nothing. A refusal throws before the legacy fallback runs.
  • Line 16980: clearLegacyClientRegistration() deletes the old client key when migrating.
  • Line 17063: ZAr ("describeConnectFailure") maps dJ to "The sign-in could not be read from the secret store. ..." and sets failedAuthorization to r==="Unauthorized"||code===401. The dJ message is "The secret store could not be read", so failedAuthorization is false.
  • The other kiro-cli KAS bundles on the same machine (2.36.0, 3.0.0, 3.1.0, 3.2.0, 3.3.0, 3.4.0) contain no kiro-path-client string. The regression starts with 3.5.0.

Second affected key

KAS 3.5.0 line 17984: organization (IdP) sign-in stores its session under kiro.mcp.idp.${sha256(issuer|clientId)}.session. That key also misses _KEY_RE. It is used only when mcp.json has an identityProvider block. I did not test that path.

Why one plain-URL server still works (inference from code reading)

clientInformation() (line 16982) is called only from the MCP SDK's auth() flow (line 2174). That flow runs on a 401, on a 403 insufficient-scope reply, after an authorization callback (finishAuth), or during a token refresh. The transport otherwise only calls tokens(), and Crew accepts tokens keys. So a server whose saved tokens are still valid connects without reading the client registration. It should break at its first refresh or 401. I have not seen that happen yet.

Workarounds

  • Set agent.kas_persist_mcp_sign_in=false (observed to work). KAS then keeps sign-ins in memory and does not ask the grant vault. The server reaches "needs sign-in", and the banner appears when the user's message names the server. Sign-ins are lost when the engine exits, so every new chat asks again.
  • Pin kiro-cli to 3.4.0 (its KAS has no kiro-path-client kind) and turn off its auto-update with kiro-cli settings app.disableAutoupdates true.

Small docs note: docs/connections.md:74-81 ("Remote servers that need a sign-in") still says a banner appears on its own. On KAS it appears only when the user's message names the server.

Suggested fix

  1. Accept kiro-path-client in _KEY_RE and add it to _PERSISTED_KINDS. It is the client registration, the same as client.
  2. Accept kiro.mcp.idp.<64 hex>.session for organization sign-in, or document why it is refused.
  3. Log a namespace refusal at WARNING with the refused kind (not the key). It is a version mismatch, not routine traffic.
  4. Answer an unknown kind in a way that lets KAS fall through to "no saved sign-in" (for example, get returns nothing) instead of a JSON-RPC error, so the next unknown kind degrades to a fresh sign-in.

Secondary issue: a server reported failed with a secret-store or other sign-in-related error is never offered sign-in. Treat "sign-in could not be read" as needs-sign-in, or offer a retry or Authorize action on it.

Activity

  1. added
    tier:T1Bug: behaviour does not match intent; fix keeps the design
    on Nov 19, 2026
  2. KiroCrewCaptain commented on Nov 19, 2026

    @KiroCrewCaptain
    Collaborator

    Thanks for the report. This issue has been triaged by Crew Captain and will be assigned to a maintainer, who will follow up here.

  3. swarina commented on Nov 19, 2026

    @swarina
    Contributor

    /claim

    I'll take this one. I reproduced it on main: the grant vault answers a get on kiro.mcp.<hash>.client with an empty result, but refuses kiro.mcp.<hash>.kiro-path-client as outside the MCP sign-in namespace. I'll accept the new kind as a persisted client registration and add a regression test next to the existing vault tests. Sign-in offers for failed servers stay out of this PR.

  4. jose-luis-tomas-garcia commented on Nov 19, 2026

    @jose-luis-tomas-garcia

    Same bug here, one more path to cover in the fix.

    Versions: Kiro Crew 0.13.0 (stable, latest), kiro-cli 3.5.0, KAS relay (kiro-cli acp --agent-engine v3), Linux (WSL). Worked on kiro-cli 3.4.0 the day before.

    Setup: remote n8n MCP server, entry with a flat clientId (public client, no secret).

    Besides the get, the delete during a reset is refused too, so clicking Authorize aborts before any browser page opens:

    "Resetting connection","startOAuth":true,"serverName":"n8n-UAT"
    "[AcpSecretStorage] Failed to delete secret"
    "Failed to connect","serverName":"n8n-UAT","error":"key is outside the MCP sign-in namespace"
    "Reset finished","status":"failed"
    

    The engine's kind list is ["client","kiro-path-client","tokens","verifier","discovery"] and a reset deletes each kind, so _KEY_RE in kiro_crew/acp/kas_secret_storage.py needs to accept kiro-path-client for delete as well as get/store. The bundled engine 0.66.117 has the same kind.

  5. swarina commented on Nov 19, 2026

    @swarina
    Contributor

    Thanks for checking this. #39442 covers the delete too: the vault validates the key the same way for get, store and delete, so a reset can remove kiro-path-client once the key is accepted. I ran all three calls against the branch and they return an empty result with no refusal.

  6. thalisantunes commented on Nov 19, 2026

    @thalisantunes
    Contributor

    Same symptom on Linux, with a different install and a working workaround.

    Environment

    • Kiro Crew 0.13.0 (pipx install, Linux x86_64, Ubuntu with the AppArmor profile installed), run as a systemd service
    • kiro-cli 3.5.0, KAS 0.66.117-node22.23.4, agent.kas_persist_mcp_sign_in=true (default)
    • Signed in with IAM Identity Center (same result with Builder ID)

    What happens
    Clicking Connect on the Atlassian card (https://mcp.atlassian.com/v2/mcp) opens a tab that stays on "Connecting..." forever. Every attempt logs:

    • gateway: OAuth mint for 'atlassian' on KAS failed: mint_server_failed
    • engine mcp.log: [AcpSecretStorage] Failed to retrieve secret, then Failed to connect ... serverName: atlassian, error: The secret store could not be read

    Calling SecretStorageServer.answer("_kiro/secret/get", ...) directly with a well-formed kiro.mcp.<hex>.tokens key works (returns {}), so the grant vault itself is readable. That fits the key-shape refusal described here. I did not capture the exact key the engine sent, so I can't confirm it was kiro-path-client.

    Workaround that worked
    Enabling the Crew-owned OAuth preview made the sign-in complete on the first try:

    kirocrew config set dashboard.feature_previews.crew_oauth true
    

    (Settings → Feature previews.) Atlassian is in DCR_SLUGS, so the gateway runs the OAuth itself and the KAS secret-store path is not used. Might be worth mentioning in the release notes until #39442 ships.

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

    channel: stableReported from a stable releasetier:T1Bug: behaviour does not match intent; fix keeps the design

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions