|
| 1 | +# Repository Guidelines |
| 2 | + |
| 3 | +## Project Structure & Module Organization |
| 4 | + |
| 5 | +- `main.go`: CLI entry for the proxy. |
| 6 | +- `pkg/mcp-proxy`: Server wiring (routing, TLS, startup/shutdown). |
| 7 | +- `pkg/auth`: OAuth/OIDC/password providers and auth routes (`templates/`). |
| 8 | +- `pkg/backend`: Stdio→HTTP bridge and transparent HTTP/S backends. |
| 9 | +- `pkg/proxy`: Reverse proxy and header injection. |
| 10 | +- `pkg/repository`: Lightweight KVS persistence. |
| 11 | +- `pkg/utils`: Keys, randomness, logging helpers. |
| 12 | +- `docs/`: Docusaurus site for product docs. |
| 13 | + |
| 14 | +## Build, Test, and Development Commands |
| 15 | + |
| 16 | +- Build: `go build -o bin/mcp-auth-proxy .` — compile the binary. |
| 17 | +- Test: `go test ./...` — run unit tests. |
| 18 | +- Coverage: `go test ./... -coverprofile=coverage.out && go tool cover -html=coverage.out -o coverage.html`. |
| 19 | + |
| 20 | +## Coding Style & Naming Conventions |
| 21 | + |
| 22 | +- Language: Go 1.22+ modules (`go.mod`). |
| 23 | +- Formatting: `gofmt -s -w .` (CI checks formatting); `go fmt ./...` locally. |
| 24 | +- Packages: lower-case names; exported identifiers use PascalCase; files `*_test.go` for tests. |
| 25 | +- Imports: standard → third-party → local (`github.com/sigbit/mcp-auth-proxy/...`). |
| 26 | + |
| 27 | +## Testing Guidelines |
| 28 | + |
| 29 | +- Framework: Go `testing` package (`*_test.go`). |
| 30 | +- Scope: Test auth providers, proxy behavior, and backend adapters in `pkg/...`. |
| 31 | +- Naming: `TestXxx` with table-driven tests where useful. |
| 32 | +- Run all: `go test ./...`; target a package: `go test ./pkg/proxy -v`. |
| 33 | + |
| 34 | +## Commit & Pull Request Guidelines |
| 35 | + |
| 36 | +- Commits: Conventional Commits (feat, fix, docs, refactor, perf, test, build, ci, chore, revert). Example: `feat: add GitHub OAuth provider support`. |
| 37 | +- PRs: use `.github/pull_request_template.md` as the template; include a clear description, linked issues (`Fixes #123`), reproduction steps, and before/after notes. Include config snippets for new flags or env vars. |
| 38 | +- CI: ensure `gofmt` passes and tests are green. |
| 39 | + |
| 40 | +## Security & Configuration Tips |
| 41 | + |
| 42 | +- Set `EXTERNAL_URL` correctly; accept TLS TOS with `--tls-accept-tos` when auto-TLS is detected. |
| 43 | +- Avoid committing contents of `data/` (runtime-only). |
0 commit comments