Skip to content
This repository was archived by the owner on Nov 14, 2025. It is now read-only.

Commit c693334

Browse files
sapientpantsclaude
andauthored
docs: add missing ADRs and update existing ones (#321)
* chore: rename build * docs: add missing ADRs and update existing ones Documents architectural decisions previously undocumented in the codebase. **New ADRs:** - ADR-0020: Testing Framework (Vitest + property-based testing) - ADR-0021: Code Quality Toolchain (ESLint, Prettier, TypeScript) - ADR-0022: Package Manager Choice (pnpm) - ADR-0023: Release Management with Changesets - ADR-0024: CI/CD Platform (GitHub Actions) - ADR-0025: Container and Security Scanning (Trivy, SLSA, SBOM) - ADR-0026: Circuit Breaker Pattern (opossum) - ADR-0027: Docker Publishing Strategy (GHCR to Docker Hub) - ADR-0028: Session-Based HTTP Transport with SSE **Updated ADRs:** - ADR-0011: Docker implementation (multi-platform, GHCR, security) - ADR-0016: Marked as superseded by ADR-0019 - ADR-0018: Circuit breaker cross-references - ADR-0019: Marked as partially superseded by ADR-0028 ADR-0028 documents the session-based HTTP transport added after ADR-0019 removed OAuth HTTP. Uses session management instead of OAuth and delegates authentication to external gateways. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * docs: add key architectural decisions to CLAUDE.md Summarizes key decisions from ADRs for quick reference: - Testing: Vitest + fast-check (80% coverage) - Code quality: TypeScript strict, ESLint, Prettier - Package manager: pnpm with version consistency - Release: Changesets workflow - CI/CD: GitHub Actions (7 workflows) - Security: Multi-layered (Trivy, CodeQL, SLSA, SBOM) - Resilience: Circuit breaker (opossum) - Docker: Multi-platform, GHCR→Docker Hub - Transport: stdio (default) + HTTP (optional) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * chore: add empty changeset for documentation updates Documentation-only changes do not require a version bump. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 287fff3 commit c693334

16 files changed

+3634
-17
lines changed

.changeset/legal-mice-hope.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
---
3+
4+
Documentation-only changes: Added 9 new ADRs (0020-0028) documenting previously undocumented architectural decisions (testing, code quality, package management, release management, CI/CD, security scanning, circuit breakers, Docker publishing, HTTP transport). Updated 4 existing ADRs (0011, 0016, 0018, 0019) with current implementation details and supersession relationships. Enhanced CLAUDE.md with key architectural decisions summary.

.github/workflows/main.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,6 @@ jobs:
6060
# =============================================================================
6161

6262
build:
63-
name: Build TypeScript
64-
6563
runs-on: ubuntu-latest
6664
outputs:
6765
artifact-name: dist-${{ github.sha }}

CLAUDE.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,63 @@ All architectural decisions are documented in Architecture Decision Records (ADR
2121

2222
Refer to the ADRs for detailed information about design rationale, implementation details, and consequences of each architectural decision.
2323

24+
## Key Architectural Decisions
25+
26+
**Testing** (ADR-0020):
27+
28+
- Vitest as test framework with native ES modules support
29+
- fast-check for property-based testing
30+
- 80% minimum coverage required (lines, functions, branches, statements)
31+
32+
**Code Quality** (ADR-0021):
33+
34+
- TypeScript strict mode enabled (all strict flags)
35+
- ESLint flat config with cognitive complexity limit (15)
36+
- Prettier for consistent formatting
37+
- Husky + lint-staged for pre-commit automation
38+
39+
**Package Manager** (ADR-0022):
40+
41+
- pnpm for disk efficiency and strict dependency management
42+
- Version MUST match across: package.json, Dockerfile, all workflows
43+
- Uses Corepack for automatic version management
44+
45+
**Release Management** (ADR-0023):
46+
47+
- Changesets for versioning and changelog generation
48+
- Changeset validation enforced in CI/CD
49+
- Automated GitHub releases via workflows
50+
51+
**CI/CD** (ADR-0024):
52+
53+
- GitHub Actions with 7 workflows (main, PR, publish, 4 reusable)
54+
- Parallel execution for validation, security, build
55+
- Quality gates block merge on failures
56+
57+
**Security** (ADR-0025):
58+
59+
- Multi-layered: Trivy (containers), CodeQL (SAST), OSV-Scanner (deps), SonarCloud
60+
- SLSA provenance attestations on all artifacts
61+
- SBOM (CycloneDX) generated for Docker images
62+
63+
**Resilience** (ADR-0026):
64+
65+
- Circuit breaker pattern via opossum library
66+
- Default: 50% error threshold, 10s timeout, 30s reset
67+
- Integrated with metrics/monitoring system
68+
69+
**Docker Publishing** (ADR-0027):
70+
71+
- Multi-platform: linux/amd64, linux/arm64
72+
- Two-stage: build→GHCR (with security scan), copy→Docker Hub
73+
- Build-once-deploy-many strategy
74+
75+
**Transport** (ADR-0010, ADR-0028):
76+
77+
- stdio: Default transport (recommended)
78+
- HTTP: Optional session-based transport with SSE
79+
- HTTP uses session management (not OAuth), delegates auth to gateways
80+
2481
## Code Quality Conventions
2582

2683
Follow these conventions to maintain code quality:
Lines changed: 87 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# 11. Docker containerization for deployment
22

33
Date: 2025-06-13
4+
Updated: 2025-10-11 (Added multi-platform, GHCR, security scanning)
45

56
## Status
67

@@ -15,22 +16,76 @@ The SonarQube MCP server needs to be easily deployable across different environm
1516
- Simplifies the deployment process for non-technical users
1617
- Supports various MCP transport mechanisms (stdio, SSE)
1718
- Enables easy updates and version management
19+
- Works on multiple CPU architectures (Intel/AMD x64, Apple Silicon ARM64)
20+
- Provides security guarantees through vulnerability scanning
1821

1922
## Decision
2023

21-
We will provide Docker containerization as a recommended deployment option for the SonarQube MCP server. This includes:
24+
We will provide Docker containerization as the recommended deployment option for the SonarQube MCP server. This includes:
2225

2326
- Maintaining a Dockerfile in the repository that packages the server with all dependencies
24-
- Publishing Docker images to Docker Hub (e.g., sapientpants/sonarqube-mcp-server)
27+
- Publishing Docker images to both GitHub Container Registry (GHCR) and Docker Hub
2528
- Documenting Docker usage in the README as a primary deployment method
26-
- Supporting both stdio and SSE transports within the containerized environment
29+
- Supporting stdio transport within the containerized environment (SSE removed as of ADR-0019)
2730

28-
The Dockerfile will:
31+
### Modern Implementation (as of 2025-10-11)
2932

30-
- Use an appropriate Node.js base image
31-
- Install all npm dependencies
32-
- Copy the built server code
33-
- Set appropriate entry points for MCP server operation
33+
The Docker implementation has evolved significantly beyond the initial decision:
34+
35+
#### Multi-Platform Support
36+
37+
- **Platforms**: Builds for both `linux/amd64` and `linux/arm64`
38+
- **Tooling**: Uses Docker Buildx with QEMU emulation for ARM64 builds
39+
- **Distribution**: Multi-platform manifest lists allow Docker to automatically select the correct architecture
40+
- **References**: See ADR-0027 for publishing strategy details
41+
42+
#### Two-Registry Strategy
43+
44+
1. **GitHub Container Registry (GHCR)** - Primary build target:
45+
- Built and pushed in main workflow
46+
- Security scanned before any public distribution
47+
- Used as intermediate registry for Docker Hub
48+
- Registry: `ghcr.io/sapientpants/sonarqube-mcp-server`
49+
50+
2. **Docker Hub** - Public distribution:
51+
- Images copied from GHCR in publish workflow
52+
- Better discoverability for end users
53+
- Registry: `sapientpants/sonarqube-mcp-server`
54+
- References\*\*: See ADR-0027 (Docker Image Publishing Strategy)
55+
56+
#### Security Scanning
57+
58+
- **Tool**: Trivy vulnerability scanner
59+
- **Severity**: Blocks on HIGH and CRITICAL vulnerabilities
60+
- **Integration**: Automatic in CI/CD pipeline before publishing
61+
- **SARIF Upload**: Results uploaded to GitHub Security tab
62+
- **References**: See ADR-0025 (Container and Security Scanning Strategy)
63+
64+
#### Supply Chain Security
65+
66+
- **SLSA Provenance**: Build attestations attached to all images
67+
- **SBOM**: Software Bill of Materials (CycloneDX format) generated and attached
68+
- **Verification**: Users can verify image provenance using GitHub attestation API
69+
70+
#### Base Image and Configuration
71+
72+
The Dockerfile:
73+
74+
- Uses `node:22-alpine` as base image for minimal size
75+
- Installs pnpm@10.17.0 for dependency management
76+
- Multi-stage build for optimal layer caching
77+
- Non-root user (`node`) for security
78+
- Proper signal handling for graceful shutdown
79+
- Health check endpoint for container orchestration
80+
81+
#### Tagging Strategy
82+
83+
Each release creates four tags:
84+
85+
- Full semantic version: `1.10.18`
86+
- Major.minor version: `1.10`
87+
- Major version: `1`
88+
- Latest: `latest`
3489

3590
## Consequences
3691

@@ -41,16 +96,36 @@ The Dockerfile will:
4196
- **Version consistency**: Specific server versions can be deployed using Docker tags
4297
- **Cross-platform compatibility**: Works identically on Linux, macOS, and Windows with Docker
4398
- **Easy updates**: Users can update by pulling new image versions
44-
- **Transport flexibility**: Both stdio and SSE transports work within containers
99+
- **Multi-Architecture**: Native support for both Intel/AMD and ARM64 (Apple Silicon, AWS Graviton)
100+
- **Security First**: Images are scanned for vulnerabilities before distribution
101+
- **Supply Chain Security**: SLSA provenance and SBOM provide transparency
102+
- **Dual Registry**: GHCR for GitHub users, Docker Hub for broader community
103+
- **Efficient Publishing**: Build once, copy to Docker Hub (no rebuild required)
45104

46105
### Negative
47106

48-
- **Additional maintenance**: Requires maintaining Dockerfile and Docker Hub releases
107+
- **Additional maintenance**: Requires maintaining Dockerfile and multi-registry releases
49108
- **Image size**: Docker images are larger than source distributions (includes Node.js runtime)
109+
- Current size: ~150MB compressed (Alpine-based)
50110
- **Docker requirement**: Users must have Docker installed and running
51111
- **Resource overhead**: Containers have slight performance overhead compared to native execution
112+
- **Multi-Platform Build Time**: ARM64 emulation adds 2-3 minutes to build time
113+
- **Registry Costs**: Potential GHCR storage costs (minimal for public repos)
114+
- **Two Registry Sync**: Need to maintain consistency between GHCR and Docker Hub
52115

53116
### Neutral
54117

55-
- Docker deployment becomes the recommended approach but not mandatory - users can still install from source
56-
- Need to ensure Docker image tags align with npm package versions for consistency
118+
- Docker deployment is the recommended approach but not mandatory - users can still install from source
119+
- Docker image tags align with npm package versions for consistency
120+
- Multi-platform manifest lists handled transparently by Docker (users don't need to specify platform)
121+
- GHCR acts as intermediate storage (invisible to most users)
122+
123+
## References
124+
125+
- Dockerfile: `Dockerfile` (in repository root)
126+
- ADR-0019: Simplify to stdio-only transport (removed SSE support)
127+
- ADR-0024: CI/CD Platform - GitHub Actions (workflow automation)
128+
- ADR-0025: Container and Security Scanning Strategy (Trivy, SLSA, SBOM)
129+
- ADR-0027: Docker Image Publishing Strategy - GHCR to Docker Hub (two-registry approach)
130+
- GitHub Container Registry: https://ghcr.io/sapientpants/sonarqube-mcp-server
131+
- Docker Hub: https://hub.docker.com/r/sapientpants/sonarqube-mcp-server

docs/architecture/decisions/0016-http-transport-with-oauth-2-0-metadata-endpoints.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,23 @@
11
# 16. HTTP Transport with OAuth 2.0 Metadata Endpoints
22

33
Date: 2025-06-22
4+
Superseded: 2025-01-30 by ADR-0019
45

56
## Status
67

7-
Accepted
8+
Superseded by ADR-0019
9+
10+
This decision was reversed on 2025-01-30. The HTTP transport and OAuth 2.0 implementation was removed in favor of stdio-only transport with enterprise features delegated to MCP gateways (Docker MCP Gateway, IBM Context Forge, SGNL, Operant, etc.).
11+
12+
**Rationale for reversal:**
13+
14+
- HTTP transport added significant complexity (~60+ authentication/authorization files)
15+
- MCP gateway solutions now provide these enterprise features at the infrastructure layer
16+
- Better separation of concerns: business logic vs infrastructure concerns
17+
- Reduced attack surface and maintenance burden
18+
- Aligns with Unix philosophy of "do one thing well"
19+
20+
See ADR-0019 for the current stdio-only transport approach.
821

922
## Context
1023

@@ -97,3 +110,10 @@ class HttpTransport implements ITransport {
97110
- ADR-0015: Transport Architecture Refactoring
98111
- ADR-0014: Current Security Model and Future OAuth2 Considerations
99112
- ADR-0008: Use Environment Variables for Configuration
113+
- **ADR-0019: Simplify to stdio-only transport (SUPERSEDES THIS ADR)**
114+
115+
## Historical Note
116+
117+
This ADR documents the HTTP transport implementation that was later removed. The decision to implement HTTP transport with OAuth 2.0 was sound at the time (June 2025), but the rapid evolution of the MCP ecosystem with purpose-built gateway solutions made this approach redundant. The code and infrastructure described in this ADR were removed in January 2025 as part of a significant simplification effort that reduced the codebase by ~40%.
118+
119+
This ADR is retained for historical context and to document the architectural exploration that led to the current stdio-only approach.

docs/architecture/decisions/0018-add-comprehensive-monitoring-and-observability.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# 18. Add comprehensive monitoring and observability
22

33
Date: 2025-01-25
4+
Updated: 2025-10-11 (Added circuit breaker details and cross-references)
45

56
## Status
67

@@ -70,7 +71,23 @@ We will implement a comprehensive monitoring and observability stack with the fo
7071

7172
### 5. Operational Features
7273

73-
- Circuit breakers using `opossum` library
74+
- **Circuit breakers** using `opossum` library
75+
- Implemented via `CircuitBreakerFactory` pattern (see ADR-0026)
76+
- Default thresholds: 50% error rate, 10-second timeout, 30-second reset
77+
- Event-driven monitoring integration:
78+
- `open` event: Circuit opened due to failures → metrics updated
79+
- `close` event: Circuit recovered → metrics updated
80+
- `halfOpen` event: Testing recovery → logged for observability
81+
- `failure` event: Request failed → failure counter incremented
82+
- `timeout` event: Request timed out → timeout metrics tracked
83+
- `reject` event: Request rejected (circuit open) → rejection counter incremented
84+
- Metrics tracked:
85+
- Circuit breaker state (open/closed/half-open)
86+
- Failure count per breaker
87+
- Rejection count per breaker
88+
- Success/failure ratio
89+
- Request latency percentiles
90+
- See ADR-0026 for complete circuit breaker documentation
7491
- Connection pooling with `undici` or `got`
7592
- Graceful degradation when dependencies fail
7693
- Request rate limiting enhancements
@@ -103,6 +120,8 @@ We will implement a comprehensive monitoring and observability stack with the fo
103120
- **Troubleshooting**: Quickly diagnose issues with distributed tracing
104121
- **Compliance**: Meet enterprise SLA requirements
105122
- **Integration**: Works with existing monitoring infrastructure
123+
- **Resilience**: Circuit breakers prevent cascading failures and provide fail-fast behavior
124+
- **Observability**: Circuit breaker events integrated with metrics for real-time failure detection
106125

107126
### Negative
108127

@@ -143,3 +162,6 @@ We will implement a comprehensive monitoring and observability stack with the fo
143162
- [OpenTelemetry Node.js](https://opentelemetry.io/docs/instrumentation/js/)
144163
- [The RED Method](https://www.weave.works/blog/the-red-method-key-metrics-for-microservices-architecture/)
145164
- [Circuit Breaker Pattern](https://martinfowler.com/bliki/CircuitBreaker.html)
165+
- ADR-0026: Circuit Breaker Pattern with opossum (complete implementation details)
166+
- Implementation: `src/monitoring/circuit-breaker.ts`
167+
- Metrics Implementation: `src/monitoring/metrics.ts`

docs/architecture/decisions/0019-simplify-to-stdio-only-transport-for-mcp-gateway-deployment.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,28 @@
11
# 19. Simplify to stdio-only transport for MCP gateway deployment
22

33
Date: 2025-01-30
4+
Partially Superseded: 2025-10-12 by ADR-0028
45

56
## Status
67

7-
Accepted
8+
Partially Superseded by ADR-0028
9+
10+
This decision was partially reversed on 2025-10-12. While the removal of OAuth-based HTTP transport and authentication complexity remains valid, the "stdio-only" decision was superseded by ADR-0028, which re-introduced HTTP transport in a simpler, session-based form without OAuth complexity.
11+
12+
**What remains valid from this ADR:**
13+
14+
- Removal of OAuth 2.0 authentication infrastructure (60+ files)
15+
- Removal of service account management and permission filtering
16+
- Delegation of enterprise features to MCP gateways
17+
- Simplified authentication model
18+
19+
**What was superseded:**
20+
21+
- "stdio-only" transport decision (HTTP transport re-added in ADR-0028)
22+
- Removal of all HTTP endpoints (HTTP re-added with session management)
23+
- Removal of SSE (SSE re-added for real-time notifications)
24+
25+
See ADR-0028 for the current HTTP transport implementation (session-based without OAuth).
826

927
## Context
1028

@@ -91,4 +109,5 @@ Users currently using HTTP transport should:
91109
- GitHub Issue #243: Simplify to stdio-only transport
92110
- ADR-0010: Use stdio transport for MCP communication
93111
- ADR-0016: HTTP transport with OAuth 2.0 (being reverted)
112+
- **ADR-0028: Session-Based HTTP Transport with SSE (PARTIALLY SUPERSEDES THIS ADR)**
94113
- MCP Specification: Transport layer abstraction

0 commit comments

Comments
 (0)