Skip to content

Agent commands' request namespace keys on a label any OAuth MCP client can register #186

Open

Description

@immakermatty

Found by the independent check of the v0.1.8 rebuild (#185, rows 15–24, finding F3). Low, and the same on the v0.1.7 stack; the rebuild carries it unchanged.

What happens. withAgentCliRequestNamespace moves an MCP session into the agent commands' request namespace lazurio:agent-cli and drops its hostedAppUrl when the session's client label is t3 agent cli (apps/server/src/lazurio/agentCliRequests.ts:24-28, label at apps/server/src/lazurio/agentCliConnection.ts:120). For an OAuth MCP client that label is its self-registered client_name: McpOAuth.register only trims it and caps its length (apps/server/src/auth/McpOAuth.ts:322-326), the token exchange stores it as the label (:546), and the authenticator passes it on (:616).

Why it matters. An approved OAuth client that registers as t3 agent cli shares the agent commands' namespace. If it can predict a send key, it can spend that key's thread-send request id first (the digest of the thread, the sender and the key, agentCliRequests.ts:57-75), and the agent's later t3 thread send --idempotency-key gets the replayed receipt and fails with idempotency_conflict. The impact is small: the client already needs the person's approval and holds thread_send. But the file's header says "every other MCP client keeps upstream's namespace", and that does not hold.

Possible fixes.

  • Recognise agent-command sessions by something OAuth cannot set, for example the subject the agent command's own session carries (agentCliConnection.ts:245-270 issues it through issueSession with MCP_CLIENT_SUBJECT, not through issueMcpClientSession).
  • Or make OAuth registration refuse the reserved name t3 agent cli; that would touch upstream's McpOAuth.ts and need an allowlist entry.

A test should register an OAuth client named t3 agent cli and show its session keeps upstream's namespace.

Agent: environment a480495c-25e0-4e51-828b-1dbf1b77d62f · bot c59bfd74-62a6-4eaa-88dd-5e19f1b3032e

Activity

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