Skip to content

Commit 589ea99

Browse files
committed
mod: clean up for repo transfer
Signed-off-by: Joshua Duffney <[email protected]>
1 parent 05e3d57 commit 589ea99

File tree

5 files changed

+93
-34
lines changed

5 files changed

+93
-34
lines changed

.github/copilot-instructions.md

Lines changed: 66 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,29 +4,28 @@
44

55
Copacetic MCP is a Go application that provides a Model Context Protocol (MCP) server for automated container image patching using Copacetic and Trivy. It exposes container patching capabilities through the MCP protocol, allowing AI agents and tools to patch container image vulnerabilities programmatically.
66

7-
**Main commands**: MCP tools `version` and `patch`
8-
**Module**: `github.com/duffney/copacetic-mcp`
7+
**Main commands**: MCP tools `version`, `scan-container`, `patch-comprehensive`, `patch-platforms`, `patch-vulnerabilities`, and `workflow-guide`
8+
**Module**: `github.com/project-copacetic/mcp-server`
99

1010
Always reference these instructions first and fallback to search or bash commands only when you encounter unexpected information that does not match the info here.
1111

1212
## Folder Structure
1313

14-
- `main.go`: Main MCP server entry point
15-
- `cmd/client/main.go`: Test client for validating MCP server functionality
16-
- `internal/mcp/`: MCP server setup, tool registration, and protocol handlers
14+
- `cmd/copa-mcp-server/main.go`: Main MCP server entry point
15+
- `cmd/copa-mcp-client/main.go`: CLI client for interacting with MCP server functionality
16+
- `internal/copamcp/`: MCP server setup, tool registration, and protocol handlers
1717
- `internal/copa/`: Copacetic command execution and container patching logic
1818
- `internal/trivy/`: Trivy vulnerability scanning integration
1919
- `internal/types/`: Shared type definitions and execution modes
20-
- `internal/util/`: Utility functions for multiplatform support
20+
- `internal/docker/`: Docker authentication utilities
2121
- `.goreleaser.yml`: GoReleaser configuration for cross-platform releases
2222
- `.github/workflows/`: CI/CD automation (build.yml, release.yml)
2323
- `Makefile`: Development tasks and build automation
2424

2525
## Libraries and Frameworks
2626

2727
- **MCP Protocol**: `github.com/modelcontextprotocol/go-sdk/mcp` for Model Context Protocol server implementation
28-
- **Container Registry**: `github.com/google/go-containerregistry` for container image operations
29-
- **Docker Integration**: `github.com/docker/docker` for container runtime operations
28+
- **CLI Framework**: `github.com/spf13/cobra` for command-line interface structure
3029
- **VEX Support**: `github.com/openvex/go-vex` for vulnerability exchange document generation
3130
- **External Tools**: Copacetic (copa) for patching, Trivy for vulnerability scanning
3231
- **Cross-platform Builds**: GoReleaser for automated multi-platform binary releases
@@ -153,7 +152,7 @@ make release-snapshot # Takes ~2 minutes 41 seconds. NEVER CANCEL. Set timeout
153152
Start the MCP server (interactive mode):
154153

