Contributing Guide¶
Thank you for your interest in contributing to litestar-mcp. This guide covers local workspace setup, test and conformance suites, static analysis gates, and the documentation verification pipeline.
Development Setup¶
Prerequisites¶
- Python:
3.10or newer (3.10through3.14supported) uv: Astral's Python package and environment manager- Node.js:
24.18.1(required only when running the official MCP protocol conformance suite viamake conformanceormake conformance-queue)
Clone and Install¶
- Clone the repository:
- Sync all runtime, optional extra, and development dependencies:
make install pins Python 3.10 for the local .venv and runs uv sync --all-extras --dev.
Running Tests & Protocol Conformance¶
Unit, Integration, and Example Suites¶
# Run unit tests, integration tests, and runnable documentation examples
make test
# Run the test suite with parallel coverage reporting
make coverage
# Run a single test module or filter
uv run pytest tests/unit/test_plugin.py -q
MCP 2026-07-28 Protocol Conformance¶
The repository validates protocol compliance against the pinned MCP conformance runner in package-lock.json under both in-process and distributed queue task executors:
# Run MCP 2026-07-28 conformance with the default in-process task executor
make conformance
# Run MCP 2026-07-28 conformance with QueueTaskExecutor (litestar-queues)
make conformance-queue
If nodenv is installed, the Makefile automatically selects Node.js 24.18.1 via NODENV_VERSION; otherwise it uses the active Node.js runtime on PATH.
Code Quality & Static Analysis¶
Run the full linting and type-checking suite before opening a pull request:
# Run ruff check, ruff format, mypy, pyright, and slotscheck
make lint
# Run lint, tests, and coverage together
make check-all
Individual quality gates can also be invoked directly:
| Target | Purpose |
|---|---|
make ruff-check |
Lint litestar_mcp, tests, docs/examples, tools/ci, and tools/docs with Ruff. |
make ruff-format |
Format Python files (Markdown files are excluded to preserve snippet and directive blocks). |
make mypy |
Run strict Mypy type-checking across litestar_mcp and tests. |
make pyright |
Run Pyright type-checking across litestar_mcp and tests. |
make slotscheck |
Verify __slots__ integrity across litestar_mcp. |
make validate-examples |
Verify # start-example / # end-example markers in docs/examples. |
make validate-pep723 |
Validate inline PEP 723 dependency blocks in standalone runnable examples. |
make validate-uvx |
Execute uvx command snippets from the architecture and example guides. |
Documentation Pipeline¶
The documentation site uses static AST extraction for API reference chapters, automated Click CLI introspection, and post-build artifact verification (objects.inv, llms.txt, llms-full.txt, .nojekyll, and legacy HTML redirect stubs).
# 1. Scan 100% of litestar_mcp/** for public docstring and PEP 257 field docstring compliance
make docs-scan
# 2. Regenerate tools/docs/generated/cli-reference.md from the Click command group
make docs-cli
# 3. Build the documentation site and run post-build artifact generation
make docs
# 4. Run the full strict CI gate (docs-scan + CLI check + clean build + postbuild + artifact verifier)
make docs-check
# 5. Serve the documentation locally with live reload
make docs-serve
Coding Standards¶
- Type Annotations: Use modern built-in generics (
list,dict,tuple,set) and PEP 604 union syntax (T | None). Do not addfrom __future__ import annotationsto modules where Litestar or Dishka inspects runtime annotations. - Data Models: Prefer
msgspec.Struct(..., frozen=True, gc=False)for wire payloads and hot-path data structures, and@dataclass(frozen=True)where framework configuration dataclasses are expected. - Docstrings: Use Google-style docstrings on all public modules, classes, methods, and functions. Document dataclass and
msgspec.Structattributes using PEP 257 attribute docstrings ("""Description."""immediately below each field) rather than duplicating anAttributes:table in the class docstring. - No Inline Comments: Explain design intent in module, class, and function docstrings rather than inline code comments.
- Line Length: Keep lines within
120characters.
Pull Request Checklist¶
- Create a feature branch from
main. - Add or update unit tests in
tests/and runnable snippets indocs/examples/for new user-visible behavior. - Verify
make lint,make test, andmake docs-checkpass with zero warnings or errors. - Open a pull request with a clear summary of the motivation, protocol impact, and verification steps.