Programmatic Authentication Guide
Overview
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ 1. OAuth Flow │ ──► │ 2. Extract Token│ ──► │ 3. Use in Code │
│ (mcp-remote) │ │ (~/.mcp-auth/) │ │ (Agent SDK) │
└─────────────────┘ └─────────────────┘ └─────────────────┘Prerequisites
Step 1: Authenticate with mcp-remote
Using Claude Desktop or Cursor
Direct Authentication
Step 2: Extract the Token
Token Storage Location
Token File Format
Extract via Command Line
Helper Script
Step 3: Use the Token
Verify with curl
Claude Agent SDK (TypeScript)
Reading Token from File (TypeScript)
Python Example
Token Expiration
Troubleshooting
Error
Cause
Solution
Security Notes
Last updated
Was this helpful?