# SSO MCP Server Standards Cheatsheet
Quick reference for coding standards. Full details in `docs/standards.md`.
---
## Naming Conventions
| Element | Convention | Example |
|---------|------------|---------|
| Variables | snake_case | `user_name`, `is_valid` |
| Constants | SCREAMING_SNAKE_CASE | `MAX_RETRIES`, `DEFAULT_PORT` |
| Functions | snake_case, verb-based | `get_checklist()`, `validate_token()` |
| Boolean funcs | is_, has_, should_, can_ | `is_authenticated()`, `has_token()` |
| Classes | PascalCase | `AuthManager`, `TokenStore` |
| Exceptions | PascalCase + Error | `AuthenticationError` |
| Files | snake_case.py | `auth_manager.py` |
| Tests | test_<module>.py | `test_auth_manager.py` |
---
## MCP Tool Standards
```python
@mcp.tool()
async def get_checklist(name: str) -> ChecklistResponse:
"""Retrieve a checklist by name.
Args:
name: Checklist name (e.g., "coding").
Returns:
ChecklistResponse with name, description, content.
Raises:
McpError: If not found or not authenticated.
"""
pass
```
---
## Test Naming
Pattern: `test_<what>_<condition>_<expected>`
```python
def test_get_checklist_with_valid_name_returns_content(): ...
def test_auth_manager_refresh_when_token_expires_soon_succeeds(): ...
```
---
## Git Conventions
**Branches**: `{type}/{issue}-{description}`
- `feature/001-mcp-auth`
- `bugfix/002-token-refresh`
**Commits**: Conventional Commits
```
feat(auth): add token refresh
fix(checklist): handle missing frontmatter
docs(readme): add setup guide
```
---
## Project Structure
```
src/sso_mcp_server/
├── server.py # MCP Server Core
├── config/settings.py # Configuration
├── auth/
│ ├── manager.py # Auth orchestration
│ ├── browser.py # OAuth flow
│ └── token_store.py # Token persistence
├── checklists/
│ ├── service.py # Business logic
│ ├── discovery.py # File discovery
│ └── parser.py # Frontmatter parser
└── tools/
├── get_checklist.py
└── list_checklists.py
```
---
## Commands
```bash
# Lint
uv run ruff check .
# Format
uv run ruff format .
# Test
uv run pytest --cov=src/sso_mcp_server
# Security
uv run bandit -r src/
```
---
## Code Review Checklist
- [ ] Naming conventions followed
- [ ] Type hints on public APIs
- [ ] Tests added/updated (>80% coverage)
- [ ] Docstrings for public functions
- [ ] No security vulnerabilities (bandit)
- [ ] Conventional commit message
---
*Full standards: `docs/standards.md`*