Harness AI x Gemini CLI Extension
Leverage Gemini CLI with Harness AI MCP Server to unleash your developer workflows.
Harness Model Context Protocol (MCP) integrates seamlessly with Gemini CLI, enabling developers to interact with Harness directly from their terminal. With this extension, you can create pipelines, troubleshoot executions, and manage connectors using natural language prompts. This integration brings the power of Harness into the command line, reducing context switching and accelerating developer workflows.
What you will learn in this topic
By the end of this topic, you will be able to:
Before you begin
Before you install and use the Harness MCP extension with Gemini CLI, ensure you have the following:
Harness MCP Server: Installed and configured. Go to Harness MCP Server for more information on installation.
Gemini CLI: Installed (requires Node.js v18 or later). Go to Gemini CLI for more information on installation.
Harness API key: An active API key with required permissions for your organization and projects.
Docker: Installed and running (required for running the MCP server).
Introduction
Harness MCP with Gemini CLI brings Harness directly into the developer's command line, turning DevOps tasks into natural language conversations. Developers can instantly generate and modify pipelines, analyze failed executions with AI-powered insights, and create or manage connectors without navigating the Harness UI. Teams gain faster feedback loops, reduced context switching, and easier governance by surfacing policy checks and approval flows directly in the CLI. This integration empowers developers to move from idea to deployment in minutes, improving productivity, accelerating time-to-market, and ensuring every action aligns with enterprise standards.
Install the Harness MCP extension
Install the extension directly from the GitHub repository:
Configure Harness access
Export your Harness API key as an environment variable:
Optional environment variables
Configure additional environment variables to set defaults for your Harness instance:
HARNESS_DEFAULT_ORG_ID: Set a default organization ID to scope commands to a specific organization.
HARNESS_DEFAULT_PROJECT_ID: Set a default project ID to scope commands to a specific project.
HARNESS_BASE_URL: Set the Harness instance base URL (defaults to
https://app.harness.io).
Start using Gemini with Harness
Launch Gemini CLI to begin interacting with Harness using natural language:
Example prompts
Use natural language prompts to perform Harness operations directly from the CLI.
Pipeline management
Error analysis
Service discovery
Policy and approvals
How it works
The extension uses Docker to run the Harness MCP server with the following configuration:
Docker image:
harness/mcp-server:latestCommunication: Standard input/output (stdio)
Environment: Inherits your
HARNESS_API_KEYand other Harness environment variablesBase URL: Defaults to
https://app.harness.io
Extension management
Manage your Gemini CLI extensions with these commands.
List installed extensions
Update the extension
Disable the extension
Uninstall the extension
Best practices
Follow these best practices to ensure secure and efficient use of the Harness MCP extension.
Secrets management: Keep all API keys in environment variables. Never hardcode API keys in scripts or configuration files.
Review before applying: Always review generated YAML configurations and pipeline definitions before applying them to your Harness instance.
RBAC enforcement: The Harness MCP enforces Role-Based Access Control (RBAC), so ensure your API key has the correct permissions for the operations you intend to perform.
Scope management: Use organization and project environment variables to set appropriate defaults and reduce the need to specify scope in every command.
Troubleshooting
Next steps
Harness MCP GitHub Repository: Review the MCP server source code and contribute to development.
Gemini CLI Extensions Documentation: Learn more about Gemini CLI capabilities and extension development.
Harness MCP Server: Review advanced MCP configuration and deployment options.
Last updated
Was this helpful?