155154
```bash
156-
./bin/copacetic-mcp-server
155+
./bin/copacetic-mcp-server stdio
157156
# Server waits for MCP protocol messages on stdin/stdout
158157
# Use Ctrl+C to stop
159158
```
@@ -187,7 +186,15 @@ Run the test client (requires server dependencies):
187186
make fmt vet # Both commands must complete successfully
188187
```
189188

190-
4. **MCP server functionality validation** - Test server-client communication:
189+
4. **Integration tests validation** - Test all MCP tools end-to-end:
190+
191+
```bash
192+
make integration-test-quick # Quick validation (~10 seconds)
193+
# OR for comprehensive testing:
194+
make integration-test # Full validation (~2-5 minutes, requires copa/trivy/docker)
195+
```
196+
197+
5. **MCP server functionality validation** - Test server-client communication:
191198
```bash
192199
# Create test script to validate version tool:
193200
cat > test_mcp.go << 'EOF'
@@ -229,6 +236,43 @@ make cross-compile # Set timeout to 240+ seconds, NEVER CANCEL
229236
ls -la bin/ # Should show binaries for linux-amd64, linux-arm64, darwin-amd64, darwin-arm64, windows-amd64.exe
230237
```
231238
239+
### Integration Tests
240+
241+
The project includes comprehensive integration tests under `.scripts/integration-test.sh` that use the copa-mcp-client to test all MCP tools end-to-end:
242+
243+
**Run full integration tests** (requires copa, trivy, and docker):
244+
245+
```bash
246+
make integration-test # Takes ~2-5 minutes depending on network and image pulls
247+
# OR directly:
248+
./.scripts/integration-test.sh
249+
```
250+
251+
**Run quick integration tests** (only version and list commands):
252+
253+
```bash
254+
make integration-test-quick # Takes ~10 seconds
255+
# OR directly:
256+
./.scripts/integration-test.sh --quick
257+
```
258+
259+
**Integration test features:**
260+
261+
- Tests all CLI commands: `version`, `list`, `scan-container`, `patch-comprehensive`, `patch-platforms`, `patch-vulnerabilities`
262+
- Validates complete vulnerability-based patching workflow (scan → patch-vulnerabilities)
263+
- Tests error scenarios with invalid inputs
264+
- Uses alpine:3.17 as test image (configurable via TEST_IMAGE environment variable)
265+
- Automatic cleanup of temporary scan reports
266+
- Colored output with detailed success/failure reporting
267+
268+
**Prerequisites for integration tests:**
269+
270+
- All external dependencies installed (copa, trivy, docker)
271+
- Built binaries in `bin/` directory (`make build` first)
272+
- Docker daemon running (for container operations)
273+
274+
The integration tests provide confidence that the MCP server and client work correctly together and that all patching workflows function as expected.
275+
232276
## Important Build and Timing Information
233277
234278
- **Build time**: ~40 seconds (first time with dependencies)
@@ -243,10 +287,14 @@ ls -la bin/ # Should show binaries for linux-amd64, linux-arm64, darwin-amd64,
243287
244288
### MCP Server Architecture
245289
246-
The server provides two MCP tools:
290+
The server provides these MCP tools:
247291
248292
- `version`: Returns copa version information
249-
- `patch`: Patches container images using Copacetic
293+
- `scan-container`: Scans container images for vulnerabilities using Trivy
294+
- `patch-comprehensive`: Patches all available platforms without vulnerability scanning
295+
- `patch-platforms`: Patches specific platforms without vulnerability scanning
296+
- `patch-vulnerabilities`: Patches vulnerabilities based on scan results (requires scan-container output)
297+
- `workflow-guide`: Provides guidance on which tools to use for different scenarios
250298
251299
### Dependencies Not Available
252300
@@ -269,15 +317,16 @@ Docker tests automatically skip in CI environments (`CI` or `GITHUB_ACTIONS` env
269317
### Key Project Structure
270318
271319
```
272-
copacetic-mcp/
273-
├── main.go # Main MCP server entry point
274-
├── cmd/client/main.go # Test client for MCP server validation
320+
mcp-server/
321+
├── cmd/
322+
│ ├── copa-mcp-server/main.go # Main MCP server entry point
323+
│ └── copa-mcp-client/main.go # CLI client for MCP server interaction
275324
├── internal/
276-
│ ├── mcp/ # MCP server handlers, tool registration, protocol implementation
325+
│ ├── copamcp/ # MCP server handlers, tool registration, protocol implementation
277326
│ ├── copa/ # Copacetic command execution and container patching orchestration
278327
│ ├── trivy/ # Trivy vulnerability scanning integration
279328
│ ├── types/ # Shared type definitions, execution modes, and parameters
280-
│ └── util/ # Utility functions for multiplatform and cross-platform support
329+
│ └── docker/ # Docker authentication utilities
281330
├── .goreleaser.yml # GoReleaser configuration for automated releases
282331
├── .github/workflows/ # GitHub Actions CI/CD automation
283332
│ ├── build.yml # Continuous integration: build, test, lint on every push/PR

.github/workflows/release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,13 @@ jobs:
3434
uses: docker/login-action@v3
3535
with:
3636
registry: ghcr.io
37-
username: duffney
38-
password: ${{ secrets.TOKEN }}
37+
username: ${{ github.actor }}
38+
password: ${{ secrets.GITHUB_TOKEN }}
3939
- name: Run GoReleaser
4040
uses: goreleaser/goreleaser-action@v6
4141
with:
4242
distribution: goreleaser
4343
version: "~> v2"
4444
args: release --clean
4545
env:
46-
GITHUB_TOKEN: ${{ secrets.TOKEN }}
46+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.goreleaser.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# GoReleaser configuration for copacetic-mcp
1+
# GoReleaser configuration for mcp-server
22
# Documentation: https://goreleaser.com
33

