Bring Your Own Agent
Connect your own agent to a Dexter account. The owner reviews its request in Dexter Wallet and chooses the permissions it receives. The agent gets a token for that connection and can inspect its approved spending limits with @dexterai/connect.
This guide uses a Node process running on the same computer as the owner's browser. It completes OAuth with a local callback, then prints the grant's status. For an existing client such as Claude or Cursor, use OpenDexter setup. See the Connect overview for account sign-in and owner wallet integrations.
Install
Use Node.js 20 or newer and an existing Dexter Wallet.
Complete the Connection
Save this as connect-agent.mjs. It registers a public OAuth client, opens a local callback listener, and prints the authorization URL. PKCE binds the returned code to this process; the callback also checks the request's state.
Run it:
Open the printed URL on the same computer. Dexter displays the requesting client and asks the owner to select their wallet. Review the permissions, set the spending limits you want, and approve. The browser returns to the local callback; your terminal prints the grant status.
Use the Approved Grant
A connection with active payment authority reports active: true and mode: "bounded_payment_authority". remaining contains the per-call, daily, and aggregate limits and usage. USDC amounts have six decimal places: 1000000 represents 1 USDC.
Keep the returned tokens in your agent's credential store and send its access token as a Bearer token when connecting to https://open.dexter.cash/mcp. The example keeps them in memory and exits after reading the grant. Keep tokens out of model prompts, logs, and checked-in files.
Your agent can then use OpenDexter's tools. The service checks each requested action against the owner's grant. A completed sign-in can also have active: false; use the returned mode and inactiveReason to decide whether another owner approval is needed before a paid action.
When the access token expires, refresh through the same token endpoint using grant_type: 'refresh_token', the returned refresh_token, and the same client_id. Replace the stored access token with the response. A refused or revoked refresh requires a new owner connection.
If Connection Stops
Keep the script running while approving; its callback belongs to that process. An expired request needs a new run. If the browser is on another computer, the local callback cannot reach the waiting agent. Use an OAuth client integration with an approved hosted callback for that deployment.
The owner can manage the connected agent and its permissions. Closing this example process ends its local session; removing the agent's authority is a separate owner action.
Last Updated: