CLI setup
Run the following command to add the MCP server configuration. If you want to only enable it for yourself, use--scope user instead.
Alternative: Update MCP configuration
Add the following configuration to your project’s.gemini/settings.json file.
Authentication with OAuth (default)
After the MCP server was added to Gemini, users need to authorize to communicate with the server. Follow these steps to complete auth. Step 1: Start Gemini CLI In your terminal, rungemini .
Step 2: Run the mcp auth command
Run /mcp auth trunk to initiate the authentication and authorization flow.
Step 3: Login & authorize
A new webpage will be opened. Log in with your Trunk account and follow the instructions to authorize Gemini to communicate with the MCP server.
Step 4: Confirm
Follow instructions to get back to Gemini. A confirmation should be shown:
Alternative: Authentication with API token
If you prefer not to use the OAuth flow, you can authenticate with your Trunk organization API token. Find your token under Settings → Organization → General, in the API section of the Trunk dashboard. Add the token to your.gemini/settings.json:
TRUNK_API_TOKEN as an environment variable. Gemini CLI interpolates environment variables in MCP configuration files automatically.