Skip to content

auth

Class info

Classes

Name Children Inherits
ApprovalRedirect
pyt3client.models.auth
`POST /oauth/mcp/decision` result (upstream `AuthMcpApprovalRedirect`).
    McpTokenResult
    pyt3client.models.auth
    `POST /oauth/mcp/token` result (upstream `AuthMcpTokenResult`).
      OAuthAuthorizationServerMetadata
      pyt3client.models.auth
      `GET /.well-known/oauth-authorization-server`.
        RegisteredClient
        pyt3client.models.auth
        `POST /oauth/mcp/register` result (upstream `AuthMcpRegisteredClient`).
          T3Credentials
          pyt3client.models.auth
          What a successful sign-in yields; persist it to reconnect without pairing again.
            T3NativeCredentials
            pyt3client.models.auth
            A sign-in for T3 Code's native surface: its WebSocket RPC and REST API.

              🛈 DocStrings

              Models for signing in to a T3 Code environment's /mcp endpoint.

              Upstream schemas live in packages/contracts/src/auth.ts (https://github.com/pingdotgg/t3code); names are noted per model.

              InteractionMode

              InteractionMode = Literal['default', 'plan']
              

              Upstream ProviderInteractionMode.

              McpAccess

              McpAccess = Literal['read-only', 'approval-required', 'auto-accept-edits', 'auto', 'full-access']
              

              Access level an outside MCP client is approved at (upstream AuthMcpClientAccess).

              • read-only: read projects, threads, providers and models.
              • approval-required ("Supervised") through full-access: also start, message and stop threads. A thread the client starts or steers can never run with a broader runtime mode than this level.

              A plain pairing code must carry the scopes the level needs (upstream mcpClientScopes): orchestration:read for read-only, plus orchestration:operate for the others, plus settings:write and source-control:write for full-access. The default code from t3 auth pairing create carries all of them.

              RuntimeMode

              RuntimeMode = Literal['approval-required', 'auto-accept-edits', 'auto', 'full-access']
              

              Upstream RuntimeMode (packages/contracts/src/providerPolicy.ts).

              ApprovalRedirect

              Bases: BaseModel

              POST /oauth/mcp/decision result (upstream AuthMcpApprovalRedirect).

              redirect_to is the registered redirect URI carrying code and state, or error and error_description when the approval failed.

              Source code in src/pyt3client/models/auth.py
              72
              73
              74
              75
              76
              77
              78
              79
              class ApprovalRedirect(BaseModel):
                  """`POST /oauth/mcp/decision` result (upstream `AuthMcpApprovalRedirect`).
              
                  `redirect_to` is the registered redirect URI carrying `code` and `state`,
                  or `error` and `error_description` when the approval failed.
                  """
              
                  redirect_to: str = Field(alias="redirectTo")
              

              McpTokenResult

              Bases: BaseModel

              POST /oauth/mcp/token result (upstream AuthMcpTokenResult).

              Source code in src/pyt3client/models/auth.py
              82
              83
              84
              85
              86
              87
              88
              89
              90
              91
              92
              class McpTokenResult(BaseModel):
                  """`POST /oauth/mcp/token` result (upstream `AuthMcpTokenResult`)."""
              
                  model_config = ConfigDict(extra="allow")
              
                  access_token: SecretStr
                  token_type: Literal["Bearer"]
                  expires_in: float
                  """Seconds. Outside MCP clients get a fixed 30 days; their sessions do not renew."""
                  scope: str
                  """Space-separated scopes, such as `orchestration:read orchestration:operate`."""
              

              expires_in instance-attribute

              expires_in: float
              

              Seconds. Outside MCP clients get a fixed 30 days; their sessions do not renew.

              scope instance-attribute

              scope: str
              

              Space-separated scopes, such as orchestration:read orchestration:operate.

              OAuthAuthorizationServerMetadata

              Bases: BaseModel

              GET /.well-known/oauth-authorization-server.

              Upstream AuthMcpAuthorizationServerMetadata.

              Source code in src/pyt3client/models/auth.py
              43
              44
              45
              46
              47
              48
              49
              50
              51
              52
              53
              54
              55
              class OAuthAuthorizationServerMetadata(BaseModel):
                  """`GET /.well-known/oauth-authorization-server`.
              
                  Upstream `AuthMcpAuthorizationServerMetadata`.
                  """
              
                  model_config = ConfigDict(extra="allow")
              
                  issuer: str
                  authorization_endpoint: str
                  token_endpoint: str
                  registration_endpoint: str
                  scopes_supported: list[str]
              

              RegisteredClient

              Bases: BaseModel

              POST /oauth/mcp/register result (upstream AuthMcpRegisteredClient).

              Registration is stateless: client_id is a signed blob of the metadata, so registering costs the server nothing and needs no cleanup.

              Source code in src/pyt3client/models/auth.py
              58
              59
              60
              61
              62
              63
              64
              65
              66
              67
              68
              69
              class RegisteredClient(BaseModel):
                  """`POST /oauth/mcp/register` result (upstream `AuthMcpRegisteredClient`).
              
                  Registration is stateless: `client_id` is a signed blob of the metadata, so
                  registering costs the server nothing and needs no cleanup.
                  """
              
                  model_config = ConfigDict(extra="allow")
              
                  client_id: str
                  client_name: str
                  redirect_uris: list[str]
              

              T3Credentials

              Bases: BaseModel

              What a successful sign-in yields; persist it to reconnect without pairing again.

              The token is an ordinary environment session with subject mcp-client. /mcp is the only endpoint that accepts it: the native WebSocket RPC and REST API reject this subject, because their surface would let the client act above its approved level. Revoke it in T3 Code under Settings -> Sharing & access.

              Source code in src/pyt3client/models/auth.py
               95
               96
               97
               98
               99
              100
              101
              102
              103
              104
              105
              106
              107
              108
              109
              110
              111
              112
              113
              class T3Credentials(BaseModel):
                  """What a successful sign-in yields; persist it to reconnect without pairing again.
              
                  The token is an ordinary environment session with subject `mcp-client`.
                  `/mcp` is the only endpoint that accepts it: the native WebSocket RPC and
                  REST API reject this subject, because their surface would let the client
                  act above its approved level. Revoke it in T3 Code under
                  Settings -> Sharing & access.
                  """
              
                  base_url: str
                  """Environment origin without a trailing slash, such as `http://127.0.0.1:3773`."""
                  environment_id: str
                  """The environment the token belongs to; check it against the descriptor before reuse."""
                  access_token: SecretStr
                  expires_at: datetime
                  scopes: tuple[str, ...]
                  access: McpAccess
                  client_id: str
              

              base_url instance-attribute

              base_url: str
              

              Environment origin without a trailing slash, such as http://127.0.0.1:3773.

              environment_id instance-attribute

              environment_id: str
              

              The environment the token belongs to; check it against the descriptor before reuse.

              T3NativeCredentials

              Bases: BaseModel

              A sign-in for T3 Code's native surface: its WebSocket RPC and REST API.

              That surface is what the web, desktop and mobile clients use. It streams a thread's events as they happen and can answer approvals, which /mcp cannot. It rejects MCP tokens, and /mcp rejects this one, so a client that uses both holds two sign-ins. Obtained by exchanging a one-time pairing token (t3 auth pairing create, or Settings -> Sharing & access) at /oauth/token.

              Source code in src/pyt3client/models/auth.py
              116
              117
              118
              119
              120
              121
              122
              123
              124
              125
              126
              127
              128
              129
              130
              class T3NativeCredentials(BaseModel):
                  """A sign-in for T3 Code's native surface: its WebSocket RPC and REST API.
              
                  That surface is what the web, desktop and mobile clients use. It streams a
                  thread's events as they happen and can answer approvals, which `/mcp` cannot.
                  It rejects MCP tokens, and `/mcp` rejects this one, so a client that uses
                  both holds two sign-ins. Obtained by exchanging a one-time pairing token
                  (`t3 auth pairing create`, or Settings -> Sharing & access) at `/oauth/token`.
                  """
              
                  base_url: str
                  """Environment origin without a trailing slash."""
                  access_token: SecretStr
                  expires_at: datetime
                  scopes: tuple[str, ...]
              

              base_url instance-attribute

              base_url: str
              

              Environment origin without a trailing slash.