Skip to content

Commit 7d704a0

Browse files
committed
Setup GitHub repository
1 parent 0571b93 commit 7d704a0

File tree

13 files changed

+395
-0
lines changed

13 files changed

+395
-0
lines changed

.github/CODE_OF_CONDUCT.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Code of Conduct
2+
3+
The Stackrox code of conduct can be found [here](https://stackrox.io/code-conduct).

.github/CONTRIBUTING.md

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
# Contributing to StackRox MCP
2+
3+
Thank you for your interest in contributing to StackRox MCP! This document provides guidelines and instructions for contributing to the project.
4+
5+
## Getting Started
6+
7+
Before contributing, get the project running locally:
8+
9+
### Initial Setup
10+
11+
Clone the repository:
12+
```bash
13+
git clone https://github.com/stackrox/stackrox-mcp.git
14+
cd stackrox-mcp
15+
```
16+
17+
Build the project:
18+
```bash
19+
make build
20+
```
21+
22+
Run the server:
23+
```bash
24+
./stackrox-mcp
25+
```
26+
27+
Once you have the project running, familiarize yourself with the development workflow below.
28+
29+
## Development Guidelines
30+
31+
### Code Quality Standards
32+
33+
All code must pass the following checks before being merged:
34+
35+
- **Formatting:** Run `make fmt` to format your code
36+
- **Format Check:** Run `make fmt-check` to verify code is formatted
37+
- **Linting:** Run `make lint` to check for style issues
38+
- **Testing:** All tests must pass with `make test`
39+
40+
These checks are automatically run in CI for all pull requests.
41+
42+
### Available Make Targets
43+
44+
View all available make commands:
45+
```bash
46+
make help
47+
```
48+
49+
Common development commands:
50+
- `make build` - Build the binary
51+
- `make test` - Run unit tests with coverage
52+
- `make coverage-html` - Generate and view HTML coverage report
53+
- `make fmt` - Format code
54+
- `make fmt-check` - Check code formatting (fails if not formatted)
55+
- `make lint` - Run golangci-lint
56+
- `make clean` - Clean build artifacts and coverage files
57+
58+
### Testing
59+
60+
- Write unit tests for all new functionality
61+
- Aim for 80% code coverage
62+
- All error paths should be tested
63+
- Run tests with coverage:
64+
```bash
65+
make test
66+
```
67+
- Generate and view detailed coverage report:
68+
```bash
69+
make coverage-html
70+
```
71+
72+
## Pull Request Guidelines
73+
74+
### Creating a PR
75+
76+
- **Title:**
77+
- The title of your PR should be clear and descriptive.
78+
- It should be short enough to fit into the title box.
79+
- **PR addresses JIRA ticket:** `ROX-1234: Add feature ABC`
80+
- **Otherwise use conventional commit style:** `<type>(<scope>): <description>`
81+
- Types: `fix`, `docs`, `test`, `refactor`, `chore`, `ci`
82+
- Example: `fix(builds): Fix builds for ABC architecture`
83+
84+
- **Description:**
85+
- Describe the motivation for this change, or why some things were done a certain way.
86+
- Focus on what cannot be extracted from the code, e.g., alternatives considered and dismissed (and why), performance concerns, non-evident edge cases.
87+
88+
- **Validation:**
89+
- Provide information that can help the PR reviewer test changes and validate they are correct.
90+
- In some cases, it will be sufficient to mention that unit tests are added and they cover the changes.
91+
- In other cases, testing may be more complex, and providing steps on how to set up and test everything will be very valuable for reviewers.
92+
93+
### Merging a PR
94+
95+
- Make sure that **all CI statuses are green**.
96+
- Always use `Squash and merge` as the merging mode (default).
97+
- Double-check that the title of the commit ("subject line") is **your PR title**, followed by the PR number prefixed with a `#` in parentheses.
98+
- Merge commit message example: `ROX-1234: Add feature ABC (#5678)`.
99+
- The body of the commit message should be empty. If GitHub pre-populates it, delete it.
100+
101+
## Code Review Process
102+
103+
- All PRs require at least one approval before merging
104+
- Address all reviewer comments and suggestions
105+
- Keep PRs focused and reasonably sized
106+
- Respond to feedback in a timely manner
107+
108+
## License
109+
110+
By contributing to StackRox MCP, you agree that your contributions will be licensed under the Apache License 2.0.

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
### Description
2+
3+
<!-- Please provide information on what this PR changes. -->
4+
5+
### Validation
6+
7+
<!-- Please provide information on how changes have been validated and tested. -->

.github/workflows/style.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Style
2+
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
branches:
8+
- main
9+
pull_request:
10+
types:
11+
- opened
12+
- reopened
13+
- synchronize
14+
15+
jobs:
16+
style:
17+
name: Code Style Checks
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
- name: Checkout code
22+
uses: actions/checkout@v4
23+
24+
- name: Set up Go
25+
uses: actions/setup-go@v5
26+
with:
27+
go-version: '1.24'
28+
29+
- name: Check code formatting
30+
run: make fmt-check
31+
32+
- name: Run golangci-lint
33+
uses: golangci/golangci-lint-action@v8
34+
with:
35+
version: v2.6

.github/workflows/test.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Test
2+
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
branches:
8+
- main
9+
pull_request:
10+
types:
11+
- opened
12+
- reopened
13+
- synchronize
14+
15+
jobs:
16+
test:
17+
name: Run Tests
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
- name: Checkout code
22+
uses: actions/checkout@v4
23+
24+
- name: Set up Go
25+
uses: actions/setup-go@v5
26+
with:
27+
go-version: '1.24'
28+
29+
- name: Download dependencies
30+
run: go mod download
31+
32+
- name: Run tests with coverage
33+
run: make test
34+
35+
# - name: Upload coverage to Codecov
36+
# uses: codecov/codecov-action@v4
37+
# with:
38+
# file: ./coverage.out
39+
# token: ${{ secrets.CODECOV_TOKEN }}
40+
# fail_ci_if_error: false

.gitignore

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# IDE and editor files
2+
.vscode/
3+
.idea/
4+
.DS_Store
5+
6+
# Test coverage output
7+
/*.out
8+
9+
# Build output
10+
/stackrox-mcp
11+
12+
# Lint output
13+
/report.xml

.golangci.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
version: "2"
2+
run:
3+
timeout: 240m
4+
go: "1.24"
5+
modules-download-mode: readonly
6+
allow-parallel-runners: true
7+
output:
8+
formats:
9+
text:
10+
path: stdout
11+
junit-xml:
12+
path: report.xml
13+
linters:
14+
enable-all: true
15+
issues:
16+
max-issues-per-linter: 0
17+
max-same-issues: 0

Makefile

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Default target
2+
.DEFAULT_GOAL := help
3+
4+
# Binary name
5+
BINARY_NAME=stackrox-mcp
6+
7+
# Go parameters
8+
GOCMD=go
9+
GOBUILD=$(GOCMD) build
10+
GOTEST=$(GOCMD) test
11+
GOFMT=$(GOCMD) fmt
12+
GOCLEAN=$(GOCMD) clean
13+
14+
# Coverage files
15+
COVERAGE_OUT=coverage.out
16+
17+
# Lint files
18+
LINT_OUT=report.xml
19+
20+
.PHONY: help
21+
help: ## Display this help message
22+
@echo "Available targets:"
23+
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-15s\033[0m %s\n", $$1, $$2}'
24+
25+
.PHONY: build
26+
build: ## Build the binary
27+
$(GOBUILD) -o $(BINARY_NAME) ./cmd/stackrox-mcp
28+
29+
.PHONY: test
30+
test: ## Run unit tests with coverage
31+
$(GOTEST) -v -cover -coverprofile=$(COVERAGE_OUT) ./...
32+
33+
.PHONY: coverage-html
34+
coverage-html: test ## Generate and open HTML coverage report
35+
$(GOCMD) tool cover -html=$(COVERAGE_OUT)
36+
37+
.PHONY: fmt
38+
fmt: ## Format Go code
39+
$(GOFMT) ./...
40+
41+
.PHONY: fmt-check
42+
fmt-check: ## Check if Go code is formatted (fails if not)
43+
@if [ -n "$$(gofmt -l .)" ]; then \
44+
echo "The following files are not formatted:"; \
45+
gofmt -l .; \
46+
exit 1; \
47+
fi
48+
49+
.PHONY: lint
50+
lint: ## Run golangci-lint
51+
go install -v "github.com/golangci/golangci-lint/v2/cmd/[email protected]"
52+
golangci-lint run
53+
54+
.PHONY: clean
55+
clean: ## Clean build artifacts and coverage files
56+
$(GOCLEAN)
57+
rm -f $(BINARY_NAME)
58+
rm -f $(COVERAGE_OUT)
59+
rm -f $(LINT_OUT)

README.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# StackRox MCP
2+
3+
## Project Overview
4+
5+
StackRox MCP is a Model Context Protocol (MCP) server that provides AI assistants with access to StackRox.
6+
7+
## Quick Start
8+
9+
Clone the repository:
10+
```bash
11+
git clone https://github.com/stackrox/stackrox-mcp.git
12+
cd stackrox-mcp
13+
```
14+
15+
Build the project:
16+
```bash
17+
make build
18+
```
19+
20+
Run the server:
21+
```bash
22+
./stackrox-mcp
23+
```
24+
25+
## Development
26+
27+
For detailed development guidelines, testing standards, and contribution workflows, see [CONTRIBUTING.md](.github/CONTRIBUTING.md).
28+
29+
### Quick Reference
30+
31+
View all available commands:
32+
```bash
33+
make help
34+
```
35+
36+
Common commands:
37+
- `make build` - Build the binary
38+
- `make test` - Run tests
39+
- `make fmt` - Format code
40+
- `make lint` - Run linter

cmd/stackrox-mcp/main.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package main
2+
3+
import (
4+
"github.com/rs/zerolog"
5+
"github.com/rs/zerolog/log"
6+
)
7+
8+
func setupLogging() {
9+
zerolog.SetGlobalLevel(zerolog.InfoLevel)
10+
}
11+
12+
func main() {
13+
setupLogging()
14+
15+
log.Info().Msg("Starting Stackrox MCP server")
16+
}

0 commit comments

Comments
 (0)