Harness MCP Server (Beta)
The Harness Model Context Protocol (MCP) Server (in Beta) enables integration with Harness tools, providing endpoints for pipelines, pull requests, and more. This guide outlines the installation, configuration, and usage of the MCP server.
Introduction
What is MCP?
MCP (Model Context Protocol) is an open standard for AI agents to interact with tools and services using a unified protocol. Instead of building custom adapters or connectors for each tool, MCP provides a consistent interface that allows AI agents to communicate seamlessly with various tools, including Harness services.
In simpler terms: MCP standardizes how AI agents talk to software tools, enabling interoperability without requiring custom code for each integration.
Why MCP?
Harness is building a diverse set of AI agents that need access to platform data and services. Additionally, customers may have their own agents that require interaction with Harness entities to perform specific tasks.
MCP solves this problem by:
- Standardizing communication: A single interface for connecting agents to Harness tools, reducing implementation complexity.
- Supporting external tools: Seamless integration with third-party tools like Windsurf, Cursor, and Claude Desktop, eliminating the need for custom adapters.
- Ensuring consistency: A common interface reduces duplication and potential inconsistencies across different agents and tools.
MCP vs. Tool/Function Calling
Why not just use function calls for each API?
- Limited Support for External Tools: Function calling is often restricted to the model’s internal tools. MCP enables integration with external tools like Windsurf, Cursor, and Claude Desktop.
- Inconsistent Implementations: Without MCP, each agent would need to implement the same logic in different languages/frameworks, increasing the risk of errors.
- Scalability and Reuse: MCP provides a standardized protocol, allowing reusable implementations across various agents and tools.
Requirements
- Harness API Token: Generate one through the Harness UI. Learn more: Manage API Keys
- Go 1.23 or later: Ensure Go is installed on your system.
Video Walkthrough (Installation and Setup)
Configuration
Windsurf Configuration
Using Source
{
"mcpServers": {
"harness": {
"command": "/path/to/harness-mcp-server",
"args": ["stdio"],
"env": {
"HARNESS_API_KEY": "your_api_key",
"HARNESS_DEFAULT_ORG_ID": "your_org_id",
"HARNESS_DEFAULT_PROJECT_ID": "your_project_id",
"HARNESS_BASE_URL": "<if-needed>"
}
}
}
}
Using Docker
{
"mcpServers": {
"harness": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"HARNESS_API_KEY",
"-e",
"HARNESS_DEFAULT_ORG_ID",
"-e",
"HARNESS_DEFAULT_PROJECT_ID",
"-e",
"HARNESS_BASE_URL",
"harness/mcp-server",
"stdio"
],
"env": {
"HARNESS_API_KEY": "<YOUR_API_KEY>",
"HARNESS_DEFAULT_ORG_ID": "<YOUR_ORG_ID>",
"HARNESS_DEFAULT_PROJECT_ID": "<YOUR_PROJECT_ID>",
"HARNESS_BASE_URL": "<YOUR_BASE_URL>"
}
}
}
}
Cursor Configuration
{
"mcpServers": {
"harness": {
"command": "/path/to/harness-mcp-server",
"args": ["stdio"],
"env": {
"HARNESS_API_KEY": "your_api_key",
"HARNESS_DEFAULT_ORG_ID": "your_org_id",
"HARNESS_DEFAULT_PROJECT_ID": "your_project_id",
"HARNESS_BASE_URL": "<if-needed>"
}
}
}
}
VS Code Configuration
{
"mcp": {
"servers": {
"harness": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"YjJmMGNkNDAyOGQ2YWQ4ZjI2MzA4NzMxNTlhOTgyNWQ=",
"-e",
"HARNESS_DEFAULT_ORG_ID",
"-e",
"HARNESS_DEFAULT_PROJECT_ID",
"-e",
"HARNESS_BASE_URL",
"harness/mcp-server",
"stdio"
],
"env": {
"HARNESS_API_KEY": "<YOUR_API_KEY>",
"HARNESS_DEFAULT_ORG_ID": "<YOUR_ORG_ID>",
"HARNESS_DEFAULT_PROJECT_ID": "<YOUR_PROJECT_ID>",
"HARNESS_BASE_URL": "<YOUR_BASE_URL>"
}
}
}
}
}
Using Claude Code
HARNESS_API_KEY=your_api_key \
HARNESS_DEFAULT_ORG_ID=your_org_id \
HARNESS_DEFAULT_PROJECT_ID=your_project_id \
./cmd/harness-mcp-server/harness-mcp-server stdio
Building from Source
- Clone the repository:
git clone https://github.com/harness/mcp-server
cd mcp-server
- Build the binary:
go build -o cmd/harness-mcp-server/harness-mcp-server ./cmd/harness-mcp-server
- Run the server:
HARNESS_API_KEY=your_api_key \
./cmd/harness-mcp-server/harness-mcp-server stdio
Use Docker Image
Alternatively, you can use the pre-built Docker image:
docker run -i --rm \
-e HARNESS_API_KEY=your_api_key \
-e HARNESS_DEFAULT_ORG_ID=your_org_id \
-e HARNESS_DEFAULT_PROJECT_ID=your_project_id \
-e HARNESS_BASE_URL=your_base_url \
harness/mcp-server stdio
Authentication
Set the HARNESS_API_KEY
environment variable for authentication. Learn more: Manage API Keys.
export HARNESS_API_KEY=<your_api_key>
Command Line Arguments
Please refer to the Harness MCP Server Command Line Arguments documentation for a full list of available command line arguments.
Environment Variables
You can customize and configure your Harness MCP server with environment variables. For a full list of options, visit the MCP Environment Variables documentation.
MCP Server Tool Sets Overview
MCP Tools allow servers to expose executable functions that can be invoked by clients and used by LLMs to perform actions.
For a full list of tools and toolsets available, visit the Harness MCP toolsets documentation.
By default, we currently support the following set of tools under the default
toolset:
get_connector_details
: Get details of a specific connectorlist_connector_catalogue
: List the Harness connector cataloguelist_connectors
: List connectors with filtering optionslist_pipelines
: List pipelines in a repositoryget_pipeline
: Get details of a specific pipelineget_execution
: Get details of a specific pipeline executionlist_executions
: List pipeline executionsfetch_execution_url
: Fetch the execution URL for a pipeline executionlist_dashboards
: Lists all available Harness dashboardsget_dashboard_data
: Retrieves the data from a specific Harness dashboard
Use Cases
Using Tools Demo
Watch the use case demo for a walkthrough of MCP server functionality:
Using Artifact Registry Tools Demo
Watch this demo to see the use of Artifact Registry tools in action.