Skip to main content

Google Gemini CLI (MCP)

Learn how to connect SQAI Suite to the Gemini CLI using the Model Context Protocol (MCP). This guide covers the configuration of the Gemini CLI settings file and the use of environment variables for secure authentication.

Updated this week

The SQAI Suite MCP (Model Context Protocol) server acts as a centralized intelligence layer for your development environment. It maintains a real-time, structured understanding of your code, user stories, and test management tools, allowing the Gemini CLI to provide context-aware responses and automation directly from your terminal.

Added Value: A Context-Aware Bridge

By connecting the SQAI MCP to the Gemini CLI, you bridge the gap between your command-line interface and your broader project data:

  • Unified Intelligence: Connects code repositories, user stories, and documentation so Gemini understands the relationship between different project artifacts.

  • Automated Traceability: Perform tasks like automated test generation or impact analysis directly via terminal commands.

  • Continuous Updates: As you update your code or project requirements, the MCP keeps the system model current, ensuring your CLI assistant always has the latest context.


1. Generate Your API Key

You need an authentication key to securely connect the Gemini CLI to the SQAI Platform.

  1. Log in to the SQAI Platform.

  2. Go to the MCP Configuration page: app.sqai-suite.com/mcp.

  3. Generate and copy your unique API Key.


2. Setup Instructions

The Gemini CLI is configured via a global settings.json file.

2.1 Set the Environment Variable

For security, the Gemini CLI configuration uses an environment variable to pull your API key rather than storing it in plain text.

  1. Open your terminal profile file (e.g., .bashrc, .zshrc, or environment variables in Windows).

  2. Add the following line, replacing your_key_here with the key from Step 1:

    • export SQAI_MCP_API_KEY="your_key_here"

  3. Restart your terminal or run source ~/.zshrc (or equivalent) to apply the change.

2.2 Configure the Settings File

  1. Open or create the file located at ~/.gemini/settings.json.

  2. Add the following configuration block:

JSON

    "mcpServers": {
"SQAI-Suite": {
"type": "http",
"httpUrl": "https://api.sqai-suite.com/mcp",
"headers": {
"Authorization": "$SQAI_MCP_API_KEY"
}
}
}

3. How to Use

  1. Verify the Connection: Run the Gemini CLI and ask it to list its available tools.

  2. Interact: You can now query your SQAI data directly.

    • Example: gemini "Use SQAI tools to find the user story for feature X and suggest three edge-case test cases."

  3. Autonomous Execution: The CLI will recognize the SQAI-Suite server and invoke the necessary tools (like get-work-item or create-test-case) based on your prompt.


Troubleshooting

Issue

Potential Cause

Solution

Server not recognized

JSON syntax error.

Ensure the mcpServers block is correctly placed within the root of your settings.json. Check for trailing commas.

Authentication Error

Missing Env Var.

Ensure SQAI_MCP_API_KEY is exported in the current terminal session. Run echo $SQAI_MCP_API_KEY to verify it returns your key.

Connection failed

Network restrictions.

Verify that your terminal has access to https://api.sqai-suite.com/mcp.

Tools not appearing

Version mismatch.

Ensure you are using a version of the Gemini CLI that supports the Model Context Protocol.

Did this answer your question?