Thank you for your interest in contributing to mcp-data-platform! This document provides guidelines and instructions for contributing.
By participating in this project, you agree to maintain a respectful and inclusive environment for everyone.
- Go 1.24 or later
- golangci-lint (for linting)
- gosec (for security scanning)
-
Fork and clone the repository:
git clone https://github.com/YOUR_USERNAME/mcp-data-platform.git cd mcp-data-platform -
Install dependencies:
go mod download
-
Install development tools:
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest go install github.com/securego/gosec/v2/cmd/gosec@latest go install golang.org/x/vuln/cmd/govulncheck@latest
-
Verify your setup:
go test -race ./... golangci-lint run ./... gosec ./...
-
Create a new branch:
git checkout -b feature/your-feature-name
-
Make your changes following the coding standards.
-
Run tests and linting:
go test -race ./... golangci-lint run ./... gosec ./... -
Commit your changes:
git commit -m "feat: add your feature description"
We follow Conventional Commits:
feat:New featuresfix:Bug fixesdocs:Documentation changestest:Adding or updating testsrefactor:Code refactoringci:CI/CD changeschore:Maintenance tasks
Examples:
feat: add support for custom semantic providers
fix: handle nil pointer in middleware chain
docs: update configuration examples
test: add tests for persona filtering
- Update documentation if needed.
- Add tests for new functionality.
- Ensure all tests pass:
go test -race ./... - Ensure linting passes:
golangci-lint run ./... - Ensure security checks pass:
gosec ./... - Submit your pull request.
- Tests added/updated
- Documentation updated
- Linting passes
- Security scan passes
- Commit messages follow conventions
- Branch is up to date with main
- Follow Effective Go
- Use
gofmtandgoimportsfor formatting - All exported functions, types, and packages must have documentation
- Use meaningful variable and function names
- Keep functions focused and reasonably sized
- Cyclomatic complexity must not exceed 10
- Always handle errors explicitly
- Wrap errors with context using
fmt.Errorf("context: %w", err) - Return errors rather than logging and continuing
- Use error types for distinguishable error conditions
- Write table-driven tests where appropriate
- Aim for >80% code coverage
- Test both success and failure paths
- Use descriptive test names:
TestFunctionName_Scenario_ExpectedResult
Example:
func TestPersonaFilter_AllowDeny_WildcardPatterns(t *testing.T) {
filter := persona.NewFilter(persona.ToolRules{
Allow: []string{"trino_*"},
Deny: []string{"*_delete_*"},
})
if !filter.IsAllowed("trino_query") {
t.Error("expected trino_query to be allowed")
}
if filter.IsAllowed("trino_delete_table") {
t.Error("expected trino_delete_table to be denied")
}
}- Package-level documentation explaining purpose
- Function documentation for exported functions
- Inline comments for complex logic only
- Keep README.md and CLAUDE.md up to date
mcp-data-platform/
├── cmd/mcp-data-platform/ # Main application entry point
├── internal/server/ # Internal server implementation
├── pkg/ # Public API packages
│ ├── platform/ # Core platform facade
│ ├── auth/ # Authentication (OIDC, API keys)
│ ├── oauth/ # OAuth 2.1 server
│ ├── persona/ # Role-based personas
│ ├── semantic/ # Semantic metadata provider
│ ├── query/ # Query execution provider
│ ├── middleware/ # Request/response middleware
│ ├── registry/ # Toolkit registry
│ ├── audit/ # Audit logging
│ ├── tuning/ # Prompts, hints, rules
│ └── tools/ # Base toolkit
├── configs/ # Example configurations
└── migrations/ # SQL migrations
- New semantic providers: Add to
pkg/semantic/ - New query providers: Add to
pkg/query/ - New middleware: Add to
pkg/middleware/ - New toolkits: Add to
pkg/registry/and register inpkg/tools/ - Authentication methods: Add to
pkg/auth/ - Configuration options: Modify
pkg/platform/config.go
# Run all tests with race detection
go test -race ./...
# Run tests with coverage
go test -race -coverprofile=coverage.out ./...
# Generate HTML coverage report
go tool cover -html=coverage.out
# Run specific package tests
go test -race ./pkg/platform/...- Never commit secrets or credentials
- Run
gosec ./...before submitting PRs - Report security vulnerabilities via SECURITY.md
- Follow secure coding practices
- Open an issue for bugs or feature requests
- Check existing issues before creating new ones
- Join discussions in pull requests
By contributing, you agree that your contributions will be licensed under the Apache License 2.0.