[Bug]: MCP OAuth ignores the requested scope, so a client asking for orchestration:read is granted operate access#38296

opened2d agobyEe18cheng

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/server

Steps to reproduce

  1. Run the T3 Code server from main (f92c5e8f9) with the MCP server enabled.
  2. Register an MCP client via OAuth dynamic registration and start authorization with only scope=orchestration:read in the authorize request.
  3. On the consent page, approve with the default access.
  4. Exchange the code for a token and look at the scope in the token response.
  5. With that token, call tools/list, then call a tool that changes state (e.g. t3_thread_launch).

Expected behavior

The grant is capped at what the client asked for. A client that requests only orchestration:read gets a read-only token whatever the approver picks: the consent page shows read-only access, tools/list returns only read tools, and write tools are refused.

Actual behavior

The requested scope is never read. The token's scope comes only from the approver's choice (apps/server/src/auth/McpOAuth.ts: the token response uses encodeOAuthScope(mcpClientScopes(pending.access)), and pending.access comes from the consent decision). Approving with the default gives the client operate access: tools/list returns every tool, and t3_thread_launch creates a real thread, though the client asked only to read.

Impact

Minor bug or occasional failure

Version or commit

main @ f92c5e8f9

Environment

macOS 26 (Darwin 25.6), server built from main; MCP client: Python mcp SDK requesting orchestration:read

Logs or stack traces

shell
1

Screenshots, recordings, or supporting files

No response

Workaround

Pick read-only access explicitly on the consent page instead of the default, and/or have the client refuse write tools itself.