Refer to README.md for project introduction, toolset documentation, and IDE integration guides.
- This is a Go 1.25+ codebase using the mcp-go library
- The server exposes MCP tools organized into toolsets (pipelines, ccm, chaos, scs, sto, idp, sei, etc.)
- All tools must handle both
org_idandproject_idscope parameters appropriately - Tool names are public API - renaming tools or adding required parameters breaks external clients
- Prefer adding optional parameters with sensible defaults over required ones
cmd/harness-mcp-server/ # Main binary entry point
common/
├── config.go # Server configuration struct
├── client/ # API clients for Harness services
│ └── dto/ # Data transfer objects
└── pkg/
├── tools/ # Individual tool implementations
├── toolsets/ # Toolset grouping and registration
└── modules/ # Harness module definitions (CCM, CD, Chaos, CI, Code, FME, IDP, SEI, STO, SSCA)
pkg/ # Additional tools and middleware
make build # Build binary with version info
make format # Format code (goimports + gci)
make test # Run all tests with coveragego test ./common/pkg/tools/... -v # Test tools package
go test ./common/pkg/toolsets/... -v # Test toolsets package
go build ./cmd/harness-mcp-server # Build only (no version info)Follow the pattern in common/pkg/tools/pipelines.go. Key helpers:
RequiredParam[T]/OptionalParam[T]- Extract parameters from requestcommon.WithScope(config, required)- Add org_id/project_id parameterscommon.FetchScope(ctx, config, request, required)- Validate and extract scope
See .harness/rules/review.md for review checklist:
- Tool names: Must be unambiguous and not conflict with existing names
- Descriptions: Must be clear and suggest what action the tool performs
- Parameters: Use
mcp.Enumfor string parameters with defined values - Errors: Use
mcp.NewToolResultErrorfor validation errors,fmt.Errorffor API/system errors (see Common Pitfalls)
make format # Runs goimports and gci - run before committing- Validation errors (params, scope):
return mcp.NewToolResultError(err.Error()), nil - API/system errors (client calls, marshaling):
return nil, fmt.Errorf("failed to X: %w", err)
See GetPipelineTool in common/pkg/tools/pipelines.go for reference.
- Use
OptionalParam[T]for optional fields - ReserveRequiredParam[T]only for mandatory parameters - Always validate scope - Call
common.FetchScope()before using org/project IDs - Respect read-only mode -
AddWriteTools()is automatically filtered when server is read-only