44
version: 2
@@ -11,7 +11,7 @@ before:
1111
# - go generate ./...
1212

1313
builds:
14-
- id: "copacetic-mcp-server"
14+
- id: "mcp-server-server"
1515
main: ./cmd/copa-mcp-server/main.go
1616
binary: copacetic-mcp-server
1717
env:
@@ -33,7 +33,7 @@ builds:
3333
- goos: windows
3434
goarch: arm64
3535

36-
- id: "copacetic-mcp-client"
36+
- id: "mcp-server-client"
3737
main: ./cmd/copa-mcp-client/main.go
3838
binary: copacetic-mcp-client
3939
env:
@@ -94,8 +94,8 @@ changelog:
9494
release:
9595
# Repository to upload the release to
9696
github:
97-
owner: duffney
98-
name: copacetic-mcp
97+
owner: project-copacetic
98+
name: mcp-server
9999

100100
# Create release draft
101101
draft: false
@@ -113,22 +113,22 @@ release:
113113
This release includes cross-platform binaries for the Copacetic MCP server and client.
114114
115115
footer: |
116-
**Full Changelog**: https://github.com/duffney/copacetic-mcp/compare/{{ .PreviousTag }}...{{ .Tag }}
116+
**Full Changelog**: https://github.com/project-copacetic/mcp-server/compare/{{ .PreviousTag }}...{{ .Tag }}
117117
118118
### Usage
119119
120120
1. Download the appropriate binary for your platform
121121
2. Extract the archive
122-
3. Run the MCP server: `./copacetic-mcp-server`
122+
3. Run the MCP server: `.copacetic-mcp-server`
123123
124-
For more information, see the [README](https://github.com/duffney/copacetic-mcp/blob/main/README.md).
124+
For more information, see the [README](https://github.com/project-copacetic/mcp-server/blob/main/README.md).
125125
126126
# Docker image: build and push single-arch (linux/amd64) image to GitHub Container Registry
127127
# Using single arch to simplify and ensure GHCR package associates cleanly with the repo.
128128
dockers:
129129
- image_templates:
130-
- "ghcr.io/duffney/copacetic-mcp:{{ .Version }}"
131-
- "ghcr.io/duffney/copacetic-mcp:latest"
130+
- "ghcr.io/project-copacetic/mcp-server:{{ .Version }}"
131+
- "ghcr.io/project-copacetic/mcp-server:latest"
132132
dockerfile: Dockerfile
133133
use: buildx
134134
build_flag_templates:

.vscode/mcp.json

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,12 @@
1010
"servers": {
1111
"MCP_DOCKER": {
1212
"command": "docker",
13-
"args": ["mcp", "gateway", "run", "--long-lived"],
13+
"args": [
14+
"mcp",
15+
"gateway",
16+
"run",
17+
"--long-lived"
18+
],
1419
"type": "stdio"
1520
},
1621
"copacetic-mcp-server": {
@@ -28,15 +33,20 @@
2833
"type=bind,source=/var/run/docker.sock,target=/var/run/docker.sock",
2934
"--mount",
3035
"type=bind,source=${env:HOME}/.docker/config.json,target=/root/.docker/config.json",
31-
"ghcr.io/duffney/copacetic-mcp:latest"
36+
"ghcr.io/project-copacetic/mcp-server:latest"
3237
],
3338
"env": {
3439
"DOCKER_HOST": "unix:///var/run/docker.sock"
3540
}
3641
},
3742
"copacetic-docker-reg-auth": {
3843
"command": "docker",
39-
"args": ["run", "--rm", "-i", "ghcr.io/duffney/copacetic-mcp:latest"],
44+
"args": [
45+
"run",
46+
"--rm",
47+
"-i",
48+
"ghcr.io/project-copacetic/mcp-server:latest"
49+
],
4050
"env": {
4151
"REGISTRY_TOKEN": "${input:token}",
4252
"REGISTRY_HOST": "nameOfRegistry"

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ Replace `/path/to/copacetic-mcp-server` with the actual path to your copacetic-m
4848
"type=bind,source=/var/run/docker.sock,target=/var/run/docker.sock",
4949
"--mount",
5050
"type=bind,source=${env:HOME}/.docker/config.json,target=/root/.docker/config.json",
51-
"ghcr.io/duffney/copacetic-mcp:latest"
51+
"ghcr.io/project-copacetic/mcp-server:latest"
5252
],
5353
"env": {
5454
"DOCKER_HOST": "unix:///var/run/docker.sock"

0 commit comments

Comments
 (0)