- Source:
mcp_server/(entry:mcp_server/main.py, services undermcp_server/services/, tools undermcp_server/tools/, utils undermcp_server/utils/, prompts undermcp_server/prompts/). - CLI entry:
main.py(select transport viaMCP_TRANSPORT=stdio|sse). - Tests:
tests/(unit/integration markers; seepytest.ini). - Config:
.env(seeenv.example), project config inpyproject.toml.
- Setup env:
uv sync && source .venv/bin/activate. - Run server (stdio):
uv run main.py. - Run server (SSE):
MCP_TRANSPORT=sse uv run main.py(SSE endpoint handled by FastMCP). - All checks:
bash scripts/run-checks.sh. - Lint/format:
uv run black --check . && uv run isort --check-only . && uv run ruff check .. - Tests:
uv run pytest -voruv run pytest -m "not slow".
ALWAYS make Python dependency changes in pyproject.toml and use uv to make them effective:
- Add dependencies: Edit
pyproject.tomlunder thedependencieslist - Remove dependencies: Remove from
pyproject.tomldependencies list - Update dependencies: Modify version constraints in
pyproject.toml - Apply changes: Run
uv syncto update the virtual environment and lock file
# 1. Edit pyproject.toml to add/remove/update dependencies
# 2. Run uv sync to apply changes
uv sync
# 3. Verify the changes took effect
uv run python -c "import new_package; print('Success')"- Use
pip installdirectly - Edit
uv.lockmanually - Use
requirements.txt(this project usespyproject.toml)
- Use
uv add <package>for adding new dependencies - Use
uv remove <package>for removing dependencies - Use
uv syncto sync the environment with pyproject.toml - Keep
uv.lockin version control for reproducible builds
ALWAYS ensure code quality by running pre-commit checks after modifications:
- After any code changes: Run the comprehensive checks script
- Before committing: Ensure all pre-commit hooks pass
- Format code: Use Black and isort for consistent formatting
- Lint code: Use Ruff for fast linting and auto-fixing
- Type check: Use mypy for static type checking
- Security scan: Use bandit for vulnerability detection
# 1. Make your code changes
# 2. Run comprehensive checks
bash scripts/run-checks.sh
# 3. If issues found, fix them:
./.venv/bin/python -m black . # Format code
./.venv/bin/python -m isort . # Sort imports
./.venv/bin/python -m ruff check --fix . # Fix linting issues
./.venv/bin/python -m mypy mcp_server/ # Check types
# 4. Run checks again to ensure everything passes
bash scripts/run-checks.sh# Install pre-commit hooks
./.venv/bin/python -m pre_commit install
# Run pre-commit on all files
./.venv/bin/python -m pre_commit run --all-files- Commit code without running quality checks
- Ignore linting or type checking errors
- Skip security scanning with bandit
- Leave formatting inconsistencies
- Run
bash scripts/run-checks.shafter code changes - Fix any issues found by the checks
- Ensure Black formatting is applied
- Verify imports are properly sorted with isort
- Check that mypy type checking passes
- Confirm bandit security scan passes
- Python 3.12+, 4‑space indentation, max line length 88.
- Formatting: Black; Imports: isort (profile=black); Lint: Ruff (E,W,F,I,B,C4,UP) with ignores in
pyproject.toml. - Modules: snake_case files; classes PascalCase; functions/vars snake_case; constants UPPER_SNAKE.
- Tool files:
mcp_server/tools/<domain>_tools.py; services:mcp_server/services/dci_<domain>_service.py.
- Framework: pytest (+pytest-asyncio for async).
- Naming: files
test_*.pyor*_test.py; functionstest_*; classesTest*. - Markers:
@pytest.mark.unit,@pytest.mark.integration,@pytest.mark.slow(seepytest.ini). - Run subsets:
uv run pytest -m unitor-m "not slow".
- Commit style observed: short, imperative, lowercase summaries (e.g., "fix authentication", "add /dci/rca prompt"). Keep scope clear and focused.
- PRs: include purpose, key changes, testing notes, and any docs updates. Link issues; add screenshots only if UX/API output changes.
- Ensure
scripts/run-checks.shand tests pass before requesting review.
- Store secrets in
.env; never commit it. Useenv.exampleas a template. - Optional scans:
uv run bandit -r . -f json -o bandit-report.jsonanduv run detect-secrets scan. - Container builds: see
Containerfile/Containerfile.sseif packaging is needed.
NEVER use partner names or company names anywhere in the codebase, including:
- Test files and test data
- Example code and documentation
- Comments and docstrings
- Variable names, function names, or any identifiers
- Configuration files
- Sample data or fixtures
- This is a public repository and partner names should remain confidential
- Partner information should not be exposed in public code
- Use generic names like
test-team,example-pipeline,sample-remoteci - Use placeholder names like
partner-1,company-aif differentiation is needed - Use descriptive generic names like
telco-lab,ran-pipeline(without partner-specific identifiers)
Bad:
team = {"name": "the-company", "id": "team-1"}
pipeline_name = "the-company-ran-4.17"Good:
team = {"name": "test-team", "id": "team-1"}
pipeline_name = "test-pipeline-4.17"- Configuration: Use
pyproject.tomlfor all Python project configuration - Dependencies: All dependencies must be declared in
pyproject.toml - Virtual Environment: Use the
.venvdirectory created byuv - Lock File: Keep
uv.lockupdated and committed - Code Quality: All code must pass pre-commit checks
- Follow existing code patterns in the codebase
- Use type hints where appropriate
- Add docstrings for new functions and classes
- Update
NEWS.mdfor significant changes - Update
README.mdfor user-facing changes - ALWAYS run quality checks before considering work complete