Create
Create
Gemini CLI
Connect Gemini CLI to a Webex MCP server.
Before configuring, you'll need OAuth 2.0 credentials. See OAuth 2.0 setup instructions in the main guide.
anchorOAuth 2.0
anchorTo configure OAuth for an MCP server in the Gemini CLI, edit the ~/.gemini/settings.json file, then use the /mcp auth command in the CLI to complete authentication through a web browser.
1. Add the MCP server configuration to settings.json
Open or create your Gemini CLI configuration file at ~/.gemini/settings.json. Add an entry in the mcpServers block for your server:
{
"mcpServers": {
"<server-name>": {
"url": "<MCP_SERVER_URL>",
"oauth": {
"enabled": true,
"clientId": "YOUR_CLIENT_ID",
"clientSecret": "YOUR_CLIENT_SECRET",
"authorizationUrl": "https://webexapis.com/v1/authorize",
"tokenUrl": "https://webexapis.com/v1/access_token",
"scopes": ["spark:mcp", "required_scope_1", "required_scope_2"]
}
}
}
}
enabled— Set totrueto enable OAuth for the serverclientIdandclientSecret— Your OAuth 2.0 client credentials from the Webex IntegrationauthorizationUrlandtokenUrl— The endpoints for the OAuth flowscopes— An array of required OAuth scopes
2. Authenticate within the Gemini CLI
After saving the settings.json file, restart the Gemini CLI and authenticate the server:
- Run
geminito start the CLI session - Initiate the authentication flow:
/mcp auth <server-name>
This will open a browser window for you to sign in and grant access. The Gemini CLI stores the access and refresh tokens locally in ~/.gemini/mcp-oauth-tokens.json for future use.