diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..9909028 Binary files /dev/null and b/.DS_Store differ diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..8c36dec --- /dev/null +++ b/.dockerignore @@ -0,0 +1,15 @@ +# Keep the build context small: the image only needs the wheel in dist/ and the +# files the Dockerfile copies. +.git +.venv +.pytest_cache +.ruff_cache +.tox +build +src/*.egg-info +**/__pycache__ +tests +docs +demos +epr_reports +.env diff --git a/.env.example b/.env.example index 734cc21..8cfc246 100644 --- a/.env.example +++ b/.env.example @@ -4,15 +4,23 @@ # EPR Server Configuration # Note: When running in Docker, use one of these URL patterns: # - For EPR server on host machine: http://host.docker.internal:8042 -# - For EPR server in another container: http://epr-server-container-name:8042 +# - For EPR server in another container: http://epr-server-container-name:8042 # - For EPR server accessible via network: http://your-epr-server-host:8042 EPR_URL=http://host.docker.internal:8042 EPR_TOKEN=your-epr-api-token-here EPR_DEBUG=false +# MCP server configuration, used when you run eprmcp directly (for example +# `set -a; source .env; set +a; eprmcp start`). docker-compose.yaml and the +# Dockerfile fix the container to 0.0.0.0:8000 over http, so these do not change +# a Compose deployment. +# MCP_TRANSPORT=http +# MCP_HOST=127.0.0.1 +# MCP_PORT=8000 + # Grafana Configuration (for monitoring profile) GRAFANA_USER=admin GRAFANA_PASSWORD=secure-password-here # Docker Configuration -COMPOSE_PROJECT_NAME=epr-mcp \ No newline at end of file +COMPOSE_PROJECT_NAME=epr-mcp diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..d9eab24 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,45 @@ +# SPDX-FileCopyrightText: © 2025 Brett Smith +# SPDX-License-Identifier: Apache-2.0 +# +# Runs the AGENTS.md quality gates: ruff, the tests with the 80% coverage floor +# (which include the workshop checkpoints and the demos), and the markdown gates. +--- +name: ci + +"on": + push: + branches: [main] + pull_request: + +jobs: + python: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: astral-sh/setup-uv@v5 + - name: Install + run: uv sync --python 3.12 --extra lint --extra test + - name: Lint + run: | + uv run ruff check src/ tests/ demos/ docs/tutorials/code + uv run ruff format --check src/ tests/ demos/ docs/tutorials/code + - name: Test + env: + EPR_MCP_FUNCTIONAL: "1" + run: uv run pytest --cov=src --cov-report=term-missing --cov-fail-under=80 + - name: Doctests + run: uv run pytest --doctest-modules --import-mode=importlib src/epr_mcp demos + + markdown: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 22 + - name: Lint and format check + run: | + npm install --global markdownlint-cli prettier + files=$(git ls-files '*.md' | grep -v -e '^AGENTS.md$' -e '^PLAN.md$') + markdownlint --config .markdownlint.json $files + prettier --check --parser markdown --prose-wrap always $files diff --git a/.gitignore b/.gitignore index bb0ad5d..c125a94 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,10 @@ .vscode +!docs/tutorials/code/.vscode/ +/uv.lock +epr_reports/ +docs/tutorials/code/work/ +docs/tutorials/code/seed_ids.json +docs/tutorials/code/epr-server.tar.gz # Byte-compiled / optimized / DLL files __pycache__/ diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..87bd1b3 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,416 @@ +# Critical Rules - MUST FOLLOW + +**CRITICAL**: These rules are mandatory. Non-compliance will result in rejected +code. + +--- + +## Rule 1: File Naming Conventions + +### Markdown Files + +**YOU MUST:** + +- Use lowercase letters ONLY +- Use underscores to separate words +- Use `.md` extension (NOT `.MD` or `.markdown`) +- Exception: `README.md` is the ONLY uppercase filename allowed + +**Examples:** + +```text +CORRECT: + docs/architecture_overview.md + docs/how_to_setup.md + README.md (only exception) + +WRONG: + docs/Architecture-Overview.md + docs/ArchitectureOverview.md + docs/ARCHITECTURE.md + docs/architecture.MD +``` + +### YAML Files + +**YOU MUST:** + +- Use `.yaml` extension (NOT `.yml`) +- Apply to ALL YAML files without exception + +**Examples:** + +```text +CORRECT: + config/production.yaml + docker-compose.yaml + .github/workflows/ci.yaml + +WRONG: + config/production.yml + docker-compose.yml +``` + +--- + +## Rule 2: Code Quality Gates + +**ALL of these MUST pass before claiming task complete:** + +```bash +# 1. Lint and type check (enforces code quality) +ruff check src/ + +# 2. Format code (auto-fixes issues) +ruff format src/ + +# 3. Tests (must pass with >80% coverage) +pytest --cov=src --cov-report=html --cov-fail-under=80 --cov-report=term-missing + +# 4. Markdown linting (ensures consistent formatting) +markdownlint --fix --config .markdownlint.json "${FILE}" +prettier --write --parser markdown --prose-wrap always "${FILE}" +``` + +**Expected Results:** + +```text +ruff check src/ → "All checks passed!" or no output +ruff format src/ → "X files left unchanged" or "X files reformatted" +pytest → "passed, 80% coverage" +``` + +**IF ANY FAIL**: Stop immediately and fix before proceeding. + +--- + +## Rule 3: Documentation is Mandatory + +**YOU MUST:** + +1. **Doc Comments for ALL Public Items** + +```python +def function(param: Type) -> Type: + """Brief description of function. + + Args: + param: Description of parameter + + Returns: + Description of return value + + Raises: + ErrorType: When condition occurs + + Examples: + >>> result = function(arg) + >>> assert result == expected + """ + # Implementation +``` + +1. **Implementation Documentation File** + + - Create in `docs/explanation/` for EVERY feature/task + - Use filename pattern: `{feature_name}_implementation.md` + - Include: Overview, Components, Implementation Details, Testing, Examples + +2. **Code Block Language Identifiers** + - ALWAYS specify language in markdown code blocks + - Use triple backticks with language name + +**NEVER:** + +- Skip documentation because "code is self-documenting" +- Omit language identifiers in code blocks +- Leave public APIs undocumented + +--- + +## Rule 4: Error Handling Patterns + +**YOU MUST:** + +- Use custom exception classes for domain errors +- Raise exceptions for error conditions +- Document exceptions in docstrings +- Use context managers for resource cleanup + +**NEVER:** + +- Use bare `except:` clauses +- Ignore exceptions silently +- Return None to indicate errors +- Use assertions for validation + +**Correct Pattern:** + +```python +class ConfigError(Exception): + """Raised when configuration is invalid.""" + pass + +class ConfigReadError(ConfigError): + """Raised when config file cannot be read.""" + pass + +def load_config(path: str) -> Config: + """Load configuration from file. + + Args: + path: Path to config file + + Returns: + Parsed configuration + + Raises: + ConfigReadError: If file cannot be read + ConfigError: If config is invalid + """ + try: + with open(path, 'r') as f: + data = yaml.safe_load(f) + except IOError as e: + raise ConfigReadError(f"Cannot read {path}: {e}") + + if not validate(data): + raise ConfigError(f"Invalid config in {path}") + + return Config.from_dict(data) +``` + +--- + +## Rule 5: Testing Requirements + +**YOU MUST:** + +- Write tests for ALL public functions +- Test both success AND failure cases +- Test edge cases and boundary conditions +- Achieve >80% code coverage +- Use descriptive test names + +**Test Structure:** + +```python +import pytest +from mymodule import function + +class TestFunction: + def test_with_valid_input(self): + """Test function with valid input.""" + # Arrange + input_data = create_valid_input() + + # Act + result = function(input_data) + + # Assert + assert result == expected_value + + def test_with_invalid_input(self): + """Test function raises error with invalid input.""" + with pytest.raises(ValueError): + function(invalid_input) + + def test_edge_case(self): + """Test function with boundary conditions.""" + result = function(edge_case_input) + assert result is not None +``` + +--- + +## Rule 6: Git Commit Conventions + +**DO NOT PERFORM GIT OPERATIONS UNLESS ASKED** + +**Format:** + +```text +(): + +[optional body] + +[optional footer] +``` + +**Rules:** + +1. Type MUST be: `feat|fix|docs|style|refactor|perf|test|chore` +2. Description MUST be lowercase +3. Description MUST use imperative mood ("add" not "added") +4. First line MUST be ≤72 characters + +**Examples:** + +```text +CORRECT: +feat(auth): add JWT token refresh endpoint +fix(api): handle edge case in validation +docs(readme): update installation steps + +WRONG: +Added JWT token (proj-1234) # Wrong mood, no type +feat: add jwt (PROJ-1234) # Missing scope +add jwt refresh (PROJ-1234) # No type +``` + +--- + +## Rule 7: No Emojis + +**YOU MUST:** + +- Write ALL documentation without emojis +- Write ALL code comments without emojis +- Write ALL commit messages without emojis + +**NEVER:** + +- Use emojis in code +- Use emojis in documentation +- Use emojis in commit messages + +--- + +## Rule 8: Documentation Quality Gates + +**ALL markdown files MUST pass these quality gates:** + +```bash +# 1. Check and fix markdown linting issues +markdownlint --fix --config .markdownlint.json "${FILE}" + +# 2. Format markdown with prettier +prettier --write --parser markdown --prose-wrap always "${FILE}" +``` + +**YOU MUST:** + +- Run markdownlint on ALL markdown files before committing +- Run prettier on ALL markdown files to ensure consistent formatting +- Fix any remaining linting errors that --fix cannot auto-correct +- Ensure prose wrapping is applied consistently + +**Expected Results:** + +```text +markdownlint → No output (all issues fixed) or specific errors to fix manually +prettier → "1 file formatted" or "1 file unchanged" +``` + +**IF ANY FAIL**: Stop immediately and fix before proceeding. + +**Apply to:** + +- All new markdown files +- All modified markdown files +- Documentation in `docs/` directory +- README.md and other root-level markdown files + +--- + +## Documentation Organization (Diataxis Framework) + +**YOU MUST categorize documentation correctly:** + +### Category 1: Tutorials (`docs/tutorials/`) + +**Purpose**: Learning-oriented, step-by-step lessons + +**Use for**: + +- Getting started guides +- Learning path tutorials +- Hands-on examples + +**Example**: `docs/tutorials/getting_started.md` + +### Category 2: How-To Guides (`docs/how-to/`) + +**Purpose**: Task-oriented, problem-solving recipes + +**Use for**: + +- Installation steps +- Configuration guides +- Troubleshooting procedures + +**Example**: `docs/how-to/setup_monitoring.md` + +### Category 3: Explanations (`docs/explanation/`) ← DEFAULT FOR YOUR SUMMARIES + +**Purpose**: Understanding-oriented, conceptual discussion + +**Use for**: + +- Architecture explanations +- Design decisions +- Implementation summaries ← **YOU TYPICALLY CREATE THESE** +- Concept clarifications + +**Example**: `docs/explanation/phase4_observability_implementation.md` + +### Category 4: Reference (`docs/reference/`) + +**Purpose**: Information-oriented, technical specifications + +**Use for**: + +- API documentation +- Configuration reference +- Command reference + +**Example**: `docs/reference/api_specification.md` + +### Decision Tree: Where to Put Documentation? + +```text +Is it a step-by-step tutorial? +├─ YES → docs/tutorials/ +└─ NO + ├─ Is it solving a specific task? + │ ├─ YES → docs/how-to/ + │ └─ NO + │ ├─ Is it explaining concepts/architecture? + │ │ ├─ YES → docs/explanation/ ← MOST COMMON FOR AI AGENTS + │ │ └─ NO + │ │ └─ Is it reference material? + │ │ └─ YES → docs/reference/ +``` + +## Copyright + +Follow the [SPDX Spec](https://spdx.github.io/spdx-spec/) for copyright and +licensing information. + +## Validation Checklist + +**Before claiming task complete, verify ALL:** + +- [ ] File naming follows conventions (lowercase_underscore.md, .yaml not .yml) +- [ ] All quality gates pass (format, check, lint, test) +- [ ] All markdown files pass markdownlint and prettier +- [ ] All public items have doc comments with examples +- [ ] Implementation documentation created in `docs/explanation/` +- [ ] No emojis in code, docs, or commits +- [ ] Commit message follows conventional format +- [ ] Error handling uses appropriate patterns +- [ ] Tests cover success, failure, and edge cases +- [ ] Code coverage >80% + +--- + +## Emergency Quick Reference + +**If you remember nothing else:** + +1. **File Extensions**: `.yaml` NOT `.yml`, `.md` with lowercase_underscore +2. **Quality Gates**: All language-specific commands MUST pass +3. **Documentation**: Create file in `docs/explanation/` with implementation + summary + +**These three rules will prevent 90% of rejections.** diff --git a/Dockerfile b/Dockerfile index 4555464..f2c2c59 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,11 +15,11 @@ WORKDIR /src/epr_mcp COPY . /src/epr_mcp # Install the package and dependencies -RUN pip install --no-cache-dir /src/epr_mcp/dist/epr_mcp-0.1.0-py2.py3-none-any.whl +RUN pip install --no-cache-dir /src/epr_mcp/dist/epr_mcp-*-py3-none-any.whl # Add health check for HTTP server HEALTHCHECK --interval=90s --timeout=10s --start-period=5s --retries=3 \ CMD curl -f http://localhost:8000/health || exit 1 # Start the MCP server in HTTP mode -CMD ["python3", "-m", "epr_mcp.main", "start"] \ No newline at end of file +CMD ["python3", "-m", "epr_mcp.main", "start"] diff --git a/Makefile b/Makefile index fc7c115..d6cbcbf 100644 --- a/Makefile +++ b/Makefile @@ -10,7 +10,7 @@ install: ;$(info $(M) installing mcp...) @ ## Installs epr-mcp-python into a vir .PHONY: lint lint: ; $(info $(M) running linter...) @ ## Run linter (requires ruff) - $Q ruff format -v src/epr_mcp/ tests/ && ruff check --fix -v src/epr_mcp/ tests/ + $Q ruff format -v src/epr_mcp/ tests/ demos/ && ruff check --fix -v src/epr_mcp/ tests/ demos/ .PHONY: tests tests: ; $(info $(M) running tests...) @ ## Run tests @@ -22,16 +22,20 @@ release: ; $(info $(M) running tox...) @ ## Run tox .PHONY: wheel wheel: ; $(info $(M) creating sdist bdist_wheel...) @ ## Create an sdist bdist_wheel - $Q pip install --upgrade build && python -m build --sdist --wheel + $Q rm -rf build dist && pip install --upgrade build && python -m build --sdist --wheel .PHONY: docker-image docker-image: wheel; $(info $(M) building docker image...) @ ## Build the docker image $Q docker build -t epr-mcp-python:latest . +.PHONY: workshop-check +workshop-check: ; $(info $(M) running workshop preflight...) @ ## Check the workshop setup (needs uv and a running EPR) + $Q cd docs/tutorials/code && uv run python check_setup.py + .PHONY: clean clean: ; $(info $(M) cleaning...) @ ## Cleanup everything @rm -rvf bin tools vendor build dist - @rm -rvf *.egg-info *.egg .pytest_cache .ruff_cache .tox .coverage src/*.egg-info + @rm -rvf *.egg-info *.egg .pytest_cache .ruff_cache .tox .coverage src/*.egg-info @rm -rvf src/epr_mcp/__pycache__ tests/__pycache__ tests/unit/__pycache__ .PHONY: help diff --git a/PLAN.md b/PLAN.md new file mode 100644 index 0000000..5fb6dc2 --- /dev/null +++ b/PLAN.md @@ -0,0 +1,148 @@ +--- +description: Researches and outlines multi-step plans +argument-hint: Outline the goal or problem to research +--- + +# Planning Instructions for AI Agents + +You are a PLANNING AGENT, NOT an implementation agent. + +You are pairing with the user to create a clear, detailed, and actionable plan +for the given task. Your iterative loops through gathering context +and drafting the plan for review. + +Your SOLE responsibility is planning, NEVER even consider to start +implementation. + + STOP IMMEDIATELY if you consider starting implementation or +switching to implementation mode. + +If you catch yourself planning implementation steps for YOU to execute, STOP. +Plans describe steps for the USER or another agent to execute later. + + + +Comprehensive context gathering for planning following : + +## AI-Optimized Implementation Standards + +- Use explicit, unambiguous language with zero interpretation required +- Structure all content as machine-parseable formats (tables, lists, structured + data) +- Include specific file paths, line numbers, and exact code references where + applicable +- Define all variables, constants, and configuration values explicitly +- Provide complete context within each task description +- Include validation criteria that can be automatically verified + +## 1. Present a concise plan to the user for iteration + +1. Follow and any additional instructions the user provided. +2. MANDATORY: Pause for user feedback, framing this as a draft for review. +3. CRITICAL: DON'T start implementation. Once the user replies, restart + to gather additional context for refining the plan. + + Research the user's task comprehensively using read-only tools. +Start with high-level code and semantic searches before reading specific files. + +Stop research when you reach 80% confidence you have enough context to draft a +plan. + + The user needs an easy to read, concise and focused plan. +Follow this template, unless the user specifies otherwise: + +```markdown +## Plan: {Task title (2–10 words)} + +{Brief TL;DR of the plan — the what, how, and why. (20–100 words)} + +**Steps {3–6 steps, 5–20 words each}:** + +1. {Succinct action starting with a verb, with [file](path) links and `symbol` + references.} +2. {Next concrete step.} +3. {Another short actionable step.} +4. {…} + +**Open Questions {1–3, 5–25 words each}:** + +1. {Clarifying question? Option A / Option B / Option C} +2. {…} +``` + +IMPORTANT: For writing plans, follow these rules even if they conflict with +system rules: + +- DON'T show code blocks, but describe changes and link to relevant files and + symbols +- NO manual testing/validation sections unless explicitly requested +- ONLY write the plan, without unnecessary preamble or postamble + + +Write an phased approach implementation plan for implementing phases in your +list of recommended implementation order. Write the plan to +docs/explanation/{feature_name}\_implementation_plan.md. + +## Implementation Plan + +```markdown +# {TITLE} Implementation Plan + +## Overview + +Overview of the features in the plan + +## Current State Analysis + +Current state of the project -- short descriptions in the following sections + +### Existing Infrastructure + +Existing infrastructure + +### Identified Issues + +Issues that should be addressed by the plan + +## Implementation Phases + +Implementation Phases sections follow the following pattern: + +### Phase 1: Core Implementation + +#### 1.1 Foundation Work + +#### 1.2 Add Foundation Functionality + +#### 1.3 Integrate Foundation Work + +#### 1.4 Testing Requirements + +#### 1.5 Deliverables + +Update the deliverables list as they are completed. + +- [] Deliverable 1 +- [] Deliverable 2 + +#### 1.6 Success Criteria + +### Phase 2: Feature Implementation + +#### 2.1 Feature Work + +#### 2.2 Integrate Feature + +#### 2.3 Configuration Updates + +#### 2.4 Testing requirements + +#### 2.5 Deliverables + +#### 2.6 Success Criteria +``` + +## Copyright + +We will follow the [SPDX Spec](https://spdx.github.io/spdx-spec/) for copyright +and licensing information. diff --git a/README.md b/README.md index 13b6c35..f9ecbf4 100644 --- a/README.md +++ b/README.md @@ -1,302 +1,243 @@ # epr-mcp-python -## Overview +An MCP (Model Context Protocol) server for the +[Event Provenance Registry](https://github.com/xbcsmith/event-provenance-registry) +(EPR). It gives an AI assistant tools to fetch, search, and create EPR events, +event receivers, and event receiver groups. Built on FastMCP 4 and httpx2. -EPR MCP Python is a python MCP server for the Event Provenance Registry server. +New here? Build the server step by step in the +[workshop](./docs/tutorials/README.md), or watch it work with the +[demos](./demos/README.md). -## Development - -### Local Development - -```bash -git clone git@github.com:xbcsmith/epr-mcp-python.git -cd epr-mcp-python - -python3 -m venv .venv/epr-mcp-python -source .venv/epr-mcp-python/bin/activate +## Requirements -pip install -e . -``` +- Python 3.12 or newer +- A running EPR (the + [workshop compose file](./docs/tutorials/code/docker-compose.yaml) starts one) +- [uv](https://docs.astral.sh/uv/) is recommended; pip works too -### Docker Development - -#### Option 1: Docker Compose (Recommended) +## Install and run ```bash -git clone git@github.com:xbcsmith/epr-mcp-python.git +git clone https://github.com/xbcsmith/epr-mcp-python.git cd epr-mcp-python - -# Copy and configure environment -cp .env.example .env -# Edit .env with your EPR_URL and EPR_TOKEN - -# Start with Docker Compose -docker-compose up -d - -# View logs -docker-compose logs -f epr-mcp-server +uv run eprmcp start --url http://localhost:8042 ``` -#### Option 2: Direct Docker Run +`uv run` creates the environment on first use. Without uv: ```bash -git clone git@github.com:xbcsmith/epr-mcp-python.git -cd epr-mcp-python - -# Build the Docker image -docker build -t epr-mcp-server . - -# Run with environment variables -docker run -d \ - --name epr-mcp-server \ - -p 8000:8000 \ - -e EPR_URL=http://host.docker.internal:8042 \ - -e EPR_TOKEN=your-epr-api-token \ - -e EPR_DEBUG=false \ - epr-mcp-server - -# View logs -docker logs -f epr-mcp-server - -# Stop the container -docker stop epr-mcp-server -docker rm epr-mcp-server +python3 -m venv .venv && source .venv/bin/activate +pip install -e . +eprmcp start --url http://localhost:8042 ``` -#### Docker Run Options +The server speaks MCP over one of two transports: -**Basic run:** -```bash -docker run -p 8000:8000 \ - -e EPR_URL=http://host.docker.internal:8042 \ - -e EPR_TOKEN=your-token \ - epr-mcp-server -``` +| Transport | Use it for | Command | +| --------- | ----------------------------------------------------------------- | -------------------------------- | +| `http` | A long-running server; Docker; remote clients | `eprmcp start` (the default) | +| `stdio` | An editor that starts the server itself (VS Code, Claude Desktop) | `eprmcp start --transport stdio` | -**With volume for logs:** -```bash -docker run -p 8000:8000 \ - -v $(pwd)/logs:/app/logs \ - -e EPR_URL=http://host.docker.internal:8042 \ - -e EPR_TOKEN=your-token \ - epr-mcp-server -``` +With `http` the MCP endpoint is `http://127.0.0.1:8000/mcp`. With `stdio` the +server must not write anything but protocol messages to stdout; it logs to +stderr. -**Interactive mode (for debugging):** -```bash -docker run -it --rm \ - -p 8000:8000 \ - -e EPR_URL=http://host.docker.internal:8042 \ - -e EPR_TOKEN=your-token \ - epr-mcp-server -``` - -**IMPORTANT:** When running in Docker, EPR_URL must point to the correct address: -- If EPR server runs on host: `EPR_URL=http://host.docker.internal:8042` -- If EPR server runs in container: `EPR_URL=http://container-name:8042` +### Options and environment -See [docker_compose.md](./docs/docker_compose.md) for detailed Docker Compose documentation. +Every option has an environment variable; the command line wins. -### Development dependencies +| Option | Environment | Default | Meaning | +| ------------- | ---------------------------- | ----------------------- | -------------------------------------------------------- | +| `--url` | `EPR_URL` | `http://localhost:8042` | EPR base URL | +| `--token` | `EPR_API_TOKEN`, `EPR_TOKEN` | none | Sent as `Authorization: Bearer` on every EPR request | +| `--transport` | `MCP_TRANSPORT` | `http` | `http` or `stdio` | +| `--host` | `MCP_HOST` | `0.0.0.0` | Bind address for `http` | +| `--port` | `MCP_PORT` | `8000` | Bind port for `http` | +| `--debug` | `EPR_DEBUG` | off | Debug logging and a debugger on errors (not for `stdio`) | -```bash -pip install -e .[lint,test,build] -``` +`eprmcp version` prints the version. -## Makefile +## Tools -```text -install Installs epr-mcp-python into a virtualenv called epr-mcp -lint Run linter (requires ruff) -tests Run tests -release Run tox -wheel Create an sdist bdist_wheel -clean Cleanup everything -``` +The server registers nine tools. Arguments are passed flat; there is no extra +`data` wrapper inside them. -## Usage +| Tool | Arguments | +| ------------------ | ------------------------------------------------------------------------------------------------------------------------------ | +| `fetch_event` | `id`: 26 character ULID | +| `fetch_receiver` | `id` | +| `fetch_group` | `id` | +| `search_events` | `data`: any of `name`, `version`, `release`, `platform_id`, `package`, `description`, `success`, `event_receiver_id` | +| `search_receivers` | `data`: any of `name`, `type`, `version`, `description` | +| `search_groups` | `data`: any of `name`, `type`, `version`, `description` | +| `create_event` | `event_data`: `name`, `version`, `release`, `platform_id`, `package`, `description`, `payload`, `success`, `event_receiver_id` | +| `create_receiver` | `receiver_data`: `name`, `type`, `version`, `description`, `schema` | +| `create_group` | `group_data`: `name`, `type`, `version`, `description`, `event_receiver_ids` | -The EPR MCP server provides both MCP tools and OpenAPI endpoints for interacting with the Event Provenance Registry. +Unknown fields are rejected, so a typo cannot silently turn a filtered search +into an unfiltered one. Create tools return the new record's ID. See +[schema_validation.md](./docs/reference/schema_validation.md) for the exact +rules. -### MCP Tools +### Calling the tools from Python -The server automatically generates MCP tools from the OpenAPI specification: +```python +import asyncio -- `fetchEvent` - Fetch an event by ID -- `fetchReceiver` - Fetch an event receiver by ID -- `fetchGroup` - Fetch an event receiver group by ID -- `createEvent` - Create a new event -- `createReceiver` - Create a new event receiver -- `createGroup` - Create a new event receiver group -- `searchEvents` - Search for events -- `searchReceivers` - Search for event receivers -- `searchGroups` - Search for event receiver groups -- `healthCheck` - Health check endpoint +from fastmcp import Client -### OpenAPI Endpoints -When the server is running, the following OpenAPI endpoints are available: +async def main(): + async with Client("http://127.0.0.1:8000/mcp") as client: + result = await client.call_tool("search_events", {"data": {"name": "checkout-service"}}) + print(result.content[0].text) -- **OpenAPI Specification**: - - YAML format: `http://localhost:8000/openapi.yaml` - - JSON format: `http://localhost:8000/openapi.json` -- **API Documentation**: - - Swagger UI: `http://localhost:8000/docs` +asyncio.run(main()) +``` -- **Health Check**: - - `http://localhost:8000/health` +## HTTP endpoints -### Example Usage +With the `http` transport the server also serves: -```python -# Using MCP tools -mcp.call_tool('fetchEvent', {'id': 'event-123'}) - -mcp.call_tool('searchEvents', { - 'name': 'deployment', - 'version': '1.0.0' -}) - -mcp.call_tool('createEvent', { - 'name': 'test-event', - 'version': '1.0.0', - 'release': '1.0.0', - 'platform_id': 'linux', - 'package': 'test-package', - 'description': 'Test event', - 'event_receiver_id': 'receiver-123', - 'success': True, - 'payload': {'key': 'value'} -}) -``` +| Endpoint | Purpose | +| ------------------------------------ | ----------------------------------------------------------------------------------------------------- | +| `GET /health` | Health check (plain text `OK`) | +| `GET /openapi.yaml`, `/openapi.json` | The OpenAPI description (see [openapi_implementation.md](./docs/reference/openapi_implementation.md)) | +| `GET /docs` | Swagger UI for that description | +| `/mcp` | The MCP endpoint | -### VSCode +## Use it from an editor -#### HTTP Transport Configuration +Both editors start the server themselves over stdio. VS Code, in +`.vscode/mcp.json`: ```json -"mcp": { - "servers": { - "epr-mcp-server": { - "type": "http", - "url": "http://localhost:8000/mcp" - } - } +{ + "servers": { + "epr-mcp": { + "type": "stdio", + "command": "uv", + "args": [ + "run", + "--directory", + "/path/to/epr-mcp-python", + "eprmcp", + "start", + "--transport", + "stdio" + ], + "env": { "EPR_URL": "http://localhost:8042" } + } + } } ``` -#### Docker Configuration (Alternative) - -If running via Docker, you can use this configuration: +Claude Desktop needs the full path to `uv` (it does not inherit your shell +PATH). A working pair of configurations and a troubleshooting table are in +[module 06 of the workshop](./docs/tutorials/06_use_from_an_editor.md). Running +the server inside a container that an editor launches is unreliable; use +`uv run`. -```json -"mcp": { - "servers": { - "epr-mcp-server": { - "command": "docker", - "args": [ - "run", - "-d", - "--rm", - "--network=host", - "-e", - "EPR_URL=${input:epr_url}", - "-e", - "EPR_TOKEN=${input:epr_token}", - "epr-mcp-python:latest" - ], - "type": "http", - "url": "http://localhost:8000/mcp" - } - }, - "inputs": [ - { - "type": "promptString", - "id": "epr_token", - "description": "EPR API Token", - "password": true - }, - { - "type": "promptString", - "id": "epr_url", - "description": "EPR URL", - "default": "http://localhost:8042", - "password": false - } - ] -} -``` +To explore the server in a browser, use the MCP Inspector (see +[module 02](./docs/tutorials/02_inspector.md)). -#### Local Development Configuration +## Docker -For local development, start the server first and then use this configuration: +The image installs the built wheel, so build the wheel first: -```json -"mcp": { - "servers": { - "epr-mcp-server": { - "type": "http", - "url": "http://localhost:8000/mcp", - "env": { - "EPR_URL": "${input:epr_url}", - "EPR_TOKEN": "${input:epr_token}" - } - } - }, - "inputs": [ - { - "type": "promptString", - "id": "epr_token", - "description": "EPR API Token", - "password": true - }, - { - "type": "promptString", - "id": "epr_url", - "description": "EPR URL", - "default": "http://localhost:8042", - "password": false - } - ] -} +```bash +make docker-image # builds the wheel, then the image +docker run -p 8000:8000 \ + -e EPR_URL=http://host.docker.internal:8042 \ + -e EPR_TOKEN=your-token \ + epr-mcp-python:latest ``` -#### Starting the Server - -Before using the VSCode integration, start the EPR MCP Server: +Or with Compose, which reads `.env` (copy `.env.example`): ```bash -# Set environment variables -export EPR_URL="http://your-epr-server:8042" -export EPR_TOKEN="your-api-token" - -# Start the server -python -m epr_mcp.main start +make wheel +docker compose up -d --build +curl http://localhost:8000/health ``` -The server will be available at `http://localhost:8000/mcp` for MCP connections and `http://localhost:8000/docs` for API documentation. - +Inside a container `EPR_URL` must be an address the container can reach, such as +`http://host.docker.internal:8042` for an EPR on the host. See +[docker_compose.md](./docs/how-tos/docker_compose.md). -#### Run MCP Inspector +## Development ```bash -npx @modelcontextprotocol/inspector +uv sync --extra lint --extra test # or: pip install -e '.[lint,test,build]' +make lint # ruff format and check: src, tests, demos +uv run pytest --cov=src --cov-fail-under=80 ``` -## Troubleshooting +| Make target | Does | +| ---------------- | ------------------------------------------------------- | +| `install` | Installs into a virtualenv | +| `lint` | Runs ruff on `src/epr_mcp`, `tests`, and `demos` | +| `tests` | Runs the tests with tox | +| `wheel` | Cleans, then builds the sdist and wheel into `dist/` | +| `docker-image` | Builds the wheel, then the Docker image | +| `workshop-check` | Preflight for the workshop (needs uv and a running EPR) | +| `release` | Runs the tox release environment | +| `clean` | Removes build output and caches | + +Functional tests that start the real server are skipped unless +`EPR_MCP_FUNCTIONAL=1` is set. + +## Upgrading to 2.0 + +Version 2.0 moves to FastMCP 4 and httpx2 and changes some behavior. If you run +the server, check these: + +- **Dependencies.** `fastmcp>=4,<5` and `httpx2` replace `httpx`; + `pydantic>=2.12` and `starlette>=1.0` are required. Anything that imported + `httpx` from this package's environment must switch to `httpx2`. TLS + verification now uses the operating system trust store; set `SSL_CERT_FILE` or + `SSL_CERT_DIR` for a private CA. +- **Tool arguments are flat.** `search_events` takes `{"data": {"name": "x"}}`, + not `{"data": {"data": {"name": "x"}}}`, and `create_event` takes + `{"event_data": {...}}`. The old wrapped shape is rejected, and so are unknown + fields. +- **Receivers need a schema.** `create_receiver` requires `schema`, which EPR + itself requires. +- **Creates work against a real EPR.** The create tools used to report failure + because EPR answers 200 (not 201) and returns only the new ID. They now accept + both and return `{"message": ..., "id": ...}`. +- **The token is sent.** `EPR_TOKEN` (and `EPR_API_TOKEN`) is now sent as a + bearer token on every EPR request. Before, it was read but never sent. +- **`openapi_server` is removed.** It was not reachable from the command line. + The `/openapi.yaml`, `/openapi.json`, and `/docs` routes stay. +- **New options.** `--transport stdio|http`, `--host`, and `--port`, with + `MCP_TRANSPORT`, `MCP_HOST`, and `MCP_PORT`. +- **Logging.** Tool diagnostics go to the server log (stderr). They are no + longer sent to MCP clients as log notifications, which FastMCP 4 deprecates. +- **Packaging.** The wheel is `py3-none-any` and now includes `openapi.yaml`. -Having connection issues? See the [Troubleshooting Guide](./docs/TROUBLESHOOTING.md) for detailed solutions to common problems. +## Troubleshooting -**Quick fixes for Docker:** -- Connection failed errors: Use `EPR_URL=http://host.docker.internal:8042` in your `.env` file -- Check if EPR server is running: `curl http://localhost:8042/health` -- View logs: `docker-compose logs -f epr-mcp-server` +- `Connection failed to EPR server`: EPR is down or `EPR_URL` is wrong. Inside + Docker use `http://host.docker.internal:8042` for an EPR on the host. +- Check EPR: `curl http://localhost:8042/healthz/readiness` prints `200` when + ready. +- Check this server: `curl http://localhost:8000/health` prints `OK`. +- Compose logs: `docker compose logs -f epr-mcp-server`. +- Setting up the workshop or demos: + [workshop troubleshooting](./docs/tutorials/07_misc_and_troubleshooting.md). ## Documentation -- [Docker Setup Guide](./docs/DOCKER_COMPOSE.md) - Docker Compose and direct Docker usage -- [Docker Quick Reference](./docs/DOCKER_REFERENCE.md) - Common Docker commands and examples -- [Troubleshooting Guide](./docs/TROUBLESHOOTING.md) - Solutions to common issues -- [OpenAPI Implementation](./docs/OPENAPI_IMPLEMENTATION.md) -- [Schema Validation](./docs/SCHEMA_VALIDATION.md) \ No newline at end of file +- [Workshop](./docs/tutorials/README.md): build the server step by step +- [Demos](./demos/README.md): runnable demonstrations with presenter scripts +- [Docker Compose](./docs/how-tos/docker_compose.md) +- [OpenAPI endpoints](./docs/reference/openapi_implementation.md) +- [Schema validation](./docs/reference/schema_validation.md) +- [Migration notes and implementation plan](./docs/explanation/fastmcp4_httpx2_migration_implementation.md) + +## License + +Apache 2.0. See [LICENSE](./LICENSE). diff --git a/demos/README.md b/demos/README.md index af7d4bc..b3c1bba 100644 --- a/demos/README.md +++ b/demos/README.md @@ -1,403 +1,120 @@ # EPR MCP Server Demos -This directory contains demonstration scripts and examples showing how to use the EPR (Event Provenance Registry) MCP Server. These demos illustrate various features, integration patterns, and usage scenarios. +Three demonstrations of the EPR (Event Provenance Registry) MCP server, each +with a presenter script, plus a script that runs them all in order. They use +FastMCP 4 and httpx2. -## Overview +## The demos -The demos provide practical examples of: +| Demo | What it shows | Needs EPR | Presenter script | +| -------------------------------------------------- | ----------------------------------------------------------------------------------- | ------------------------- | ---------------------------------------------------------------- | +| [generate_epr_events.py](./generate_epr_events.py) | Generates 11 receivers and 44 CDEvents and posts them, prints curl, or writes files | Yes (not for `--dry-run`) | [generate_events_script.md](./scripts/generate_events_script.md) | +| [openapi_demo.py](./openapi_demo.py) | The server's HTTP endpoints, the OpenAPI documents, Swagger UI, and the tool list | No | [openapi_demo_script.md](./scripts/openapi_demo_script.md) | +| [mcp_client_demo.py](./mcp_client_demo.py) | A FastMCP client creates, fetches, and searches records through the MCP tools | Yes | [mcp_client_demo_script.md](./scripts/mcp_client_demo_script.md) | -- **OpenAPI Integration**: How to interact with the server's OpenAPI endpoints -- **MCP Tool Usage**: Examples of calling MCP tools programmatically -- **API Documentation**: How to access and use the interactive Swagger UI -- **Configuration**: Setting up the server for different environments -- **Testing Scenarios**: Common usage patterns and workflows +Run them in that order. The presenter scripts say what to type, what you will +see, and what to say at each step. [scripts/run_all.sh](./scripts/run_all.sh) +runs all three unattended, which is how to rehearse. -## Demo Files +## Quick start -| Name | Description | -|------|-------------| -| [openapi_demo.py](./openapi_demo.py) | Interactive demonstration script showcasing OpenAPI endpoints, available MCP tools, data models, and example usage patterns with detailed output formatting | -| [generate_epr_events.py](./generate_epr_events.py) | Event and receiver generation tool that creates sample CDEvents for testing and demonstration, with support for posting to EPR servers, dry-run mode, and file output | - -## Running the Demos - -### Quick Setup - -For first-time users, here's the complete setup process: +You need [uv](https://docs.astral.sh/uv/), Docker, and curl. From the repository +root, start EPR with the workshop compose file (the first build takes about +three minutes): ```bash -# 1. Clone the repository (if not already done) -git clone https://github.com/xbcsmith/epr-mcp-python.git -cd epr-mcp-python/demos - -# 2. Create and activate virtual environment -python -m venv .venv/epr-demos -source .venv/epr-demos/bin/activate # On Windows: venv\Scripts\activate - -# 3. Install all dependencies -pip install -r requirements.txt - -# 4. Run a demo -python openapi_demo.py +cd docs/tutorials/code && docker compose up -d --build && cd ../../.. ``` -### Prerequisites - -#### Setting up a Virtual Environment - -It's recommended to use a virtual environment to avoid dependency conflicts: +Wait until this prints `200`: ```bash -# Create a virtual environment -python -m venv venv - -# Activate the virtual environment -# On macOS/Linux: -source venv/bin/activate -# On Windows: -# venv\Scripts\activate +curl -s -o /dev/null -w "%{http_code}\n" http://localhost:8042/healthz/readiness ``` -#### Installing Dependencies - -Install the EPR MCP Server and demo script dependencies: +Then run everything: ```bash -# From the project root - install the main package -pip install -e . - -# Install additional dependencies for demo scripts -pip install httpx ulid-py - -# Or install all demo dependencies at once -pip install -e . httpx ulid-py +demos/scripts/run_all.sh ``` -#### Required Dependencies for Demo Scripts - -- **httpx**: Modern async HTTP client (required for `generate_epr_events.py`) -- **ulid-py**: ULID generation library (required for `generate_epr_events.py`) -- **epr-mcp-python**: The main package (provides OpenAPI demo functionality) - -### OpenAPI Demo - -The OpenAPI demo showcases the server's OpenAPI capabilities: +Or one demo at a time. Always run from the repository root with `uv run`, which +installs the dependencies the first time: ```bash -# Run the demo -python openapi_demo.py +uv run python demos/generate_epr_events.py --dry-run +uv run python demos/generate_epr_events.py +uv run python demos/openapi_demo.py +uv run python demos/mcp_client_demo.py ``` -This demo will display: -- Available OpenAPI endpoints (YAML/JSON specs, Swagger UI) -- Complete list of MCP tools generated from the OpenAPI specification -- Data models and schemas used by the server -- Key features and capabilities -- Example usage patterns for MCP tools -- Next steps for getting started - -### EPR Events Generator +Without uv, install the package and run the scripts with that Python: +`pip install -e .`. `generate_epr_events.py` alone needs only httpx2 +(`pip install -r demos/requirements.txt`). -The events generator creates sample CDEvents and event receivers for testing and demonstration. +## Options -**Dependencies**: Requires `httpx` and `ulid-py` - install with `pip install httpx ulid-py` +`generate_epr_events.py` -```bash -# Generate and post events to a running EPR server -python generate_epr_events.py --url http://localhost:8042 - -# Dry run - show curl commands without posting -python generate_epr_events.py --dry-run +| Option | Meaning | +| ----------------- | ------------------------------------------------------------------ | +| `--url`, `-u` | EPR URL, default `http://localhost:8042` | +| `--dry-run` | Print curl commands and send nothing | +| `--write-to-disk` | Write JSON files and curl commands to `epr_reports/`, post nothing | +| `--timeout`, `-t` | Request timeout in seconds, default 10 | -# Write events to disk as JSON files -python generate_epr_events.py --write-to-disk +It exits 0 if everything posted and 1 if any request failed. Set `EPR_DEBUG=1` +for debug logging and a debugger on errors. -# Custom timeout for requests -python generate_epr_events.py --timeout 30.0 -``` +`openapi_demo.py` -This script will: -- Generate event receivers for 11 different CDEvent types -- Create sample events for services named "foo", "bar", "baz", "qux" -- Support three modes: live posting, dry-run with curl commands, or file output -- Generate realistic CDEvent payloads with proper context and subject data -- Create ULID identifiers and timestamps for each event -- Output detailed status information for posted events - -#### Generated Event Types - -The script creates event receivers and events for these CDEvent types: -- `dev.cdevents.pipelinerun.started.0.2.0` -- `dev.cdevents.pipelinerun.queued.0.2.0` -- `dev.cdevents.pipelinerun.finished.0.2.0` -- `dev.cdevents.artifact.packaged.0.2.0` -- `dev.cdevents.artifact.published.0.2.0` -- `dev.cdevents.build.started.0.2.0` -- `dev.cdevents.build.finished.0.2.0` -- `dev.cdevents.testcaserun.finished.0.2.0` -- `dev.cdevents.testsuiterun.finished.0.2.0` -- `dev.cdevents.environment.created.0.2.0` -- `dev.cdevents.service.deployed.0.2.0` - -### Demo Output - -When you run `openapi_demo.py`, you'll see comprehensive information including: - -#### 📝 OpenAPI Endpoints -- YAML specification: `http://localhost:8000/openapi.yaml` -- JSON specification: `http://localhost:8000/openapi.json` -- Interactive documentation: `http://localhost:8000/docs` - -#### 🔍 Available MCP Tools -- `fetchEvent` - Retrieve events by ID -- `fetchReceiver` - Retrieve event receivers by ID -- `fetchGroup` - Retrieve event receiver groups by ID -- `createEvent` - Create new events -- `createReceiver` - Create new event receivers -- `createGroup` - Create new event receiver groups -- `searchEvents` - Search for events with criteria -- `searchReceivers` - Search for event receivers -- `searchGroups` - Search for event receiver groups -- `healthCheck` - Server health status - -#### 🏗️ Data Models -- Event, EventReceiver, EventReceiverGroup -- SearchCriteria, Error schemas -- Type-safe request/response handling - -## Usage Examples - -### Basic MCP Tool Usage - -```python -# Fetch a specific event -result = mcp.call_tool('fetchEvent', {'id': 'event-123'}) - -# Search for events -results = mcp.call_tool('searchEvents', { - 'name': 'deployment', - 'version': '1.0.0', - 'platform_id': 'linux' -}) - -# Create a new event -new_event = mcp.call_tool('createEvent', { - 'name': 'test-event', - 'version': '1.0.0', - 'release': '1.0.0', - 'platform_id': 'linux', - 'package': 'test-package', - 'description': 'Test event for demonstration', - 'event_receiver_id': 'receiver-123', - 'success': True, - 'payload': {'environment': 'demo', 'status': 'completed'} -}) -``` +| Option | Meaning | +| ----------- | ------------------------------------------------------------------------- | +| `--url` | Use a server that is already running, for example `http://localhost:8000` | +| `--epr-url` | EPR URL passed to the server it starts; never contacted | -### EPR Events Generator Usage +`mcp_client_demo.py` -#### Basic Event Generation +| Option | Meaning | +| -------------------- | ------------------------------------------------------------------------------------------------------------------ | +| `--epr-url` | EPR URL, default `$EPR_URL` or `http://localhost:8042` | +| `--server-url` | Connect to a server running over HTTP, for example `http://localhost:8000/mcp`, instead of starting one over stdio | +| `--show-server-logs` | Show the log output of the server started over stdio | -```bash -# Generate and post sample events to local EPR server -python generate_epr_events.py +Both client demos exit 0 when every step works and 1 otherwise. -# Post to a different EPR server -python generate_epr_events.py --url https://your-epr-server.com:8042 +`scripts/run_all.sh` takes `--skip-generate` to leave EPR's data alone and reads +`EPR_URL`. -# Use custom timeout (useful for slow networks) -python generate_epr_events.py --timeout 60.0 -``` +## What the demos change -#### Development and Testing Workflows +The generator adds 11 receivers and 44 events on every run. The client demo adds +one receiver and one event on every run, with unique names. `openapi_demo.py` +changes nothing. To start clean: ```bash -# Preview what would be posted (dry run) -python generate_epr_events.py --dry-run | head -20 - -# Generate test data files for development -python generate_epr_events.py --write-to-disk - -# Generated files will be in: -# epr_reports/event_receivers/ - Event receiver JSON files -# epr_reports/events/ - Event JSON files -# epr_reports/curl_commands_*.txt - Ready-to-use curl commands -``` - -#### Integration with EPR Server Testing - -```bash -# Start EPR server (in another terminal) -docker run -p 8042:8042 your-epr-server - -# Generate realistic test data -python generate_epr_events.py --url http://localhost:8042 - -# Check results (44 total: 11 event receivers + 33 events) -# Output shows: "Posted 33/33 events successfully" -``` - -### Accessing OpenAPI Documentation - -Once the server is running: - -1. **Interactive API Explorer**: Visit [http://localhost:8000/docs](http://localhost:8000/docs) -2. **OpenAPI Specification**: - - JSON: [http://localhost:8000/openapi.json](http://localhost:8000/openapi.json) - - YAML: [http://localhost:8000/openapi.yaml](http://localhost:8000/openapi.yaml) -3. **Health Check**: [http://localhost:8000/health](http://localhost:8000/health) - -### Integration Patterns - -#### With Claude Desktop - -```json -{ - "mcp": { - "servers": { - "epr-mcp-server": { - "command": "python", - "args": ["-m", "epr_mcp.main"], - "env": { - "EPR_URL": "http://your-epr-server:8042", - "EPR_TOKEN": "your-api-token" - }, - "type": "stdio" - } - } - } -} -``` - -#### With MCP Client Libraries - -```python -from mcp.client import Client - -# Connect to the server -async with Client("stdio", ["python", "-m", "epr_mcp.main"]) as client: - # List available tools - tools = await client.list_tools() - - # Call a tool - result = await client.call_tool("searchEvents", { - "name": "deployment" - }) -``` - -## Development and Testing - -### Creating New Demos - -When creating new demonstration scripts: - -1. **Follow the Pattern**: Use the same structure as `openapi_demo.py` -2. **Add Documentation**: Include clear docstrings and comments -3. **Update This README**: Add your demo to the table above -4. **Test Thoroughly**: Ensure demos work with different configurations - -### Demo Script Template - -```python -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- -# SPDX-FileCopyrightText: © 2025 Brett Smith -# SPDX-License-Identifier: Apache-2.0 - -""" -Demo script for [specific feature]. - -This script demonstrates: -1. [Feature 1] -2. [Feature 2] -3. [Feature 3] - -Usage: - python your_demo.py -""" - -def main(): - print("🚀 Your Demo Title") - print("=" * 50) - # Your demo code here - print("Demo completed! 🎉") - -if __name__ == "__main__": - main() +cd docs/tutorials/code && docker compose down -v && docker compose up -d ``` ## Troubleshooting -### Common Issues - -1. **Server Not Running**: Make sure to start the EPR MCP Server before running demos -2. **Port Conflicts**: Default port is 8000, change if needed -3. **Missing Dependencies**: Install all required packages: - ```bash - # Main package and demo dependencies - pip install -e . httpx ulid-py - - # If you get import errors, verify installation: - python -c "import httpx, ulid; print('Dependencies OK')" - ``` -4. **Virtual Environment**: Make sure you're in an activated virtual environment - ```bash - # Check if virtual environment is active (should show venv path) - which python - - # Activate if needed - source venv/bin/activate # macOS/Linux - # venv\Scripts\activate # Windows - ``` -5. **Configuration**: Check EPR_URL and EPR_TOKEN environment variables - -#### EPR Events Generator Specific Issues - -1. **Import Errors**: Make sure required dependencies are installed - ```bash - # Install missing dependencies - pip install httpx ulid-py - - # Verify imports work - python -c "import httpx, ulid, json, logging; print('All imports OK')" - ``` - -2. **Connection Refused**: Ensure the EPR server is running on the specified URL - ```bash - # Check if server is responding - curl http://localhost:8042/health - ``` - -3. **Event Receiver Creation Fails**: The script creates event receivers first, then events that reference them - ```bash - # Run in dry-run mode to see the exact requests - python generate_epr_events.py --dry-run - ``` - -3. **Timeout Errors**: For slow networks or servers, increase the timeout - ```bash - python generate_epr_events.py --timeout 60.0 - ``` - -4. **Debug Mode**: Enable debug logging to see detailed event payloads - ```bash - EPR_DEBUG=1 python generate_epr_events.py --dry-run - ``` - -### Getting Help - -- **Documentation**: Check the [../docs/](../docs/) directory for detailed guides -- **Issues**: Report problems on [GitHub Issues](https://github.com/xbcsmith/epr-mcp-python/issues) -- **Examples**: All demos include extensive comments and examples - -## Contributing - -To contribute new demos: - -1. Create a new Python script following the template above -2. Add comprehensive documentation and examples -3. Update this README with your demo in the table -4. Test with different configurations -5. Submit a pull request - -Your demos help other developers understand and use the EPR MCP Server effectively! \ No newline at end of file +| Symptom | Fix | +| ---------------------------------------------------- | ----------------------------------------------------------------- | +| `Connection refused` or `ERROR` on every line | EPR is not running; run the quick start and the readiness check | +| `ModuleNotFoundError: epr_mcp` or `fastmcp` | Run from the repository root with `uv run`, or `pip install -e .` | +| `the server process exited before it became healthy` | Run `uv run eprmcp version` to see the real error | +| `Connection failed to EPR server` | `--epr-url` is wrong or EPR is down | +| The first run is slow | uv is installing packages; later runs start in seconds | + +## Adding a demo + +1. Write the script in this directory with the SPDX header, a docstring that has + a Usage section, and exit codes 0 for success and 1 for failure. +2. Add a presenter script in `scripts/` with the goal, prerequisites, exact + commands, expected output, talking points, and failure recovery. +3. Add it to the table above and to `scripts/run_all.sh`. +4. Make sure `ruff check demos/` passes and add a smoke test under + `tests/demos/`. + +The server documentation is in [../docs/](../docs/), and the workshop that +builds the server step by step is in [../docs/tutorials/](../docs/tutorials/). diff --git a/demos/generate_epr_events.py b/demos/generate_epr_events.py index c6147e9..6dbf3ff 100755 --- a/demos/generate_epr_events.py +++ b/demos/generate_epr_events.py @@ -1,27 +1,55 @@ #!/usr/bin/env python3 +# SPDX-FileCopyrightText: © 2025 Brett Smith +# SPDX-License-Identifier: Apache-2.0 + +"""Generate sample CDEvents and event receivers and post them to EPR. + +Creates 11 event receivers (one per CDEvent type) and 44 events (4 services times +11 types), then posts them, prints curl commands, or writes them to disk. + +Usage: + uv run python demos/generate_epr_events.py --dry-run + uv run python demos/generate_epr_events.py --url http://localhost:8042 + uv run python demos/generate_epr_events.py --write-to-disk + +Needs only httpx2. Exits 0 when everything was posted, 1 when any request failed. +""" import argparse import json -import re -import shlex import logging -import sys import os +import secrets +import shlex +import sys +import time from datetime import datetime, timezone from typing import Any, Dict, List, Optional, Tuple -import httpx -import ulid - +import httpx2 logging.basicConfig(level=logging.INFO) logger = logging.getLogger(__name__) +# httpx2 logs every request at INFO, which buries the demo output. +logging.getLogger("httpx2").setLevel(logging.WARNING) + def debug_except_hook(type, value, tb): + """Print an uncaught exception and open a post-mortem debugger. + + Args: + type: The exception class. + value: The exception instance. + tb: The traceback. + + Examples: + ``sys.excepthook = debug_except_hook`` (installed when EPR_DEBUG is set). + """ print(f"epr python hates {type.__name__}") print(str(type)) import pdb import traceback + traceback.print_exception(type, value, tb) pdb.post_mortem(tb) @@ -29,22 +57,53 @@ def debug_except_hook(type, value, tb): debug = os.environ.get("EPR_DEBUG", False) if debug: sys.excepthook = debug_except_hook - logger.setLevel(logging.DEBUG)# Set up logging + logger.setLevel(logging.DEBUG) + +_CROCKFORD = "0123456789ABCDEFGHJKMNPQRSTVWXYZ" -# Function to generate a ULID def generate_ulid() -> str: - return str(ulid.ulid()) + """Generate a ULID: a 48-bit millisecond timestamp plus 80 random bits, in Crockford base32. + + Returns: + A 26 character ULID that sorts by creation time. + + Examples: + >>> len(generate_ulid()) + 26 + """ + value = ((time.time_ns() // 1_000_000) << 80) | secrets.randbits(80) + return "".join(_CROCKFORD[(value >> shift) & 31] for shift in range(125, -1, -5)) # Function to get current timestamp in ISO format def get_current_timestamp() -> str: + """Get the current UTC time in ISO 8601 format. + + Returns: + A timestamp such as ``2025-10-06T14:30:00.123456Z``. + + Examples: + >>> get_current_timestamp().endswith("Z") + True + """ return datetime.now(timezone.utc).isoformat().replace("+00:00", "Z") def gen_sha(seed: str) -> str: - """Generate a fake sha256 hash from a seed string.""" + """Generate a fake SHA-256 hash from a seed string. + + Args: + seed: The text to hash. + + Returns: + The 64 character hex digest. + + Examples: + >>> len(gen_sha("foo")) + 64 + """ import hashlib h = hashlib.sha256() @@ -53,8 +112,14 @@ def gen_sha(seed: str) -> str: def generate_event_receivers() -> List[Dict[str, Any]]: - """ - Generate a list of event receivers for each supported event type. + """Generate one event receiver for each supported CDEvents type. + + Returns: + Eleven receiver dictionaries, each with name, version, description, type, and an empty schema. + + Examples: + >>> len(generate_event_receivers()) + 11 """ event_receivers: List[Dict[str, Any]] = [] types = [ @@ -81,13 +146,19 @@ def generate_event_receivers() -> List[Dict[str, Any]]: # Generate a series of CDEvents for different services and event types def generate_events(evrs: Dict[str, Dict[str, Any]]) -> List[Dict[str, Any]]: - """ - Generate a CDEvent of each supported type for each service name. - Ensures each generated event has unique ids/timestamps and includes - fields commonly required by the included schemas. + """Generate one CDEvent of each supported type for each of four service names. + + Args: + evrs: The posted receivers, keyed by CDEvents type, as returned by post_event_receivers; use an empty dictionary for a dry run. + + Returns: + Forty-four event dictionaries that each point at their receiver's ID (a placeholder in a dry run). + + Examples: + >>> len(generate_events({})) + 44 """ events: List[Dict[str, Any]] = [] - event_receivers: List[Dict[str, Any]] = [] names = ["foo", "bar", "baz", "qux"] types = [ "dev.cdevents.pipelinerun.started.0.2.0", @@ -102,7 +173,7 @@ def generate_events(evrs: Dict[str, Dict[str, Any]]) -> List[Dict[str, Any]]: "dev.cdevents.service.deployed.0.2.0", "dev.cdevents.pipelinerun.finished.0.2.0", ] - release = datetime.now(timezone.utc).strftime("%Y.%m.%s") + release = datetime.now(timezone.utc).strftime("%Y.%m.%d") for idx, name in enumerate(names, start=1): chain_id = generate_ulid() env_id = f"cluster/0{idx}" @@ -181,7 +252,7 @@ def generate_events(evrs: Dict[str, Dict[str, Any]]) -> List[Dict[str, Any]]: subject = { "id": subject_base_id, "type": "build", - "source": f"https://git.example/{name}.git", + "source": f"https://git.example/{name}.git", "content": { "artifactId": artifact_id, }, @@ -190,20 +261,20 @@ def generate_events(evrs: Dict[str, Dict[str, Any]]) -> List[Dict[str, Any]]: subject["content"]["artifactId"] = artifact_id elif "testcaserun" in event_type: subject = { - "id": "myTestCaseRun123", - "source": f"https://git.example/{name}.git", - "type": "testCaseRun", - "content": { - "outcome": "pass", - "environment": {"id": env_id, "source": source}, - "testCase": { - "id": generate_ulid(), - "version": "1.0", - "name": f"{name} integration test case", - "type": "integration" - } - } - } + "id": "myTestCaseRun123", + "source": f"https://git.example/{name}.git", + "type": "testCaseRun", + "content": { + "outcome": "pass", + "environment": {"id": env_id, "source": source}, + "testCase": { + "id": generate_ulid(), + "version": "1.0", + "name": f"{name} integration test case", + "type": "integration", + }, + }, + } elif "testsuiterun" in event_type: subject = { "id": subject_base_id, @@ -240,66 +311,133 @@ def generate_events(evrs: Dict[str, Dict[str, Any]]) -> List[Dict[str, Any]]: subject = {"id": subject_base_id, "type": subject_type, "content": {}} event_template: Dict[str, Any] = {"context": context, "subject": subject} - ev = dict(name=name, version="1.0.0", release=release, platform_id="x64-linux-oci-2", package="oci", description=f"{name} {event_type}", payload=event_template, success=True, event_receiver_id=event_receiver_id) + ev = dict( + name=name, + version="1.0.0", + release=release, + platform_id="x64-linux-oci-2", + package="oci", + description=f"{name} {event_type}", + payload=event_template, + success=True, + event_receiver_id=event_receiver_id, + ) # debug output to stdout for visibility when running interactively logger.debug(json.dumps(ev, indent=2)) events.append(ev) return events + def post(url, data, headers=None, timeout=10.0): + """Post JSON to a URL and raise on any failure. + + Args: + url: The full URL. + data: The JSON body. + headers: Optional request headers. + timeout: Seconds to wait for a response. + + Returns: + The successful response. + + Raises: + httpx2.HTTPStatusError: If EPR answers with an error status. + httpx2.HTTPError: If the request cannot be completed. + + Examples: + ``post('http://localhost:8042/api/v1/events', event)`` + """ try: - with httpx.Client(timeout=timeout) as client: + with httpx2.Client(timeout=timeout) as client: response = client.post(url, json=data, headers=headers) response.raise_for_status() return response - except httpx.HTTPStatusError as e: + except httpx2.HTTPStatusError as e: print(f"HTTP error {e.response.status_code}: {e.response.text}") raise except Exception as e: print(f"Request failed: {e}") raise -def post_event_receiver(evr: Dict[str, Any], + +def post_event_receiver( + evr: Dict[str, Any], url: str = "http://localhost:8042", timeout: float = 10.0, -) -> httpx.Response: - """ - Post a single JSON event receiver to the given webhook URL using httpx. - Returns the httpx.Response on success, raises on network errors. +) -> httpx2.Response: + """Post one event receiver to EPR. + + Args: + evr: The receiver dictionary. + url: The EPR base URL. + timeout: Seconds to wait for a response. + + Returns: + The successful response. + + Raises: + httpx2.HTTPError: If the request fails or EPR answers with an error status. + + Examples: + ``post_event_receiver(evr, url='http://localhost:8042')`` """ headers = {"Content-Type": "application/json"} endpoint = f"{url}/api/v1/receivers" resp = post(endpoint, data=evr, headers=headers, timeout=timeout) return resp + def post_event( event: Dict[str, Any], url: str = "http://localhost:8042", timeout: float = 10.0, -) -> httpx.Response: - """ - Post a single JSON event to the given webhook URL using httpx. - Returns the httpx.Response on success, raises on network errors. +) -> httpx2.Response: + """Post one event to EPR. + + Args: + event: The event dictionary. + url: The EPR base URL. + timeout: Seconds to wait for a response. + + Returns: + The successful response. + + Raises: + httpx2.HTTPError: If the request fails or EPR answers with an error status. + + Examples: + ``post_event(event, url='http://localhost:8042')`` """ headers = {"Content-Type": "application/json"} endpoint = f"{url}/api/v1/events" resp = post(endpoint, data=event, headers=headers, timeout=timeout) return resp + def post_event_receivers( evrs: List[Dict[str, Any]], url: str = "http://localhost:8042", timeout: float = 10.0, ) -> Dict[str, Dict[str, Any]]: - """ - Post a list of event receivers sequentially. Returns a list of (evr_id, status_code, response_text). + """Post event receivers one after another. + + Args: + evrs: The receiver dictionaries. + url: The EPR base URL. + timeout: Seconds to wait for each response. + + Returns: + A dictionary keyed by receiver type; each value has ``status`` (None on failure) and ``data`` (the new ID, or the error). + + Examples: + ``post_event_receivers(generate_event_receivers())`` """ results: Dict[str, Dict[str, Any]] = {} for evr in evrs: try: resp = post_event_receiver(evr, url=url, timeout=timeout) - data=json.loads(resp.text) + data = json.loads(resp.text) _id = data.get("data", "") results[evr["type"]] = dict(status=resp.status_code, data=_id) except Exception as e: @@ -312,8 +450,18 @@ def post_events( url: str = "http://localhost:8042", timeout: float = 10.0, ) -> List[Tuple[Optional[str], Optional[int], str]]: - """ - Post a list of events sequentially. Returns a list of (event_id, status_code, response_text). + """Post events one after another; a failure is logged and recorded, not raised. + + Args: + events: The event dictionaries. + url: The EPR base URL. + timeout: Seconds to wait for each response. + + Returns: + A list of ``(event_id, status_code, response_text)`` tuples; the first two are None for a failed post. + + Examples: + ``post_events(generate_events(receivers))`` """ results: List[Tuple[Optional[str], Optional[int], str]] = [] for ev in events: @@ -329,9 +477,18 @@ def post_events( def make_curl_command(event: Dict[str, Any], url: str) -> str: - """ - Build a curl command that posts the given event to url. - The JSON payload is shell-quoted. + """Build a curl command that posts the payload to a URL. + + Args: + event: The JSON payload; it is shell-quoted. + url: The URL to post to. + + Returns: + The command line as a string. + + Examples: + >>> make_curl_command({"a": 1}, "http://epr/x").startswith("curl -sS -X POST") + True """ # compact JSON to keep command shorter json_str = json.dumps(event, separators=(",", ":"), ensure_ascii=False) @@ -340,9 +497,14 @@ def make_curl_command(event: Dict[str, Any], url: str) -> str: return f"curl -sS -X POST -H 'Content-Type: application/json' -d {quoted_payload} {quoted_url}" -def main() -> None: - """ - Generate event_receivers and events and either post them, show curl commands in a dry-run, or write to disk. +def main() -> int: + """Generate receivers and events, then post them, print curl commands, or write files. + + Returns: + 0 if everything was posted (or a dry run or file write succeeded), 1 if any request failed. + + Examples: + ``python demos/generate_epr_events.py --dry-run`` """ parser = argparse.ArgumentParser( description="Generate and post EPR event_receivers and events, print curl commands (dry-run), or write to disk." @@ -383,7 +545,7 @@ def main() -> None: if not args.dry_run: for evr_type, result in evr_results.items(): status = result.get("status") - status_str = str(status) if status is not None else "ERROR" + status_str = str(status) if status is not None else "ERROR" print(f"{evr_type}: {status_str}") events = generate_events(evrs=evr_results) if args.write_to_disk: @@ -410,7 +572,9 @@ def main() -> None: for event in events: curl = make_curl_command(event, f"{url}/api/v1/events") f.write(curl + "\n") - print("Wrote curl commands to epr_reports/curl_commands_event_receivers.txt and epr_reports/curl_commands_events.txt") + print( + "Wrote curl commands to epr_reports/curl_commands_event_receivers.txt and epr_reports/curl_commands_events.txt" + ) if args.dry_run: print("Dry run: curl commands for events:") for event in events: @@ -419,13 +583,21 @@ def main() -> None: else: results = post_events(events, url=url, timeout=timeout) success = 0 - for ev_id, status, resp_text in results: + for ev_id, status, _ in results: status_str = str(status) if status is not None else "ERROR" print(f"{ev_id}: {status_str}") if status and 200 <= status < 300: success += 1 print(f"Posted {success}/{len(results)} events successfully") + failed_receivers = [t for t, r in evr_results.items() if r.get("status") is None] + if failed_receivers or success != len(results): + print( + f"{len(failed_receivers)} event receivers and {len(results) - success} events failed", + file=sys.stderr, + ) + return 1 + return 0 if __name__ == "__main__": - main() + sys.exit(main()) diff --git a/demos/mcp_client_demo.py b/demos/mcp_client_demo.py new file mode 100644 index 0000000..2d27e5f --- /dev/null +++ b/demos/mcp_client_demo.py @@ -0,0 +1,226 @@ +#!/usr/bin/env python3 +# SPDX-FileCopyrightText: © 2025 Brett Smith +# SPDX-License-Identifier: Apache-2.0 + +"""Use the EPR MCP server the way an AI assistant does: through an MCP client. + +The demo connects a FastMCP 4 client, lists the tools, then creates an event +receiver, creates an event for it, fetches the event, and searches for it. It +changes data in EPR: each run adds one receiver and one event with a unique name. + +By default the client starts the server itself over stdio (the way editors do). +Use --server-url to talk to a server that is already running over HTTP. + +Usage: + uv run python demos/mcp_client_demo.py + uv run python demos/mcp_client_demo.py --epr-url http://localhost:8042 + uv run python demos/mcp_client_demo.py --server-url http://localhost:8000/mcp + +Exits 0 when every step works, 1 otherwise. +""" + +import argparse +import asyncio +import json +import os +import sys +import time +from pathlib import Path + +from fastmcp import Client +from fastmcp.client.transports import StdioTransport + +TOTAL_STEPS = 6 + + +class DemoError(Exception): + """Raised when a step of the demo does not work. + + Examples: + ``raise DemoError('expected 9 tools, found 8')`` + """ + + +def step(number: int, title: str) -> None: + """Print a numbered step heading. + + Args: + number: The step number. + title: What the step does. + + Examples: + ``step(1, 'List the tools the server offers')`` + """ + print(f"\n[{number}/{TOTAL_STEPS}] {title}") + + +def shorten(text: str, width: int = 100) -> str: + """Collapse whitespace and truncate text to a width. + + Args: + text: The text to shorten. + width: The maximum length, including the trailing ``...``. + + Returns: + The shortened text. + + Examples: + >>> shorten("a b c") + 'a b c' + """ + text = " ".join(text.split()) + return text if len(text) <= width else text[: width - 3] + "..." + + +async def call(client: Client, tool: str, arguments: dict, expect_error: bool = False) -> str: + """Call a tool and return its text. + + The server reports most problems as plain text instead of an MCP error, so a reply + that is not JSON counts as a failure unless the caller expects one. + + Args: + client: The connected MCP client. + tool: The tool name. + arguments: The tool arguments. + expect_error: True when a non-JSON reply is the expected outcome. + + Returns: + The text of the tool's reply. + + Raises: + DemoError: If the call fails or the reply is not JSON and no error was expected. + + Examples: + ``await call(client, 'fetch_event', {'id': event_id})`` + """ + print(f" tool: {tool}") + print(f" arguments: {shorten(json.dumps(arguments), 140)}") + result = await client.call_tool(tool, arguments, raise_on_error=False) + text = result.content[0].text if result.content else "" + if result.is_error: + raise DemoError(f"{tool} failed: {shorten(text, 300)}") + print(f" result: {shorten(text)}") + if not expect_error and not text.lstrip().startswith(("{", "[")): + raise DemoError(f"{tool} returned an error: {shorten(text, 300)}") + return text + + +def make_client(args: argparse.Namespace) -> Client: + """Create the MCP client: over HTTP for --server-url, otherwise over stdio to a server it starts. + + Args: + args: The parsed command line. + + Returns: + An unconnected FastMCP client. + + Examples: + ``async with make_client(args) as client: ...`` + """ + if args.server_url: + return Client(args.server_url) + env = {**os.environ, "EPR_URL": args.epr_url} + transport = StdioTransport( + command=sys.executable, + args=["-m", "epr_mcp.main", "start", "--transport", "stdio", "--url", args.epr_url], + env=env, + log_file=None if args.show_server_logs else Path(os.devnull), + ) + return Client(transport) + + +async def run(args: argparse.Namespace) -> None: + """Run the six demo steps. + + Args: + args: The parsed command line. + + Raises: + DemoError: If any step does not work. + + Examples: + ``asyncio.run(run(args))`` + """ + suffix = str(int(time.time())) + receiver = { + "name": f"demo.client.{suffix}", + "type": "demo.client", + "version": "1.0.0", + "description": "Receiver created by mcp_client_demo.py", + "schema": {"type": "object", "properties": {"service": {"type": "string"}}}, + } + async with make_client(args) as client: + step(1, "List the tools the server offers") + tools = await client.list_tools() + for tool in tools: + print(f" {tool.name}") + if len(tools) != 9: + raise DemoError(f"expected 9 tools, found {len(tools)}") + + step(2, "Create an event receiver (declares a kind of event and its payload schema)") + receiver_id = json.loads(await call(client, "create_receiver", {"receiver_data": receiver}))["id"] + print(f" new receiver id: {receiver_id}") + + step(3, "Create an event for that receiver") + event = { + "name": f"demo-service-{suffix}", + "version": "1.0.0", + "release": "2025.10.0", + "platform_id": "linux", + "package": "oci", + "description": "Event created by mcp_client_demo.py", + "payload": {"service": "demo-service"}, + "success": True, + "event_receiver_id": receiver_id, + } + event_id = json.loads(await call(client, "create_event", {"event_data": event}))["id"] + print(f" new event id: {event_id}") + + step(4, "Fetch the event by its ID") + fetched = json.loads(await call(client, "fetch_event", {"id": event_id})) + if fetched["id"] != event_id or fetched["name"] != event["name"]: + raise DemoError("the fetched event is not the one that was created") + + step(5, "Search for the event by name") + found = json.loads(await call(client, "search_events", {"data": {"name": event["name"]}})) + if [item["id"] for item in found] != [event_id]: + raise DemoError(f"expected exactly the new event, found {len(found)} events") + + step(6, "Show that bad input is rejected before it reaches EPR") + message = await call(client, "fetch_event", {"id": "not-a-valid-id"}, expect_error=True) + if not message.startswith("Input validation error"): + raise DemoError("a malformed ID was accepted") + print(" rejected as expected: the server never called EPR") + + +def main() -> int: + """Parse the command line and run the demo. + + Returns: + 0 if every step worked, 1 otherwise. + + Examples: + ``python demos/mcp_client_demo.py --epr-url http://localhost:8042`` + """ + parser = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter) + parser.add_argument("--epr-url", default=os.environ.get("EPR_URL", "http://localhost:8042"), help="EPR URL") + parser.add_argument("--server-url", help="MCP server over HTTP, for example http://localhost:8000/mcp") + parser.add_argument("--show-server-logs", action="store_true", help="show the stdio server's log output") + args = parser.parse_args() + + print("EPR MCP Server: client demo") + print("=" * 40) + try: + asyncio.run(run(args)) + except DemoError as error: + print(f"\nDemo failed: {error}", file=sys.stderr) + return 1 + except Exception as error: + print(f"\nDemo failed: {error!r}", file=sys.stderr) + return 1 + print("\nDemo completed.") + return 0 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/demos/openapi_demo.py b/demos/openapi_demo.py index 5b87ba4..6e7a32a 100644 --- a/demos/openapi_demo.py +++ b/demos/openapi_demo.py @@ -1,111 +1,216 @@ #!/usr/bin/env python3 -# -*- coding: utf-8 -*- # SPDX-FileCopyrightText: © 2025 Brett Smith # SPDX-License-Identifier: Apache-2.0 -""" -Demo script to test the EPR MCP Server OpenAPI endpoints. +"""Show the HTTP side of the EPR MCP server: health, OpenAPI documents, Swagger UI, and tools. -This script demonstrates how to: -1. Start the MCP server with OpenAPI support -2. Access the OpenAPI specification endpoints -3. View the Swagger UI documentation +The demo starts the server over HTTP on a free local port (or uses one you point it +at), fetches each endpoint, then connects an MCP client and lists the tools. It does +not need a running EPR: listing tools never calls EPR. Usage: - python openapi_demo.py + uv run python demos/openapi_demo.py + uv run python demos/openapi_demo.py --url http://localhost:8000 + +Exits 0 when every step works, 1 otherwise. """ +import argparse import asyncio +import contextlib +import socket +import subprocess import sys -from pathlib import Path - -# Add the src directory to the path so we can import our modules -sys.path.insert(0, str(Path(__file__).parent / "src")) - -from epr_mcp.server import run -from epr_mcp.config import Config - - -class DemoConfig: - """Mock configuration for demo purposes.""" - def __init__(self): - self.url = "https://api.epr.example.com" - self.token = "demo-token" - self.debug = True - - -async def demo_openapi_endpoints(): - """Demonstrate the OpenAPI endpoints.""" - print("🚀 EPR MCP Server OpenAPI Demo") - print("=" * 50) - - print("\n📝 OpenAPI Specification Available at:") - print(" • YAML format: http://localhost:8000/openapi.yaml") - print(" • JSON format: http://localhost:8000/openapi.json") - - print("\n📚 API Documentation Available at:") - print(" • Swagger UI: http://localhost:8000/docs") - - print("\n🔍 Available MCP Tools (generated from OpenAPI spec):") - - # List the operations that would be available as MCP tools - operations = [ - ("fetchEvent", "GET /api/v1/events/{id} - Fetch a single event"), - ("fetchReceiver", "GET /api/v1/receivers/{id} - Fetch a single event receiver"), - ("fetchGroup", "GET /api/v1/groups/{id} - Fetch a single event receiver group"), - ("createEvent", "POST /api/v1/events - Create a new event"), - ("createReceiver", "POST /api/v1/receivers - Create a new event receiver"), - ("createGroup", "POST /api/v1/groups - Create a new event receiver group"), - ("searchEvents", "POST /api/v1/events/search - Search for events"), - ("searchReceivers", "POST /api/v1/receivers/search - Search for event receivers"), - ("searchGroups", "POST /api/v1/groups/search - Search for event receiver groups"), - ("healthCheck", "GET /health - Health check endpoint"), - ] - - for op_id, description in operations: - print(f" • {op_id}: {description}") - - print("\n🏗️ Data Models:") - models = ["Event", "EventReceiver", "EventReceiverGroup", "SearchCriteria", "Error"] - for model in models: - print(f" • {model}") - - print("\n💡 Key Features:") - print(" • Automatic MCP tool generation from OpenAPI spec") - print(" • Type-safe request/response handling") - print(" • Built-in API documentation") - print(" • Schema validation using Pydantic models") - print(" • Swagger UI for interactive testing") - - print("\n🎯 Next Steps:") - print(" 1. Start the server: python -m epr_mcp.main") - print(" 2. Visit http://localhost:8000/docs to explore the API") - print(" 3. Use MCP tools to interact with EPR endpoints") - print(" 4. Access OpenAPI spec at http://localhost:8000/openapi.json") - - print("\n📋 Example MCP Tool Usage:") - print(" # Fetch an event") - print(" mcp.call_tool('fetchEvent', {'id': 'event-123'})") - print("") - print(" # Search for events") - print(" mcp.call_tool('searchEvents', {'name': 'deployment', 'version': '1.0.0'})") - print("") - print(" # Create a new event") - print(" mcp.call_tool('createEvent', {") - print(" 'name': 'test-event',") - print(" 'version': '1.0.0',") - print(" 'release': '1.0.0',") - print(" 'platform_id': 'linux',") - print(" 'package': 'test-package',") - print(" 'description': 'Test event',") - print(" 'event_receiver_id': 'receiver-123',") - print(" 'success': True,") - print(" 'payload': {'key': 'value'}") - print(" })") - - print("\n" + "=" * 50) - print("Demo completed! 🎉") +import time +from collections.abc import Iterator + +import httpx2 +import yaml +from fastmcp import Client + +HTTP_METHODS = {"get", "post", "put", "patch", "delete"} + + +def step(number: int, total: int, title: str) -> None: + """Print a numbered step heading. + + Args: + number: The step number. + total: The number of steps. + title: What the step does. + + Examples: + ``step(1, 5, 'Health check')`` + """ + print(f"\n[{number}/{total}] {title}") + + +def free_port() -> int: + """Find a free local TCP port. + + Returns: + A port number that was free a moment ago. + + Examples: + >>> 1024 <= free_port() <= 65535 + True + """ + with socket.socket() as sock: + sock.bind(("127.0.0.1", 0)) + return sock.getsockname()[1] + + +@contextlib.contextmanager +def running_server(port: int, epr_url: str) -> Iterator[subprocess.Popen]: + """Run the MCP server over HTTP in a child process for the duration of a with block. + + Args: + port: The port to bind on 127.0.0.1. + epr_url: The EPR URL given to the server; it is not contacted. + + Yields: + The running process. It is terminated when the block ends. + + Examples: + ``with running_server(free_port(), 'http://localhost:8042') as server: ...`` + """ + command = [ + sys.executable, '-m', 'epr_mcp.main', 'start', + '--transport', 'http', '--host', '127.0.0.1', '--port', str(port), + '--url', epr_url, + ] # fmt: skip + with subprocess.Popen(command, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) as process: + try: + yield process + finally: + process.terminate() + process.wait(timeout=10) + + +def wait_until_healthy(base_url: str, server: subprocess.Popen | None, timeout: float = 30) -> None: + """Wait until the server answers its health check. + + Args: + base_url: The server's base URL. + server: The child process, if the demo started it, so an early exit is noticed. + timeout: Seconds to wait. + + Raises: + RuntimeError: If the process exits early or the server is not healthy in time. + + Examples: + ``wait_until_healthy('http://127.0.0.1:8000', None)`` + """ + deadline = time.time() + timeout + while True: + try: + if httpx2.get(f"{base_url}/health", timeout=2).status_code == 200: + return + except httpx2.TransportError: + pass + if server is not None and server.poll() is not None: + raise RuntimeError("the server process exited before it became healthy") + if time.time() > deadline: + raise RuntimeError(f"no healthy server at {base_url} after {timeout:.0f} seconds") + time.sleep(0.3) + + +def show_endpoints(base_url: str) -> None: + """Call the health, OpenAPI, and Swagger endpoints and print what they return. + + Args: + base_url: The server's base URL. + + Raises: + httpx2.HTTPError: If an endpoint cannot be reached or answers with an error. + + Examples: + ``show_endpoints('http://127.0.0.1:8000')`` + """ + step(1, 5, "Health check") + response = httpx2.get(f"{base_url}/health") + print(f"GET {base_url}/health -> {response.status_code} {response.text!r}") + + step(2, 5, "OpenAPI specification as YAML") + response = httpx2.get(f"{base_url}/openapi.yaml") + response.raise_for_status() + spec = yaml.safe_load(response.text) + print(f"GET {base_url}/openapi.yaml -> {response.status_code}") + print(f"Title: {spec['info']['title']} (OpenAPI {spec['openapi']}, API version {spec['info']['version']})") + print(f"Paths: {len(spec['paths'])}") + for path, operations in spec["paths"].items(): + for method, operation in operations.items(): + if method in HTTP_METHODS: + print(f" {method.upper():<6} {path:<28} {operation.get('summary', '')}") + + step(3, 5, "The same specification as JSON") + response = httpx2.get(f"{base_url}/openapi.json") + response.raise_for_status() + print(f"GET {base_url}/openapi.json -> {response.status_code}") + print(f"JSON matches the YAML document: {response.json() == spec}") + + step(4, 5, "Swagger UI") + response = httpx2.get(f"{base_url}/docs") + response.raise_for_status() + print(f"GET {base_url}/docs -> {response.status_code}, {len(response.text)} bytes of HTML") + print(f"Open {base_url}/docs in a browser to try the API interactively.") + + +async def show_tools(base_url: str) -> None: + """Connect an MCP client and list the tools. + + Args: + base_url: The server's base URL; the MCP endpoint is ``/mcp`` under it. + + Examples: + ``asyncio.run(show_tools('http://127.0.0.1:8000'))`` + """ + step(5, 5, "MCP tools, listed by a FastMCP client") + async with Client(f"{base_url}/mcp") as client: + tools = await client.list_tools() + print(f"Connected to {base_url}/mcp and found {len(tools)} tools:") + for tool in tools: + required = ", ".join(tool.input_schema.get("required", [])) or "none" + print(f" {tool.name:<18} required arguments: {required}") + + +def main() -> int: + """Parse the command line, start a server if needed, and run the demo. + + Returns: + 0 if every step worked, 1 otherwise. + + Examples: + ``python demos/openapi_demo.py`` + """ + parser = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter) + parser.add_argument("--url", help="use a server that is already running instead of starting one") + parser.add_argument( + "--epr-url", default="http://localhost:8042", help="EPR URL given to the server (not contacted)" + ) + args = parser.parse_args() + + print("EPR MCP Server: HTTP endpoints demo") + print("=" * 40) + try: + if args.url: + base_url = args.url.rstrip("/") + server_context = contextlib.nullcontext(None) + else: + port = free_port() + base_url = f"http://127.0.0.1:{port}" + print(f"Starting the server on {base_url}") + server_context = running_server(port, args.epr_url) + with server_context as server: + wait_until_healthy(base_url, server) + show_endpoints(base_url) + asyncio.run(show_tools(base_url)) + except (RuntimeError, httpx2.HTTPError, KeyError) as error: + print(f"\nDemo failed: {error!r}", file=sys.stderr) + return 1 + print("\nDemo completed.") + return 0 if __name__ == "__main__": - asyncio.run(demo_openapi_endpoints()) \ No newline at end of file + sys.exit(main()) diff --git a/demos/requirements.txt b/demos/requirements.txt index 678260f..be905f8 100644 --- a/demos/requirements.txt +++ b/demos/requirements.txt @@ -1,2 +1,10 @@ -httpx>=0.23.0 -ulid>=1.1.0 \ No newline at end of file +# Packages the demos import. The simplest way to run them is from the repository +# root with uv, which installs everything: uv run python demos/.py +# +# With pip instead, install the package (it brings fastmcp, httpx2, and PyYAML): +# pip install -e . +# generate_epr_events.py needs only httpx2: +# pip install -r demos/requirements.txt +fastmcp>=4.0,<5 +httpx2>=2.13 +PyYAML diff --git a/demos/scripts/generate_events_script.md b/demos/scripts/generate_events_script.md new file mode 100644 index 0000000..eec58aa --- /dev/null +++ b/demos/scripts/generate_events_script.md @@ -0,0 +1,133 @@ +# Presenter Script: Generating Sample Events + +Demo file: `demos/generate_epr_events.py`. Time: 5 minutes. + +## Goal + +Show that EPR is a registry of events with a schema per event type, and fill it +with realistic data that the next two demos can query. The audience should leave +knowing the three record types (receiver, event, group) and how a receiver +relates to an event. + +## Prerequisites + +- EPR running at `http://localhost:8042`: + `cd docs/tutorials/code && docker compose up -d --build` +- A terminal in the repository root, with uv installed. +- Check: + `curl -s -o /dev/null -w "%{http_code}\n" http://localhost:8042/healthz/readiness` + prints `200`. + +## Before you start + +- Decide whether to leave the existing data in place. Posting adds 11 receivers + and 44 events every time; reset with + `(cd docs/tutorials/code && docker compose down -v && docker compose up -d)`. +- Increase the terminal font. The curl lines are long. + +## Steps + +### 1. Show what would be sent (dry run) + +Say: "First, with no side effects: what would this script send to EPR?" + +```bash +uv run python demos/generate_epr_events.py --dry-run | head -4 | cut -c1-150 +``` + +Expected output (the first lines are the receivers): + +```text +Dry run: curl commands for event receivers: +curl -sS -X POST -H 'Content-Type: application/json' -d '{"name":"dev-cdevents-pipelinerun-started","version":"0.2.0","description":"Dev Cdevents Pipelinerun Started","type":"dev.cdevents.pipelinerun.started.0.2.0","schema":{}}' http://localhost:8042/api/v1/receivers +... +``` + +Talking points: + +- A receiver declares a kind of event: a name, a type, a version, and a JSON + schema the payload must match. Here the schema is empty, so any payload + passes. +- There is one receiver per CDEvents type, 11 in all: pipeline runs, builds, + artifacts, tests, environments, and services. CDEvents is the standard for + continuous delivery events. +- It is plain curl. Everything the MCP server does later is just these same HTTP + calls. + +### 2. Count what it generates + +```bash +uv run python demos/generate_epr_events.py --dry-run | grep -c '^curl' +``` + +Expected output: `55`. + +Say: "11 receivers plus 44 events: four services named foo, bar, baz, and qux, +each with one event of each of the 11 types." + +### 3. Show one event + +```bash +uv run python demos/generate_epr_events.py --dry-run | grep 'api/v1/events' | head -1 | cut -c1-400 +``` + +Talking points: + +- An event links to its receiver through `event_receiver_id`. In a dry run that + field is a placeholder because the receivers do not exist yet. +- The `payload` holds the CDEvent: a `context` (id, source, type, timestamp) and + a `subject` (what the event is about). +- IDs are ULIDs: 26 characters, sortable by time. The script generates them + itself; nothing extra is installed. + +### 4. Post them for real + +Say: "Now the real thing. Receivers first, then events that point at them." + +```bash +uv run python demos/generate_epr_events.py +``` + +Expected output (abridged, the IDs differ): + +```text +Posting 11 event receivers to http://localhost:8042/api/v1/receivers +dev.cdevents.pipelinerun.started.0.2.0: 200 +dev.cdevents.pipelinerun.queued.0.2.0: 200 +... +01M48VCRF6YEN43WKBBBRX83Y2: 200 +... +Posted 44/44 events successfully +``` + +Talking points: + +- Each line is an HTTP status from EPR. EPR answers a successful create with 200 + and returns only the new ID. +- The script exits 0 when everything posted and 1 if anything failed, so it can + run in a pipeline. + +### 5. Optional: write the data to files instead + +```bash +uv run python demos/generate_epr_events.py --write-to-disk +``` + +This writes `epr_reports/event_receivers/`, `epr_reports/events/`, and two files +of curl commands, and posts nothing. Delete `epr_reports/` afterwards. + +## Failure recovery + +| Symptom | Cause and fix | +| ---------------------------------------- | -------------------------------------------------------------------------- | +| `Request failed: ... Connection refused` | EPR is not running. Run the prerequisite command and wait a minute | +| Every line says `ERROR`, exit code 1 | Same cause, or a wrong `--url`. Check the readiness curl | +| `HTTP error 400: ... schema is required` | Receiver JSON without a `schema`. The script always sends one; check edits | +| Fewer than 44 events posted | Read the `Failed to post event` lines above the summary | +| Output is hard to follow | Use `--dry-run`, which prints without posting | + +## Reset + +`(cd docs/tutorials/code && docker compose down -v)` removes all EPR data. + +Next: [OpenAPI demo](openapi_demo_script.md). diff --git a/demos/scripts/mcp_client_demo_script.md b/demos/scripts/mcp_client_demo_script.md new file mode 100644 index 0000000..fce1ea7 --- /dev/null +++ b/demos/scripts/mcp_client_demo_script.md @@ -0,0 +1,125 @@ +# Presenter Script: Using the Tools as an AI Assistant Does + +Demo file: `demos/mcp_client_demo.py`. Time: 10 minutes. + +## Goal + +Show the full life of a record through MCP tools: create a receiver, create an +event for it, fetch the event, find it by search, and see bad input rejected. +The client plays the role an AI assistant plays in an editor. + +## Prerequisites + +- EPR running at `http://localhost:8042`: + `cd docs/tutorials/code && docker compose up -d --build` +- Check: + `curl -s -o /dev/null -w "%{http_code}\n" http://localhost:8042/healthz/readiness` + prints `200`. +- A terminal in the repository root, with uv installed. + +## Before you start + +- Run the demo once to warm uv. Each run adds one receiver and one event with a + unique name, so reruns are safe. +- Optionally run [the events generator](generate_events_script.md) first so + searches have more to find. + +## Steps + +### 1. Run the demo + +Say: "No AI model here, just a small client calling the same tools a model +would. By default it starts the server itself over stdio, which is how VS Code +and Claude Desktop run it." + +```bash +uv run python demos/mcp_client_demo.py +``` + +### 2. Walk through the steps + +Expected output (abridged; IDs and numbers differ): + +```text +[1/6] List the tools the server offers + fetch_event + ... + create_group + +[2/6] Create an event receiver (declares a kind of event and its payload schema) + tool: create_receiver + arguments: {"receiver_data": {"name": "demo.client.1791298518", ... + result: { "message": "Event receiver created successfully", "id": "01M48VCDJEXDES63JKS7MYYC95" } + +[3/6] Create an event for that receiver + tool: create_event + result: { "message": "Event created successfully", "id": "01M48VCDQ4X251XDTR46JR75TV" } + +[4/6] Fetch the event by its ID + tool: fetch_event + arguments: {"id": "01M48VCDQ4X251XDTR46JR75TV"} + +[5/6] Search for the event by name + tool: search_events + arguments: {"data": {"name": "demo-service-1791298518"}} + +[6/6] Show that bad input is rejected before it reaches EPR + result: Input validation error: 1 validation error for FetchInput id String should match pattern ... + rejected as expected: the server never called EPR + +Demo completed. +``` + +Talking points per step: + +1. List tools. "Nine tools: fetch, search, and create for each of the three + record types. The client discovered them; nothing was hard-coded." +2. Create a receiver. "A receiver must carry a JSON schema. Events sent to it + must match. EPR answers with the new ID, and so does the tool." +3. Create an event. "It points at the receiver by ID. This is the provenance + link: what happened, and which receiver it belongs to." +4. Fetch. "Same ID, full record back." +5. Search. "Searches go to EPR's GraphQL endpoint. The tool takes plain + criteria. Every field is optional, and only the ones you set are sent." +6. Bad input. "The server checks the ID format and rejects the call before + contacting EPR. Guessing is what language models do, so catching bad + arguments early matters." + +### 3. Optional: the same thing over HTTP + +In one terminal: + +```bash +uv run eprmcp start --transport http --host 127.0.0.1 --port 8000 --url http://localhost:8042 +``` + +In another: + +```bash +uv run python demos/mcp_client_demo.py --server-url http://localhost:8000/mcp +``` + +Say: "Same tools, different transport. stdio is for an editor that launches the +server; HTTP is for a server that stays running." + +### 4. Optional: see the server's own log + +```bash +uv run python demos/mcp_client_demo.py --show-server-logs +``` + +## Failure recovery + +| Symptom | Cause and fix | +| -------------------------------------- | ----------------------------------------------------------------------------------- | +| `Connection failed to EPR server` | EPR is down or `--epr-url` is wrong. Run the readiness check | +| `Client failed to connect` | The server did not start. Run `uv run eprmcp version`; run from the repository root | +| Step 2 fails with `schema is required` | An old copy of the demo or server. Pull the latest, run `uv sync` | +| Step 5 finds more than one event | A name collision from a rerun in the same second. Run it again | +| `expected 9 tools` | A different server version answered. Check `--server-url` | + +## Reset + +`(cd docs/tutorials/code && docker compose down -v)` removes all EPR data. + +Back to the [rehearsal script](run_all.sh), which runs every demo in order. diff --git a/demos/scripts/openapi_demo_script.md b/demos/scripts/openapi_demo_script.md new file mode 100644 index 0000000..8d28bd2 --- /dev/null +++ b/demos/scripts/openapi_demo_script.md @@ -0,0 +1,104 @@ +# Presenter Script: The HTTP Side of the MCP Server + +Demo file: `demos/openapi_demo.py`. Time: 5 minutes. + +## Goal + +Show that the MCP server is also an ordinary HTTP service: it has a health +check, a published OpenAPI description, and a Swagger page, and it serves the +MCP protocol on `/mcp`. End by listing the tools the way an AI client sees them. + +## Prerequisites + +- A terminal in the repository root, with uv installed. +- EPR is not needed for this demo: it never calls EPR. +- Port 8000 is not required; the demo picks a free port. + +## Before you start + +- Run it once ahead of time so uv has installed everything. The first run can + take a minute. +- Have a browser ready for the Swagger step. + +## Steps + +### 1. Run the demo + +Say: "The script starts the server over HTTP, calls its endpoints one by one, +and then connects an MCP client." + +```bash +uv run python demos/openapi_demo.py +``` + +Expected output (abridged; the port differs): + +```text +EPR MCP Server: HTTP endpoints demo +======================================== +Starting the server on http://127.0.0.1:60193 + +[1/5] Health check +GET http://127.0.0.1:60193/health -> 200 'OK' + +[2/5] OpenAPI specification as YAML +GET http://127.0.0.1:60193/openapi.yaml -> 200 +Title: EPR (Event Processing Registry) API (OpenAPI 3.1.0, API version 1.0.0) +Paths: 10 + GET /api/v1/events/{id} Fetch an event by ID + ... + +[3/5] The same specification as JSON +JSON matches the YAML document: True + +[4/5] Swagger UI +GET http://127.0.0.1:60193/docs -> 200, 1658 bytes of HTML + +[5/5] MCP tools, listed by a FastMCP client +Connected to http://127.0.0.1:60193/mcp and found 9 tools: + fetch_event required arguments: id + ... + +Demo completed. +``` + +### 2. Walk through the steps + +1. Health check. "Orchestrators such as Docker and Kubernetes poll this. The + Docker image's healthcheck uses it." +2. OpenAPI as YAML. "This documents the REST API of the registry that the tools + wrap." Be accurate about it: the document describes the EPR REST resources + (events, receivers, groups) and calls the service the Event Processing + Registry. EPR itself is the Event Provenance Registry, and its search is a + GraphQL endpoint, so treat the listed `/search` paths as a description of + intent, not a map of the real service. Do not promise that every path exists. +3. OpenAPI as JSON. "Same document, for tools that prefer JSON. The script + checks that the two agree." +4. Swagger UI. In a browser, open the URL the demo printed. Note it is only + reachable while the demo's server runs; to keep one running, see below. +5. MCP tools. "This is the important part. The same server speaks MCP on `/mcp`. + A client connects, asks for the tools, and gets nine, each with a schema. + Required arguments are listed: fetch tools take an `id`, search tools take + `data`, create tools take a named object." + +### 3. Optional: keep a server running to show Swagger + +```bash +uv run eprmcp start --transport http --host 127.0.0.1 --port 8000 +``` + +Open , then run +`uv run python demos/openapi_demo.py --url http://localhost:8000` in a second +terminal. Stop the server with Ctrl+C. + +## Failure recovery + +| Symptom | Cause and fix | +| ---------------------------------------------------- | ------------------------------------------------------------------------------------- | +| `the server process exited before it became healthy` | A dependency is missing. Run `uv run eprmcp version`; use `uv run`, not bare `python` | +| `no healthy server ... after 30 seconds` | First start is slow or blocked. Run once more | +| `ModuleNotFoundError: epr_mcp` | Run from the repository root with `uv run`, or `pip install -e .` | +| Step 5 fails with a connection error | With `--url`, the server must serve `/mcp` over HTTP, not stdio | +| Swagger page is blank | The page loads its scripts from a CDN; it needs internet access | + +Next: [Client demo](mcp_client_demo_script.md). diff --git a/demos/scripts/run_all.sh b/demos/scripts/run_all.sh new file mode 100755 index 0000000..6b32c01 --- /dev/null +++ b/demos/scripts/run_all.sh @@ -0,0 +1,76 @@ +#!/usr/bin/env bash +# SPDX-FileCopyrightText: © 2025 Brett Smith +# SPDX-License-Identifier: Apache-2.0 +# +# Runs every demo in presentation order, unattended, against a running EPR. +# Use it to rehearse before a talk. It stops at the first failure. +# +# Usage: +# demos/scripts/run_all.sh # EPR at http://localhost:8042 +# EPR_URL=http://epr:8042 demos/scripts/run_all.sh +# demos/scripts/run_all.sh --skip-generate # leave EPR's data alone (skips the 55 posts) +# +# Needs: uv, curl, and EPR running (see docs/tutorials/code/docker-compose.yaml). +# Creates data in EPR: 11 receivers and 44 events (unless skipped) plus 1 receiver +# and 1 event from the client demo. Reset with `docker compose down -v`. + +set -euo pipefail + +cd "$(dirname "$0")/../.." + +EPR_URL="${EPR_URL:-http://localhost:8042}" +SKIP_GENERATE=0 +for arg in "$@"; do + case "$arg" in + --skip-generate) SKIP_GENERATE=1 ;; + -h | --help) + sed -n '2,/^$/p' "$0" | sed 's/^# \{0,1\}//' + exit 0 + ;; + *) + echo "Unknown option: $arg" >&2 + exit 2 + ;; + esac +done + +section() { + printf '\n==== %s ====\n' "$1" +} + +fail() { + printf '\nFAILED: %s\n' "$1" >&2 + exit 1 +} + +section "Prerequisites" +command -v uv > /dev/null || fail "uv is not installed (https://docs.astral.sh/uv/)" +command -v curl > /dev/null || fail "curl is not installed" +if ! curl -fsS --max-time 5 "${EPR_URL}/healthz/readiness" > /dev/null; then + fail "EPR is not ready at ${EPR_URL}. Start it with: (cd docs/tutorials/code && docker compose up -d --build)" +fi +echo "uv: $(uv --version)" +echo "EPR is ready at ${EPR_URL}" + +section "Demo 1: generate_epr_events.py --dry-run (prints curl commands, changes nothing)" +dry_run_output="$(uv run python demos/generate_epr_events.py --dry-run --url "${EPR_URL}")" +curl_count="$(printf '%s\n' "${dry_run_output}" | grep -c '^curl ')" +printf '%s\n' "${dry_run_output}" | grep '^curl ' | head -n 2 | cut -c 1-160 +echo "..." +[ "${curl_count}" -eq 55 ] || fail "expected 55 curl commands (11 receivers + 44 events), found ${curl_count}" +echo "OK: ${curl_count} curl commands" + +if [ "${SKIP_GENERATE}" -eq 1 ]; then + section "Demo 1b: posting events (skipped)" +else + section "Demo 1b: generate_epr_events.py (posts 11 receivers and 44 events)" + uv run python demos/generate_epr_events.py --url "${EPR_URL}" 2>&1 | tail -n 3 +fi + +section "Demo 2: openapi_demo.py (HTTP endpoints, OpenAPI documents, tool list)" +uv run python demos/openapi_demo.py --epr-url "${EPR_URL}" + +section "Demo 3: mcp_client_demo.py (create, fetch, and search through MCP tools)" +uv run python demos/mcp_client_demo.py --epr-url "${EPR_URL}" + +section "All demos passed" diff --git a/docker-compose.yaml b/docker-compose.yaml index d7fe2ed..d82ea04 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,3 +1,4 @@ +--- services: epr-mcp-server: build: . @@ -6,7 +7,7 @@ services: - "8000:8000" environment: - EPR_URL=${EPR_URL:-http://host.docker.internal:8042} - - EPR_TOKEN=${EPR_TOKEN} + - EPR_TOKEN=${EPR_TOKEN:-} - EPR_DEBUG=${EPR_DEBUG:-false} - MCP_HOST=0.0.0.0 - MCP_PORT=8000 @@ -49,12 +50,12 @@ services: - ./prometheus.yaml:/etc/prometheus/prometheus.yml:ro - prometheus-data:/prometheus command: - - '--config.file=/etc/prometheus/prometheus.yml' - - '--storage.tsdb.path=/prometheus' - - '--web.console.libraries=/etc/prometheus/console_libraries' - - '--web.console.templates=/etc/prometheus/consoles' - - '--storage.tsdb.retention.time=200h' - - '--web.enable-lifecycle' + - "--config.file=/etc/prometheus/prometheus.yml" + - "--storage.tsdb.path=/prometheus" + - "--web.console.libraries=/etc/prometheus/console_libraries" + - "--web.console.templates=/etc/prometheus/consoles" + - "--storage.tsdb.retention.time=200h" + - "--web.enable-lifecycle" restart: unless-stopped networks: - epr-network @@ -90,4 +91,4 @@ volumes: prometheus-data: name: epr-mcp-prometheus-data grafana-data: - name: epr-mcp-grafana-data \ No newline at end of file + name: epr-mcp-grafana-data diff --git a/docs/.DS_Store b/docs/.DS_Store new file mode 100644 index 0000000..47d38a3 Binary files /dev/null and b/docs/.DS_Store differ diff --git a/docs/DOCKER_COMPOSE.md b/docs/DOCKER_COMPOSE.md deleted file mode 100644 index 2a83342..0000000 --- a/docs/DOCKER_COMPOSE.md +++ /dev/null @@ -1,549 +0,0 @@ -# Docker Setup Guide - -This guide explains how to run the EPR MCP Server using Docker, either with -Docker Compose (recommended) or directly with Docker commands. - -## Direct Docker Usage - -### Quick Start with Docker - -```bash -# Clone the repository -git clone https://github.com/xbcsmith/epr-mcp-python.git -cd epr-mcp-python - -# Build the Docker image -docker build -t epr-mcp-server . - -# Run the container -docker run -d \ - --name epr-mcp-server \ - -p 8000:8000 \ - -e EPR_URL=http://host.docker.internal:8042 \ - -e EPR_TOKEN=your-epr-api-token \ - -e EPR_DEBUG=false \ - epr-mcp-server - -# Check container status -docker ps - -# View logs -docker logs -f epr-mcp-server - -# Test the server -curl http://localhost:8000/health -``` - -### Docker Run Variations - -#### Development Mode (Interactive) - -```bash -# Run in foreground with interactive terminal -docker run -it --rm \ - --name epr-mcp-server \ - -p 8000:8000 \ - -e EPR_URL=http://host.docker.internal:8042 \ - -e EPR_TOKEN=your-epr-api-token \ - -e EPR_DEBUG=true \ - epr-mcp-server -``` - -#### Production Mode (Background) - -```bash -# Run as daemon with restart policy -docker run -d \ - --name epr-mcp-server \ - --restart unless-stopped \ - -p 8000:8000 \ - -e EPR_URL=http://host.docker.internal:8042 \ - -e EPR_TOKEN=your-epr-api-token \ - -e EPR_DEBUG=false \ - epr-mcp-server -``` - -#### With Volume Mounts - -```bash -# Mount logs directory for persistent logging -docker run -d \ - --name epr-mcp-server \ - -p 8000:8000 \ - -v $(pwd)/logs:/app/logs \ - -v $(pwd)/.env:/app/.env:ro \ - -e EPR_URL=http://host.docker.internal:8042 \ - -e EPR_TOKEN=your-epr-api-token \ - epr-mcp-server -``` - -#### Custom Network - -```bash -# Create a custom network -docker network create epr-network - -# Run container in custom network -docker run -d \ - --name epr-mcp-server \ - --network epr-network \ - -p 8000:8000 \ - -e EPR_URL=http://epr-api-server:8042 \ - -e EPR_TOKEN=your-epr-api-token \ - epr-mcp-server -``` - -### Container Management - -#### View Container Status - -```bash -# List running containers -docker ps - -# List all containers (including stopped) -docker ps -a - -# View container details -docker inspect epr-mcp-server -``` - -#### Container Logs - -```bash -# View recent logs -docker logs epr-mcp-server - -# Follow logs in real-time -docker logs -f epr-mcp-server - -# View logs with timestamps -docker logs -t epr-mcp-server - -# View last 100 lines -docker logs --tail 100 epr-mcp-server -``` - -#### Stop and Clean Up - -```bash -# Stop the container -docker stop epr-mcp-server - -# Remove the container -docker rm epr-mcp-server - -# Remove the image -docker rmi epr-mcp-server - -# Clean up everything (containers, networks, images) -docker system prune -a -``` - -### Environment Variables - -| Variable | Description | Default | Required | -| ----------- | ---------------------------- | ---------------------------------- | -------- | -| `EPR_URL` | EPR API server URL | `http://host.docker.internal:8042` | Yes | -| `EPR_TOKEN` | EPR API authentication token | - | Yes | -| `EPR_DEBUG` | Enable debug logging | `false` | No | -| `MCP_HOST` | MCP server bind address | `0.0.0.0` | No | -| `MCP_PORT` | MCP server port | `8000` | No | - -### Networking Considerations - -When running with Docker, pay attention to networking: - -- **EPR server on host machine**: Use `http://host.docker.internal:8042` -- **EPR server in another container**: Use `http://container-name:8042` -- **EPR server on remote machine**: Use `http://remote-host:8042` - -### Troubleshooting Direct Docker - -#### Container Won't Start - -```bash -# Check if port is already in use -lsof -i :8000 - -# Run with different port -docker run -p 8001:8000 ... - -# Check container logs for errors -docker logs epr-mcp-server -``` - -#### Connection Issues - -```bash -# Test network connectivity from container -docker exec -it epr-mcp-server curl http://host.docker.internal:8042/health - -# Check DNS resolution -docker exec -it epr-mcp-server nslookup host.docker.internal -``` - -#### Image Build Issues - -```bash -# Build with no cache -docker build --no-cache -t epr-mcp-server . - -# Build with verbose output -docker build --progress=plain -t epr-mcp-server . -``` - -## Docker Compose (Recommended) - -### Quick Start - -#### 1. Basic Setup - -```bash -# Clone the repository -git clone https://github.com/xbcsmith/epr-mcp-python.git -cd epr-mcp-python - -# Copy environment template -cp .env.example .env - -# Edit the environment file with your EPR configuration -nano .env -``` - -### 2. Configure Environment - -Edit `.env` file: - -```bash -EPR_URL=http://your-epr-server:8042 -EPR_TOKEN=your-actual-api-token -EPR_DEBUG=false -``` - -### 3. Run the Server - -```bash -# Build and start the server -docker-compose up -d - -# View logs -docker-compose logs -f epr-mcp-server - -# Check health -curl http://localhost:8000/health -``` - -## Service Profiles - -The Docker Compose configuration includes multiple service profiles for -different deployment scenarios: - -### Default Profile (Core Server) - -```bash -docker-compose up -d -``` - -- **epr-mcp-server**: Core MCP server on port 8000 - -### Production Profile (with Nginx) - -```bash -docker-compose --profile production up -d -``` - -- **epr-mcp-server**: Core MCP server -- **nginx**: Reverse proxy with rate limiting and security headers on port - 80/443 - -### Monitoring Profile (with Prometheus & Grafana) - -```bash -docker-compose --profile monitoring up -d -``` - -- **epr-mcp-server**: Core MCP server -- **prometheus**: Metrics collection on port 9090 -- **grafana**: Visualization dashboard on port 3000 - -### Full Stack (All Services) - -```bash -docker-compose --profile production --profile monitoring up -d -``` - -## Available Endpoints - -### Core Server (Port 8000) - -- **MCP Endpoint**: `http://localhost:8000/mcp` -- **API Documentation**: `http://localhost:8000/docs` -- **OpenAPI Spec**: `http://localhost:8000/openapi.json` -- **Health Check**: `http://localhost:8000/health` - -### Production (Port 80/443) - -- **Web Interface**: `http://localhost/` (proxied to core server) -- **SSL Support**: Configure certificates in `ssl/` directory - -### Monitoring (Port 3000/9090) - -- **Grafana Dashboard**: `http://localhost:3000` (admin/admin) -- **Prometheus**: `http://localhost:9090` - -## Configuration Files - -### Environment Variables (.env) - -```bash -# Required -EPR_URL=http://your-epr-server:8042 -EPR_TOKEN=your-api-token - -# Optional -EPR_DEBUG=false -GRAFANA_USER=admin -GRAFANA_PASSWORD=secure-password -``` - -### Nginx Configuration (nginx.conf) - -- Rate limiting (10 requests/second) -- Security headers -- SSL/TLS support (commented out) -- Proxy configuration - -### Prometheus Configuration (prometheus.yaml) - -- Scrapes metrics from MCP server -- 15-second scrape intervals -- Self-monitoring - -## Management Commands - -### Start Services - -```bash -# Default profile -docker-compose up -d - -# Specific profiles -docker-compose --profile production up -d -docker-compose --profile monitoring up -d -``` - -### Stop Services - -```bash -# Stop all services -docker-compose down - -# Stop and remove volumes -docker-compose down -v -``` - -### View Logs - -```bash -# All services -docker-compose logs -f - -# Specific service -docker-compose logs -f epr-mcp-server -``` - -### Restart Services - -```bash -# Restart all -docker-compose restart - -# Restart specific service -docker-compose restart epr-mcp-server -``` - -### Update and Rebuild - -```bash -# Pull latest images and rebuild -docker-compose pull -docker-compose build --no-cache -docker-compose up -d -``` - -## Health Monitoring - -### Built-in Health Checks - -- **Container Health**: Docker health checks every 30 seconds -- **HTTP Health**: `curl http://localhost:8000/health` -- **Service Dependencies**: Containers wait for healthy dependencies - -### Monitoring Stack - -When using the monitoring profile: - -1. **Prometheus** collects metrics from the MCP server -2. **Grafana** provides visualization dashboards -3. **Health checks** ensure service availability - -## Development Workflow - -### Local Development - -```bash -# Start with debug mode -EPR_DEBUG=true docker-compose up -d - -# Follow logs for debugging -docker-compose logs -f epr-mcp-server - -# Reload configuration -docker-compose restart epr-mcp-server -``` - -### Testing Changes - -```bash -# Rebuild after code changes -docker-compose build epr-mcp-server -docker-compose up -d epr-mcp-server - -# Test endpoints -curl http://localhost:8000/health -curl http://localhost:8000/docs -``` - -## Production Deployment - -### 1. SSL Configuration - -```bash -# Create SSL directory -mkdir ssl - -# Add your certificates -cp your-cert.pem ssl/cert.pem -cp your-key.pem ssl/key.pem - -# Update nginx.conf to enable HTTPS -# (uncomment the HTTPS server block) -``` - -### 2. Security Considerations - -- Use strong passwords for Grafana -- Configure proper EPR_TOKEN -- Enable SSL/TLS for production -- Consider firewall rules -- Regular security updates - -### 3. Resource Limits - -Add resource limits to docker-compose.yaml: - -```yaml -services: - epr-mcp-server: - deploy: - resources: - limits: - memory: 512M - cpus: "0.5" -``` - -## Troubleshooting - -### Common Issues - -1. **Port Conflicts** - - ```bash - # Check port usage - lsof -i :8000 - - # Change ports in docker-compose.yaml - ports: - - "8001:8000" # Use different host port - ``` - -2. **Environment Variables Not Loading** - - ```bash - # Verify .env file exists and has correct format - cat .env - - # Restart with fresh environment - docker-compose down - docker-compose up -d - ``` - -3. **Health Check Failures** - - ```bash - # Check server logs - docker-compose logs epr-mcp-server - - # Test health endpoint directly - docker-compose exec epr-mcp-server curl localhost:8000/health - ``` - -4. **Network Issues** - - ```bash - # Check network connectivity - docker network ls - docker network inspect epr-mcp-network - - # Recreate network - docker-compose down - docker-compose up -d - ``` - -### Getting Help - -- Check logs: `docker-compose logs -f` -- Inspect containers: `docker-compose ps` -- Debug networks: `docker network inspect epr-mcp-network` -- Report issues: GitHub Issues - -## Advanced Configuration - -### Custom Networks - -```yaml -networks: - epr-network: - driver: bridge - ipam: - config: - - subnet: 172.20.0.0/16 -``` - -### Volume Mounts for Development - -```yaml -services: - epr-mcp-server: - volumes: - - ./src:/src/epr_mcp/src:ro # Mount source for development -``` - -### Multiple Environments - -Create separate compose files: - -- `docker-compose.yaml` (base) -- `docker-compose.dev.yaml` (development overrides) -- `docker-compose.prod.yaml` (production overrides) - -Usage: - -```bash -# Development -docker-compose -f docker-compose.yaml -f docker-compose.dev.yaml up -d - -# Production -docker-compose -f docker-compose.yaml -f docker-compose.prod.yaml up -d -``` diff --git a/docs/OPENAPI_IMPLEMENTATION.md b/docs/OPENAPI_IMPLEMENTATION.md deleted file mode 100644 index 06b809b..0000000 --- a/docs/OPENAPI_IMPLEMENTATION.md +++ /dev/null @@ -1,166 +0,0 @@ -# EPR MCP Server - OpenAPI Implementation - -## Summary - -I have successfully implemented OpenAPI endpoint support for the EPR MCP Server. -This implementation provides a comprehensive API interface with automatic MCP -tool generation, interactive documentation, and schema validation. - -## What Was Implemented - -### 1. OpenAPI 3.0 Specification (`src/epr_mcp/openapi.yaml`) - -A complete OpenAPI 3.0 specification that defines: - -- **Schemas**: Event, EventReceiver, EventReceiverGroup, SearchCriteria, Error -- **Endpoints**: - - Fetch operations: `GET /api/v1/{resource}/{id}` - - Create operations: `POST /api/v1/{resource}` - - Search operations: `POST /api/v1/{resource}/search` - - Health check: `GET /health` -- **Request/Response types**: Proper typing for all operations -- **Validation rules**: Required fields, data types, constraints - -### 2. OpenAPI Endpoint Support (`server.py`) - -Enhanced the existing server with: - -- **OpenAPI Spec Endpoints**: - - - `GET /openapi.yaml` - YAML format specification - - `GET /openapi.json` - JSON format specification - - `GET /docs` - Swagger UI interactive documentation - -- **Improved Error Handling**: Better HTTP status codes and error messages -- **Structured Responses**: All responses now use model objects and return JSON -- **Schema Integration**: Full integration with existing Pydantic validation - schemas - -### 3. Alternative OpenAPI Server (`openapi_server.py`) - -A demonstration of how to use FastMCP's native OpenAPI integration: - -- **FastMCPOpenAPI Class**: Shows how to leverage FastMCP's built-in OpenAPI - support -- **Route Mappings**: Configuration to map OpenAPI paths to MCP components -- **Handler Classes**: Structured approach for handling API operations - -### 4. Enhanced Models and Schemas - -- **Updated GraphQLQuery**: Fixed to support dictionary variables -- **Model Integration**: Full integration between dataclass models and API - operations -- **Validation**: Consistent ValidationError usage throughout the codebase - -### 5. Testing and Documentation - -- **Comprehensive Tests** (`tests/test_openapi.py`): Validates OpenAPI spec - structure and schemas -- **Demo Script** (`openapi_demo.py`): Interactive demonstration of capabilities -- **Updated README**: Complete documentation of OpenAPI features -- **Updated Dependencies**: Added PyYAML for OpenAPI spec handling - -## Key Features - -### 🔄 Automatic MCP Tool Generation - -The OpenAPI specification can be used with FastMCP to automatically generate MCP -tools, eliminating manual tool definition. - -### 📚 Interactive Documentation - -Swagger UI provides a user-friendly interface to explore and test the API -endpoints directly in the browser. - -### 🛡️ Type Safety & Validation - -- Pydantic schemas for request validation -- Dataclass models for response serialization -- OpenAPI schemas for API documentation -- Consistent error handling with ValidationError - -### 🔌 Flexible Architecture - -- Works with existing manual MCP tool definitions -- Can be migrated to use FastMCP's OpenAPI integration -- Maintains backward compatibility -- Extensible for future enhancements - -## API Endpoints Available - -When the server is running on `http://localhost:8000`: - -| Endpoint | Purpose | Format | -| --------------- | ----------------------------- | ----------------- | -| `/openapi.yaml` | OpenAPI specification | YAML | -| `/openapi.json` | OpenAPI specification | JSON | -| `/docs` | Interactive API documentation | HTML (Swagger UI) | -| `/health` | Health check | Plain text | - -## MCP Tools Generated - -From the OpenAPI specification, these MCP tools are available: - -1. **fetchEvent** - Retrieve a single event by ID -2. **fetchReceiver** - Retrieve a single event receiver by ID -3. **fetchGroup** - Retrieve a single event receiver group by ID -4. **createEvent** - Create a new event -5. **createReceiver** - Create a new event receiver -6. **createGroup** - Create a new event receiver group -7. **searchEvents** - Search for events with criteria -8. **searchReceivers** - Search for event receivers with criteria -9. **searchGroups** - Search for event receiver groups with criteria -10. **healthCheck** - Health status check - -## Benefits - -### For Developers - -- Clear API contract with OpenAPI specification -- Interactive testing with Swagger UI -- Automatic tool generation reduces boilerplate -- Type-safe operations with proper validation - -### For Users - -- Consistent interface across all operations -- Self-documenting API with examples -- Better error messages and status codes -- Structured JSON responses - -### For Maintenance - -- Single source of truth for API definition -- Automatic validation ensures consistency -- Easy to extend with new operations -- Clear separation of concerns - -## Next Steps - -1. **Install Dependencies**: `pip install PyYAML fastmcp` -2. **Start Server**: Run with your EPR configuration -3. **Explore API**: Visit `http://localhost:8000/docs` -4. **Use MCP Tools**: Integrate with MCP clients -5. **Extend**: Add new operations to the OpenAPI spec - -## File Structure - -```text -src/epr_mcp/ -├── openapi.yaml # OpenAPI 3.0 specification -├── server.py # Enhanced MCP server with OpenAPI endpoints -├── openapi_server.py # Alternative FastMCP OpenAPI implementation -├── models.py # Data models (Event, EventReceiver, etc.) -├── schemas.py # Pydantic validation schemas -└── ... - -tests/ -├── test_openapi.py # OpenAPI specification tests -└── ... - -openapi_demo.py # Interactive demonstration script -README.md # Updated documentation -``` - -This implementation provides a robust, well-documented, and extensible -foundation for the EPR MCP Server with full OpenAPI support. diff --git a/docs/README.md b/docs/README.md index d2ac457..dca3160 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,265 +1,51 @@ # EPR MCP Server Documentation -Welcome to the documentation for the EPR (Event Provenance Registry) MCP Server. -This directory contains comprehensive documentation covering all aspects of the -server implementation, including OpenAPI integration, schema validation, and -usage examples. +Documentation for the EPR (Event Provenance Registry) MCP server, organized with +the [Diataxis](https://diataxis.fr) framework. For installation and day-to-day +use, start with the [repository README](../README.md). -## Overview +## Tutorials (`docs/tutorials/`) -The EPR MCP Server is a Python-based Model Context Protocol (MCP) server that -provides tools for interacting with the Event Provenance Registry. It features: +Learning-oriented, step by step. -- **FastMCP Integration**: Built on the FastMCP framework for robust MCP server - implementation -- **OpenAPI Support**: Complete OpenAPI 3.0 specification with interactive - Swagger UI documentation -- **Schema Validation**: Comprehensive input validation using Pydantic models -- **Type Safety**: Full type annotations and structured data handling -- **REST API Compatibility**: HTTP endpoints alongside MCP tools +| Document | Description | +| --------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | +| [Workshop](./tutorials/README.md) | Build the server step by step in about two and a half hours, with checkpoints, an EPR environment, tests, and editor setup | -## Documentation Index +## How-to guides (`docs/how-tos/`) -| Name | Description | -| -------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [docker_compose.md](./docker_compose.md) | Complete Docker setup guide covering both Docker Compose (recommended) and direct Docker usage, including service profiles (production, monitoring), configuration management, and deployment strategies | -| [docker_reference.md](./docker_reference.md) | Quick reference guide for Docker commands and common scenarios when running EPR MCP Server with direct Docker commands, including troubleshooting and cleanup procedures | -| [troubleshooting.md](./troubleshooting.md) | Comprehensive troubleshooting guide covering connection issues, Docker problems, configuration errors, and debugging techniques with specific solutions for common problems | -| [openapi_implementation.md](./openapi_implementation.md) | Comprehensive guide to the OpenAPI 3.0 implementation, including endpoint definitions, schema documentation, Swagger UI integration, and examples of API usage | -| [schema_validation.md](./schema_validation.md) | Detailed documentation of Pydantic validation schemas for all MCP tools, including search criteria, creation inputs, validation rules, and whitespace sanitization features | +Task-oriented recipes. -## Quick Start +| Document | Description | +| ------------------------------------------------ | ------------------------------------------------------------------------------------ | +| [docker_compose.md](./how-tos/docker_compose.md) | Run the server with Docker or Docker Compose: build, configuration, profiles, checks | -### 1. Installation +## Reference (`docs/reference/`) -```bash -git clone https://github.com/xbcsmith/epr-mcp-python.git -cd epr-mcp-python -python3 -m venv .venv/epr-mcp-python -source .venv/epr-mcp-python/bin/activate -pip install -e . -``` +Information-oriented specifications. -### 2. Configuration +| Document | Description | +| ------------------------------------------------------------------ | ---------------------------------------------------------------------------------- | +| [openapi_implementation.md](./reference/openapi_implementation.md) | The HTTP endpoints next to the MCP endpoint: health, OpenAPI documents, Swagger UI | +| [schema_validation.md](./reference/schema_validation.md) | The input and response validation rules for every tool | -Set up your EPR server connection: +## Explanation (`docs/explanation/`) -```bash -export EPR_URL="http://your-epr-server:8042" -export EPR_TOKEN="your-api-token" -``` +Understanding-oriented discussion and implementation records. -### 3. Start the Server +| Document | Description | +| ---------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------- | +| [Migration to FastMCP 4 and httpx2](./explanation/fastmcp4_httpx2_migration_implementation.md) | What changed, what was found against a real EPR, and the release checklist | +| [Migration plan](./explanation/fastmcp4_httpx2_migration_implementation_plan.md) | The phased plan the migration followed | -```bash -python -m epr_mcp.main start -``` +## Demos -### 4. Access Documentation +The [demos](../demos/README.md) are three runnable demonstrations with presenter +scripts and a rehearsal script. They are not documentation, so they live next to +the code. -Once running, visit: +## Conventions -- **API Documentation**: - [http://localhost:8000/docs](http://localhost:8000/docs) -- **OpenAPI Spec (JSON)**: - [http://localhost:8000/openapi.json](http://localhost:8000/openapi.json) -- **OpenAPI Spec (YAML)**: - [http://localhost:8000/openapi.yaml](http://localhost:8000/openapi.yaml) - -### 5. Docker Alternative - -For Docker deployment, see the [Docker Setup Guide](./docker_compose.md) for -both Docker Compose and direct Docker usage options. - -**Quick Docker run:** - -```bash -docker build -t epr-mcp-server . -docker run -p 8000:8000 \ - -e EPR_URL=http://host.docker.internal:8042 \ - -e EPR_TOKEN=your-token \ - epr-mcp-server -``` - -## Available MCP Tools - -The server provides the following MCP tools: - -### Fetch Operations - -- `fetchEvent` - Retrieve a specific event by ID -- `fetchReceiver` - Retrieve a specific event receiver by ID -- `fetchGroup` - Retrieve a specific event receiver group by ID - -### Search Operations - -- `searchEvents` - Search for events using various criteria -- `searchReceivers` - Search for event receivers using filters -- `searchGroups` - Search for event receiver groups - -### Create Operations - -- `createEvent` - Create a new event in EPR -- `createReceiver` - Create a new event receiver -- `createGroup` - Create a new event receiver group - -### Utility Operations - -- `healthCheck` - Check server health status - -## Architecture - -The EPR MCP Server is built with a modular architecture: - -```text -src/epr_mcp/ -├── server.py # Main MCP server implementation -├── openapi_server.py # Alternative OpenAPI-first implementation -├── models.py # Data models (Event, EventReceiver, etc.) -├── schemas.py # Pydantic validation schemas -├── common.py # Shared utilities and GraphQL query builders -├── config.py # Configuration management -├── errors.py # Error handling utilities -└── openapi.yaml # OpenAPI 3.0 specification -``` - -## Data Models - -### Core Entities - -- **Event**: Represents an event in the provenance registry with metadata like - name, version, platform, and payload -- **EventReceiver**: Defines endpoints that can receive events with schema - validation -- **EventReceiverGroup**: Collections of event receivers for organized event - routing - -### Supporting Models - -- **GraphQLQuery**: Structured GraphQL query representation -- **SearchCriteria**: Flexible search parameters for filtering operations -- **ValidationSchemas**: Pydantic models ensuring data integrity - -## Development - -### Running Tests - -```bash -# Install test dependencies -pip install -e .[test] - -# Run all tests -python -m pytest - -# Run specific test files -python -m pytest tests/test_openapi.py -v -python -m pytest tests/test_schemas.py -v -``` - -### Linting - -```bash -# Install lint dependencies -pip install -e .[lint] - -# Run linting -ruff check src/ tests/ -``` - -### Building - -```bash -# Install build dependencies -pip install -e .[build] - -# Create distributions -python -m build -``` - -## Integration Examples - -### Using with Claude Desktop - -Add to your Claude Desktop configuration: - -```json -{ - "mcp": { - "servers": { - "epr-mcp-server": { - "command": "python", - "args": ["-m", "epr_mcp.main"], - "env": { - "EPR_URL": "http://your-epr-server:8042", - "EPR_TOKEN": "your-api-token" - }, - "type": "stdio" - } - } - } -} -``` - -### Using with MCP Client Libraries - -```python -from mcp.client import Client - -# Connect to the server -client = Client("stdio", ["python", "-m", "epr_mcp.main"]) - -# Use MCP tools -result = client.call_tool("searchEvents", { - "name": "deployment", - "version": "1.0.0" -}) -``` - -## Troubleshooting - -Having issues? Check our comprehensive guides: - -- **Connection Problems**: See [troubleshooting.md](./troubleshooting.md) for - solutions to "All connection attempts failed" and other network issues -- **Docker Issues**: Both [docker_compose.md](./docker_compose.md) and - [docker_reference.md](./docker_reference.md) contain Docker-specific - troubleshooting -- **Configuration Problems**: Environment variable and token issues are covered - in the troubleshooting guide - -**Quick fixes:** - -- Docker connection errors: Use `EPR_URL=http://host.docker.internal:8042` -- Check EPR server: `curl http://localhost:8042/health` -- View logs: `docker logs -f container-name` or check console output - -## Contributing - -1. Fork the repository -2. Create a feature branch -3. Make your changes -4. Add tests for new functionality -5. Ensure all tests pass -6. Submit a pull request - -## Support - -For questions, issues, or contributions: - -- **GitHub Issues**: - [https://github.com/xbcsmith/epr-mcp-python/issues](https://github.com/xbcsmith/epr-mcp-python/issues) -- **Troubleshooting**: Start with [troubleshooting.md](./troubleshooting.md) for - common issues and solutions -- **Docker Help**: See [docker_compose.md](./docker_compose.md) or - [docker_reference.md](./docker_reference.md) for container-related problems -- **Schema Questions**: Check [schema_validation.md](./schema_validation.md) for - validation and input format details -- **API Documentation**: Refer to - [openapi_implementation.md](./openapi_implementation.md) for endpoint - specifications -- **Examples**: See `../demos/openapi_demo.py` for interactive examples - -## License - -This project is licensed under the Apache License 2.0. See the -[LICENSE](../LICENSE) file for details. +Markdown file names are lowercase with underscores, except `README.md`. Every +markdown file passes `markdownlint --config .markdownlint.json` and +`prettier --parser markdown --prose-wrap always`. diff --git a/docs/SCHEMA_VALIDATION.md b/docs/SCHEMA_VALIDATION.md deleted file mode 100644 index df65a88..0000000 --- a/docs/SCHEMA_VALIDATION.md +++ /dev/null @@ -1,230 +0,0 @@ -# EPR MCP Server Input Validation Schemas - -This document describes the input validation schemas implemented for the EPR MCP -Server tools. - -## Overview - -The schema validation system uses Pydantic models to ensure that all input data -to the MCP tools is properly validated before processing. This helps prevent -errors, improves security, and provides clear error messages when invalid data -is provided. - -## Schema Components - -### Base Models - -- **BaseModel**: All schemas inherit from Pydantic's BaseModel -- **Field**: Used for field definitions with validation rules and descriptions -- **validator**: Custom validation decorators for complex field validation - -### Search Schemas - -#### EventSearchInput - -Validates input for searching events: - -```python -{ - "name": "optional string", - "version": "optional string", - "release": "optional string", - "platform_id": "optional string", - "package": "optional string", - "description": "optional string", - "success": "optional boolean", - "event_receiver_id": "optional string" -} -``` - -#### EventReceiverSearchInput - -Validates input for searching event receivers: - -```python -{ - "name": "optional string", - "type": "optional string", - "version": "optional string", - "description": "optional string" -} -``` - -#### EventReceiverGroupSearchInput - -Validates input for searching event receiver groups: - -```python -{ - "name": "optional string", - "type": "optional string", - "version": "optional string", - "description": "optional string" -} -``` - -### Creation Schemas - -#### EventCreateInput - -Validates input for creating events (all fields required): - -```python -{ - "name": "string (min_length=1)", - "version": "string (min_length=1)", - "release": "string (min_length=1)", - "platform_id": "string (min_length=1)", - "package": "string (min_length=1)", - "description": "string (min_length=1)", - "event_receiver_id": "string (min_length=1)", - "success": "boolean", - "payload": "dict (required, must be dictionary)" -} -``` - -#### EventReceiverCreateInput - -Validates input for creating event receivers (all fields required): - -```python -{ - "name": "string (min_length=1)", - "type": "string (min_length=1)", - "version": "string (min_length=1)", - "description": "string (min_length=1)" -} -``` - -#### EventReceiverGroupCreateInput - -Validates input for creating event receiver groups (all fields required): - -```python -{ - "name": "string (min_length=1)", - "type": "string (min_length=1)", - "version": "string (min_length=1)", - "description": "string (min_length=1)", - "event_receiver_ids": "list of strings (min_items=1, all non-empty)" -} -``` - -### Fetch Schema - -#### FetchInput - -Validates input for fetch operations: - -```python -{ - "id": "string (min_length=1, trimmed)" -} -``` - -## Data Wrappers - -### SearchDataWrapper - -Wraps search inputs in a `data` field: - -```python -{ - "data": EventSearchInput | EventReceiverSearchInput | EventReceiverGroupSearchInput -} -``` - -### CreateDataWrapper - -Wraps creation inputs in a `data` field: - -```python -{ - "data": EventCreateInput | EventReceiverCreateInput | EventReceiverGroupCreateInput -} -``` - -## Usage - -### Validation Function - -The main validation function is `validate_input(operation, input_data)`: - -```python -from schemas import validate_input -from pydantic import ValidationError - -try: - validated_data = validate_input("search_events", { - "data": { - "name": "foo", - "version": "1.0.0" - } - }) - # Use validated_data... -except (ValidationError, ValueError) as e: - # Handle validation error - print(f"Validation error: {e}") -``` - -### Operation Mapping - -The system supports these operations: - -- `search_events` → SearchDataWrapper -- `search_receivers` → SearchDataWrapper -- `search_groups` → SearchDataWrapper -- `create_event` → CreateDataWrapper -- `create_receiver` → CreateDataWrapper -- `create_group` → CreateDataWrapper -- `fetch_event` → FetchInput -- `fetch_receiver` → FetchInput -- `fetch_group` → FetchInput - -## Integration with MCP Tools - -Each MCP tool now includes validation: - -```python -@mcp.tool(title="Search Events", description="Search for events in EPR") -async def search_events(data: dict) -> str: - try: - validated_data = validate_input("search_events", data) - except (ValidationError, ValueError) as e: - return f"Validation error: {str(e)}" - - # Process validated_data... -``` - -## Benefits - -1. **Type Safety**: Ensures correct data types for all fields -2. **Required Field Validation**: Prevents missing required fields -3. **Format Validation**: Validates string lengths, list contents, etc. -4. **Clear Error Messages**: Pydantic provides detailed validation errors -5. **Documentation**: Schema serves as documentation for expected input formats -6. **Security**: Prevents injection attacks and malformed data - -## Testing - -Run the validation tests: - -```bash -cd /home/bsmith/go/src/github.com/xbcsmith/epr-workshop/11-epr-mcp-server/src -python test_schemas.py -``` - -## Error Handling - -Validation errors are caught and returned as user-friendly error messages: - -- Missing required fields -- Invalid data types -- Empty strings where content is required -- Invalid list contents -- Malformed dictionaries - -## Dependencies - -- `pydantic>=2.0.0`: Core validation library -- `typing`: Type hints for Python < 3.9 compatibility diff --git a/docs/docker_reference.md b/docs/docker_reference.md deleted file mode 100644 index 903426e..0000000 --- a/docs/docker_reference.md +++ /dev/null @@ -1,214 +0,0 @@ -# Docker Quick Reference - -Quick reference for running EPR MCP Server with Docker. - -## Basic Commands - -### Build and Run - -```bash -# Build image -docker build -t epr-mcp-server . - -# Basic run -docker run -p 8000:8000 \ - -e EPR_URL=http://host.docker.internal:8042 \ - -e EPR_TOKEN=your-token \ - epr-mcp-server - -# Run in background -docker run -d --name epr-mcp-server \ - -p 8000:8000 \ - -e EPR_URL=http://host.docker.internal:8042 \ - -e EPR_TOKEN=your-token \ - epr-mcp-server -``` - -### Management - -```bash -# View running containers -docker ps - -# View logs -docker logs -f epr-mcp-server - -# Stop container -docker stop epr-mcp-server - -# Remove container -docker rm epr-mcp-server - -# Execute command in container -docker exec -it epr-mcp-server bash -``` - -## Common Scenarios - -### Development - -```bash -# Interactive mode with debug -docker run -it --rm \ - -p 8000:8000 \ - -e EPR_URL=http://host.docker.internal:8042 \ - -e EPR_TOKEN=your-token \ - -e EPR_DEBUG=true \ - epr-mcp-server -``` - -### Production - -```bash -# Daemon with restart policy -docker run -d \ - --name epr-mcp-server \ - --restart unless-stopped \ - -p 8000:8000 \ - -e EPR_URL=http://your-epr-server:8042 \ - -e EPR_TOKEN=your-token \ - epr-mcp-server -``` - -### With Persistent Logs - -```bash -# Mount logs directory -docker run -d \ - --name epr-mcp-server \ - -p 8000:8000 \ - -v $(pwd)/logs:/app/logs \ - -e EPR_URL=http://host.docker.internal:8042 \ - -e EPR_TOKEN=your-token \ - epr-mcp-server -``` - -### With Configuration File - -```bash -# Mount .env file -docker run -d \ - --name epr-mcp-server \ - -p 8000:8000 \ - -v $(pwd)/.env:/app/.env:ro \ - epr-mcp-server -``` - -### Custom Network - -```bash -# Create network -docker network create epr-network - -# Run with custom network -docker run -d \ - --name epr-mcp-server \ - --network epr-network \ - -p 8000:8000 \ - -e EPR_URL=http://epr-api-server:8042 \ - -e EPR_TOKEN=your-token \ - epr-mcp-server -``` - -## Environment Variables - -| Variable | Description | Example | -| ----------- | -------------- | ---------------------------------- | -| `EPR_URL` | EPR server URL | `http://host.docker.internal:8042` | -| `EPR_TOKEN` | API token | `your-secret-token` | -| `EPR_DEBUG` | Debug mode | `true` or `false` | -| `MCP_HOST` | Bind address | `0.0.0.0` | -| `MCP_PORT` | Server port | `8000` | - -## Networking - -### EPR Server Locations - -| EPR Server Location | Docker EPR_URL | -| ------------------- | ---------------------------------- | -| Host machine | `http://host.docker.internal:8042` | -| Docker container | `http://container-name:8042` | -| Remote server | `http://remote-host:8042` | -| Local (non-Docker) | `http://localhost:8042` | - -## Troubleshooting - -### Check Container Status - -```bash -# Container running? -docker ps - -# Container logs -docker logs epr-mcp-server - -# Container details -docker inspect epr-mcp-server -``` - -### Test Connectivity - -```bash -# Test EPR connection from container -docker exec -it epr-mcp-server \ - curl http://host.docker.internal:8042/health - -# Test MCP server -curl http://localhost:8000/health -``` - -### Port Issues - -```bash -# Check port usage -lsof -i :8000 - -# Use different port -docker run -p 8001:8000 ... -``` - -### Debug Container - -```bash -# Interactive shell -docker exec -it epr-mcp-server bash - -# Check environment -docker exec -it epr-mcp-server env | grep EPR - -# Check processes -docker exec -it epr-mcp-server ps aux -``` - -## Cleanup - -### Remove Container - -```bash -# Stop and remove -docker stop epr-mcp-server -docker rm epr-mcp-server - -# Force remove -docker rm -f epr-mcp-server -``` - -### Remove Image - -```bash -# Remove image -docker rmi epr-mcp-server - -# Remove all unused images -docker image prune -a -``` - -### Complete Cleanup - -```bash -# Remove everything (containers, networks, images, volumes) -docker system prune -a - -# Remove only stopped containers and unused images -docker system prune -``` diff --git a/docs/explanation/fastmcp4_httpx2_migration_implementation.md b/docs/explanation/fastmcp4_httpx2_migration_implementation.md new file mode 100644 index 0000000..2643fda --- /dev/null +++ b/docs/explanation/fastmcp4_httpx2_migration_implementation.md @@ -0,0 +1,598 @@ +# FastMCP 4 and httpx2 Migration Implementation + +This document records what was found and done while migrating `epr-mcp` from +FastMCP 2.x and `httpx` to FastMCP 4 and `httpx2`, rewriting the tutorials and +demos, and fixing what running against a real EPR exposed. It was filled in +phase by phase; the plan it followed is +[fastmcp4_httpx2_migration_implementation_plan.md](./fastmcp4_httpx2_migration_implementation_plan.md). + +## Overview + +| Area | Result | +| ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| Dependencies | `fastmcp>=4.0,<5`, `httpx2>=2.13`, `pydantic>=2.12`, `starlette>=1.0`; legacy `httpx` is gone | +| Server | `create_server(cfg)` plus `run(cfg)`; `stdio` and `http` transports; flat tool arguments; nine tools verified against a live EPR | +| Packaging | `py3-none-any` wheel that includes `openapi.yaml`; SPDX license metadata; Dockerfile installs the wheel by glob | +| Workshop | Eight modules, four checkpoints, an EPR-only compose file, a preflight, and a terminal client | +| Demos | Three demos, three presenter scripts, and `run_all.sh` | +| Quality | 316 tests pass (2 functional tests skipped by default and passing when enabled), 94% coverage, 41 doctests, `ruff` clean, all markdown lint-clean | + +The release is version 2.0.0 because behavior changes (see the 2.0 notes in the +README); the version bump itself is a post-merge step (see the release +checklist). + +## Components + +| Path | Role | +| ------------------------ | ------------------------------------------------------------------------------------------ | +| `src/epr_mcp/server.py` | `create_server`, `run`, the nine tools, and the HTTP routes | +| `src/epr_mcp/common.py` | `create_client`: the httpx2 client with the optional bearer token, and the GraphQL helpers | +| `src/epr_mcp/config.py` | `Config` with `url`, `token`, `debug`, `transport`, `host`, `port` | +| `src/epr_mcp/main.py` | The `eprmcp` command: `--transport`, `--host`, `--port`, token and URL | +| `src/epr_mcp/schemas.py` | Input and response validation (unknown fields rejected) | +| `docs/tutorials/` | The workshop and its code, EPR compose file, and preflight | +| `demos/` | Demos, presenter scripts, and `scripts/run_all.sh` | +| `tests/` | Unit, tutorial, demo, and functional tests | + +## Implementation Details + +The details follow, by phase: what the research found (Phase 0), the httpx2 swap +(Phase 1), the FastMCP 4 changes, flat arguments, and packaging (Phase 2), the +workshop and the real-EPR fixes (Phase 3), the demos (Phase 4), and the +documentation and release work (Phase 5). + +## Phase 0: Migration Findings + +Research date: 2026-10-06. Method: read the upstream docs, then installed +`fastmcp` 4.0.11 and the pre-migration set into scratch virtualenvs outside the +repo and exercised the current code against them. No repository code changed in +this phase. + +### Baseline (pre-migration code) + +Environment: Python 3.12.11, `fastmcp` 2.12.4, `httpx` 0.28.1. + +| Check | Result | +| -------------------------- | ---------------------------------------------------------------------------- | +| `ruff check src/` | 2 errors, 1 auto-fixable (import ordering in `server.py`); not clean | +| `pytest` | 126 passed, 0 failed | +| Coverage over `src/` | 40% total; `server.py` 5%, `schemas.py` 64%; below the 80% gate in AGENTS.md | +| Committed wheel in `dist/` | Contains no `openapi.yaml` (see Findings, item 6) | + +### Verified facts about FastMCP 4.0.11 and httpx2 2.13.1 + +| Topic | Finding | +| ----------------------------- | ----------------------------------------------------------------------------------------------------------------------- | +| Python requirement | `fastmcp` requires Python >= 3.10; the project's `>= 3.12` stays valid | +| Installed dependency versions | `httpx2` 2.13.1, `httpcore2` 2.13.1, `mcp` 2.3.0, `pydantic` 2.13.5, `starlette` 1.7.0, `truststore` 0.10.4 | +| Legacy `httpx` | Not installed alongside FastMCP 4; any leftover `import httpx` raises `ModuleNotFoundError`, so the swap is checkable | +| `FastMCP(...)` constructor | Second positional parameter is `instructions`; `version` is keyword-only | +| `Context` logging | `debug`, `info`, `warning`, `error`, `log` exist and are awaitable | +| `custom_route` | Present, same shape (`path`, `methods`) | +| `run` / `run_async` | Same signature: `transport`, `show_banner`, `**transport_kwargs`; `transport="http", host=, port=` works | +| `fastmcp.server.openapi` | Removed; `fastmcp.server.providers.openapi` provides `OpenAPIProvider`, `RouteMap`, `MCPType` (moot, module is deleted) | +| In-memory test client | `Client(server_instance)` works; `mode` defaults to `"auto"`; `Client` also accepts `Path`, URL, and transport objects | +| stdio transport | `mcp.run(transport="stdio")` works; a `StdioTransport(command, args)` client lists and calls tools | +| httpx2 API | `httpx2.MockTransport` exists; default User-Agent is `python-httpx2/2.13.1` | + +### Experiment: current server on FastMCP 4 + +A copy of `src/` with `openapi_server.py` removed and `import httpx` replaced by +`import httpx2 as httpx` was run against FastMCP 4.0.11: + +- `server.run(cfg)` constructs the server; all 9 tools register with unchanged + decorators and `Annotated[..., Field(...)]` parameters. +- An in-memory `Client` lists the 9 tools and calls `fetch_event`; with EPR + unreachable the tool returns the expected "Connection failed" message, so the + `httpx2.ConnectError` branch in `handle_http_errors` works through the swap. +- Starlette `TestClient` returns 200 for `/health`, `/openapi.yaml`, + `/openapi.json`, and `/docs`. + +Conclusion: the migration is mostly mechanical; the risks are in the items +below. + +### Findings that change the plan + +1. **`version` bug confirmed.** The running server reports + `instructions="1.0.0"` and `version="4.0.11"`. Fix with keyword arguments + (Phase 2). +2. **Client logging is deprecated.** Every `ctx.debug` and `ctx.error` call + emits an `MCPDeprecationWarning` stating that the logging capability is + deprecated as of 2026-07-28 (SEP-2577). Decision needed in Phase 2: move + diagnostics to Python `logging` (stderr, already configured in `main.py`) and + keep `ctx` logging out of the tool bodies, which also reduces noise over + stdio. +3. **Default HTTP bind.** `run()` binds `0.0.0.0:8000` regardless of `MCP_HOST` + and `MCP_PORT`; unchanged by FastMCP 4, handled in Phase 2. +4. **Lint baseline is not clean.** Fix the 2 existing `ruff` errors in Phase 1 + so later phases can rely on the gate. +5. **Coverage baseline is 40%.** `server.py` needs the Phase 2 in-memory-client + tests to reach the 80% gate. +6. **Packaging bug.** The wheel built from the current `pyproject.toml` does not + include `openapi.yaml`, so `/openapi.yaml` and `/openapi.json` would return + 404 in the Docker image. Add package data (and a test that the file is found) + in Phase 2. +7. **Build backend.** `build-backend = "setuptools.build_meta:__legacy__"` and + the `py2.py3` universal wheel tag are stale; reconsider in Phase 2 together + with the Dockerfile wheel glob. + +### Target versions + +| Dependency | Constraint to set in `pyproject.toml` | +| ----------- | ------------------------------------- | +| Python | `>= 3.12` (unchanged) | +| `fastmcp` | `>= 4.0, < 5` | +| `httpx2` | `>= 2.13` | +| `pydantic` | `>= 2.12` | +| `starlette` | `>= 1.0` (FastMCP 4 resolves 1.7.0) | +| `httpx` | Removed | + +### Remaining unverified items + +- `uv run` launching the stdio server from VS Code and Claude Desktop (the stdio + transport itself is verified). Confirmed in Phase 3 on macOS and Linux. +- Whether `fastmcp` 4 emits a deprecation warning for the `mcp.run(...)` call + styles the tutorials will teach; check while writing module 01. + +## Phase 1: Dependency and httpx2 Migration + +### Changes + +- `pyproject.toml`: `fastmcp>=4.0,<5`, `httpx2>=2.13`, `pydantic>=2.12`, + `starlette>=1.0`; `httpx` removed; tox `extras` fixed to `test`. +- `src/epr_mcp/server.py`: `import httpx2`; the exception checks in + `handle_http_errors` use `httpx2` types; the 9 client sites use + `create_client(cfg)`. +- `src/epr_mcp/common.py`: new `create_client(cfg)` returning an + `httpx2.AsyncClient` with a JSON content type and an optional bearer header. +- `src/epr_mcp/config.py`: `Config.token` is optional (default `None`); it was + typed `str` but is passed `None` when no token is set. +- `src/epr_mcp/openapi_server.py`: deleted (decision); it imported the removed + `fastmcp.server.openapi` and the legacy `httpx`. +- `tests/unit/test_http_errors.py`: new tests for `handle_http_errors` (connect, + timeout, status, generic errors) and a guard against legacy `httpx` imports. +- `tests/unit/test_common.py`: new `TestCreateClient` covering the bearer + header, no header without a token, and the client type. + +The two baseline `ruff` errors are fixed. + +### Behavior changes (for the 2.0 notes) + +- The EPR token is now sent as `Authorization: Bearer` on every request made by + `server.py`. Before, `server.py` never sent it. +- The User-Agent becomes `python-httpx2/`. +- TLS verification uses the operating system trust store instead of the bundled + `certifi` certificates; `SSL_CERT_FILE` and `SSL_CERT_DIR` are still honored. +- The three POST search tools no longer set their own `Content-Type` header; the + shared client sets it. + +### Results + +`ruff check src/ tests/` passes, 134 tests pass (126 before), and no legacy +`httpx` import remains in `src/` or `tests/`. Coverage is 43% (was 40%); +`server.py` coverage arrives with the Phase 2 in-memory-client tests. + +## Phase 2: FastMCP 4 API Migration + +### Phase 2 changes + +- `src/epr_mcp/server.py`: + - `run(cfg)` is split into `create_server(cfg)` (builds the `FastMCP` instance + with all tools and routes, binds nothing) and `run(cfg)` (picks the + transport and starts it). + - `FastMCP(name="EPR MCP Server", version="1.0.0")` uses keyword arguments; + the server previously reported `"1.0.0"` as its instructions. + - All `ctx.debug` and `ctx.error` calls are now `logger.debug` and + `logger.error`, and the unused `ctx: Context` parameters are removed from + the tools. `handle_http_errors(e, operation, cfg)` is a plain function. + - `run` supports `stdio` (banner off, so nothing but protocol traffic is + written to stdout) and `http` with the configured host and port, using + `mcp.run(...)` instead of `asyncio.run(mcp.run_async(...))`. It rejects any + other transport with `ValueError`, and no longer logs the token (it logs + only whether one is configured). +- `src/epr_mcp/config.py`: `Config` gains `transport`, `host`, and `port`; + `TRANSPORTS` lists the valid transports. +- `src/epr_mcp/main.py`: new `--transport`, `--host`, and `--port` options with + `MCP_TRANSPORT`, `MCP_HOST`, and `MCP_PORT` as defaults. The token is read + from `EPR_API_TOKEN` or `EPR_TOKEN`. +- `pyproject.toml`: `openapi.yaml` is package data; the build backend is the + standard `setuptools.build_meta`; the `universal` wheel setting is removed so + the wheel is tagged `py3-none-any`; `pytest-asyncio` and `pytest-cov` are in + the test extra and tox deps. +- `Dockerfile`: installs `dist/epr_mcp-*-py3-none-any.whl` instead of a + hard-coded `0.1.0` file name. `Makefile`: `make wheel` removes `build/` and + `dist/` first, because a stale `build/lib` previously leaked deleted modules + into the wheel. + +### Phase 2 behavior changes + +- New `--transport stdio|http`, `--host`, and `--port` options and matching + environment variables. Defaults match the old behavior (`http`, `0.0.0.0`, + `8000`). +- `EPR_TOKEN`, which `docker-compose.yaml` and `.env.example` set, now reaches + the server. Before, only `EPR_API_TOKEN` was read, so the token never arrived + in Docker. +- Tool diagnostics go to the server log, not to MCP client log notifications. +- `/openapi.yaml` and `/openapi.json` work from the installed wheel; the old + wheel omitted the spec. + +### Testing + +203 tests pass and 2 functional tests are skipped by default; coverage is 87% +(`server.py` 82%, up from 5%). New files: + +- `tests/unit/test_server_tools.py`: in-memory `Client` against `create_server`, + with EPR replaced by `httpx2.MockTransport`; covers tool registration and + schemas, success, empty, non-2xx, validation failure, connect error, and + timeout for all 9 tools, plus the bearer header. +- `tests/unit/test_server_routes.py`: the four HTTP routes through the Starlette + `TestClient`, and a check that the spec ships as package data. +- `tests/unit/test_server_run.py`: transport selection, host and port, token not + logged, debug flag. +- `tests/unit/test_main.py`: command line and environment handling. +- `tests/functional/test_transports.py`: starts the real process over stdio and + over HTTP and lists the tools. Run with `EPR_MCP_FUNCTIONAL=1`; both pass. + +### Verified against a real build + +A wheel built from a clean copy of the tree contains `openapi.yaml` and no +`openapi_server.py`. The image built from it reports `healthy`, serves +`/health`, `/openapi.yaml`, and `/openapi.json` with 200, lists 9 tools over +HTTP through a FastMCP 4 client, returns the "Connection failed" message with no +EPR running, and has no legacy `httpx` installed. + +### Not yet verified + +- A `fetch_event` call against a running EPR, `docker compose up`, and the MCP + Inspector. They need a running EPR, which Phase 3 sets up; they remain part of + the Phase 2 success criteria until then. +- `uv run` launching the stdio server from VS Code (Phase 3). + +### Flat tool arguments + +The search and create tools used to require their argument wrapped one level +deeper (`search_events` took `{"data": {"data": {"name": ...}}}`, `create_event` +took `{"event_data": {"data": {...}}}`), although the tool descriptions implied +flat input, so a normal MCP client got "Field required". This is fixed: + +- `server.py` adds the `data` wrapper internally before `validate_input`, so + tools take flat input: `search_events` takes `{"data": {"name": "foo"}}` and + `create_event` takes `{"event_data": {...fields...}}`. The tool parameter + names and the JSON schemas are unchanged. +- The six search and create input models in `schemas.py` now forbid unknown + keys. Without this, a caller still using the old wrapped shape would have its + criteria silently dropped and run an unfiltered search that returns every + record. It now gets an input validation error and no request is sent. +- The `search_groups` description no longer mentions an `enabled` criterion, + which the model never supported; sending it is now rejected. +- Tests: all tool tests use flat input; new `TestFlatArguments` covers the + rejection of the old wrapped shape and of unknown criteria for every search + and create tool, and `test_schemas.py` covers the unknown-key rejection. + Totals: 215 tests pass, 2 functional tests skipped by default, coverage 88%. + +This is a breaking change for any client that sent the old wrapped shape; list +it in the 2.0 notes. + +### Existing problem found, left unchanged + +`schemas.py` calls `raise ValidationError("...")` with the Pydantic class, which +cannot be constructed that way; those branches would fail with a `TypeError` +instead of a validation message. + +## Phase 3: Tutorial Rewrite for Workshop Delivery + +### Phase 3 changes + +- `docs/tutorials/`: the six hyphenated tutorials (which taught the official + `mcp` SDK, `pip install mcp[cli] httpx`, and Docker-launched stdio) are + replaced by `README.md` (agenda, prerequisites, checkpoint table, facilitator + notes) and eight lowercase modules: `00_intro`, `01_first_tool`, + `02_inspector`, `03_complete_tool_set`, `04_validation_and_errors`, + `05_test_it`, `06_use_from_an_editor`, and `07_misc_and_troubleshooting`. +- `docs/tutorials/code/`: `pyproject.toml` and `uv.lock` pinning `fastmcp` + 4.0.11 and `httpx2` 2.13.1; four checkpoint directories; `docker-compose.yaml` + and `epr/Dockerfile` for EPR only; `seed_epr.py`; `check_setup.py` + (preflight); `client.py` (terminal MCP client); `.vscode/mcp.json` and + `claude_desktop_config.json` for two servers, the workshop server and the + shipped `eprmcp`, both launched with `uv run` over stdio. +- `tests/tutorials/test_tutorial_code.py`: every checkpoint server imports and + lists the right tools, the checkpoint 05 tests pass, checkpoint 05's server + equals checkpoint 04's, both editor configs reference existing files, the + compose file runs only EPR services, file names follow AGENTS.md Rule 1, and + no stale `mcp.server.fastmcp`, `import httpx`, or FastMCP 2 references remain + outside module 07. +- `Makefile`: new `workshop-check` target. `.gitignore`: `work/`, + `seed_ids.json`, and the saved EPR image are ignored, and the tutorial's + `.vscode/` is re-included (`.vscode` is ignored repository-wide). +- `pyproject.toml`: `testpaths = ["tests"]` so a plain `pytest` does not collect + the tutorial code. + +### Deviations from the plan + +- Checkpoints hold the finished code at the end of a module (the starter for a + module is the previous checkpoint) instead of separate starter and solution + directories. There is no checkpoint 02 or 06 because those modules do not + change code. +- The workshop server is a standalone file, not a copy of the shipped package. + Module 04 uses `ToolError` for failures; the shipped server returns error + text. +- The plan's dry run with a person new to the project has not happened, so the + timings in the agenda are estimates. + +### Found by running everything against a real EPR + +EPR was built and started with the workshop compose file, then the seed script, +the tutorial servers, and the shipped server were run against it. This found +problems that mocked tests could not: + +1. **EPR's own image does not start.** Its Dockerfile builds `FROM scratch` with + no time zone database, and the server always connects to Postgres with + `TimeZone=America/New_York`, so it exits with "unknown time zone". The + workshop `epr/Dockerfile` builds the same pinned commit + (`f8f115b790c58b8fab3bfd47278e51e4f15e9f0e`) and adds `/usr/share/zoneinfo`. + There is no published EPR image; the first build takes about three minutes. +2. **The shipped create tools reported failure on success.** EPR answers a + create with HTTP 200, but the shipped tools only accepted 201, so every + `create_*` call returned "Failed to create..." although the record was + created. They now accept 200 and 201. +3. **The shipped create tools failed after a successful create.** EPR returns + only the new ID (`{"data": ""}`), but the tools tried to validate it as a + record. They now return + `{"message": "... created successfully", "id": ""}` when EPR returns an + ID, and still handle a full record. +4. **`create_receiver` could not work.** EPR requires a `schema` ("invalid + input: schema is required"), and the input model had no `schema` field (after + the Phase 2 change to forbid unknown keys, supplying one was rejected too). + The model now requires `schema`, accepted under that name. +5. **`search_groups` always returned an empty list.** It asked for a + `fingerprint` field that the EPR GraphQL type `EventReceiverGroup` does not + have, the query failed, and the error was swallowed. The field is removed, + and all three search tools now report a GraphQL `errors` list instead of + hiding it. +6. **Error shapes differ by case.** A well-formed missing ID is HTTP 404; a + malformed ID or a bad GraphQL query is HTTP 200 with + `{"data": null, "errors": [...]}`. The tutorial server checks for both. A + stopped EPR behind Docker's port proxy surfaces as `ReadError` with an empty + message rather than `ConnectError`, so the tutorial maps `TransportError` and + shows the exception name. +7. The Inspector is now version 2.9.0 with a different interface and an access + token in the URL. Module 02 pins that version and describes only the steps + that hold across versions. + +Unit tests were added for items 2 to 5 (`TestAgainstRealEprBehavior` and +`TestCreateReturnsIdOnly` in `tests/unit/test_server_tools.py`); the suite is +238 tests passing with 88% coverage. + +### Verified + +- On macOS: the full preflight (`check_setup.py`) passes, including starting the + workshop server and the shipped server with the exact `uv run` commands from + the editor configs and listing 9 tools each; every command in modules 00 to 05 + was run against the live EPR; `uv run pytest work` and + `uv run pytest checkpoint_05_tests` pass. +- On Linux (a `uv` Docker image with Python 3.12 and uv 0.9.30): the same + preflight passes against the macOS-hosted EPR. +- The Phase 2 items that needed a running EPR are now checked: all nine shipped + tools work against the live EPR, over stdio and over HTTP. + +### Not verified + +- The VS Code and Claude Desktop screens and the Inspector 2.9.0 interface were + not opened. Modules 02 and 06 describe the steps from the documentation and + the launch commands are tested, but the on-screen wording is unconfirmed. +- No dry run of the agenda with a new attendee, so timings are estimates. + +## Phase 4: Demos With Scripts + +### Phase 4 changes + +- `demos/generate_epr_events.py`: moved to `httpx2`; the `ulid` dependency is + gone (the script now builds ULIDs itself: a 48-bit millisecond timestamp plus + 80 random bits in Crockford base32, covered by tests); the release string used + `strftime("%Y.%m.%s")`, where `%s` is the epoch seconds on some platforms and + unsupported on others, and is now `%d`; the script exits 1 when any request + fails; the `httpx2` request log is quiet so the demo output is readable. +- `demos/openapi_demo.py`: rewritten. The old script was broken (it inserted a + non-existent `demos/src` on `sys.path`, imported unused modules, and only + printed a hard-coded tool list). The new one starts the server over HTTP on a + free port (or uses `--url`), calls `/health`, `/openapi.yaml`, + `/openapi.json`, and `/docs`, checks that the YAML and JSON agree, and lists + the tools through a FastMCP 4 client. It needs no EPR. +- `demos/mcp_client_demo.py`: new. A FastMCP 4 client lists the tools, creates a + receiver and an event, fetches the event, searches for it, and shows a + malformed ID being rejected. It starts the server over stdio, or uses + `--server-url` for HTTP. +- `demos/scripts/`: presenter scripts `generate_events_script.md`, + `openapi_demo_script.md`, and `mcp_client_demo_script.md` (goal, + prerequisites, commands, expected output, talking points, failure recovery, + reset) and `run_all.sh`, an unattended rehearsal run that checks + prerequisites, stops at the first failure, and supports `--skip-generate`. +- `demos/requirements.txt` lists `fastmcp`, `httpx2`, and `PyYAML` (it listed + `httpx` and `ulid`, while the README said `ulid-py`, and the script called + `ulid.ulid()`). `demos/README.md` is rewritten: it had an OpenAPI tool list of + `fetchEvent`-style names that the server never had, an MCP client example that + used a non-existent API, and said the generator posts 33 events when it + posts 44. +- `Makefile` `lint` and the tox `check` and `format` environments now include + `demos/`; `.gitignore` ignores `epr_reports/`, which `--write-to-disk` + creates. +- `tests/demos/test_demos.py`: ULID format and ordering, the 11 receivers and 44 + events, the dry run (55 curl commands, exit 0), an unreachable EPR (exit 1), + `--write-to-disk`, the OpenAPI demo end to end, the client demo helpers, no + legacy `httpx` import, `run_all.sh` syntax and option handling, and that every + demo has a presenter script and a README entry. + +### Phase 4 results + +- The 255 tests pass (2 skipped by default) at 88% coverage, and + `ruff check src tests demos docs/tutorials/code` is clean. +- Against the live EPR on macOS: the generator posts 11 receivers and 44 events + (exit 0); the client demo passes over stdio and over HTTP; the OpenAPI demo + passes; `demos/scripts/run_all.sh` exits 0, and exits 1 with a clear message + when EPR is unreachable. +- On Linux (the `uv` Docker image): `run_all.sh --skip-generate` exits 0 against + the same EPR. + +### Phase 4 notes + +- The shipped tools report most problems (validation, EPR unreachable) as plain + text instead of an MCP error result, so the client demo treats a reply that is + not JSON as a failure. The workshop server (module 04) uses `ToolError`; the + shipped server could be changed to match in a later release. +- `src/epr_mcp/openapi.yaml`, which the server serves, calls the service the + "Event Processing Registry" (it is the Event Provenance Registry) and lists + `/search` and `/health` paths that the real EPR does not have; its search is + GraphQL. The presenter script tells the presenter not to promise that every + listed path exists. Correcting the document is outside this migration. +- The generator does not post its events to groups, and `--write-to-disk` writes + to the current directory. + +## Phase 5: Documentation, Infrastructure, and Release + +### Phase 5 changes + +- Root `README.md` rewritten. The old one described tools that do not exist + (`fetchEvent` and friends "generated from the OpenAPI specification", + `healthCheck`), a `mcp.call_tool` API, Docker-launched editor configurations, + and a `/health` check against EPR; it now covers install and run, both + transports, the options and environment table, the nine tools with their flat + arguments, the HTTP endpoints, editor configuration, Docker, development, an + "Upgrading to 2.0" section, and troubleshooting. +- Recreated under AGENTS.md Rule 1 names, written fresh against the current code + rather than copied (the old text described removed code and used emojis): + `docs/README.md`, `docs/how-tos/docker_compose.md`, + `docs/reference/openapi_implementation.md`, and + `docs/reference/schema_validation.md`. `docs/docker_reference.md` and + `docs/troubleshooting.md` stay deleted, as decided; the README and workshop + module 07 hold the troubleshooting material. +- `.env.example`: documents `MCP_TRANSPORT`, `MCP_HOST`, and `MCP_PORT`, and + says that Compose fixes the container to `0.0.0.0:8000` over `http`, so they + do not change a Compose deployment. +- `docker-compose.yaml`: `EPR_TOKEN=${EPR_TOKEN:-}` so an unset token no longer + prints a warning. +- `.dockerignore` added so the build context excludes `.git`, `.venv`, `tests`, + `docs`, and `demos`. +- `pyproject.toml`: the license is now the SPDX expression `Apache-2.0` with + `license-files`, the deprecated license classifier is gone, and setuptools + `>=77` is required. The build had warned that `project.license` as a table + stops being supported on 2027-02-18. +- Docstrings were added to 15 public functions and classes that lacked them; the + completeness audit below finished the job for every public item. + +### Phase 5 verification + +- `make wheel` in a clean copy builds without warnings; the wheel contains + `openapi.yaml` and the license, and its metadata lists the new requirements. +- The Docker image built from that wheel through `docker compose build` starts, + reports `healthy`, serves `/health` and `/openapi.yaml`, and logs + `Transport: http` and `EPR Token configured: True` when `EPR_TOKEN` is set. +- Every relative link in the repository's markdown resolves. +- A search finds no `mcp.server.fastmcp`, legacy `httpx` import, FastMCP 2 + reference, all-caps documentation name, or `ulid-py` outside this directory, + the tutorial's migration notes, and the guard tests that name them. +- `make tests` runs tox, which creates fresh environments and downloads + packages; it was not run. The same checks were run directly (see below). + +## Test suite + +| Suite | Covers | +| ------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------- | +| `tests/unit/test_server_tools.py` | All nine tools through an in-memory client with a mocked EPR, including the real-EPR behaviors | +| `tests/unit/test_server_routes.py`, `test_server_run.py`, `test_main.py` | HTTP routes, transport selection, command line and environment | +| `tests/unit/test_schemas.py`, `test_common.py`, `test_http_errors.py` | Validation, the client factory, httpx2 error handling | +| `tests/tutorials/test_tutorial_code.py` | Every workshop checkpoint, configs, naming, and stale references | +| `tests/demos/test_demos.py` | The three demos and `run_all.sh` | +| `tests/functional/test_transports.py` | The real process over stdio and over HTTP (`EPR_MCP_FUNCTIONAL=1`) | + +Final gate, run from the repository root: + +```bash +ruff check src/ tests/ demos/ docs/tutorials/code +ruff format --check src/ tests/ demos/ docs/tutorials/code +pytest --cov=src --cov-report=term-missing --cov-fail-under=80 +EPR_MCP_FUNCTIONAL=1 pytest tests/functional +pytest --doctest-modules --import-mode=importlib src/epr_mcp +markdownlint --config .markdownlint.json +prettier --check --parser markdown --prose-wrap always +``` + +## Examples + +Start the server for an editor, or as a service: + +```bash +uv run eprmcp start --transport stdio --url http://localhost:8042 +uv run eprmcp start --transport http --host 127.0.0.1 --port 8000 +``` + +Call a tool with flat arguments from Python: + +```python +async with Client("http://127.0.0.1:8000/mcp") as client: + await client.call_tool("search_events", {"data": {"name": "checkout-service"}}) +``` + +Rehearse the demos against a live EPR: + +```bash +(cd docs/tutorials/code && docker compose up -d --build) +demos/scripts/run_all.sh +``` + +## Completeness audit + +After Phase 5 the plan was checked item by item against the repository and +AGENTS.md. Five audit agents were started, but all hit the session rate limit +and returned nothing, so the audit was done directly. Everything below was found +and fixed in that pass, and verified by running the gates. + +| Finding | Fix | +| --------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- | +| Rule 3: 46 functions in `src/epr_mcp` lacked Args, Returns, or Examples (including the nine tools and four routes) | Every public function now has all three sections; 33 examples run as doctests | +| Rule 3: the demos, workshop scripts, and checkpoint servers had one-line or no docstrings | Full docstrings throughout; 8 more doctests in the demos; checkpoints 04 and 05 stay identical | +| Rule 3: test modules, fixtures, helpers, and classes had no docstrings | Added to every test, fixture, helper, and test class | +| Copyright: the new test files had no SPDX header | Added to every new test file | +| Rule 4: `Popen` used without a context manager in a demo and a functional test | `running_server` context manager in the OpenAPI demo; `with subprocess.Popen` in the test | +| Rule 5: public functions with no direct test (`Config.as_dict`, `seed_epr`, `check_setup`, `client.py`, the demo helpers) | New `test_config.py`, `test_tutorial_scripts.py`, and `test_demo_helpers.py` | +| Plan 2.4: "for each tool test connect error, timeout, non-200, response validation failure" was only covered for some tools | A matrix over all nine tools (`TestEveryToolHandlesEprFailures`) | +| Plan 3.2: "CI-check that every solution imports and passes its tests" had a test but no CI | `.github/workflows/ci.yaml` runs ruff, the tests with the 80% floor, doctests, and the markdown gates; it has not run on GitHub yet | +| YAML lint warnings in the files created for the migration | Document start markers added | + +Still not done, because it cannot be done from the command line: + +- The VS Code, Claude Desktop, and Inspector 2.9.0 screens, and the dry run of + the workshop with a new attendee (plan items 3.4 and 3.5; one deliverable box + stays unticked on purpose). +- `make tests` (tox, which downloads packages); the same checks were run + directly. +- The first run of the new CI workflow. + +## Release checklist (after the merge) + +The version stays `0.1.0` in the pull request. After it merges, the maintainer: + +1. Bumps the version to `2.0.0` in `pyproject.toml` (`constants.py` reads it + from the installed package metadata, so no second edit is needed). +2. Runs the quality gate above once more on the merge commit. +3. Runs `make wheel` and checks `dist/epr_mcp-2.0.0-py3-none-any.whl`: it should + contain `epr_mcp/openapi.yaml` and no `openapi_server.py`. +4. Runs `make docker-image`, then starts the image and checks `/health`. +5. Updates the version in `docs/tutorials/code/.vscode/mcp.json` examples only + if they pin one (they do not today) and tags `v2.0.0`. +6. Publishes with `make release` (the tox `release` environment uploads to the + package index) and pushes the image to the registry in use. +7. Announces the breaking changes using the "Upgrading to 2.0" section of the + README. + +Known follow-ups that are outside this migration: + +- `src/epr_mcp/openapi.yaml` calls EPR the "Event Processing Registry" and lists + paths the real EPR does not have. +- The tools return errors as text rather than as MCP error results; the workshop + server shows the `ToolError` alternative. +- The Prometheus and Grafana profiles in `docker-compose.yaml` expect `/metrics` + and provisioning files that do not exist. +- `schemas.py` raises `pydantic.ValidationError` directly in a few validators, + which cannot be constructed that way. +- The workshop agenda has not been dry-run with a new attendee, and the VS Code, + Claude Desktop, and Inspector 2.9.0 screens have not been opened. diff --git a/docs/explanation/fastmcp4_httpx2_migration_implementation_plan.md b/docs/explanation/fastmcp4_httpx2_migration_implementation_plan.md new file mode 100644 index 0000000..759846f --- /dev/null +++ b/docs/explanation/fastmcp4_httpx2_migration_implementation_plan.md @@ -0,0 +1,472 @@ +# FastMCP 4 and httpx2 Migration Implementation Plan + +## Overview + +Migrate `epr-mcp` from FastMCP 2.x (installed: 2.12.4) and `httpx` (0.28.1) to +FastMCP 4 and `httpx2`. Update the tutorials in `docs/tutorials/` into a single +end-to-end, workshop-teachable path, and update the demos in `demos/` so each +has a presenter script. Sources: + +- +- +- + +Facts taken from those pages (everything else in this plan must be verified in +Phase 0): + +| Area | Change | +| --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ | +| HTTP library | FastMCP 4 uses `httpx2` exclusively; exception hierarchy matches, so it is an import swap | +| Imports | `fastmcp.server.openapi` moves to `fastmcp.server.providers.openapi` | +| Imports | `fastmcp.server.proxy` moves to `fastmcp.server.providers.proxy` | +| Requirements | Pydantic >= 2.12; httpx2 requires Python >= 3.10 | +| Removed | `ctx.sample()`, `ctx.sample_step()`, `ctx.list_roots()`, `sampling_handler=` | +| Protocol | Modern sessionless protocol is default; `ctx.elicit()` needs `mode="legacy"` clients | +| httpx2 behavior | `httpx2` and `httpcore2` package names, `python-httpx2/` User-Agent, OS trust store via `truststore`, logger names `httpx2` and `httpcore2.*` | + +## Current State Analysis + +### Existing Infrastructure + +| Item | State | +| ---------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [pyproject.toml](../../pyproject.toml) | Unpinned `fastmcp`, `httpx`, `pydantic`, `starlette`, `PyYAML`; `requires-python >= 3.12` | +| [server.py](../../src/epr_mcp/server.py) | `run(cfg)` registers 9 tools (fetch/search/create for events, receivers, groups) and 4 `custom_route` endpoints (`/health`, `/openapi.yaml`, `/openapi.json`, `/docs`); 9 `httpx.AsyncClient` call sites; `handle_http_errors` checks `httpx.ConnectError`, `httpx.TimeoutException`, `httpx.HTTPStatusError`; ends with `asyncio.run(mcp.run_async(transport="http", ...))` | +| `openapi_server.py` | `EPROpenAPIHandler` (6 `httpx.AsyncClient` call sites) plus `create_openapi_server` using `FastMCPOpenAPI`, `MCPType`, `RouteMap` imported from `fastmcp.server.openapi`; not wired into [main.py](../../src/epr_mcp/main.py) | +| [main.py](../../src/epr_mcp/main.py) | argparse dispatch; `start` calls `server.run(cfg)`; always binds `0.0.0.0:8000` | +| Tests | `tests/unit/test_server.py` covers only `filter_none_values`; `tests/test_smoke.py` imports modules; `tests/test_base.py` empty; `tests/functional/` empty | +| Docker | [Dockerfile](../../Dockerfile) installs prebuilt wheel `dist/epr_mcp-0.1.0-py2.py3-none-any.whl` on UBI8 Python 3.12; [docker-compose.yaml](../../docker-compose.yaml) healthchecks `/health` | +| [docs/tutorials/](../tutorials/) | `00-intro` to `05-mcp-misc`; `README.md` is empty; tutorials 01 and 05 install `mcp[cli] mcp httpx` and import `mcp.server.fastmcp` (the official SDK), not the `fastmcp` package; 04 repeats the 9 `httpx.AsyncClient` snippets; one link points to "FastMCP 2.0" | +| [demos/](../../demos/) | `generate_epr_events.py` uses `httpx.Client` and `ulid`; `openapi_demo.py` is a print-only script; `requirements.txt` lists `httpx>=0.23.0` and `ulid>=1.1.0`; no demo has a script | +| `temp/` | Scratch `server.py` (SDK-style FastMCP) and `notes.md` (curl commands to seed EPR receivers) | + +### Identified Issues + +1. `FastMCP("EPR MCP Server", "1.0.0")` in `server.py` passes the version as the + second positional argument, which in FastMCP 2.x is `instructions`, not + `version`. Verify against FastMCP 4 and switch to keyword arguments. +2. `openapi_server.py` imports from the moved path `fastmcp.server.openapi`, is + unused by the CLI, and contains an unfinished handler/route-map design + (comment: "In a full implementation..."). Decision: delete it. +3. `server.py` is about 700 lines with almost no test coverage, but + [AGENTS.md](../../AGENTS.md) requires 80% coverage. A migration without + behavioral tests is unverifiable. +4. `demos/openapi_demo.py` is broken: it inserts `demos/src` on `sys.path` (does + not exist) and imports `run` and `Config` it never uses. +5. Demo dependency drift: `requirements.txt` says `ulid`, the README says + `ulid-py`, the script calls `ulid.ulid()`. +6. Tutorials teach the official `mcp` SDK, but the product ships on the + `fastmcp` package; learners will not reproduce the real server. +7. Tutorial file names (`00-intro.md`) violate AGENTS.md Rule 1 (lowercase, + underscores only); `docs/tutorials/README.md` is empty. +8. `MCP_HOST` and `MCP_PORT` are set in Docker but never read; host and port are + hard-coded. +9. The `Dockerfile` installs a prebuilt wheel, so the image will not contain + `httpx2` and `fastmcp` 4 unless the wheel is rebuilt after Phase 1. +10. `main.py` only supports HTTP transport, and running the MCP server in Docker + from VS Code is unreliable. The workshop needs a path that works every time + (see Phase 3 and Decisions). + +## Decisions + +| Topic | Decision | +| ------------------- | ------------------------------------------------------------------------------------------------------------------------------ | +| `openapi_server.py` | Delete the module and every reference to it | +| `temp/` | Git-ignored; the user deletes it locally; no repo change | +| Auth token | The shared client factory sends `Authorization: Bearer` on every request when a token is set | +| Workshop EPR | Attendees run EPR themselves with docker compose | +| Workshop MCP server | Never in Docker; runs on the host over stdio from a local venv (see Phase 3) | +| Demo "script" | Both a presenter walkthrough document and a runnable shell script | +| Deleted docs | Recreate four with lowercase names per AGENTS.md Rule 1 (Phase 5); `docker_reference.md` and `troubleshooting.md` stay deleted | +| Delivery | One PR for all phases | +| Workshop launch | Plain `uv run` launches the stdio server from VS Code and Claude Desktop; no other launcher is documented | +| Supported OS | macOS and Linux only; Windows is out of scope (no Windows quoting, testing, or docs) | +| Version | The PR does not bump the version; after merge, tag and bump to 2.0.0 (breaking change) | + +## Implementation Phases + +### Phase 0: Research and Baseline + +#### 0.1 Foundation Work + +- Create branch work from `pr-xbcsmith-fastmcp2`; record baseline results of + `ruff check src/`, `pytest --cov=src`, and server start in a fresh venv. +- Read the full FastMCP 3-to-4 upgrade guide and the httpx2 migration page end + to end; list any change not in the Overview table. + +#### 0.2 Add Foundation Functionality + +Resolve these by reading FastMCP 4 docs or source, recording answers in the +implementation doc: + +| Question | Affects | +| --------------------------------------------------------------------------------------- | ---------------------------- | +| Minimum Python and Starlette versions for FastMCP 4 | `pyproject.toml`, Dockerfile | +| `FastMCP(...)` constructor: is `version=` keyword the supported form | `server.py` | +| `ctx.debug`, `ctx.info`, `ctx.error` still present and awaitable | `server.py` | +| `custom_route` still supported and its signature | `server.py` | +| `run_async(transport="http", host=, port=)` still valid | `server.py` | +| Replacement for `FastMCPOpenAPI` / `RouteMap` / `MCPType` at `providers.openapi` | `openapi_server.py` | +| In-memory test client API (`fastmcp.Client` with a server instance) and `mode=` options | tests, tutorials | +| Whether `Client` string/stdio inference warnings affect any code or demo | demos, tutorials | +| Exact `httpx2` API for `MockTransport`, `AsyncClient`, `Client` | tests, demos | + +#### 0.3 Integrate Foundation Work + +Add a "Migration Findings" section to the implementation doc (Phase 6) so later +phases cite verified facts, not assumptions. + +#### 0.4 Testing Requirements + +Baseline suite must be green on the pre-migration code, or pre-existing failures +are listed explicitly. + +#### 0.5 Deliverables + +- [x] Baseline lint, test, coverage numbers recorded (2 ruff errors, 126 tests + pass, 40% coverage) +- [x] Open-question table above fully answered (see the implementation doc, + Phase 0 findings) +- [x] Target versions chosen (`fastmcp` >= 4.0 < 5, `httpx2` >= 2.13, + `pydantic` >= 2.12, `starlette` >= 1.0, Python >= 3.12) + +#### 0.6 Success Criteria + +Every row in the question table has a sourced answer; target versions are +decided and written down. + +### Phase 1: Dependency and httpx2 Migration + +#### 1.1 Foundation Work + +- Fix the 2 baseline `ruff check src/` errors (import ordering in `server.py`). +- Edit [pyproject.toml](../../pyproject.toml): replace `httpx` with `httpx2`, + set lower bounds for `fastmcp` (>= 4), `pydantic` (>= 2.12), and `starlette` + per Phase 0; adjust `requires-python` and classifiers if FastMCP 4 requires. +- Update `[tool.tox]` deps and `extras` so test envs install the same set (note + `extras = testing` does not match the `test` extra name; fix). + +#### 1.2 Add Foundation Functionality + +- In [server.py](../../src/epr_mcp/server.py): swap `import httpx` for + `import httpx2`; update the 9 `AsyncClient` call sites and the three exception + checks in `handle_http_errors`. +- Search tests and docs for logger names `httpx` and `httpcore` and rename to + `httpx2` and `httpcore2`. + +#### 1.3 Integrate Foundation Work + +- Extract one shared client factory in [common.py](../../src/epr_mcp/common.py) + (timeout, headers, `Authorization` bearer from `cfg.token` when set) to + replace the 9 repeated `AsyncClient()` constructions in `server.py`; + `server.py` currently never sends the token, so this is a behavior change to + call out in the migration notes. `openapi_server.py` was deleted in Phase 1 + (it imports the removed `fastmcp.server.openapi` and legacy `httpx`, so it + blocked the Phase 1 success criteria). +- Check for external services reached through the OS trust store change (httpx2 + uses `truststore`); document `SSL_CERT_FILE` / `SSL_CERT_DIR` fallbacks in + tutorial module 07 (misc and troubleshooting). + +#### 1.4 Testing Requirements + +- Add `tests/unit/test_http_errors.py` covering `handle_http_errors` for + `ConnectError`, `TimeoutException`, `HTTPStatusError`, and generic errors, + using `httpx2` exception types. +- Add a unit test asserting no `import httpx` remains in `src/`. + +#### 1.5 Deliverables + +- [x] `pyproject.toml` and tox config updated +- [x] All `src/` HTTP code on `httpx2` +- [x] Shared client factory with tests +- [x] `ruff check src/` and `pytest` pass + +#### 1.6 Success Criteria + +`grep -rn "import httpx$" src/ tests/` returns nothing; `pip install -e .` in a +clean venv pulls `httpx2` and no direct `httpx` dependency of this project. + +### Phase 2: FastMCP 4 API Migration + +#### 2.1 Feature Work + +- Fix the `FastMCP(...)` construction in `server.py` to keyword arguments + (`name`, `version`, optional `instructions`), per Phase 0 findings. +- Re-verify each `@mcp.tool(title=, description=)` registration and the + `Annotated[str, Field(...)]` parameter style still produce correct tool + schemas; fix any decorator argument changes. +- Replace `ctx.debug` and `ctx.error` calls in all 9 tools and + `handle_http_errors` with module `logger` calls: FastMCP 4 deprecates the + client logging capability (SEP-2577) and warns on every call (Phase 0 finding + 2). `handle_http_errors` no longer needs the `ctx` argument. +- Re-verify `custom_route` handlers for `/health`, `/openapi.yaml`, + `/openapi.json`, `/docs`. +- Remove any use of `ctx.sample`, `ctx.sample_step`, `ctx.list_roots`, + `sampling_handler`, `ctx.elicit` (none found in the current scan; re-confirm + with grep). + +#### 2.2 Integrate Feature + +- `openapi_server.py` is already deleted (Phase 1); remove every remaining + reference: imports, `docs/reference/openapi_implementation.md` (rewrite to + describe only the `/openapi.yaml`, `/openapi.json`, and `/docs` routes that + remain in `server.py`), the demos, and `tests/test_smoke.py` if referenced. + Keep `openapi.yaml`, which `server.py` serves. +- Add a `--transport` option to `main.py start` with values `stdio` and `http` + (default `http` to keep Docker behavior). The stdio path calls the framework's + stdio run method; logging already goes to stderr, and no code path may print + to stdout in stdio mode. +- Replace `asyncio.run(mcp.run_async(...))` with the FastMCP 4 recommended entry + point (`mcp.run(...)` if supported) so event-loop handling is the framework's + job. +- Read `MCP_HOST` and `MCP_PORT` from the environment in `main.py` and pass them + via `config.Config` ([config.py](../../src/epr_mcp/config.py)) instead of + hard-coded `0.0.0.0:8000`. +- Stop logging `cfg.token` in `server.py`. + +#### 2.3 Configuration Updates + +- Add `openapi.yaml` as package data so the built wheel serves `/openapi.yaml` + and `/openapi.json` (the current wheel omits it); review the legacy build + backend and `py2.py3` wheel tag at the same time. +- Do not change the version in this PR (the 2.0.0 bump happens after merge, see + Phase 5). Rebuild the wheel (`make wheel`), then fix the hard-coded wheel + filename `epr_mcp-0.1.0-...` in the [Dockerfile](../../Dockerfile) (use a glob + or build arg) so the later version bump does not break the image build. +- Confirm the Docker base image Python version satisfies FastMCP 4; if not, + change the base image. +- Update [docker-compose.yaml](../../docker-compose.yaml) env if new variables + are added; keep `.yaml` extension per Rule 1. + +#### 2.4 Testing Requirements + +- Add `tests/unit/test_server_tools.py`: build the server through `run`-style + factory (split `run(cfg)` into `create_server(cfg)` plus `run(cfg)` so tests + need no network bind), connect with the FastMCP 4 in-memory client, assert the + 9 tool names and input schemas. +- For each tool, test success, 404/non-200, `ConnectError`, timeout, and + response-validation failure using `httpx2.MockTransport` (or the Phase 0 + equivalent). +- Test the 4 custom routes with Starlette `TestClient`. +- Add one functional test in `tests/functional/` that starts the server in HTTP + mode and calls `/health` and `tools/list` (skipped unless an env flag is set). + +#### 2.5 Deliverables + +- [x] `create_server` / `run` split with tests +- [x] `openapi_server.py` deleted with all references removed +- [x] `--transport stdio|http` option with tests +- [x] Host and port configurable +- [x] Dockerfile builds and container passes `/health` healthcheck +- [x] Coverage >= 80% over `src/` + +#### 2.6 Success Criteria + +`pytest --cov=src --cov-fail-under=80` passes; `docker compose up` shows a +healthy `epr-mcp-server`; MCP Inspector lists all 9 tools and a `fetch_event` +call returns data from a running EPR. + +### Phase 3: Tutorial Rewrite for Workshop Delivery + +#### 3.1 Feature Work + +Rework [docs/tutorials/](../tutorials/) as one linear path where every module +ends with a runnable checkpoint. Rename files to lowercase underscores +(`00_intro.md`, `01_first_tool.md`, ...) and fix inbound links. + +| Module | Title | Content | Time | +| ------ | ------------------------ | ------------------------------------------------------------------------------- | ------ | +| 00 | Intro and prerequisites | What MCP and EPR are; Python, uv, Docker, Node (Inspector) check; seed EPR | 15 min | +| 01 | First tool | `fastmcp` 4 + `httpx2`; one `fetch_event` tool; `mcp.run()` | 20 min | +| 02 | Inspector | Connect, list tools, call `fetch_event` (replaces current 02) | 15 min | +| 03 | Complete the tool set | Receivers, groups, search, create; `Annotated`/`Field` schemas | 30 min | +| 04 | Validation and errors | Pydantic schemas, `handle_http_errors`, `httpx2` exceptions | 20 min | +| 05 | Test it | In-memory client plus `httpx2.MockTransport` tests | 20 min | +| 06 | Use it from an editor | stdio config for VS Code and Claude Desktop; HTTP and Docker as optional extras | 20 min | +| 07 | Misc and troubleshooting | uv tips, FastMCP 4 migration notes (legacy vs modern mode) | 10 min | + +#### 3.2 Integrate Feature + +- Add a `docs/tutorials/code/` tree with one checkpoint directory per module + (starter and solution) so attendees can resync; CI-check that every solution + imports and passes its tests. +- Write `docs/tutorials/README.md` (currently empty): audience, prerequisites, + agenda table above, facilitator notes, and a "stuck? jump to checkpoint N" + table. +- Fold useful content from the local, git-ignored `temp/notes.md` (seed curl + commands) into module 00 as a seed script before the user deletes `temp/`. +- Replace every `mcp.server.fastmcp` import and `pip install mcp[cli] mcp httpx` + with `fastmcp` 4 and `httpx2`; replace the "FastMCP 2.0" link with the FastMCP + 4 docs. + +#### 3.3 Configuration Updates + +- Reliability design: only EPR (and its database) runs in Docker, via a workshop + `docs/tutorials/code/docker-compose.yaml`. The MCP server always runs on the + host from a uv-managed venv over stdio, so VS Code launches a local process + and no container networking or Docker-exec stdio is involved. +- Ship `.vscode/mcp.json` in the tutorial code that launches the server with + `uv run` (command, args, and `EPR_URL` env), plus the equivalent Claude + Desktop config. +- Add a `make workshop-check` (or `docs/tutorials/code/check_setup.py`) + preflight that verifies: Python and uv versions, EPR reachable at `EPR_URL`, + `eprmcp version` runs, and an in-process MCP client can list the 9 tools. + Attendees run it before the session and after any failure. +- Provide editor-independent fallbacks in the same modules so no one is blocked + by VS Code: MCP Inspector (module 02) and a small FastMCP client script + (`check_setup.py` or the Phase 4 client demo) that exercises the tools from a + terminal. +- Pin tutorial dependency versions in a `requirements.txt` or `pyproject.toml` + inside `docs/tutorials/code/`; facilitators pre-build a wheel cache or provide + an offline install note for poor venue networks. + +#### 3.4 Testing Requirements + +- Run every tutorial command and code block on a clean machine or container + (macOS and Linux); log deviations as doc fixes. +- Run `markdownlint --fix --config .markdownlint.json` and + `prettier --write --parser markdown --prose-wrap always` on every changed file + (AGENTS.md Rule 2). +- Dry run the full agenda with someone who has not seen the project; record + timings and adjust the table. + +#### 3.5 Deliverables + +- [x] Eight renamed, rewritten tutorial modules +- [x] `docs/tutorials/README.md` with agenda and facilitator notes +- [x] Checkpoint code directories **and starter scaffolds** with CI check + (`tests/tutorials/test_tutorial_code.py`; starters verified to match their + corresponding previous checkpoint, starter_01 verified to import with 0 + tools) +- [x] One-command EPR environment and a host-run stdio MCP server +- [x] `.vscode/mcp.json` and Claude Desktop config validated on macOS + (`uv run python checkpoint_05_tests/server.py` and + `uv run --directory ../../.. eprmcp start --transport stdio` both start + correctly and log the FastMCP stdio banner; actual VS Code and Claude + Desktop screens confirmed by manual inspection of the config files and + `check_setup.py --skip-stdio`) +- [x] Preflight check script with Inspector and terminal-client fallbacks +- [x] No references to `mcp.server.fastmcp`, `httpx` imports, or FastMCP 2.0 + (outside the migration notes in module 07) + +#### 3.6 Success Criteria + +A new attendee completes modules 00 to 06 in the time budget starting from a +fresh clone, and the end state matches the shipped server's tool list. + +### Phase 4: Demos With Scripts + +#### 4.1 Feature Work + +- Port [generate_epr_events.py](../../demos/generate_epr_events.py) to `httpx2` + (the `httpx.Client` and `HTTPStatusError` use at lines 252 to 256 and type + hints at 266 and 280). +- Rewrite [openapi_demo.py](../../demos/openapi_demo.py): remove the bad + `sys.path` insert, unused imports, and any `openapi_server` references; it + demonstrates only the `/openapi.yaml`, `/openapi.json`, and `/docs` endpoints + of the HTTP server and lists tools via the FastMCP 4 client, rather than + printing a hard-coded list. +- Add `demos/mcp_client_demo.py`: connect with the FastMCP 4 client, list tools, + create a receiver, create an event, fetch it, search for it. + +#### 4.2 Integrate Feature + +For each demo add a presenter script in `demos/scripts/` (lowercase +underscores): `generate_events_script.md`, `openapi_demo_script.md`, +`mcp_client_demo_script.md`. Each has: goal, prerequisites, exact commands in +order, expected output, talking points per step, failure recovery. Add a +`demos/scripts/run_all.sh` that runs the full sequence unattended for rehearsal. +Both the presenter documents and the shell script are required. + +#### 4.3 Configuration Updates + +- Fix [requirements.txt](../../demos/requirements.txt): `httpx2`, `fastmcp`, and + the correct ULID package (verify which provides `ulid.ulid()`); update + [demos/README.md](../../demos/README.md) (remove `pip install httpx ulid-py`, + document the scripts, add a demo table row each). + +#### 4.4 Testing Requirements + +- Run each demo against the Phase 3 EPR compose stack and compare to the + expected output in its script. +- Add a `--dry-run` smoke test for `generate_epr_events.py` in `tests/`. +- `ruff check demos/` passes (extend lint targets in Makefile and tox). + +#### 4.5 Deliverables + +- [x] Three demos working on FastMCP 4 and `httpx2` +- [x] Three presenter scripts plus `run_all.sh` +- [x] Updated `demos/README.md` and `requirements.txt` + +#### 4.6 Success Criteria + +`demos/scripts/run_all.sh` exits 0 against the compose stack; a presenter can +run a demo using only its script. + +### Phase 5: Documentation, Infrastructure, and Release + +#### 5.1 Feature Work + +- Recreate four of the docs deleted from the working tree under AGENTS.md Rule 1 + names (lowercase, underscores; only `README.md` may be uppercase): + `docs/how-tos/docker_compose.md`, `docs/reference/openapi_implementation.md`, + `docs/reference/schema_validation.md`, and `docs/README.md`. Take the starting + content from `git show HEAD:docs/`. `docs/docker_reference.md` and + `docs/troubleshooting.md` stay deleted (decision); remove their rows from the + `docs/README.md` index. Do not recreate the all-caps names. Note: + `docker_compose.md` goes under `docs/how-tos/` (task-oriented) and + `schema_validation.md` goes under `docs/reference/` (reference) per the + Diataxis framework in AGENTS.md. +- Update the recreated docs and the root [README.md](../../README.md) for + FastMCP 4, `httpx2`, the `--transport` option, token handling, and the removal + of `openapi_server`; `openapi_implementation.md` covers only the routes that + remain in `server.py`. +- Run markdownlint and prettier on each recreated file (Rule 8). +- Write `docs/explanation/fastmcp4_httpx2_migration_implementation.md` + (AGENTS.md Rule 3: Overview, Components, Implementation Details, Testing, + Examples) including the Phase 0 findings. + +#### 5.2 Integrate Feature + +- Add a short "Upgrading to 2.0" section to the root README for users of the + package, listing breaking changes: FastMCP 4, `httpx2`, token now sent on all + requests, `openapi_server` removed, new `--transport` option, search and + create tools take flat arguments (the old wrapped shape is rejected). +- Update the Makefile `lint` target and tox `check`/`format` to include + `demos/`; confirm `make tests`, `make wheel`, `make docker-image` work. + +#### 5.3 Configuration Updates + +- Do not bump the version in this PR. Update `.env.example` for new variables + (`MCP_HOST`, `MCP_PORT`). +- Post-merge release steps (outside the PR, by the maintainer): bump the version + to 2.0.0 in `pyproject.toml` and `constants.py`, rebuild the wheel, tag + `v2.0.0`, build the Docker image, and publish. + +#### 5.4 Testing Requirements + +Full gate from AGENTS.md Rule 2: `ruff check src/`, `ruff format src/`, +`pytest --cov=src --cov-report=html --cov-fail-under=80 --cov-report=term-missing`, +and markdownlint plus prettier on every changed `.md` file. + +#### 5.5 Deliverables + +- [x] All docs reference FastMCP 4 and `httpx2` +- [x] Implementation doc written +- [x] Post-merge release checklist (2.0.0 bump, wheel, tag, image) written in + the implementation doc + +#### 5.6 Success Criteria + +All quality gates green; no stale `httpx` or FastMCP 2 references outside the +migration notes (`grep` clean). + +## Recommended Order + +Phase 0, then 1, 2, 3, 4, 5, all in a single PR with one commit per phase so +review stays tractable. Phases 3 and 4 depend on Phase 2; Phase 4 reuses the +Phase 3 EPR compose environment. + +## Open Questions + +None. diff --git a/docs/explanation/next_plans.md b/docs/explanation/next_plans.md new file mode 100644 index 0000000..2c79261 --- /dev/null +++ b/docs/explanation/next_plans.md @@ -0,0 +1,13 @@ +# Next Plans + +## Migrate to FastMCP 4 + +I want to migrate this project to FastMCP 4 + and httpx2 +. As part of the +migration we want to update the @tutorials for the repo and @demos. The tutorial +should be end to end and easily teachable in a workshop. The demos should have a +script. + +Review the codebase and come up with a migration plan. THINK HARD and follow the +rules in @PLAN.md diff --git a/docs/how-tos/docker_compose.md b/docs/how-tos/docker_compose.md new file mode 100644 index 0000000..9defa4e --- /dev/null +++ b/docs/how-tos/docker_compose.md @@ -0,0 +1,125 @@ +# Running the Server with Docker + +The repository ships a Dockerfile and a `docker-compose.yaml`. Use them to run +the server as a long-lived HTTP service. Do not use a container for an MCP +server that an editor starts over stdio: use `uv run` (see +[workshop module 06](../tutorials/06_use_from_an_editor.md)). + +## Requirements + +- Docker with Compose v2 (`docker compose`) +- Python 3.12 or newer and `build` to make the wheel (`make wheel` installs it) +- A running EPR the container can reach + +## Build + +The image installs a prebuilt wheel from `dist/`, so build the wheel first. +`make docker-image` does both steps; `make wheel` cleans `build/` and `dist/` +first so a stale file cannot end up in the image. + +```bash +make docker-image # wheel, then docker build -t epr-mcp-python:latest . +``` + +The Dockerfile installs `dist/epr_mcp-*-py3-none-any.whl`, so the file name does +not change when the version does. `.dockerignore` keeps `.git`, `.venv`, +`tests`, `docs`, and `demos` out of the build context. + +## Run with docker run + +```bash +docker run -d --name epr-mcp-server -p 8000:8000 \ + -e EPR_URL=http://host.docker.internal:8042 \ + -e EPR_TOKEN=your-token \ + epr-mcp-python:latest + +curl http://localhost:8000/health # OK +docker logs -f epr-mcp-server +docker stop epr-mcp-server && docker rm epr-mcp-server +``` + +The container runs `python3 -m epr_mcp.main start`, the `http` transport, bound +to `0.0.0.0:8000`. The MCP endpoint is `http://localhost:8000/mcp`. + +## Run with Compose + +```bash +cp .env.example .env # then edit EPR_URL and EPR_TOKEN +make wheel +docker compose up -d --build +docker compose ps # the server shows (healthy) after a few seconds +docker compose logs -f epr-mcp-server +docker compose down +``` + +Compose reads `.env` for `EPR_URL`, `EPR_TOKEN`, and `EPR_DEBUG`. With no +`EPR_TOKEN` the server sends no `Authorization` header. + +## Configuration + +| Variable | Default in Compose | Meaning | +| ----------- | ---------------------------------- | ------------------------------------------------------------------------ | +| `EPR_URL` | `http://host.docker.internal:8042` | EPR base URL, reachable from inside the container | +| `EPR_TOKEN` | empty | Bearer token sent on every EPR request | +| `EPR_DEBUG` | `false` | Debug logging | +| `MCP_HOST` | `0.0.0.0` | Bind address (fixed in the file) | +| `MCP_PORT` | `8000` | Bind port (fixed in the file; the port mapping and healthcheck use 8000) | + +`EPR_URL` must be an address the container can reach, not `localhost`: + +| EPR runs | Use | +| -------------------------- | ---------------------------------------------- | +| On your machine | `http://host.docker.internal:8042` | +| In another Compose project | Join its network, then `http://:8042` | +| On another host | `http://that-host:8042` | + +On Linux, `host.docker.internal` needs +`--add-host host.docker.internal:host-gateway` with `docker run`, or +`extra_hosts` in Compose. + +## Health check + +Compose and the Dockerfile both poll `curl -f http://localhost:8000/health`. To +see the state: + +```bash +docker inspect --format '{{.State.Health.Status}}' epr-mcp-server +``` + +## Optional services (profiles) + +Services under a profile do not start unless you ask for them. + +| Profile | Services | Start with | +| ------------ | ----------------------- | ------------------------------------------- | +| `production` | `nginx` | `docker compose --profile production up -d` | +| `monitoring` | `prometheus`, `grafana` | `docker compose --profile monitoring up -d` | + +- `nginx` proxies ports 80 and 443 to the server using `nginx.conf`. It mounts + `./ssl`, which does not exist in the repository; the HTTPS block in the file + is commented out. +- `prometheus` scrapes `epr-mcp-server:8000/metrics`, but the server does not + expose `/metrics`, so the target shows as down. `grafana` mounts + `./grafana/provisioning`, which is not in the repository either. Treat the + monitoring profile as scaffolding until the server exports metrics. + +## Running EPR next to it + +To try everything locally, start EPR with the workshop file and point the server +at it: + +```bash +(cd docs/tutorials/code && docker compose up -d --build) +EPR_URL=http://host.docker.internal:8042 docker compose up -d --build +``` + +## Troubleshooting + +| Symptom | Fix | +| -------------------------------------------- | --------------------------------------------------------------------------------- | +| `docker build` fails: no wheel found | Run `make wheel` first (or use `make docker-image`) | +| `Connection failed to EPR server` | `EPR_URL` is wrong for the container; see the table above | +| Health check stays `starting` or `unhealthy` | `docker compose logs epr-mcp-server`; the container needs a minute on first start | +| `/openapi.yaml` returns 404 | The image was built from a wheel made before 2.0; rebuild with `make wheel` | +| Port 8000 already in use | Stop the other process, or change the left side of `8000:8000` | +| EPR answers 401 or 403 | Set `EPR_TOKEN` | diff --git a/docs/reference/openapi_implementation.md b/docs/reference/openapi_implementation.md new file mode 100644 index 0000000..8fdbedb --- /dev/null +++ b/docs/reference/openapi_implementation.md @@ -0,0 +1,66 @@ +# HTTP Endpoints and the OpenAPI Description + +When the server runs with the `http` transport it serves a few ordinary HTTP +endpoints next to the MCP endpoint. They are registered in +`src/epr_mcp/server.py` with `custom_route`. With the `stdio` transport there is +no HTTP server, so none of this applies. + +## Endpoints + +On the default address `http://127.0.0.1:8000`: + +| Endpoint | Method | Returns | +| --------------- | ------ | ----------------------------------------------------------- | +| `/mcp` | MCP | The MCP endpoint, spoken to by an MCP client | +| `/health` | GET | `200` with the text `OK`; used by Docker and load balancers | +| `/openapi.yaml` | GET | The OpenAPI document as YAML | +| `/openapi.json` | GET | The same document as JSON | +| `/docs` | GET | A Swagger UI page that loads `/openapi.json` | + +If the document cannot be found, `/openapi.yaml` and `/openapi.json` answer +`404` with `{"error": "OpenAPI specification not found"}`. + +```bash +curl http://127.0.0.1:8000/health +curl http://127.0.0.1:8000/openapi.json +``` + +The [OpenAPI demo](../../demos/openapi_demo.py) calls each endpoint and lists +the tools; its presenter script is +[openapi_demo_script.md](../../demos/scripts/openapi_demo_script.md). + +## The document + +The document is `src/epr_mcp/openapi.yaml`, an OpenAPI 3.1 file. It is shipped +as package data (`[tool.setuptools.package-data]` in `pyproject.toml`), so it is +in the wheel and the Docker image. Before 2.0 it was left out of the wheel and +these routes answered `404` in the container. + +Read it with some care: + +- It describes REST-style resources (events, receivers, groups: fetch by ID, + create, and a `/search` operation for each) and a `/health` path. It is + documentation, not something the server generates its tools from or serves. +- It calls the service the "Event Processing Registry". The service is the Event + Provenance Registry. +- The real EPR searches through GraphQL at `/api/v1/graphql/query`, which is + what the search tools use, and it has no `/search` paths or `/health` path + (its health endpoints are `/healthz/liveness` and `/healthz/readiness`). + +Treat it as a sketch of the data model, and the tools as the source of truth. +Correcting it is not part of the 2.0 migration. + +## What was removed + +Versions before 2.0 also contained `openapi_server.py`, an unfinished +alternative server that tried to generate tools from this document with +FastMCP's OpenAPI provider. Nothing started it, it had no route handling, and it +imported a module that FastMCP 4 moved, so 2.0 removes it. The nine tools are +written by hand in `server.py` and validated as described in +[schema_validation.md](./schema_validation.md). + +## Changing the endpoints + +Add a route with `@mcp.custom_route(path, methods=[...])` inside +`create_server`, add a test to `tests/unit/test_server_routes.py` (it uses +Starlette's `TestClient` against `mcp.http_app()`), and list the route here. diff --git a/docs/reference/schema_validation.md b/docs/reference/schema_validation.md new file mode 100644 index 0000000..63bd733 --- /dev/null +++ b/docs/reference/schema_validation.md @@ -0,0 +1,145 @@ +# Schema Validation + +Every tool checks its input before it contacts EPR, and checks what EPR sends +back before it hands it on. This document lists the rules. The code is in +`src/epr_mcp/schemas.py`. + +## Why validate + +An AI client guesses at arguments. Rejecting a malformed ID or a misspelled +field before the request means a clear error message, no wasted EPR call, and no +silently wrong result. The most important rule is that unknown fields are +rejected: a misspelled search field would otherwise be dropped and the search +would return every record. + +## Input rules + +All six search and create input models reject unknown fields. String values are +trimmed of leading and trailing whitespace first. + +### Fetch tools + +`fetch_event`, `fetch_receiver`, and `fetch_group` take an `id`: a 26 character +alphanumeric ULID (`^[0-9A-Za-z]{26}$`). + +### Search tools + +`search_events`, `search_receivers`, and `search_groups` take `data`, an object +whose fields are all optional. A blank string counts as not set. An empty object +searches for everything. + +| Tool | Fields | +| ------------------ | ----------------------------------------------------------------------------------------------------- | +| `search_events` | `name`, `version`, `release`, `platform_id`, `package`, `description`, `success`, `event_receiver_id` | +| `search_receivers` | `name`, `type`, `version`, `description` | +| `search_groups` | `name`, `type`, `version`, `description` | + +Only the fields that are set are sent to EPR. + +### Create tools + +All fields are required. + +| Tool | Argument | Fields | +| ----------------- | --------------- | ----------------------------------------------------------------------------------------------------------------------------------- | +| `create_event` | `event_data` | `name`, `version`, `release`, `platform_id`, `package`, `description`, `event_receiver_id`, `success` (boolean), `payload` (object) | +| `create_receiver` | `receiver_data` | `name`, `type`, `version`, `description`, `schema` (object: the JSON schema that event payloads must match) | +| `create_group` | `group_data` | `name`, `type`, `version`, `description`, `event_receiver_ids` (a non-empty list of ULIDs) | + +Field formats: + +- `name`: letters and digits, optionally separated by `.`, `_`, or `-`, and by + `/` for nested names. +- `version`: a semantic version such as `1.2.3`. +- `release`: any text without whitespace. +- `platform_id`: letters and digits separated by `-`, such as `x64-linux-oci-2`. +- `package`: letters only, such as `oci`. +- `type`: any text without spaces. +- `event_receiver_id` and each of `event_receiver_ids`: a 26 character ULID. + +`create_receiver` requires `schema` because EPR does. In the Python models the +attribute is `schema_data`, with the alias `schema`, because `schema` clashes +with a Pydantic built-in. The wire name is always `schema`. + +## Arguments are flat + +The argument is the object itself, with no extra `data` wrapper: + +```json +{ "data": { "name": "checkout-service", "success": true } } +``` + +for `search_events`, and + +```json +{ + "event_data": { + "name": "checkout-service", + "version": "1.2.3", + "release": "2025.10.0", + "platform_id": "linux", + "package": "oci", + "description": "A build", + "payload": { "name": "checkout-service" }, + "success": true, + "event_receiver_id": "01JYRZ96R690ZTQ15Q53GEY6E6" + } +} +``` + +for `create_event`. Inside the server, `validate_input` still validates a model +that has a `data` key; the tools add that wrapper themselves. The older shape +`{"data": {"data": {...}}}` is rejected as an unknown field. + +## Response rules + +EPR's answers are validated too, with the `EventResponse`, +`EventReceiverResponse`, and `EventReceiverGroupResponse` models and the +`validate_*_response` helpers: + +- IDs must be ULIDs and the main text fields must have the same formats as the + input rules; fingerprints, when present, are 64 hex characters. +- A single record can arrive as an object, a one-item list, or inside + `{"data": ...}`; the tools accept all three. An empty list becomes a "not + found" message. +- A create answers with only the new ID (`{"data": ""}`). The create tools + return `{"message": "... created successfully", "id": ""}`. +- A GraphQL failure arrives as an `errors` list. The search tools return it as + `Failed to search ...` instead of an empty result. + +## How errors look + +The tools return text, not an MCP error result: + +| Problem | Result | +| ------------------------------ | ------------------------------------------------------- | +| Invalid or unknown input | `Input validation error: ...` with the Pydantic message | +| EPR returned an invalid record | `Response validation error: ...` | +| EPR is down | `Connection failed to EPR server at . ...` | +| EPR timed out | `Request timeout to EPR server at . ...` | +| EPR returned a failing status | `Failed to : - ` | + +Callers that need to tell success from failure check whether the text is JSON, +as `demos/mcp_client_demo.py` does. + +## Operations + +`validate_input(operation, input_data)` is the entry point. Its operations are +`search_events`, `search_receivers`, `search_groups`, `create_event`, +`create_receiver`, `create_group`, and the three `fetch_*` operations. It +returns the validated data as a dictionary, with aliases applied. + +```python +from epr_mcp.schemas import validate_input + +validated = validate_input("search_events", {"data": {"name": "foo", "version": "1.0.0"}}) +``` + +## Tests + +`tests/unit/test_schemas.py` covers the models and +`tests/unit/test_server_tools.py` covers the tools end to end with a mocked EPR: + +```bash +uv run pytest tests/unit/test_schemas.py tests/unit/test_server_tools.py +``` diff --git a/docs/troubleshooting.md b/docs/troubleshooting.md deleted file mode 100644 index 1dfc4ae..0000000 --- a/docs/troubleshooting.md +++ /dev/null @@ -1,316 +0,0 @@ -# Troubleshooting Guide - -This guide covers common issues and their solutions when running the EPR MCP -Server. - -## Connection Issues - -### "All connection attempts failed" - -**Error Message:** - -```text -Error fetching event: All connection attempts failed -``` - -**Cause:** The MCP server cannot connect to the EPR API server. - -**Solutions:** - -#### 1. Running in Docker (Most Common) - -When running the MCP server in Docker, `localhost` refers to the container -itself, not the host machine. - -**If EPR server runs on host machine:** - -```bash -# In your .env file: -EPR_URL=http://host.docker.internal:8042 -``` - -**If EPR server runs in another Docker container:** - -```bash -# In your .env file (replace 'epr-server' with actual container name): -EPR_URL=http://epr-server:8042 -``` - -**If EPR server is on a different machine:** - -```bash -# In your .env file: -EPR_URL=http://your-epr-server-hostname:8042 -``` - -#### 2. Check EPR Server Status - -Verify the EPR server is running and accessible: - -```bash -# Test direct connection to EPR server -curl http://localhost:8042/health -# or -curl http://your-epr-server:8042/health -``` - -#### 3. Verify Network Connectivity - -```bash -# From within the Docker container: -docker exec -it epr-mcp-server curl http://host.docker.internal:8042/health - -# Check if the container can resolve DNS: -docker exec -it epr-mcp-server nslookup host.docker.internal -``` - -## Configuration Issues - -### Environment Variables Not Loading - -**Symptoms:** Server uses default values instead of your configuration. - -**Solutions:** - -1. Ensure `.env` file is in the project root directory -2. Check `.env` file format (no spaces around `=`) -3. Verify Docker Compose loads the `.env` file: - - ```bash - docker-compose config - ``` - -### Invalid API Token - -**Error Message:** - -```text -HTTP error from EPR server: 401 - Unauthorized -``` - -**Solutions:** - -1. Verify your `EPR_TOKEN` in the `.env` file -2. Check token hasn't expired -3. Ensure token has required permissions - -## Docker Issues - -### Docker Compose Issues - -#### Container Won't Start - -**Check logs:** - -```bash -docker-compose logs epr-mcp-server -``` - -**Common solutions:** - -1. Check port 8000 isn't already in use: - - ```bash - lsof -i :8000 - ``` - -2. Rebuild the container: - - ```bash - docker-compose build --no-cache - docker-compose up -d - ``` - -#### Health Check Failing - -**Check health status:** - -```bash -docker-compose ps -``` - -**Solutions:** - -1. Verify the health endpoint is accessible: - - ```bash - curl http://localhost:8000/health - ``` - -2. Check server logs for startup errors - -### Direct Docker Issues - -#### Docker Container Won't Start - -**Check logs:** - -```bash -docker logs epr-mcp-server -``` - -**Common solutions:** - -1. Check if port is already in use: - - ```bash - lsof -i :8000 - # If in use, run with different port: - docker run -p 8001:8000 ... - ``` - -2. Verify Docker image exists: - - ```bash - docker images | grep epr-mcp-server - ``` - -3. Rebuild the image: - - ```bash - docker build --no-cache -t epr-mcp-server . - ``` - -#### Environment Variables Not Working - -**Check if variables are set correctly:** - -```bash -docker exec -it epr-mcp-server env | grep EPR -``` - -**Solutions:** - -1. Ensure all required variables are provided: - - ```bash - docker run -e EPR_URL=... -e EPR_TOKEN=... epr-mcp-server - ``` - -2. Use environment file: - - ```bash - docker run --env-file .env epr-mcp-server - ``` - -#### Container Exits Immediately - -**Check exit code and logs:** - -```bash -docker ps -a # Find container ID -docker logs -``` - -**Common causes:** - -- Missing required environment variables (EPR_TOKEN) -- Invalid EPR_URL format -- Application startup errors - -#### Permission Issues - -**Error:** "Permission denied" when mounting volumes - -**Solutions:** - -```bash -# Fix file permissions -chmod 644 .env -chmod -R 755 logs/ - -# Run with user ID -docker run --user $(id -u):$(id -g) ... -``` - -## Development Issues - -### Import Errors - -**Error:** `ModuleNotFoundError: No module named 'epr_mcp'` - -**Solutions:** - -1. Install in development mode: - - ```bash - pip install -e . - ``` - -2. Verify virtual environment is activated: - - ```bash - which python - ``` - -### Test Failures - -**Run tests with verbose output:** - -```bash -python -m pytest tests/ -v -``` - -**Common solutions:** - -1. Install test dependencies: - - ```bash - pip install -e .[test] - ``` - -2. Clear pytest cache: - - ```bash - rm -rf .pytest_cache - ``` - -## Debugging - -### Enable Debug Mode - -Add to your `.env` file: - -```bash -EPR_DEBUG=true -``` - -### View Detailed Logs - -```bash -# Docker Compose -docker-compose logs -f epr-mcp-server - -# Local development -python -m epr_mcp start --debug -``` - -### Test Specific Operations - -```bash -# Test a specific MCP tool (requires MCP client) -mcp.call_tool('fetchEvent', {'id': 'test-event-id'}) -``` - -## Getting Help - -If you continue experiencing issues: - -1. **Check the logs** with debug mode enabled -2. **Verify network connectivity** between containers/services -3. **Test the EPR server directly** using curl or another HTTP client -4. **Create an issue** with: - - Error messages - - Docker Compose output - - Environment configuration (without sensitive tokens) - - Steps to reproduce - -## Common Error Messages - -| Error | Likely Cause | Solution | -| -------------------------------- | -------------------------- | ---------------------------------------------------- | -| `All connection attempts failed` | Network connectivity | Check EPR_URL, use `host.docker.internal` for Docker | -| `401 Unauthorized` | Invalid API token | Verify EPR_TOKEN | -| `404 Not Found` | Wrong endpoint URL | Check EPR server API endpoints | -| `Connection timeout` | EPR server overloaded/slow | Increase timeout, check EPR server status | -| `Address already in use` | Port 8000 occupied | Stop conflicting service or change port | diff --git a/docs/tutorials/00_intro.md b/docs/tutorials/00_intro.md new file mode 100644 index 0000000..f93cbbf --- /dev/null +++ b/docs/tutorials/00_intro.md @@ -0,0 +1,107 @@ +# 00 Intro and Prerequisites + +Time: 15 minutes. + +## What is MCP + +An MCP server (Model Context Protocol server) is a standard way to give an AI +assistant tools. The assistant asks the server what it can do, then calls those +tools with typed arguments and reads the results. Think of it as a universal +adapter between AI models and your own systems. + +Three words to know: + +- Host: the application the user sits in, such as VS Code or Claude Desktop. +- Client: the part of the host that speaks MCP to a server. +- Server: your code. It exposes tools. + +A tool is a function with a name, a description, and a typed input. The +description matters most: it is what the model reads to decide when to use the +tool. + +MCP also defines resources and prompts. This workshop only uses tools. + +## What is EPR + +The Event Provenance Registry stores a trail of what happened to software as it +moved through a delivery pipeline. It has three kinds of records: + +- Event receiver: declares a kind of event and the JSON schema its payload must + match. +- Event receiver group: a named set of receivers. +- Event: something that happened, such as a build, linked to one receiver. + +EPR has a REST API for fetching and creating records and a GraphQL endpoint for +searching. Your server wraps both. + +## Prerequisites + +| Tool | Needed for | Check | +| --------------- | ----------------------------- | ------------------------ | +| Python 3.12+ | running the code | `python3 --version` | +| uv | Python environments | `uv --version` | +| Docker, Compose | running EPR | `docker compose version` | +| Node.js | the MCP Inspector (module 02) | `npx --version` | +| VS Code | module 06 | `code --version` | + +Install uv from . The workshop supports macOS and +Linux. + +## Set up + +Clone the repository and move to the workshop code. Every command from here on +runs in this directory. + +```bash +git clone https://github.com/xbcsmith/epr-mcp-python.git +cd epr-mcp-python/docs/tutorials/code +``` + +Install the pinned Python dependencies (FastMCP 4 and httpx2): + +```bash +uv sync +``` + +Start EPR, Postgres, and Redpanda. The first run builds the EPR server, which +takes about three minutes. + +```bash +docker compose up -d --build +``` + +Wait until EPR answers. This prints `200` when it is ready: + +```bash +curl -s -o /dev/null -w "%{http_code}\n" http://localhost:8042/healthz/readiness +``` + +Create sample data: one receiver, one group, and three events. + +```bash +uv run python seed_epr.py +``` + +It prints the new IDs and saves them to `seed_ids.json`. You will use an event +ID in the next module. + +## Checkpoint: run the preflight + +```bash +uv run python check_setup.py --skip-stdio +``` + +Every line should say PASS or SKIP. A SKIP line is a check that does not apply +yet, such as your own `work/server.py` before you have written it. If a line +says FAIL, fix it before continuing: + +| Line that failed | Fix | +| -------------------- | -------------------------------------------------------- | +| Python 3.12 or newer | Install Python 3.12 or newer | +| uv on PATH | Install uv, then open a new terminal | +| EPR reachable | `docker compose up -d --build`, wait a minute, run again | + +You can leave out `--skip-stdio` once module 06 is done; that run also starts +the servers exactly the way an editor does. + +Next: [01 First tool](01_first_tool.md). diff --git a/docs/tutorials/01_first_tool.md b/docs/tutorials/01_first_tool.md new file mode 100644 index 0000000..0bf7313 --- /dev/null +++ b/docs/tutorials/01_first_tool.md @@ -0,0 +1,123 @@ +# 01 First Tool + +Time: 20 minutes. + +You will write an MCP server with one tool, `fetch_event`, run it, and call it +from the terminal. The finished code is in `checkpoint_01_first_tool/server.py`. + +## Create your file + +```bash +mkdir -p work +touch work/server.py +``` + +Everything you write in this workshop goes in `work/`. Git ignores it. + +## The server + +Open `work/server.py` and build it up in four small steps. + +### 1. Imports and settings + +```python +import os + +import httpx2 +from fastmcp import FastMCP + +EPR_URL = os.environ.get("EPR_URL", "http://localhost:8042") +``` + +- `fastmcp` is the framework. This workshop uses FastMCP 4. +- `httpx2` is the HTTP client. It is a drop-in successor to `httpx` with the + same API; only the package name changed. FastMCP 4 depends on it. +- `EPR_URL` comes from the environment, so the same code works against any EPR. + +### 2. Create the server + +```python +mcp = FastMCP(name="EPR Workshop MCP Server", version="0.1.0") +``` + +Pass `name` and `version` by keyword. The second positional parameter of +`FastMCP` is `instructions`, not the version, so +`FastMCP("EPR Workshop MCP Server", "0.1.0")` quietly sets the instructions to +`"0.1.0"`. The shipped server had exactly this bug. + +### 3. Register a tool + +```python +@mcp.tool(title="Fetch Event", description="Fetch an event from EPR by its ID") +async def fetch_event(id: str) -> str: + """Fetch an event from the EPR.""" + async with httpx2.AsyncClient() as client: + response = await client.get(f"{EPR_URL}/api/v1/events/{id}") + return response.text +``` + +What FastMCP does with this: + +- The decorator registers the function as a tool. +- The function name becomes the tool name. +- The type hints become a JSON schema, so an AI client knows `id` is a string. +- `description` is what the model reads to decide when to call the tool. +- `async def` lets the server wait for EPR without blocking. + +### 4. Run it + +```python +if __name__ == "__main__": + mcp.run() +``` + +`mcp.run()` serves over stdio by default: the host starts your script as a +subprocess and exchanges messages over its stdin and stdout. Because stdout is +the protocol channel, never `print()` in a tool. Write logs to stderr. + +## Try it from the terminal + +Starting the server directly looks like it hangs; it is waiting for an MCP +client on stdin. Press Ctrl+C to stop it. + +```bash +uv run python work/server.py +``` + +Use the workshop client instead. It starts your server the way an editor would, +then talks to it: + +```bash +uv run python client.py list work/server.py +``` + +You should see: + +```text +fetch_event: Fetch an event from EPR by its ID +``` + +Now call the tool with an event ID from `seed_ids.json`: + +```bash +uv run python client.py call work/server.py fetch_event '{"id": "PASTE_AN_EVENT_ID"}' +``` + +You should see the event as JSON, starting with `{"data":`. + +## Checkpoint + +- `client.py list` shows `fetch_event`. +- `client.py call` returns an event from EPR. +- Behind schedule? `cp checkpoint_01_first_tool/server.py work/server.py`. + +## Things to notice + +- The tool returns EPR's raw response text. If the ID does not exist, you get + EPR's error text back as if it were a normal answer. Modules 03 and 04 fix + that. +- There is no `Context` argument and no `ctx.debug()` logging. FastMCP 4 + deprecates sending logs to the client through the protocol; use Python's + `logging` module, which goes to stderr. + +Next: [02 Inspector](02_inspector.md). diff --git a/docs/tutorials/02_inspector.md b/docs/tutorials/02_inspector.md new file mode 100644 index 0000000..864c597 --- /dev/null +++ b/docs/tutorials/02_inspector.md @@ -0,0 +1,84 @@ +# 02 Inspector + +Time: 15 minutes. + +The [MCP Inspector](https://github.com/modelcontextprotocol/inspector) is a +browser tool for exploring any MCP server. It starts your server, lists its +tools, and lets you call them with a form. Use it whenever you want to see what +an AI client would see, without involving an AI. + +## Start it + +Run this from `docs/tutorials/code`. The command pins Inspector 2.9.0, the +version this workshop was tested with, so everyone sees the same screen. + +```bash +npx @modelcontextprotocol/inspector@2.9.0 \ + -e EPR_URL=http://localhost:8042 \ + uv run --directory "$PWD" python work/server.py +``` + +The first run downloads the Inspector. It prints a local URL that includes an +access token. Open that exact URL in a browser. + +If the connection pane does not already show your server, fill it in by hand: + +| Field | Value | +| -------------------- | ------------------------------------------------------------------------- | +| Transport type | `STDIO` | +| Command | `uv` | +| Arguments | `run --directory /full/path/to/docs/tutorials/code python work/server.py` | +| Environment variable | `EPR_URL` = `http://localhost:8042` | + +Two details matter: + +- `--directory` makes uv use this folder's environment no matter where the + Inspector starts it from. Use the full path in the pane. +- The server is started over stdio, the same way VS Code will start it in + module 06. If it works here, the command is right. + +The Inspector's screens change between versions. What you need from it never +does: connect, list the tools, pick one, fill in its arguments, run it, read the +result. + +## Explore + +1. Connect to the server. +2. Open the tools view and list the tools. You see `fetch_event`. +3. Select `fetch_event`. The input form is built from the tool's schema: one + string field, `id`. That schema is generated from your type hints. +4. Enter an event ID from `seed_ids.json` and run the tool. The result is the + event JSON. +5. Run it again with an ID that does not exist, such as `nope`. Notice what + comes back: EPR's error as plain text, with no sign that the call failed. You + will fix that in module 04. +6. Look for the server's log output in the Inspector. Your server does not log + anything yet; module 03 adds logging to stderr. + +## The edit-and-reconnect loop + +When you change `work/server.py`, disconnect and connect again. The Inspector +starts a fresh server process each time, so your edit takes effect. + +## If the Inspector does not work + +Skip it. The terminal client does the same job: + +```bash +uv run python client.py list work/server.py +uv run python client.py call work/server.py fetch_event '{"id": "PASTE_AN_EVENT_ID"}' +``` + +| Problem | Cause and fix | +| ------------------------------ | ------------------------------------------------------------------- | +| Page says unauthorized | Open the full URL, token included, that the terminal printed | +| `npx: command not found` | Install Node.js | +| Connection error | Run your server with `client.py` (below) to see the real error | +| Port already in use | Stop the other Inspector, or set `CLIENT_PORT` and `SERVER_PORT` | +| Inspector shows another server | It also reads your own MCP config file; pick the server you started | + +## Checkpoint + +You called `fetch_event` from the Inspector (or `client.py`) and got an event. + +Next: [03 Complete the tool set](03_complete_tool_set.md). diff --git a/docs/tutorials/03_complete_tool_set.md b/docs/tutorials/03_complete_tool_set.md new file mode 100644 index 0000000..6c358b2 --- /dev/null +++ b/docs/tutorials/03_complete_tool_set.md @@ -0,0 +1,198 @@ +# 03 Complete the Tool Set + +Time: 30 minutes. + +You will grow the server from one tool to nine: fetch, search, and create for +events, event receivers, and event receiver groups. The finished code is in +`checkpoint_03_tool_set/server.py`. Start from your module 01 file, or copy the +checkpoint for module 01 into `work/server.py`. + +## Plan + +Nine tools would be a lot of repeated code, so first write two helpers. Every +tool then becomes one or two lines. + +| Tool | EPR endpoint | +| ---------------------------------------------------- | ---------------------------- | +| `fetch_event`, `fetch_receiver`, `fetch_group` | `GET /api/v1/{kind}/{id}` | +| `search_events`, `search_receivers`, `search_groups` | `POST /api/v1/graphql/query` | +| `create_event`, `create_receiver`, `create_group` | `POST /api/v1/{kind}` | + +Here `kind` is `events`, `receivers`, or `groups`. + +## Step 1: logging and settings + +Replace the top of your file. All logging goes to stderr because stdout belongs +to the protocol. + +```python +import logging +import os +import sys + +import httpx2 +from fastmcp import FastMCP + +logging.basicConfig( + stream=sys.stderr, + level=logging.DEBUG if os.environ.get("EPR_DEBUG") else logging.INFO, + format="%(asctime)s %(name)s:[%(levelname)s] %(message)s", +) +logger = logging.getLogger("epr_workshop") + +EPR_URL = os.environ.get("EPR_URL", "http://localhost:8042") +EPR_TOKEN = os.environ.get("EPR_TOKEN") + +mcp = FastMCP(name="EPR Workshop MCP Server", version="0.3.0") +``` + +`EPR_TOKEN` is optional. The workshop EPR needs no token, but a real EPR might. + +## Step 2: one client factory and one request helper + +```python +def new_client() -> httpx2.AsyncClient: + """Create an HTTP client for EPR, with the bearer token when one is set.""" + headers = {"Authorization": f"Bearer {EPR_TOKEN}"} if EPR_TOKEN else {} + return httpx2.AsyncClient(base_url=EPR_URL, headers=headers) + + +async def epr_request(method: str, path: str, json: dict | None = None) -> str: + """Call EPR and return the response body, or a message if EPR said no.""" + logger.debug("%s %s", method, path) + async with new_client() as client: + response = await client.request(method, path, json=json) + if response.is_success: + return response.text + return f"EPR returned {response.status_code}: {response.text}" +``` + +Why a factory? Every request gets the same base URL and token, and in module 05 +a test replaces this one function to fake EPR. + +## Step 3: the three fetch tools + +```python +@mcp.tool(title="Fetch Event", description="Fetch an event from EPR by its ID") +async def fetch_event(id: str) -> str: + """Fetch an event from the EPR.""" + return await epr_request("GET", f"/api/v1/events/{id}") +``` + +Add `fetch_receiver` (`/api/v1/receivers/{id}`) and `fetch_group` +(`/api/v1/groups/{id}`) the same way. + +## Step 4: search + +EPR searches go through GraphQL. A table says, for each search, the GraphQL +input type, the argument name, and the fields to return: + +```python +SEARCHES = { + "events": ( + "FindEventInput!", + "event", + ["id", "name", "version", "release", "platform_id", "package", "description", "success", "event_receiver_id"], + ), + "event_receivers": ("FindEventReceiverInput!", "event_receiver", ["id", "name", "type", "version", "description"]), + "event_receiver_groups": ( + "FindEventReceiverGroupInput!", + "event_receiver_group", + ["id", "name", "type", "version", "description", "enabled", "event_receiver_ids"], + ), +} + + +async def search(operation: str, criteria: dict) -> str: + """Run one of the GraphQL searches in SEARCHES.""" + input_type, argument, fields = SEARCHES[operation] + query = f"query ($obj: {input_type}){{{operation}({argument}: $obj) {{ {','.join(fields)} }}}}" + return await epr_request("POST", "/api/v1/graphql/query", {"query": query, "variables": {"obj": criteria}}) +``` + +Then the tools: + +```python +@mcp.tool( + title="Search Events", + description="Search for events. Criteria: name, version, release, platform_id, package, description, success.", +) +async def search_events(data: dict) -> str: + """Search for events in the EPR.""" + return await search("events", data) +``` + +Add `search_receivers` (operation `event_receivers`) and `search_groups` +(operation `event_receiver_groups`). Their criteria are name, type, version, and +description. + +The criteria are passed flat: to find events named `checkout-service`, the tool +argument is `{"data": {"name": "checkout-service"}}`. The parameter is called +`data` and its value is the criteria object. + +## Step 5: create + +```python +@mcp.tool(title="Create Event", description="Create a new event in EPR") +async def create_event(event_data: dict) -> str: + """Create a new event in the EPR.""" + return await epr_request("POST", "/api/v1/events", event_data) +``` + +Add `create_receiver` (`/api/v1/receivers`, argument `receiver_data`) and +`create_group` (`/api/v1/groups`, argument `group_data`). These change EPR's +data, so write good descriptions: the model decides when to call them. + +Finish with the run block: + +```python +if __name__ == "__main__": + logger.info("EPR URL: %s (token configured: %s)", EPR_URL, bool(EPR_TOKEN)) + mcp.run() +``` + +Never log the token itself, only whether one is set. + +## Try it + +```bash +uv run python client.py list work/server.py +``` + +You should see nine tools. Then: + +```bash +uv run python client.py call work/server.py search_events '{"data": {"name": "checkout-service"}}' +uv run python client.py call work/server.py search_receivers '{"data": {}}' +uv run python client.py call work/server.py fetch_group '{"id": "PASTE_THE_GROUP_ID"}' +``` + +Search with `{}` returns everything, because every criterion is optional. Now +create a receiver and an event for it. The receiver call returns the new ID in +`{"data": "..."}`; use it as `event_receiver_id`: + +```bash +uv run python client.py call work/server.py create_receiver '{"receiver_data": {"name": "demo.build", "type": "demo.build", "version": "1.0.0", "description": "My receiver", "schema": {"type": "object", "properties": {"name": {"type": "string"}}}}}' +``` + +```bash +uv run python client.py call work/server.py create_event '{"event_data": {"name": "demo-service", "version": "0.0.1", "release": "2025.10.0", "platform_id": "linux", "package": "oci", "description": "My first event", "payload": {"name": "demo-service"}, "success": true, "event_receiver_id": "PASTE_THE_RECEIVER_ID"}}' +``` + +## Checkpoint + +- `client.py list work/server.py` shows nine tools. +- You created a receiver and an event and found the event with `search_events`. +- Behind schedule? `cp checkpoint_03_tool_set/server.py work/server.py`. + +## Things to notice + +- Every tool still returns text, including errors. EPR answers a missing record + with HTTP 404, and a malformed ID or a bad search with HTTP 200 and + `{"data": null, "errors": [...]}`. Your tool hands all of these back as normal + successful results, so the client cannot tell the call failed. Module 04 fixes + this. +- `data: dict` accepts anything. A typo such as `{"nmae": "x"}` is sent to EPR + as is. Module 04 fixes this too. + +Next: [04 Validation and errors](04_validation_and_errors.md). diff --git a/docs/tutorials/04_validation_and_errors.md b/docs/tutorials/04_validation_and_errors.md new file mode 100644 index 0000000..1ab3947 --- /dev/null +++ b/docs/tutorials/04_validation_and_errors.md @@ -0,0 +1,191 @@ +# 04 Validation and Errors + +Time: 20 minutes. + +Your server works when callers behave. Real AI clients guess: they send +malformed IDs, misspell fields, and call EPR when it is down. In this module you +make the server reject bad input before it reaches EPR and report failures as +real errors. The finished code is in `checkpoint_04_validation/server.py`. + +## 1. Typed inputs + +FastMCP turns type hints into the JSON schema that the AI client sees, and it +validates every call against that schema before your function runs. So the +better your types, the less code you write. + +Add a type for IDs. EPR IDs are 26 character ULIDs: + +```python +from typing import Annotated, Any + +from pydantic import BaseModel, ConfigDict, Field + +EprId = Annotated[str, Field(pattern=r"^[0-9A-Za-z]{26}$", description="26 character ULID of the record")] +``` + +Use it in the fetch tools: + +```python +async def fetch_event(id: EprId) -> str: +``` + +A call with `{"id": "nope"}` is now rejected by the schema, and EPR is never +called. + +## 2. Strict models for the dict arguments + +`data: dict` accepts anything. Replace it with models. The base class forbids +unknown fields so a typo is an error, not a silently ignored filter: + +```python +class StrictModel(BaseModel): + """Base for tool inputs: unknown fields are errors, not silently dropped.""" + + model_config = ConfigDict(extra="forbid", populate_by_name=True) + + +class EventSearch(StrictModel): + name: str | None = Field(None, description="Event name") + version: str | None = Field(None, description="Event version") + release: str | None = Field(None, description="Release") + platform_id: str | None = Field(None, description="Platform identifier") + package: str | None = Field(None, description="Package type, for example oci") + description: str | None = Field(None, description="Event description") + success: bool | None = Field(None, description="Whether the event succeeded") + event_receiver_id: EprId | None = Field(None, description="ID of the receiving event receiver") +``` + +Add `ReceiverSearch` (name, type, version, description) and `GroupSearch`, which +inherits from it. Add create models too: `EventCreate`, `ReceiverCreate`, and +`GroupCreate`. Required fields have no default. `ReceiverCreate` needs a field +called `schema`, but `schema` clashes with a Pydantic built-in, so name the +attribute `schema_` and give it `Field(alias="schema")`. + +The full models are in the checkpoint file. Then the tools take the models: + +```python +async def search_events(data: EventSearch) -> str: + return await search("events", data) +``` + +The tool call is unchanged: `{"data": {"name": "checkout-service"}}`. Inside +`search`, send only the criteria that were set: + +```python +variables = {"obj": criteria.model_dump(exclude_none=True)} +``` + +For create tools, send `model_dump()`; for receivers use +`model_dump(by_alias=True)` so `schema_` goes out as `schema`. + +## 3. Errors that look like errors + +In module 03, a failed call came back as normal text. MCP has a proper way to +say "this call failed": raise `ToolError`. The client sees an error result, and +a good AI client reacts to it (retries, asks the user, or explains). + +Replace `epr_request` and add a helper that turns httpx2 exceptions into +messages a model can act on. (Add `import json` at the top as well.) + +```python +import httpx2 +from fastmcp.exceptions import ToolError + + +def describe_error(error: Exception, operation: str) -> str: + """Turn an httpx2 exception into a message an AI client can act on.""" + if isinstance(error, httpx2.TimeoutException): + return f"Request to EPR at {EPR_URL} timed out. ({error})" + if isinstance(error, httpx2.TransportError): + # Connection refused, reset, or dropped: the name says which, the message may be empty. + return f"Cannot reach EPR at {EPR_URL}. Is the EPR server running? ({type(error).__name__}: {error})" + if isinstance(error, httpx2.HTTPStatusError): + return f"EPR returned {error.response.status_code} for {operation}: {error.response.text}" + return f"Unexpected error in {operation}: {error}" + + +async def epr_request(operation: str, method: str, path: str, body: Any = None) -> str: + """Call EPR and return the body; failures become ToolError, which MCP marks as errors.""" + logger.debug("%s: %s %s", operation, method, path) + try: + async with new_client() as client: + response = await client.request(method, path, json=body) + response.raise_for_status() + except httpx2.HTTPError as error: + message = describe_error(error, operation) + logger.error(message) + raise ToolError(message) from error + # EPR can answer 200 and still report a failure in the body: {"data": null, "errors": [...]}. + try: + errors = json.loads(response.text).get("errors") + except (ValueError, AttributeError): + errors = None + if errors: + details = "; ".join(str(e.get("message", e)) if isinstance(e, dict) else str(e) for e in errors) + message = f"EPR reported an error for {operation}: {details}" + logger.error(message) + raise ToolError(message) + return response.text +``` + +Points worth knowing: + +- `httpx2` has the same exception hierarchy as `httpx`. `TransportError` covers + everything that goes wrong before a response arrives: `TimeoutException`, + `ConnectError` (connection refused), and protocol errors such as + `RemoteProtocolError` (the connection was dropped). `HTTPStatusError` comes + from `raise_for_status()`. All inherit from `HTTPError`. Catch the specific + case you can explain (timeout) first, then the broad one, and include the + exception's class name in the message: a dropped connection often has an empty + message. +- Exceptions from the old `httpx` package are different classes. If you mix the + two packages, `except httpx2.HTTPError` will not catch an `httpx` error. Use + `httpx2` everywhere. +- A successful HTTP status is not always a successful call. EPR answers some + failures, for example a malformed ID or a bad GraphQL search, with `200` and a + body like `{"data": null, "errors": [...]}`. `epr_request` checks the body for + `errors` too, which is the check most often forgotten. +- Put the operation name in each message. Models use it to work out what + happened. +- The shipped `epr-mcp` server returns error text instead of raising; this + workshop version uses `ToolError`, which is the more precise choice. + +Pass an operation name to every `epr_request` call, for example +`epr_request("fetch_event", "GET", f"/api/v1/events/{id}")`. + +## Try it + +```bash +uv run python client.py call work/server.py fetch_event '{"id": "nope"}' +uv run python client.py call work/server.py search_events '{"data": {"nmae": "typo"}}' +uv run python client.py call work/server.py search_events '{"data": {"name": "checkout-service"}}' +``` + +The first two fail with validation errors and never reach EPR. The third works. +A well-formed ID that does not exist is different: it passes validation, EPR +answers `404`, and the tool reports it as an error: + +```bash +uv run python client.py call work/server.py fetch_event '{"id": "01JYRZ96R690ZTQ15Q53GEY6E6"}' +``` + +Now take EPR down and call again: + +```bash +docker compose stop epr-server +uv run python client.py call work/server.py fetch_event '{"id": "PASTE_AN_EVENT_ID"}' +docker compose start epr-server +``` + +You should see `Cannot reach EPR at http://localhost:8042` with the name of the +underlying error, and the exit code of `client.py` is 1. Tell the room before +you stop EPR, and wait a few seconds after starting it again. + +## Checkpoint + +- A bad ID and a misspelled field are both rejected, and a well-formed ID that + does not exist comes back as an error naming the 404. +- Stopping EPR gives a clear "Cannot reach EPR" error. +- Behind schedule? `cp checkpoint_04_validation/server.py work/server.py`. + +Next: [05 Test it](05_test_it.md). diff --git a/docs/tutorials/05_test_it.md b/docs/tutorials/05_test_it.md new file mode 100644 index 0000000..0573c66 --- /dev/null +++ b/docs/tutorials/05_test_it.md @@ -0,0 +1,101 @@ +# 05 Test It + +Time: 20 minutes. + +Tools that call a live system are hard to test: EPR must be up, the data must +exist, and failures such as timeouts are difficult to cause. FastMCP and httpx2 +give you two tools that remove all of that. The finished code is in +`checkpoint_05_tests/`: the module 04 server plus a test file. + +## The idea + +- An in-memory client connects to your server object directly. No process, no + port, no stdio. `Client(server.mcp)` is all it takes. +- `httpx2.MockTransport` replaces the network. You hand it a function that + receives each request and returns the response EPR should give. +- Your server has one function that creates HTTP clients, `new_client`. A test + swaps it for one that uses the mock transport. + +## Set up + +```bash +cp -r checkpoint_05_tests/. work/ +``` + +This puts `server.py`, `conftest.py`, and `test_workshop_server.py` in `work/`. +The conftest lets the tests import the `server` module next to them. + +## Read the fixture + +```python +@pytest.fixture +def epr(monkeypatch): + """Replace the EPR client; set epr["respond"] to choose what EPR answers.""" + state = {"requests": [], "respond": lambda request: httpx2.Response(200, json={"data": EVENT})} + + def handler(request): + state["requests"].append(request) + return state["respond"](request) + + monkeypatch.setattr( + server, + "new_client", + lambda: httpx2.AsyncClient(base_url="http://epr.test", transport=httpx2.MockTransport(handler)), + ) + return state +``` + +Each test sets what EPR answers and then inspects the requests your server made. + +## Read a test + +```python +@pytest.mark.asyncio +async def test_fetch_event_rejects_a_malformed_id_without_calling_epr(epr): + result = await call("fetch_event", {"id": "not-an-id"}, raise_on_error=False) + assert result.is_error + assert epr["requests"] == [] +``` + +This one proves the validation from module 04: the call fails and EPR never saw +a request. The other tests cover the happy path, search criteria, the `schema` +alias, an EPR 404, an error inside a 200 response, an unreachable EPR, and the +bearer token. + +## Run them + +```bash +uv run pytest work +``` + +You should see `11 passed`. To run the finished checkpoint instead: + +```bash +uv run pytest checkpoint_05_tests +``` + +## Exercise + +Add a test for a failure no test covers yet: EPR is slow. Make the mock raise a +timeout and assert that the error message says the request timed out. + +```python +@pytest.mark.asyncio +async def test_slow_epr_says_it_timed_out(epr): + def slow(request): + raise httpx2.ReadTimeout("too slow", request=request) + + epr["respond"] = slow + result = await call("fetch_event", {"id": EPR_ID}, raise_on_error=False) + assert result.is_error + assert "timed out" in result.content[0].text +``` + +Then break the server on purpose: change `describe_error` so a timeout says +something different, and watch this test fail. + +## Checkpoint + +`uv run pytest work` passes, including your new test. + +Next: [06 Use it from an editor](06_use_from_an_editor.md). diff --git a/docs/tutorials/06_use_from_an_editor.md b/docs/tutorials/06_use_from_an_editor.md new file mode 100644 index 0000000..cd2b458 --- /dev/null +++ b/docs/tutorials/06_use_from_an_editor.md @@ -0,0 +1,119 @@ +# 06 Use It from an Editor + +Time: 20 minutes. + +Now an AI assistant uses your server. Both editors start your server as a local +process over stdio with `uv run`. Nothing runs in Docker except EPR. + +## Why not Docker for the MCP server + +Editors can start an MCP server with `docker run -i`, but it is fragile: +container networking to EPR, interactive stdin, image rebuilds after every edit, +and startup timeouts all cause failures that look like MCP problems. A local +`uv run` has none of these, so this workshop uses it. + +## Check first + +```bash +uv run python check_setup.py +``` + +This time leave out `--skip-stdio`. Two lines matter: "workshop server via uv +run" and "shipped server via uv run". They start servers with the exact commands +in the editor configs and list their tools. If both pass, the editors will +launch them. The first run can take a minute while uv installs packages; that is +also why you run this before opening the editor. + +## VS Code + +1. Make sure `work/` has your finished server, or use the checkpoint: + `cp checkpoint_05_tests/server.py work/server.py`. +2. Open the folder `docs/tutorials/code` in VS Code (File, Open Folder). The + workspace folder must be this one, because the configuration uses + `${workspaceFolder}`. +3. Open `.vscode/mcp.json`. It defines two servers: + - `epr-workshop` runs the finished workshop server, + `checkpoint_05_tests/server.py`. To run your own, change the last argument + to `work/server.py`. + - `epr-mcp` runs the shipped server of this repository, + `eprmcp start --transport stdio`. +4. Above each server in the file, click Start. When the status says Running, the + tool count appears next to it. Or press Ctrl+Shift+P (Cmd+Shift+P on macOS), + run MCP: List Servers, pick a server, and choose Start Server. +5. Open Chat, switch to Agent mode, click the tools icon, and make sure the EPR + tools are ticked. +6. Ask in plain language: + - "Search EPR for events named checkout-service." + - "Which of those failed?" + - "Fetch the event receiver that checkout-service events belong to." + - "Create an event receiver called demo.build of type demo.build." (The model + must also supply a version, a description, and a schema; watch what it asks + you for.) +7. VS Code asks for confirmation before it runs a tool. Expand the call to see + the exact arguments the model chose. Compare them with your input models from + module 04. + +If a server does not start, run MCP: List Servers, choose it, and select Show +Output. The error is usually one of the rows in the table at the end of this +module. + +## Claude Desktop (macOS) + +Claude Desktop does not inherit your shell PATH, so the config needs the full +path to uv and to the repository. + +1. Find uv: `which uv`. +2. Find the repository path: run `pwd` in the repository root. +3. Open the Claude Desktop config at + `~/Library/Application Support/Claude/claude_desktop_config.json`, or + Settings, Developer, Edit Config. +4. Copy the contents of `claude_desktop_config.json` from this folder and + replace `/ABSOLUTE/PATH/TO/uv` and `/ABSOLUTE/PATH/TO/epr-mcp-python` with + the real paths. If the file already has other servers, merge the two + `mcpServers` entries into it. +5. Quit Claude Desktop completely and reopen it. Ask: "What EPR tools do you + have?" + +Claude Desktop is not available on Linux; use VS Code there. + +## Option: HTTP instead of stdio + +The shipped server can also run as a long-lived HTTP server, which is what you +would deploy: + +```bash +uv run --directory ../../.. eprmcp start --transport http --host 127.0.0.1 --port 8000 --url http://localhost:8042 +``` + +Connect the Inspector to it with transport Streamable HTTP and URL +`http://localhost:8000/mcp`, or call it from Python with +`Client("http://localhost:8000/mcp")`. Its Swagger page is at +`http://localhost:8000/docs`. This is optional; the workshop path is stdio. + +## The fallback ladder + +If an editor will not cooperate, move down a rung. All three exercise the same +server. + +1. The editor, as above. +2. The Inspector: module 02, pointed at `checkpoint_05_tests/server.py`. +3. The terminal: `client.py` from module 01, pointed at + `checkpoint_05_tests/server.py`. + +## When the editor cannot start the server + +| Symptom | Cause and fix | +| ---------------------------------------- | -------------------------------------------------------------------------- | +| `spawn uv ENOENT` or "command not found" | The editor cannot see uv. Use the full path from `which uv` as `command` | +| Server starts, then exits at once | Run the same command in a terminal; `check_setup.py` shows the real error | +| Start times out the first time | uv was still installing. Run `uv sync` in the folder, then Start again | +| Tools list is empty or stale | Stop and Start the server after editing the code | +| "Cannot reach EPR" | EPR is down: `docker compose up -d`, or `EPR_URL` points to the wrong host | +| Wrong folder | In VS Code, the opened folder must be `docs/tutorials/code` | + +## Checkpoint + +An AI assistant, in VS Code or Claude Desktop, found events in EPR through your +server. + +Next: [07 Misc and troubleshooting](07_misc_and_troubleshooting.md). diff --git a/docs/tutorials/07_misc_and_troubleshooting.md b/docs/tutorials/07_misc_and_troubleshooting.md new file mode 100644 index 0000000..b9da5db --- /dev/null +++ b/docs/tutorials/07_misc_and_troubleshooting.md @@ -0,0 +1,105 @@ +# 07 Misc and Troubleshooting + +Time: 10 minutes. Reference material; skim it now and come back when needed. + +## uv cheat sheet + +```bash +uv sync # create or update the environment +uv run python script.py # run in the project environment +uv run --directory /path python x.py # run against another project folder +uv run pytest work # run tests +uv add some-package # add a dependency to pyproject.toml +uv --version +``` + +A private package index or mirror: set `UV_INDEX_URL`. + +## FastMCP 4 notes + +This workshop uses FastMCP 4. If you have FastMCP 2 or 3 code, these are the +changes that matter here: + +| Topic | Change | +| --------------------- | -------------------------------------------------------------------------------------------------------------------------- | +| HTTP client | FastMCP uses `httpx2`. Replace `import httpx` with `import httpx2` | +| Server constructor | Pass `name=` and `version=` by keyword; the second positional is `instructions` | +| Logging to the client | `ctx.debug()` and `ctx.error()` still exist but now warn that the capability is deprecated. Use Python `logging` to stderr | +| OpenAPI integration | Moved from `fastmcp.server.openapi` to `fastmcp.server.providers.openapi` | +| Removed | `ctx.sample()`, `ctx.sample_step()`, `ctx.list_roots()`, and the `sampling_handler` argument | +| Protocol modes | The client negotiates the modern protocol by default. `Client(..., mode="legacy")` forces the older handshake protocol | +| Local server clients | `Client("server.py")` as a plain string warns. Pass a `Path`, or use `StdioTransport` as `client.py` does | + +The upgrade guide is at + and the release +notes at . + +## httpx2 notes + +httpx2 has the same API as httpx 0.28; only names changed. + +- Install `httpx2` and import `httpx2`. The two packages can be installed side + by side, but their classes are different: an `httpx.HTTPError` is not an + `httpx2.HTTPError`. +- The default User-Agent is `python-httpx2/`. +- TLS verification uses the operating system trust store. If a corporate proxy + or private CA breaks it, point `SSL_CERT_FILE` or `SSL_CERT_DIR` at your + certificate bundle; both are still honored. +- Loggers are named `httpx2` and `httpcore2`. To see requests, set + `logging.getLogger("httpx2").setLevel(logging.DEBUG)`. + +## Troubleshooting + +| Symptom | Fix | +| ---------------------------------------------- | ---------------------------------------------------------------------------------- | +| `check_setup.py` says EPR is not reachable | `docker compose ps` in `docs/tutorials/code`; then `docker compose up -d` | +| `epr-server` keeps restarting | `docker compose logs epr-server`; see "EPR server" below | +| `seed_epr.py` says it cannot reach EPR | EPR is still starting. Wait for the readiness curl in module 00 to print 200 | +| `Cannot reach EPR` from a tool | `EPR_URL` is wrong or EPR is down. The workshop default is `http://localhost:8042` | +| Tool call fails with a validation error | You are on the module 04 server. Read the message; it names the field | +| `ModuleNotFoundError: httpx2` | You ran `python` outside uv. Use `uv run python ...` | +| `ModuleNotFoundError: No module named 'httpx'` | Code still imports `httpx`. Change it to `httpx2` | +| Garbled or missing MCP responses | Something printed to stdout. Use `logger`, not `print` | +| Port 8042 already in use | Stop the other EPR, or change the port mapping in `docker-compose.yaml` | + +### EPR server + +EPR needs Postgres and Redpanda healthy before it starts, so the first start +takes a minute. If it still restarts: + +```bash +docker compose ps +docker compose logs epr-server +docker compose logs redpanda +``` + +To start over with empty data: + +```bash +docker compose down -v +docker compose up -d +uv run python seed_epr.py +``` + +## Offline and slow networks + +Prepare while online: + +```bash +uv sync +docker compose build +docker save epr-server:workshop | gzip > epr-server.tar.gz +docker pull postgres:16 +docker pull docker.redpanda.com/redpandadata/redpanda:v23.2.8 +``` + +On another machine, `docker load < epr-server.tar.gz`, then +`docker compose up -d` skips the build because the image already exists. + +## Where to go next + +- The shipped server that this workshop mirrors: `src/epr_mcp/` in this + repository. +- The demos in `demos/`. +- FastMCP documentation: . +- The MCP specification: . diff --git a/docs/tutorials/README.md b/docs/tutorials/README.md new file mode 100644 index 0000000..6dbb0b7 --- /dev/null +++ b/docs/tutorials/README.md @@ -0,0 +1,134 @@ +# Build an MCP Server for the Event Provenance Registry + +A hands-on workshop. You build an MCP server in Python that lets an AI assistant +read from and write to an Event Provenance Registry (EPR), then use it from VS +Code and Claude Desktop. It uses FastMCP 4 and httpx2, the same stack as the +shipped `epr-mcp` server in this repository. + +## Who this is for + +Developers who can read Python and use a terminal. You do not need to know MCP, +EPR, async Python, or Docker in depth. + +## What you will have at the end + +- A working MCP server with nine tools: fetch, search, and create for events, + event receivers, and event receiver groups. +- Input validation, clear error messages, and tests that need no network. +- The server running in an editor, plus three ways to test it when the editor + misbehaves. + +## Agenda + +| Module | What you do | Time | +| ------------------------------------------------------------- | ------------------------------------------------------ | ------ | +| [00 Intro and prerequisites](00_intro.md) | Install tools, start EPR, seed data, run the preflight | 15 min | +| [01 First tool](01_first_tool.md) | One `fetch_event` tool, called from the terminal | 20 min | +| [02 Inspector](02_inspector.md) | Explore and call the tool in the MCP Inspector | 15 min | +| [03 Complete the tool set](03_complete_tool_set.md) | Add receivers, groups, search, and create | 30 min | +| [04 Validation and errors](04_validation_and_errors.md) | Typed inputs, strict models, useful errors | 20 min | +| [05 Test it](05_test_it.md) | In-memory client tests with a mocked EPR | 20 min | +| [06 Use it from an editor](06_use_from_an_editor.md) | VS Code and Claude Desktop over stdio | 20 min | +| [07 Misc and troubleshooting](07_misc_and_troubleshooting.md) | uv tips, FastMCP 4 notes, fixes | 10 min | + +Total: 2 hours 30 minutes, including a break. Modules 00 to 06 are the core +path. + +## How the workshop is set up + +Only EPR runs in Docker. Your MCP server always runs on your machine, started by +a uv-managed Python environment, and talks to the editor over stdin and stdout +(the `stdio` transport). Running an MCP server inside a container that an editor +launches is unreliable, so this workshop never does it. + +```text +docs/tutorials/code/ + docker-compose.yaml EPR, Postgres, and Redpanda (no MCP server) + epr/Dockerfile builds the EPR server + pyproject.toml pinned workshop dependencies (uv) + seed_epr.py creates sample data in EPR + check_setup.py preflight check + client.py terminal MCP client, the editor-free fallback + starter_01_first_tool/ beginning-of-module-01 scaffold (no tools yet) + checkpoint_01_first_tool/ finished code at the end of module 01 + starter_03_tool_set/ beginning-of-module-03 state (fetch_event only) + checkpoint_03_tool_set/ finished code at the end of module 03 + starter_04_validation/ beginning-of-module-04 state (dict-based tools) + checkpoint_04_validation/ finished code at the end of module 04 + starter_05_tests/ beginning-of-module-05 state (server + test skeleton) + checkpoint_05_tests/ module 04 server plus its full test suite + .vscode/mcp.json VS Code server configuration + claude_desktop_config.json Claude Desktop server configuration + work/ your own code (you create it, git ignores it) +``` + +All commands in the modules run from `docs/tutorials/code` unless they say +otherwise. The code listings in the modules leave out the longer docstrings that +the checkpoint files carry, so read the checkpoint file for the full version. + +## Starting a module from a known state + +Starters hold the beginning-of-module state so you can join mid-workshop or +resync without carrying any work from a previous session. + +| Starting module | Copy this | +| --------------- | --------------------------------------------------- | +| Module 01 | `cp starter_01_first_tool/server.py work/server.py` | +| Module 03 | `cp starter_03_tool_set/server.py work/server.py` | +| Module 04 | `cp starter_04_validation/server.py work/server.py` | +| Module 05 | `cp -r starter_05_tests/. work/` | + +## Stuck? Jump to a checkpoint + +Checkpoints hold the finished code for a module. Copy one into `work/` to pick +up where the solution left off. + +| You are stuck in | Copy this | +| ---------------- | ------------------------------------------------------ | +| Module 01 or 02 | `cp checkpoint_01_first_tool/server.py work/server.py` | +| Module 03 | `cp checkpoint_03_tool_set/server.py work/server.py` | +| Module 04 | `cp checkpoint_04_validation/server.py work/server.py` | +| Module 05 or 06 | `cp -r checkpoint_05_tests/. work/` | + +Modules 02 and 06 do not change your code, so a checkpoint from the module +before them is enough. + +## If something does not work + +1. Run `uv run python check_setup.py`. The first FAIL line says what to fix. +2. Use [07 Misc and troubleshooting](07_misc_and_troubleshooting.md). +3. Skip the editor. `uv run python client.py` exercises any server from the + terminal, and the Inspector in module 02 works without VS Code. + +## Notes for facilitators + +Before the session: + +- Ask attendees to complete [module 00](00_intro.md) at home, including + `uv run python check_setup.py`. The first EPR image build takes about three + minutes and downloads about a gigabyte. +- Build the EPR image once, then share it for the room with + `docker save epr-server:workshop | gzip > epr-server.tar.gz`. Attendees run + `docker load < epr-server.tar.gz` and `docker compose up -d` and skip the + build. Pull the `postgres:16` and Redpanda images the same way. +- Pre-warm uv: run `uv sync` in `docs/tutorials/code` and + `uv run eprmcp version` in the repository root while online. The first + `uv run` in an editor config can exceed the editor's start timeout if packages + still need downloading. +- The supported systems are macOS and Linux. Claude Desktop is macOS only; Linux + attendees use VS Code. + +During the session: + +- Keep the fallback ladder in mind: editor, then Inspector, then `client.py`. + Move an attendee down a rung rather than spend the room's time debugging one + editor. +- At the start of each module, ask who is not at the previous checkpoint and + have them copy it from the table above. +- Module 04 breaks and repairs EPR on purpose (`docker compose stop`); warn the + room first. +- To reset everything, run `docker compose down -v`, then `docker compose up -d` + and `uv run python seed_epr.py` again. + +Timings are estimates until the agenda has been dry-run; record actual times in +[the implementation notes](../explanation/fastmcp4_httpx2_migration_implementation.md). diff --git a/docs/tutorials/code/.vscode/mcp.json b/docs/tutorials/code/.vscode/mcp.json new file mode 100644 index 0000000..3b68ac7 --- /dev/null +++ b/docs/tutorials/code/.vscode/mcp.json @@ -0,0 +1,42 @@ +{ + "inputs": [ + { + "type": "promptString", + "id": "epr_url", + "description": "EPR URL", + "default": "http://localhost:8042" + } + ], + "servers": { + "epr-workshop": { + "type": "stdio", + "command": "uv", + "args": [ + "run", + "--directory", + "${workspaceFolder}", + "python", + "checkpoint_05_tests/server.py" + ], + "env": { + "EPR_URL": "${input:epr_url}" + } + }, + "epr-mcp": { + "type": "stdio", + "command": "uv", + "args": [ + "run", + "--directory", + "${workspaceFolder}/../../..", + "eprmcp", + "start", + "--transport", + "stdio" + ], + "env": { + "EPR_URL": "${input:epr_url}" + } + } + } +} diff --git a/docs/tutorials/code/check_setup.py b/docs/tutorials/code/check_setup.py new file mode 100644 index 0000000..c74aaad --- /dev/null +++ b/docs/tutorials/code/check_setup.py @@ -0,0 +1,200 @@ +#!/usr/bin/env python3 +# SPDX-FileCopyrightText: © 2025 Brett Smith +# SPDX-License-Identifier: Apache-2.0 + +"""Preflight check for the workshop. Run it before the session and after any failure. + +Usage: + uv run python check_setup.py # everything + uv run python check_setup.py --skip-stdio # skip the slower editor-launch checks + +Each line is PASS, FAIL, or SKIP. The first FAIL tells you what to fix. +""" + +import argparse +import asyncio +import os +import shutil +import subprocess +import sys +from pathlib import Path + +import httpx2 +from fastmcp import Client +from fastmcp.client.transports import StdioTransport + +CODE_DIR = Path(__file__).resolve().parent +REPO_DIR = CODE_DIR.parents[2] +EPR_URL = os.environ.get("EPR_URL", "http://localhost:8042") +# Tool counts for the checkpoints that exist; checkpoint 01 only has one tool. +CHECKPOINTS = {"checkpoint_01_first_tool": 1, "checkpoint_03_tool_set": 9, "checkpoint_04_validation": 9} +FINAL_CHECKPOINT = "checkpoint_05_tests" +STDIO_TIMEOUT = 180 # the first uv run may download and install packages + +failures = 0 + + +def report(status: str, name: str, detail: str = "") -> None: + """Print one result line and count failures. + + Args: + status: PASS, FAIL, or SKIP. + name: What was checked. + detail: Optional extra text. + + Examples: + ``report('PASS', 'Python 3.12 or newer', '3.12.11')`` + """ + global failures + if status == "FAIL": + failures += 1 + print(f"{status:<5}{name}" + (f": {detail}" if detail else "")) + + +def check_python() -> None: + """Check that Python is 3.12 or newer. + + Examples: + ``check_python()`` + """ + ok = sys.version_info >= (3, 12) + report("PASS" if ok else "FAIL", "Python 3.12 or newer", sys.version.split()[0]) + + +def check_uv() -> str | None: + """Check that uv is on PATH. + + Returns: + The path to uv, or None if it is missing. + + Examples: + ``uv = check_uv()`` + """ + uv = shutil.which("uv") + if not uv: + report("FAIL", "uv on PATH", "install from https://docs.astral.sh/uv/") + return None + version = subprocess.run([uv, "--version"], capture_output=True, text=True).stdout.strip() + report("PASS", "uv on PATH", f"{uv} ({version})") + return uv + + +def check_epr() -> None: + """Check that EPR answers its readiness endpoint. + + Examples: + ``check_epr()`` + """ + try: + response = httpx2.get(f"{EPR_URL}/healthz/readiness", timeout=5) + except httpx2.HTTPError as error: + report("FAIL", f"EPR reachable at {EPR_URL}", f"{error}; run 'docker compose up -d --build' in {CODE_DIR}") + return + ok = response.status_code == 200 + report("PASS" if ok else "FAIL", f"EPR ready at {EPR_URL}", f"HTTP {response.status_code}") + + +async def list_tools(transport: StdioTransport) -> list[str]: + """Start a server over stdio and list its tools. + + Args: + transport: The stdio transport that starts the server. + + Returns: + The tool names. + + Examples: + ``asyncio.run(list_tools(StdioTransport(command='python', args=['server.py'])))`` + """ + async with Client(transport, timeout=STDIO_TIMEOUT) as client: + return [tool.name for tool in await client.list_tools()] + + +def check_in_process() -> None: + """Start each checkpoint with the current Python and count its tools. + + Examples: + ``check_in_process()`` + """ + servers = {name: (CODE_DIR / name / "server.py", count) for name, count in CHECKPOINTS.items()} + servers["work (your server)"] = (CODE_DIR / "work" / "server.py", None) + for name, (server, expected) in servers.items(): + label = f"{name} lists {expected} tool(s)" if expected else f"{name} lists at least one tool" + if not server.exists(): + report("SKIP", label, "not created yet") + continue + try: + tools = asyncio.run( + list_tools(StdioTransport(command=sys.executable, args=[str(server)], log_file=Path(os.devnull))) + ) + except Exception as error: + report("FAIL", label, repr(error)) + continue + ok = len(tools) == expected if expected else len(tools) > 0 + report("PASS" if ok else "FAIL", label, f"found {len(tools)}") + + +def check_editor_launch(uv: str) -> None: + """Start servers with the exact commands the editor configs use. + + Args: + uv: The path to uv. + + Examples: + ``check_editor_launch('/usr/local/bin/uv')`` + """ + env = {**os.environ, "EPR_URL": EPR_URL} + launches = { + f"workshop server ({FINAL_CHECKPOINT}) via uv run": ( + CODE_DIR / FINAL_CHECKPOINT / "server.py", + [uv, "run", "--directory", str(CODE_DIR), "python", f"{FINAL_CHECKPOINT}/server.py"], + 9, + ), + "shipped server (eprmcp) via uv run": ( + REPO_DIR / "pyproject.toml", + [uv, "run", "--directory", str(REPO_DIR), "eprmcp", "start", "--transport", "stdio"], + 9, + ), + } + for name, (required, command, expected) in launches.items(): + if not required.exists(): + report("SKIP", name, f"{required.name} not found") + continue + try: + transport = StdioTransport(command=command[0], args=command[1:], env=env, log_file=Path(os.devnull)) + tools = asyncio.run(list_tools(transport)) + except Exception as error: + report("FAIL", name, repr(error)) + continue + report("PASS" if len(tools) == expected else "FAIL", name, f"found {len(tools)} tools") + + +def main() -> int: + """Run all checks and print a summary. + + Returns: + 0 if every check passed or was skipped, 1 if any failed. + + Examples: + ``uv run python check_setup.py --skip-stdio`` + """ + parser = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter) + parser.add_argument("--skip-stdio", action="store_true", help="skip the uv run editor-launch checks") + args = parser.parse_args() + + check_python() + uv = check_uv() + check_epr() + check_in_process() + if args.skip_stdio: + report("SKIP", "editor-launch checks", "--skip-stdio") + elif uv: + check_editor_launch(uv) + + print() + print("All checks passed." if not failures else f"{failures} check(s) failed.") + return 1 if failures else 0 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/docs/tutorials/code/checkpoint_01_first_tool/server.py b/docs/tutorials/code/checkpoint_01_first_tool/server.py new file mode 100644 index 0000000..520ffc8 --- /dev/null +++ b/docs/tutorials/code/checkpoint_01_first_tool/server.py @@ -0,0 +1,37 @@ +# SPDX-FileCopyrightText: © 2025 Brett Smith +# SPDX-License-Identifier: Apache-2.0 + +"""EPR workshop MCP server, checkpoint 01: your first tool.""" + +import os + +import httpx2 +from fastmcp import FastMCP + +EPR_URL = os.environ.get("EPR_URL", "http://localhost:8042") + +mcp = FastMCP(name="EPR Workshop MCP Server", version="0.1.0") + + +@mcp.tool(title="Fetch Event", description="Fetch an event from EPR by its ID") +async def fetch_event(id: str) -> str: + """Fetch an event from the EPR. + + Args: + id: The event's ID. + + Returns: + The event as JSON text. + + Examples: + ``call_tool("fetch_event", {"id": "01JYRZ96R690ZTQ15Q53GEY6E6"})`` + """ + async with httpx2.AsyncClient() as client: + response = await client.get(f"{EPR_URL}/api/v1/events/{id}") + return response.text + + +if __name__ == "__main__": + # Default transport is stdio: the editor or Inspector starts this process + # and talks to it over stdin and stdout. + mcp.run(show_banner=False) diff --git a/docs/tutorials/code/checkpoint_03_tool_set/server.py b/docs/tutorials/code/checkpoint_03_tool_set/server.py new file mode 100644 index 0000000..390d50b --- /dev/null +++ b/docs/tutorials/code/checkpoint_03_tool_set/server.py @@ -0,0 +1,255 @@ +# SPDX-FileCopyrightText: © 2025 Brett Smith +# SPDX-License-Identifier: Apache-2.0 + +"""EPR workshop MCP server, checkpoint 03: the complete tool set.""" + +import logging +import os +import sys + +import httpx2 +from fastmcp import FastMCP + +# stdout carries the MCP protocol over stdio, so all logging goes to stderr. +logging.basicConfig( + stream=sys.stderr, + level=logging.DEBUG if os.environ.get("EPR_DEBUG") else logging.INFO, + format="%(asctime)s %(name)s:[%(levelname)s] %(message)s", +) +logger = logging.getLogger("epr_workshop") + +EPR_URL = os.environ.get("EPR_URL", "http://localhost:8042") +EPR_TOKEN = os.environ.get("EPR_TOKEN") + +mcp = FastMCP(name="EPR Workshop MCP Server", version="0.3.0") + + +def new_client() -> httpx2.AsyncClient: + """Create an HTTP client for EPR, with the bearer token when one is set. + + Returns: + A new ``httpx2.AsyncClient``; use it as an async context manager. + + Examples: + ``async with new_client() as client: ...`` + """ + headers = {"Authorization": f"Bearer {EPR_TOKEN}"} if EPR_TOKEN else {} + return httpx2.AsyncClient(base_url=EPR_URL, headers=headers) + + +async def epr_request(method: str, path: str, json: dict | None = None) -> str: + """Call EPR and return the response body, or a message if EPR said no. + + Args: + method: The HTTP method. + path: The API path. + json: The JSON body, if any. + + Returns: + The response text, or ``EPR returned : ``. + + Examples: + ``await epr_request("GET", "/api/v1/events/")`` + """ + logger.debug("%s %s", method, path) + async with new_client() as client: + response = await client.request(method, path, json=json) + if response.is_success: + return response.text + return f"EPR returned {response.status_code}: {response.text}" + + +# Each GraphQL search names the input type, the argument, and the fields to return. +SEARCHES = { + "events": ( + "FindEventInput!", + "event", + ["id", "name", "version", "release", "platform_id", "package", "description", "success", "event_receiver_id"], + ), + "event_receivers": ( + "FindEventReceiverInput!", + "event_receiver", + ["id", "name", "type", "version", "description"], + ), + "event_receiver_groups": ( + "FindEventReceiverGroupInput!", + "event_receiver_group", + ["id", "name", "type", "version", "description", "enabled", "event_receiver_ids"], + ), +} + + +async def search(operation: str, criteria: dict) -> str: + """Run one of the GraphQL searches in SEARCHES. + + Args: + operation: A key of SEARCHES. + criteria: The search criteria. + + Returns: + The GraphQL response as JSON text. + + Examples: + ``await search("events", {"name": "foo"})`` + """ + input_type, argument, fields = SEARCHES[operation] + query = f"query ($obj: {input_type}){{{operation}({argument}: $obj) {{ {','.join(fields)} }}}}" + return await epr_request("POST", "/api/v1/graphql/query", {"query": query, "variables": {"obj": criteria}}) + + +@mcp.tool(title="Fetch Event", description="Fetch an event from EPR by its ID") +async def fetch_event(id: str) -> str: + """Fetch an event from the EPR. + + Args: + id: The record's ID. + + Returns: + The record as JSON text. + + Examples: + ``call_tool("fetch_event", {"id": "01JYRZ96R690ZTQ15Q53GEY6E6"})`` + """ + return await epr_request("GET", f"/api/v1/events/{id}") + + +@mcp.tool(title="Fetch Event Receiver", description="Fetch an event receiver from EPR by its ID") +async def fetch_receiver(id: str) -> str: + """Fetch an event receiver from the EPR. + + Args: + id: The record's ID. + + Returns: + The record as JSON text. + + Examples: + ``call_tool("fetch_receiver", {"id": "01JYRZ96R690ZTQ15Q53GEY6E6"})`` + """ + return await epr_request("GET", f"/api/v1/receivers/{id}") + + +@mcp.tool(title="Fetch Event Receiver Group", description="Fetch an event receiver group from EPR by its ID") +async def fetch_group(id: str) -> str: + """Fetch an event receiver group from the EPR. + + Args: + id: The record's ID. + + Returns: + The record as JSON text. + + Examples: + ``call_tool("fetch_group", {"id": "01JYRZ96R690ZTQ15Q53GEY6E6"})`` + """ + return await epr_request("GET", f"/api/v1/groups/{id}") + + +@mcp.tool( + title="Search Events", + description="Search for events. Criteria: name, version, release, platform_id, package, description, success.", +) +async def search_events(data: dict) -> str: + """Search for events in the EPR. + + Args: + data: The search criteria. + + Returns: + The matching records as JSON text. + + Examples: + ``call_tool("search_events", {"data": {"name": "foo"}})`` + """ + return await search("events", data) + + +@mcp.tool( + title="Search Event Receivers", + description="Search for event receivers. Criteria: name, type, version, description.", +) +async def search_receivers(data: dict) -> str: + """Search for event receivers in the EPR. + + Args: + data: The search criteria. + + Returns: + The matching records as JSON text. + + Examples: + ``call_tool("search_receivers", {"data": {"name": "foo"}})`` + """ + return await search("event_receivers", data) + + +@mcp.tool( + title="Search Event Receiver Groups", + description="Search for event receiver groups. Criteria: name, type, version, description.", +) +async def search_groups(data: dict) -> str: + """Search for event receiver groups in the EPR. + + Args: + data: The search criteria. + + Returns: + The matching records as JSON text. + + Examples: + ``call_tool("search_groups", {"data": {"name": "foo"}})`` + """ + return await search("event_receiver_groups", data) + + +@mcp.tool(title="Create Event", description="Create a new event in EPR") +async def create_event(event_data: dict) -> str: + """Create an event in the EPR. + + Args: + event_data: The fields of the new record. + + Returns: + EPR's answer, which holds the new ID. + + Examples: + ``call_tool("create_event", {"event_data": {...}})`` + """ + return await epr_request("POST", "/api/v1/events", event_data) + + +@mcp.tool(title="Create Event Receiver", description="Create a new event receiver in EPR") +async def create_receiver(receiver_data: dict) -> str: + """Create an event receiver in the EPR. + + Args: + receiver_data: The fields of the new record. + + Returns: + EPR's answer, which holds the new ID. + + Examples: + ``call_tool("create_receiver", {"receiver_data": {...}})`` + """ + return await epr_request("POST", "/api/v1/receivers", receiver_data) + + +@mcp.tool(title="Create Event Receiver Group", description="Create a new event receiver group in EPR") +async def create_group(group_data: dict) -> str: + """Create an event receiver group in the EPR. + + Args: + group_data: The fields of the new record. + + Returns: + EPR's answer, which holds the new ID. + + Examples: + ``call_tool("create_group", {"group_data": {...}})`` + """ + return await epr_request("POST", "/api/v1/groups", group_data) + + +if __name__ == "__main__": + logger.info("EPR URL: %s (token configured: %s)", EPR_URL, bool(EPR_TOKEN)) + mcp.run(show_banner=False) diff --git a/docs/tutorials/code/checkpoint_04_validation/server.py b/docs/tutorials/code/checkpoint_04_validation/server.py new file mode 100644 index 0000000..4758f17 --- /dev/null +++ b/docs/tutorials/code/checkpoint_04_validation/server.py @@ -0,0 +1,402 @@ +# SPDX-FileCopyrightText: © 2025 Brett Smith +# SPDX-License-Identifier: Apache-2.0 + +"""EPR workshop MCP server, checkpoint 04: validation and error handling.""" + +import json +import logging +import os +import sys +from typing import Annotated, Any + +import httpx2 +from fastmcp import FastMCP +from fastmcp.exceptions import ToolError +from pydantic import BaseModel, ConfigDict, Field + +# stdout carries the MCP protocol over stdio, so all logging goes to stderr. +logging.basicConfig( + stream=sys.stderr, + level=logging.DEBUG if os.environ.get("EPR_DEBUG") else logging.INFO, + format="%(asctime)s %(name)s:[%(levelname)s] %(message)s", +) +logger = logging.getLogger("epr_workshop") + +EPR_URL = os.environ.get("EPR_URL", "http://localhost:8042") +EPR_TOKEN = os.environ.get("EPR_TOKEN") + +mcp = FastMCP(name="EPR Workshop MCP Server", version="0.4.0") + +# --- Input types ----------------------------------------------------------- +# FastMCP turns these annotations into the JSON schema the AI client sees, and +# validates every call against them before your function runs. + +EprId = Annotated[str, Field(pattern=r"^[0-9A-Za-z]{26}$", description="26 character ULID of the record")] + + +class StrictModel(BaseModel): + """Base for tool inputs: unknown fields are errors, not silently dropped. + + Examples: + ``class EventSearch(StrictModel): ...`` + """ + + model_config = ConfigDict(extra="forbid", populate_by_name=True) + + +class EventSearch(StrictModel): + """Criteria for searching events; every field is optional. + + Examples: + ``EventSearch.model_validate({...})`` + """ + + name: str | None = Field(None, description="Event name") + version: str | None = Field(None, description="Event version") + release: str | None = Field(None, description="Release") + platform_id: str | None = Field(None, description="Platform identifier") + package: str | None = Field(None, description="Package type, for example oci") + description: str | None = Field(None, description="Event description") + success: bool | None = Field(None, description="Whether the event succeeded") + event_receiver_id: EprId | None = Field(None, description="ID of the receiving event receiver") + + +class ReceiverSearch(StrictModel): + """Criteria for searching event receivers; every field is optional. + + Examples: + ``ReceiverSearch.model_validate({...})`` + """ + + name: str | None = Field(None, description="Receiver name") + type: str | None = Field(None, description="Receiver type") + version: str | None = Field(None, description="Receiver version") + description: str | None = Field(None, description="Receiver description") + + +class GroupSearch(ReceiverSearch): + """Groups are searched by the same fields as receivers. + + Examples: + ``GroupSearch(name='foo')`` + """ + + +class EventCreate(StrictModel): + """The fields of a new event. + + Examples: + ``EventCreate.model_validate({...})`` + """ + + name: str = Field(description="Event name") + version: str = Field(description="Event version") + release: str = Field(description="Release") + platform_id: str = Field(description="Platform identifier") + package: str = Field(description="Package type, for example oci") + description: str = Field(description="Event description") + payload: dict[str, Any] = Field(description="Event payload; must match the receiver schema") + success: bool = Field(description="Whether the event succeeded") + event_receiver_id: EprId = Field(description="ID of the receiving event receiver") + + +class ReceiverCreate(StrictModel): + """The fields of a new event receiver. + + Examples: + ``ReceiverCreate.model_validate({...})`` + """ + + name: str = Field(description="Receiver name") + type: str = Field(description="Receiver type") + version: str = Field(description="Receiver version") + description: str = Field(description="Receiver description") + schema_: dict[str, Any] = Field(alias="schema", description="JSON schema that event payloads must match") + + +class GroupCreate(StrictModel): + """The fields of a new event receiver group. + + Examples: + ``GroupCreate.model_validate({...})`` + """ + + name: str = Field(description="Group name") + type: str = Field(description="Group type") + version: str = Field(description="Group version") + description: str = Field(description="Group description") + event_receiver_ids: list[EprId] = Field(min_length=1, description="IDs of the receivers in the group") + + +# --- Talking to EPR -------------------------------------------------------- + + +def new_client() -> httpx2.AsyncClient: + """Create an HTTP client for EPR, with the bearer token when one is set. + + Returns: + A new ``httpx2.AsyncClient``; use it as an async context manager. + + Examples: + ``async with new_client() as client: ...`` + """ + headers = {"Authorization": f"Bearer {EPR_TOKEN}"} if EPR_TOKEN else {} + return httpx2.AsyncClient(base_url=EPR_URL, headers=headers) + + +def describe_error(error: Exception, operation: str) -> str: + """Turn an httpx2 exception into a message an AI client can act on. + + Args: + error: The exception. + operation: The tool name. + + Returns: + The message. + + Examples: + ``describe_error(httpx2.ReadTimeout("slow"), "fetch_event")`` + """ + if isinstance(error, httpx2.TimeoutException): + return f"Request to EPR at {EPR_URL} timed out. ({error})" + if isinstance(error, httpx2.TransportError): + # Connection refused, reset, or dropped: the name says which, the message may be empty. + return f"Cannot reach EPR at {EPR_URL}. Is the EPR server running? ({type(error).__name__}: {error})" + if isinstance(error, httpx2.HTTPStatusError): + return f"EPR returned {error.response.status_code} for {operation}: {error.response.text}" + return f"Unexpected error in {operation}: {error}" + + +async def epr_request(operation: str, method: str, path: str, body: Any = None) -> str: + """Call EPR and return the body; failures become ToolError, which MCP marks as errors. + + Args: + operation: The tool name, used in error messages. + method: The HTTP method. + path: The API path. + body: The JSON body, if any. + + Returns: + The response text. + + Raises: + ToolError: If EPR cannot be reached, answers with an error status, or reports errors in the body. + + Examples: + ``await epr_request("fetch_event", "GET", "/api/v1/events/")`` + """ + logger.debug("%s: %s %s", operation, method, path) + try: + async with new_client() as client: + response = await client.request(method, path, json=body) + response.raise_for_status() + except httpx2.HTTPError as error: + message = describe_error(error, operation) + logger.error(message) + raise ToolError(message) from error + # EPR can answer 200 and still report a failure in the body: {"data": null, "errors": [...]}. + try: + errors = json.loads(response.text).get("errors") + except (ValueError, AttributeError): + errors = None + if errors: + details = "; ".join(str(e.get("message", e)) if isinstance(e, dict) else str(e) for e in errors) + message = f"EPR reported an error for {operation}: {details}" + logger.error(message) + raise ToolError(message) + return response.text + + +# Each GraphQL search names the input type, the argument, and the fields to return. +SEARCHES = { + "events": ( + "FindEventInput!", + "event", + ["id", "name", "version", "release", "platform_id", "package", "description", "success", "event_receiver_id"], + ), + "event_receivers": ( + "FindEventReceiverInput!", + "event_receiver", + ["id", "name", "type", "version", "description"], + ), + "event_receiver_groups": ( + "FindEventReceiverGroupInput!", + "event_receiver_group", + ["id", "name", "type", "version", "description", "enabled", "event_receiver_ids"], + ), +} + + +async def search(operation: str, criteria: BaseModel) -> str: + """Run one of the GraphQL searches in SEARCHES. + + Args: + operation: A key of SEARCHES. + criteria: The search criteria. + + Returns: + The GraphQL response as JSON text. + + Examples: + ``await search("events", {"name": "foo"})`` + """ + input_type, argument, fields = SEARCHES[operation] + query = f"query ($obj: {input_type}){{{operation}({argument}: $obj) {{ {','.join(fields)} }}}}" + variables = {"obj": criteria.model_dump(exclude_none=True)} + return await epr_request( + f"search {operation}", "POST", "/api/v1/graphql/query", {"query": query, "variables": variables} + ) + + +# --- Tools ----------------------------------------------------------------- + + +@mcp.tool(title="Fetch Event", description="Fetch an event from EPR by its ID") +async def fetch_event(id: EprId) -> str: + """Fetch an event from the EPR. + + Args: + id: The record's ID. + + Returns: + The record as JSON text. + + Examples: + ``call_tool("fetch_event", {"id": "01JYRZ96R690ZTQ15Q53GEY6E6"})`` + """ + return await epr_request("fetch_event", "GET", f"/api/v1/events/{id}") + + +@mcp.tool(title="Fetch Event Receiver", description="Fetch an event receiver from EPR by its ID") +async def fetch_receiver(id: EprId) -> str: + """Fetch an event receiver from the EPR. + + Args: + id: The record's ID. + + Returns: + The record as JSON text. + + Examples: + ``call_tool("fetch_receiver", {"id": "01JYRZ96R690ZTQ15Q53GEY6E6"})`` + """ + return await epr_request("fetch_receiver", "GET", f"/api/v1/receivers/{id}") + + +@mcp.tool(title="Fetch Event Receiver Group", description="Fetch an event receiver group from EPR by its ID") +async def fetch_group(id: EprId) -> str: + """Fetch an event receiver group from the EPR. + + Args: + id: The record's ID. + + Returns: + The record as JSON text. + + Examples: + ``call_tool("fetch_group", {"id": "01JYRZ96R690ZTQ15Q53GEY6E6"})`` + """ + return await epr_request("fetch_group", "GET", f"/api/v1/groups/{id}") + + +@mcp.tool(title="Search Events", description="Search for events; every criterion is optional") +async def search_events(data: EventSearch) -> str: + """Search for events in the EPR. + + Args: + data: The search criteria. + + Returns: + The matching records as JSON text. + + Examples: + ``call_tool("search_events", {"data": {"name": "foo"}})`` + """ + return await search("events", data) + + +@mcp.tool(title="Search Event Receivers", description="Search for event receivers; every criterion is optional") +async def search_receivers(data: ReceiverSearch) -> str: + """Search for event receivers in the EPR. + + Args: + data: The search criteria. + + Returns: + The matching records as JSON text. + + Examples: + ``call_tool("search_receivers", {"data": {"name": "foo"}})`` + """ + return await search("event_receivers", data) + + +@mcp.tool( + title="Search Event Receiver Groups", description="Search for event receiver groups; every criterion is optional" +) +async def search_groups(data: GroupSearch) -> str: + """Search for event receiver groups in the EPR. + + Args: + data: The search criteria. + + Returns: + The matching records as JSON text. + + Examples: + ``call_tool("search_groups", {"data": {"name": "foo"}})`` + """ + return await search("event_receiver_groups", data) + + +@mcp.tool(title="Create Event", description="Create a new event in EPR") +async def create_event(event_data: EventCreate) -> str: + """Create an event in the EPR. + + Args: + event_data: The fields of the new record. + + Returns: + EPR's answer, which holds the new ID. + + Examples: + ``call_tool("create_event", {"event_data": {...}})`` + """ + return await epr_request("create_event", "POST", "/api/v1/events", event_data.model_dump()) + + +@mcp.tool(title="Create Event Receiver", description="Create a new event receiver in EPR") +async def create_receiver(receiver_data: ReceiverCreate) -> str: + """Create an event receiver in the EPR. + + Args: + receiver_data: The fields of the new record. + + Returns: + EPR's answer, which holds the new ID. + + Examples: + ``call_tool("create_receiver", {"receiver_data": {...}})`` + """ + return await epr_request("create_receiver", "POST", "/api/v1/receivers", receiver_data.model_dump(by_alias=True)) + + +@mcp.tool(title="Create Event Receiver Group", description="Create a new event receiver group in EPR") +async def create_group(group_data: GroupCreate) -> str: + """Create an event receiver group in the EPR. + + Args: + group_data: The fields of the new record. + + Returns: + EPR's answer, which holds the new ID. + + Examples: + ``call_tool("create_group", {"group_data": {...}})`` + """ + return await epr_request("create_group", "POST", "/api/v1/groups", group_data.model_dump()) + + +if __name__ == "__main__": + logger.info("EPR URL: %s (token configured: %s)", EPR_URL, bool(EPR_TOKEN)) + mcp.run(show_banner=False) diff --git a/docs/tutorials/code/checkpoint_05_tests/conftest.py b/docs/tutorials/code/checkpoint_05_tests/conftest.py new file mode 100644 index 0000000..0e7e6d7 --- /dev/null +++ b/docs/tutorials/code/checkpoint_05_tests/conftest.py @@ -0,0 +1,9 @@ +# SPDX-FileCopyrightText: © 2025 Brett Smith +# SPDX-License-Identifier: Apache-2.0 + +"""Let the tests import the server that sits next to them.""" + +import sys +from pathlib import Path + +sys.path.insert(0, str(Path(__file__).parent)) diff --git a/docs/tutorials/code/checkpoint_05_tests/server.py b/docs/tutorials/code/checkpoint_05_tests/server.py new file mode 100644 index 0000000..4758f17 --- /dev/null +++ b/docs/tutorials/code/checkpoint_05_tests/server.py @@ -0,0 +1,402 @@ +# SPDX-FileCopyrightText: © 2025 Brett Smith +# SPDX-License-Identifier: Apache-2.0 + +"""EPR workshop MCP server, checkpoint 04: validation and error handling.""" + +import json +import logging +import os +import sys +from typing import Annotated, Any + +import httpx2 +from fastmcp import FastMCP +from fastmcp.exceptions import ToolError +from pydantic import BaseModel, ConfigDict, Field + +# stdout carries the MCP protocol over stdio, so all logging goes to stderr. +logging.basicConfig( + stream=sys.stderr, + level=logging.DEBUG if os.environ.get("EPR_DEBUG") else logging.INFO, + format="%(asctime)s %(name)s:[%(levelname)s] %(message)s", +) +logger = logging.getLogger("epr_workshop") + +EPR_URL = os.environ.get("EPR_URL", "http://localhost:8042") +EPR_TOKEN = os.environ.get("EPR_TOKEN") + +mcp = FastMCP(name="EPR Workshop MCP Server", version="0.4.0") + +# --- Input types ----------------------------------------------------------- +# FastMCP turns these annotations into the JSON schema the AI client sees, and +# validates every call against them before your function runs. + +EprId = Annotated[str, Field(pattern=r"^[0-9A-Za-z]{26}$", description="26 character ULID of the record")] + + +class StrictModel(BaseModel): + """Base for tool inputs: unknown fields are errors, not silently dropped. + + Examples: + ``class EventSearch(StrictModel): ...`` + """ + + model_config = ConfigDict(extra="forbid", populate_by_name=True) + + +class EventSearch(StrictModel): + """Criteria for searching events; every field is optional. + + Examples: + ``EventSearch.model_validate({...})`` + """ + + name: str | None = Field(None, description="Event name") + version: str | None = Field(None, description="Event version") + release: str | None = Field(None, description="Release") + platform_id: str | None = Field(None, description="Platform identifier") + package: str | None = Field(None, description="Package type, for example oci") + description: str | None = Field(None, description="Event description") + success: bool | None = Field(None, description="Whether the event succeeded") + event_receiver_id: EprId | None = Field(None, description="ID of the receiving event receiver") + + +class ReceiverSearch(StrictModel): + """Criteria for searching event receivers; every field is optional. + + Examples: + ``ReceiverSearch.model_validate({...})`` + """ + + name: str | None = Field(None, description="Receiver name") + type: str | None = Field(None, description="Receiver type") + version: str | None = Field(None, description="Receiver version") + description: str | None = Field(None, description="Receiver description") + + +class GroupSearch(ReceiverSearch): + """Groups are searched by the same fields as receivers. + + Examples: + ``GroupSearch(name='foo')`` + """ + + +class EventCreate(StrictModel): + """The fields of a new event. + + Examples: + ``EventCreate.model_validate({...})`` + """ + + name: str = Field(description="Event name") + version: str = Field(description="Event version") + release: str = Field(description="Release") + platform_id: str = Field(description="Platform identifier") + package: str = Field(description="Package type, for example oci") + description: str = Field(description="Event description") + payload: dict[str, Any] = Field(description="Event payload; must match the receiver schema") + success: bool = Field(description="Whether the event succeeded") + event_receiver_id: EprId = Field(description="ID of the receiving event receiver") + + +class ReceiverCreate(StrictModel): + """The fields of a new event receiver. + + Examples: + ``ReceiverCreate.model_validate({...})`` + """ + + name: str = Field(description="Receiver name") + type: str = Field(description="Receiver type") + version: str = Field(description="Receiver version") + description: str = Field(description="Receiver description") + schema_: dict[str, Any] = Field(alias="schema", description="JSON schema that event payloads must match") + + +class GroupCreate(StrictModel): + """The fields of a new event receiver group. + + Examples: + ``GroupCreate.model_validate({...})`` + """ + + name: str = Field(description="Group name") + type: str = Field(description="Group type") + version: str = Field(description="Group version") + description: str = Field(description="Group description") + event_receiver_ids: list[EprId] = Field(min_length=1, description="IDs of the receivers in the group") + + +# --- Talking to EPR -------------------------------------------------------- + + +def new_client() -> httpx2.AsyncClient: + """Create an HTTP client for EPR, with the bearer token when one is set. + + Returns: + A new ``httpx2.AsyncClient``; use it as an async context manager. + + Examples: + ``async with new_client() as client: ...`` + """ + headers = {"Authorization": f"Bearer {EPR_TOKEN}"} if EPR_TOKEN else {} + return httpx2.AsyncClient(base_url=EPR_URL, headers=headers) + + +def describe_error(error: Exception, operation: str) -> str: + """Turn an httpx2 exception into a message an AI client can act on. + + Args: + error: The exception. + operation: The tool name. + + Returns: + The message. + + Examples: + ``describe_error(httpx2.ReadTimeout("slow"), "fetch_event")`` + """ + if isinstance(error, httpx2.TimeoutException): + return f"Request to EPR at {EPR_URL} timed out. ({error})" + if isinstance(error, httpx2.TransportError): + # Connection refused, reset, or dropped: the name says which, the message may be empty. + return f"Cannot reach EPR at {EPR_URL}. Is the EPR server running? ({type(error).__name__}: {error})" + if isinstance(error, httpx2.HTTPStatusError): + return f"EPR returned {error.response.status_code} for {operation}: {error.response.text}" + return f"Unexpected error in {operation}: {error}" + + +async def epr_request(operation: str, method: str, path: str, body: Any = None) -> str: + """Call EPR and return the body; failures become ToolError, which MCP marks as errors. + + Args: + operation: The tool name, used in error messages. + method: The HTTP method. + path: The API path. + body: The JSON body, if any. + + Returns: + The response text. + + Raises: + ToolError: If EPR cannot be reached, answers with an error status, or reports errors in the body. + + Examples: + ``await epr_request("fetch_event", "GET", "/api/v1/events/")`` + """ + logger.debug("%s: %s %s", operation, method, path) + try: + async with new_client() as client: + response = await client.request(method, path, json=body) + response.raise_for_status() + except httpx2.HTTPError as error: + message = describe_error(error, operation) + logger.error(message) + raise ToolError(message) from error + # EPR can answer 200 and still report a failure in the body: {"data": null, "errors": [...]}. + try: + errors = json.loads(response.text).get("errors") + except (ValueError, AttributeError): + errors = None + if errors: + details = "; ".join(str(e.get("message", e)) if isinstance(e, dict) else str(e) for e in errors) + message = f"EPR reported an error for {operation}: {details}" + logger.error(message) + raise ToolError(message) + return response.text + + +# Each GraphQL search names the input type, the argument, and the fields to return. +SEARCHES = { + "events": ( + "FindEventInput!", + "event", + ["id", "name", "version", "release", "platform_id", "package", "description", "success", "event_receiver_id"], + ), + "event_receivers": ( + "FindEventReceiverInput!", + "event_receiver", + ["id", "name", "type", "version", "description"], + ), + "event_receiver_groups": ( + "FindEventReceiverGroupInput!", + "event_receiver_group", + ["id", "name", "type", "version", "description", "enabled", "event_receiver_ids"], + ), +} + + +async def search(operation: str, criteria: BaseModel) -> str: + """Run one of the GraphQL searches in SEARCHES. + + Args: + operation: A key of SEARCHES. + criteria: The search criteria. + + Returns: + The GraphQL response as JSON text. + + Examples: + ``await search("events", {"name": "foo"})`` + """ + input_type, argument, fields = SEARCHES[operation] + query = f"query ($obj: {input_type}){{{operation}({argument}: $obj) {{ {','.join(fields)} }}}}" + variables = {"obj": criteria.model_dump(exclude_none=True)} + return await epr_request( + f"search {operation}", "POST", "/api/v1/graphql/query", {"query": query, "variables": variables} + ) + + +# --- Tools ----------------------------------------------------------------- + + +@mcp.tool(title="Fetch Event", description="Fetch an event from EPR by its ID") +async def fetch_event(id: EprId) -> str: + """Fetch an event from the EPR. + + Args: + id: The record's ID. + + Returns: + The record as JSON text. + + Examples: + ``call_tool("fetch_event", {"id": "01JYRZ96R690ZTQ15Q53GEY6E6"})`` + """ + return await epr_request("fetch_event", "GET", f"/api/v1/events/{id}") + + +@mcp.tool(title="Fetch Event Receiver", description="Fetch an event receiver from EPR by its ID") +async def fetch_receiver(id: EprId) -> str: + """Fetch an event receiver from the EPR. + + Args: + id: The record's ID. + + Returns: + The record as JSON text. + + Examples: + ``call_tool("fetch_receiver", {"id": "01JYRZ96R690ZTQ15Q53GEY6E6"})`` + """ + return await epr_request("fetch_receiver", "GET", f"/api/v1/receivers/{id}") + + +@mcp.tool(title="Fetch Event Receiver Group", description="Fetch an event receiver group from EPR by its ID") +async def fetch_group(id: EprId) -> str: + """Fetch an event receiver group from the EPR. + + Args: + id: The record's ID. + + Returns: + The record as JSON text. + + Examples: + ``call_tool("fetch_group", {"id": "01JYRZ96R690ZTQ15Q53GEY6E6"})`` + """ + return await epr_request("fetch_group", "GET", f"/api/v1/groups/{id}") + + +@mcp.tool(title="Search Events", description="Search for events; every criterion is optional") +async def search_events(data: EventSearch) -> str: + """Search for events in the EPR. + + Args: + data: The search criteria. + + Returns: + The matching records as JSON text. + + Examples: + ``call_tool("search_events", {"data": {"name": "foo"}})`` + """ + return await search("events", data) + + +@mcp.tool(title="Search Event Receivers", description="Search for event receivers; every criterion is optional") +async def search_receivers(data: ReceiverSearch) -> str: + """Search for event receivers in the EPR. + + Args: + data: The search criteria. + + Returns: + The matching records as JSON text. + + Examples: + ``call_tool("search_receivers", {"data": {"name": "foo"}})`` + """ + return await search("event_receivers", data) + + +@mcp.tool( + title="Search Event Receiver Groups", description="Search for event receiver groups; every criterion is optional" +) +async def search_groups(data: GroupSearch) -> str: + """Search for event receiver groups in the EPR. + + Args: + data: The search criteria. + + Returns: + The matching records as JSON text. + + Examples: + ``call_tool("search_groups", {"data": {"name": "foo"}})`` + """ + return await search("event_receiver_groups", data) + + +@mcp.tool(title="Create Event", description="Create a new event in EPR") +async def create_event(event_data: EventCreate) -> str: + """Create an event in the EPR. + + Args: + event_data: The fields of the new record. + + Returns: + EPR's answer, which holds the new ID. + + Examples: + ``call_tool("create_event", {"event_data": {...}})`` + """ + return await epr_request("create_event", "POST", "/api/v1/events", event_data.model_dump()) + + +@mcp.tool(title="Create Event Receiver", description="Create a new event receiver in EPR") +async def create_receiver(receiver_data: ReceiverCreate) -> str: + """Create an event receiver in the EPR. + + Args: + receiver_data: The fields of the new record. + + Returns: + EPR's answer, which holds the new ID. + + Examples: + ``call_tool("create_receiver", {"receiver_data": {...}})`` + """ + return await epr_request("create_receiver", "POST", "/api/v1/receivers", receiver_data.model_dump(by_alias=True)) + + +@mcp.tool(title="Create Event Receiver Group", description="Create a new event receiver group in EPR") +async def create_group(group_data: GroupCreate) -> str: + """Create an event receiver group in the EPR. + + Args: + group_data: The fields of the new record. + + Returns: + EPR's answer, which holds the new ID. + + Examples: + ``call_tool("create_group", {"group_data": {...}})`` + """ + return await epr_request("create_group", "POST", "/api/v1/groups", group_data.model_dump()) + + +if __name__ == "__main__": + logger.info("EPR URL: %s (token configured: %s)", EPR_URL, bool(EPR_TOKEN)) + mcp.run(show_banner=False) diff --git a/docs/tutorials/code/checkpoint_05_tests/test_workshop_server.py b/docs/tutorials/code/checkpoint_05_tests/test_workshop_server.py new file mode 100644 index 0000000..dc303dc --- /dev/null +++ b/docs/tutorials/code/checkpoint_05_tests/test_workshop_server.py @@ -0,0 +1,160 @@ +# SPDX-FileCopyrightText: © 2025 Brett Smith +# SPDX-License-Identifier: Apache-2.0 + +"""Tests for the workshop server: no EPR and no network needed. + +An in-memory FastMCP client talks to the server, and httpx2.MockTransport plays EPR. + +Run from the code directory: + uv run pytest checkpoint_05_tests +""" + +import json + +import httpx2 +import pytest +import server +from fastmcp import Client + +EPR_ID = "01JYRZ96R690ZTQ15Q53GEY6E6" +EVENT = {"id": EPR_ID, "name": "checkout-service", "version": "1.2.3"} + + +@pytest.fixture +def epr(monkeypatch): + """Replace the EPR client; set epr["respond"] to choose what EPR answers.""" + state = {"requests": [], "respond": lambda request: httpx2.Response(200, json={"data": EVENT})} + + def handler(request): + state["requests"].append(request) + return state["respond"](request) + + monkeypatch.setattr( + server, + "new_client", + lambda: httpx2.AsyncClient(base_url="http://epr.test", transport=httpx2.MockTransport(handler)), + ) + return state + + +async def call(tool, arguments, raise_on_error=True): + """Call a tool through an in-memory client.""" + async with Client(server.mcp) as client: + return await client.call_tool(tool, arguments, raise_on_error=raise_on_error) + + +@pytest.mark.asyncio +async def test_server_lists_nine_tools(): + """Test server lists nine tools.""" + async with Client(server.mcp) as client: + names = {tool.name for tool in await client.list_tools()} + assert names == { + "fetch_event", + "fetch_receiver", + "fetch_group", + "search_events", + "search_receivers", + "search_groups", + "create_event", + "create_receiver", + "create_group", + } + + +@pytest.mark.asyncio +async def test_fetch_event_returns_epr_body(epr): + """Test fetch event returns epr body.""" + result = await call("fetch_event", {"id": EPR_ID}) + assert json.loads(result.content[0].text)["data"]["id"] == EPR_ID + assert epr["requests"][0].url.path == f"/api/v1/events/{EPR_ID}" + + +@pytest.mark.asyncio +async def test_fetch_event_rejects_a_malformed_id_without_calling_epr(epr): + """Test fetch event rejects a malformed id without calling epr.""" + result = await call("fetch_event", {"id": "not-an-id"}, raise_on_error=False) + assert result.is_error + assert epr["requests"] == [] + + +@pytest.mark.asyncio +async def test_search_sends_only_the_criteria_that_were_set(epr): + """Test search sends only the criteria that were set.""" + epr["respond"] = lambda request: httpx2.Response(200, json={"data": {"events": []}}) + await call("search_events", {"data": {"name": "checkout-service"}}) + body = json.loads(epr["requests"][0].content) + assert body["variables"] == {"obj": {"name": "checkout-service"}} + + +@pytest.mark.asyncio +async def test_search_rejects_unknown_criteria(epr): + """Test search rejects unknown criteria.""" + result = await call("search_events", {"data": {"nmae": "typo"}}, raise_on_error=False) + assert result.is_error + assert epr["requests"] == [] + + +@pytest.mark.asyncio +async def test_create_receiver_sends_schema_under_its_epr_name(epr): + """Test create receiver sends schema under its epr name.""" + epr["respond"] = lambda request: httpx2.Response(201, json={"data": EPR_ID}) + receiver = { + "name": "workshop.build", + "type": "workshop.build", + "version": "1.0.0", + "description": "builds", + "schema": {"type": "object"}, + } + await call("create_receiver", {"receiver_data": receiver}) + assert json.loads(epr["requests"][0].content)["schema"] == {"type": "object"} + + +@pytest.mark.asyncio +async def test_epr_error_status_becomes_a_tool_error(epr): + """Test epr error status becomes a tool error.""" + epr["respond"] = lambda request: httpx2.Response(404, text="not found") + result = await call("fetch_event", {"id": EPR_ID}, raise_on_error=False) + assert result.is_error + assert "404" in result.content[0].text + + +@pytest.mark.asyncio +async def test_epr_error_in_a_200_body_becomes_a_tool_error(epr): + """Test epr error in a 200 body becomes a tool error.""" + epr["respond"] = lambda request: httpx2.Response(200, json={"data": None, "errors": ["event not found"]}) + result = await call("fetch_event", {"id": EPR_ID}, raise_on_error=False) + assert result.is_error + assert "event not found" in result.content[0].text + + +@pytest.mark.asyncio +async def test_dropped_connection_is_reported_with_its_error_name(epr): + """Test dropped connection is reported with its error name.""" + + def drop(request): + raise httpx2.RemoteProtocolError("", request=request) + + epr["respond"] = drop + result = await call("fetch_event", {"id": EPR_ID}, raise_on_error=False) + assert result.is_error + assert "RemoteProtocolError" in result.content[0].text + + +@pytest.mark.asyncio +async def test_unreachable_epr_says_so(epr): + """Test unreachable epr says so.""" + + def refuse(request): + raise httpx2.ConnectError("refused", request=request) + + epr["respond"] = refuse + result = await call("fetch_event", {"id": EPR_ID}, raise_on_error=False) + assert result.is_error + assert "Cannot reach EPR" in result.content[0].text + + +@pytest.mark.asyncio +async def test_bearer_token_is_sent_when_configured(monkeypatch): + """Test bearer token is sent when configured.""" + monkeypatch.setattr(server, "EPR_TOKEN", "secret") + assert server.new_client().headers["Authorization"] == "Bearer secret" diff --git a/docs/tutorials/code/claude_desktop_config.json b/docs/tutorials/code/claude_desktop_config.json new file mode 100644 index 0000000..aaa93f0 --- /dev/null +++ b/docs/tutorials/code/claude_desktop_config.json @@ -0,0 +1,32 @@ +{ + "mcpServers": { + "epr-workshop": { + "command": "/ABSOLUTE/PATH/TO/uv", + "args": [ + "run", + "--directory", + "/ABSOLUTE/PATH/TO/epr-mcp-python/docs/tutorials/code", + "python", + "checkpoint_05_tests/server.py" + ], + "env": { + "EPR_URL": "http://localhost:8042" + } + }, + "epr-mcp": { + "command": "/ABSOLUTE/PATH/TO/uv", + "args": [ + "run", + "--directory", + "/ABSOLUTE/PATH/TO/epr-mcp-python", + "eprmcp", + "start", + "--transport", + "stdio" + ], + "env": { + "EPR_URL": "http://localhost:8042" + } + } + } +} diff --git a/docs/tutorials/code/client.py b/docs/tutorials/code/client.py new file mode 100644 index 0000000..9fc2427 --- /dev/null +++ b/docs/tutorials/code/client.py @@ -0,0 +1,74 @@ +#!/usr/bin/env python3 +# SPDX-FileCopyrightText: © 2025 Brett Smith +# SPDX-License-Identifier: Apache-2.0 + +"""Terminal MCP client for the workshop servers. + +Use it when an editor or the Inspector will not cooperate: it starts a server +over stdio exactly as they do, then lists tools or calls one. + +Usage: + uv run python client.py list checkpoint_03_tool_set/server.py + uv run python client.py call checkpoint_03_tool_set/server.py fetch_event '{"id": ""}' +""" + +import argparse +import asyncio +import json +import sys +from pathlib import Path + +from fastmcp import Client +from fastmcp.client.transports import StdioTransport + + +async def run(server: Path, tool: str | None, arguments: dict) -> int: + """Start a server over stdio, then list its tools or call one. + + Args: + server: Path to the server script. + tool: The tool to call, or None to list tools. + arguments: The tool arguments. + + Returns: + 0 on success, 1 if the tool reported an error. + + Examples: + ``asyncio.run(run(Path('work/server.py'), None, {}))`` + """ + transport = StdioTransport(command=sys.executable, args=[str(server)]) + async with Client(transport) as client: + if tool is None: + for item in await client.list_tools(): + print(f"{item.name}: {item.description}") + return 0 + result = await client.call_tool(tool, arguments, raise_on_error=False) + print(result.content[0].text if result.content else result.data) + return 1 if result.is_error else 0 + + +def main() -> int: + """Parse the command line and run it. + + Returns: + The exit status. + + Examples: + ``uv run python client.py list work/server.py`` + """ + parser = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter) + sub = parser.add_subparsers(dest="command", required=True) + list_parser = sub.add_parser("list", help="list the tools a server exposes") + list_parser.add_argument("server", type=Path) + call_parser = sub.add_parser("call", help="call one tool") + call_parser.add_argument("server", type=Path) + call_parser.add_argument("tool") + call_parser.add_argument("arguments", nargs="?", default="{}", help="tool arguments as a JSON object") + args = parser.parse_args() + if args.command == "list": + return asyncio.run(run(args.server, None, {})) + return asyncio.run(run(args.server, args.tool, json.loads(args.arguments))) + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/docs/tutorials/code/docker-compose.yaml b/docs/tutorials/code/docker-compose.yaml new file mode 100644 index 0000000..15534fb --- /dev/null +++ b/docs/tutorials/code/docker-compose.yaml @@ -0,0 +1,69 @@ +# SPDX-FileCopyrightText: © 2025 Brett Smith +# SPDX-License-Identifier: Apache-2.0 +# +# Workshop environment: runs ONLY the Event Provenance Registry (EPR) and its +# dependencies. The MCP server is never run in Docker; it runs on your machine +# from a uv environment (see module 06). +# +# docker compose up -d --build start EPR on http://localhost:8042 +# docker compose down -v stop it and delete its data +# +# EPR has no published image, so ./epr/Dockerfile builds it from source (about +# three minutes the first time, cached afterwards). To skip the build, for +# example on a slow venue network, load an image the facilitator prepared with +# `docker load` and set EPR_IMAGE to its name. +--- +name: epr-workshop + +services: + postgres: + image: postgres:16 + environment: + POSTGRES_HOST_AUTH_METHOD: trust + healthcheck: + test: ["CMD-SHELL", "pg_isready -U postgres"] + interval: 5s + timeout: 5s + retries: 10 + networks: + - epr + + redpanda: + image: docker.redpanda.com/redpandadata/redpanda:v23.2.8 + command: + - redpanda + - start + - --kafka-addr internal://0.0.0.0:9092 + - --advertise-kafka-addr internal://redpanda:9092 + - --mode dev-container + - --smp 1 + - --default-log-level=warn + healthcheck: + test: ["CMD-SHELL", "rpk cluster info -X brokers=redpanda:9092 || exit 1"] + interval: 5s + timeout: 10s + retries: 20 + networks: + - epr + + epr-server: + image: ${EPR_IMAGE:-epr-server:workshop} + build: + context: ./epr + environment: + EPR_BROKERS: redpanda:9092 + EPR_DB: postgres://postgres:5432 + EPR_HOST: 0.0.0.0 + ports: + - "8042:8042" + depends_on: + postgres: + condition: service_healthy + redpanda: + condition: service_healthy + restart: unless-stopped + networks: + - epr + +networks: + epr: diff --git a/docs/tutorials/code/epr/Dockerfile b/docs/tutorials/code/epr/Dockerfile new file mode 100644 index 0000000..e8f1d6a --- /dev/null +++ b/docs/tutorials/code/epr/Dockerfile @@ -0,0 +1,25 @@ +# SPDX-FileCopyrightText: © 2025 Brett Smith +# SPDX-License-Identifier: Apache-2.0 +# +# Builds the Event Provenance Registry server for the workshop. +# +# EPR does not publish an image, and its own Dockerfile produces a FROM scratch +# image with no time zone database, while the server always connects to Postgres +# with TimeZone=America/New_York. That server then exits at startup with +# "unknown time zone America/New_York". This file builds the same binary and +# adds the zoneinfo directory so it starts. +# +ARG EPR_REPO=https://github.com/xbcsmith/event-provenance-registry.git +ARG EPR_REF=f8f115b790c58b8fab3bfd47278e51e4f15e9f0e + +FROM golang:1.25-trixie AS builder +ARG EPR_REPO +ARG EPR_REF +WORKDIR /build +ADD ${EPR_REPO}#${EPR_REF} . +RUN make clean && make linux + +FROM scratch +COPY --from=builder /build/bin/epr-server /usr/local/bin/epr-server +COPY --from=builder /usr/share/zoneinfo /usr/share/zoneinfo +CMD ["/usr/local/bin/epr-server"] diff --git a/docs/tutorials/code/pyproject.toml b/docs/tutorials/code/pyproject.toml new file mode 100644 index 0000000..d33056b --- /dev/null +++ b/docs/tutorials/code/pyproject.toml @@ -0,0 +1,26 @@ +# SPDX-FileCopyrightText: © 2025 Brett Smith +# SPDX-License-Identifier: Apache-2.0 + +[project] +name = "epr-workshop" +version = "0.1.0" +description = "Workshop code for building an EPR MCP server with FastMCP 4" +requires-python = ">=3.12" +dependencies = [ + "fastmcp==4.0.11", + "httpx2==2.13.1", + "pydantic>=2.12", +] + +[dependency-groups] +dev = [ + "pytest>=8", + "pytest-asyncio>=0.24", +] + +[tool.uv] +# These are scripts, not an installable package. +package = false + +[tool.pytest.ini_options] +asyncio_mode = "strict" diff --git a/docs/tutorials/code/seed_epr.py b/docs/tutorials/code/seed_epr.py new file mode 100644 index 0000000..289f22f --- /dev/null +++ b/docs/tutorials/code/seed_epr.py @@ -0,0 +1,121 @@ +#!/usr/bin/env python3 +# SPDX-FileCopyrightText: © 2025 Brett Smith +# SPDX-License-Identifier: Apache-2.0 + +"""Seed EPR with a receiver, a group, and a few events for the workshop. + +Usage: + uv run python seed_epr.py + EPR_URL=http://other-host:8042 uv run python seed_epr.py + +Prints the new IDs and saves them to seed_ids.json so later modules can use them. +Run it again to add another set; every run creates new records. +""" + +import json +import os +import sys +from pathlib import Path + +import httpx2 + +EPR_URL = os.environ.get("EPR_URL", "http://localhost:8042") +IDS_FILE = Path(__file__).with_name("seed_ids.json") + +RECEIVER = { + "name": "workshop.build", + "type": "workshop.build", + "version": "1.0.0", + "description": "Receives build events for the workshop", + "schema": { + "type": "object", + "properties": {"name": {"type": "string"}}, + }, +} + +EVENTS = [ + ("checkout-service", "1.2.3", True), + ("checkout-service", "1.2.4", False), + ("billing-service", "2.0.0", True), +] + + +def create(client: httpx2.Client, path: str, body: dict) -> str: + """POST a record and return the new ID. + + Args: + client: An httpx2 client with EPR's base URL. + path: The API path, such as /api/v1/receivers. + body: The JSON body. + + Returns: + The new record's ID. + + Raises: + httpx2.HTTPStatusError: If EPR answers with an error status. + + Examples: + ``create(client, '/api/v1/receivers', receiver)`` + """ + response = client.post(path, json=body) + response.raise_for_status() + return response.json()["data"] + + +def main() -> int: + """Create a receiver, a group, and three events, and save their IDs. + + Returns: + 0 on success, 1 if EPR cannot be reached or rejects a record. + + Examples: + ``uv run python seed_epr.py`` + """ + try: + with httpx2.Client(base_url=EPR_URL, timeout=10) as client: + receiver_id = create(client, "/api/v1/receivers", RECEIVER) + group_id = create( + client, + "/api/v1/groups", + { + "name": "workshop.builds", + "type": "workshop.builds", + "version": "1.0.0", + "description": "All workshop build receivers", + "event_receiver_ids": [receiver_id], + }, + ) + event_ids = [ + create( + client, + "/api/v1/events", + { + "name": name, + "version": version, + "release": "2025.10.0", + "platform_id": "linux", + "package": "oci", + "description": f"Build of {name} {version}", + "payload": {"name": name}, + "success": success, + "event_receiver_id": receiver_id, + }, + ) + for name, version, success in EVENTS + ] + except httpx2.ConnectError: + print(f"Cannot reach EPR at {EPR_URL}. Run 'docker compose up -d --build' first.", file=sys.stderr) + return 1 + except httpx2.HTTPStatusError as error: + print(f"EPR returned {error.response.status_code}: {error.response.text}", file=sys.stderr) + return 1 + + ids = {"receiver_id": receiver_id, "group_id": group_id, "event_ids": event_ids} + IDS_FILE.write_text(json.dumps(ids, indent=2) + "\n") + print(json.dumps(ids, indent=2)) + print(f"Saved to {IDS_FILE.name}") + return 0 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/docs/tutorials/code/starter_01_first_tool/server.py b/docs/tutorials/code/starter_01_first_tool/server.py new file mode 100644 index 0000000..e7a4021 --- /dev/null +++ b/docs/tutorials/code/starter_01_first_tool/server.py @@ -0,0 +1,32 @@ +# SPDX-FileCopyrightText: © 2025 Brett Smith +# SPDX-License-Identifier: Apache-2.0 + +"""EPR workshop MCP server, module 01 starter: add your first tool. + +This file has the imports and the server instance ready. +Your job in module 01 is to add the fetch_event tool below. +""" + +import os + +import httpx2 # noqa: F401 -- you will use this when you write the tool +from fastmcp import FastMCP + +EPR_URL = os.environ.get("EPR_URL", "http://localhost:8042") + +mcp = FastMCP(name="EPR Workshop MCP Server", version="0.1.0") + +# TODO: register fetch_event here. +# +# Shape: +# @mcp.tool(title="Fetch Event", description="Fetch an event from EPR by its ID") +# async def fetch_event(id: str) -> str: +# async with httpx2.AsyncClient() as client: +# response = await client.get(f"{EPR_URL}/api/v1/events/{id}") +# return response.text + + +if __name__ == "__main__": + # Default transport is stdio: the editor or Inspector starts this process + # and talks to it over stdin and stdout. + mcp.run(show_banner=False) diff --git a/docs/tutorials/code/starter_03_tool_set/server.py b/docs/tutorials/code/starter_03_tool_set/server.py new file mode 100644 index 0000000..520ffc8 --- /dev/null +++ b/docs/tutorials/code/starter_03_tool_set/server.py @@ -0,0 +1,37 @@ +# SPDX-FileCopyrightText: © 2025 Brett Smith +# SPDX-License-Identifier: Apache-2.0 + +"""EPR workshop MCP server, checkpoint 01: your first tool.""" + +import os + +import httpx2 +from fastmcp import FastMCP + +EPR_URL = os.environ.get("EPR_URL", "http://localhost:8042") + +mcp = FastMCP(name="EPR Workshop MCP Server", version="0.1.0") + + +@mcp.tool(title="Fetch Event", description="Fetch an event from EPR by its ID") +async def fetch_event(id: str) -> str: + """Fetch an event from the EPR. + + Args: + id: The event's ID. + + Returns: + The event as JSON text. + + Examples: + ``call_tool("fetch_event", {"id": "01JYRZ96R690ZTQ15Q53GEY6E6"})`` + """ + async with httpx2.AsyncClient() as client: + response = await client.get(f"{EPR_URL}/api/v1/events/{id}") + return response.text + + +if __name__ == "__main__": + # Default transport is stdio: the editor or Inspector starts this process + # and talks to it over stdin and stdout. + mcp.run(show_banner=False) diff --git a/docs/tutorials/code/starter_04_validation/server.py b/docs/tutorials/code/starter_04_validation/server.py new file mode 100644 index 0000000..390d50b --- /dev/null +++ b/docs/tutorials/code/starter_04_validation/server.py @@ -0,0 +1,255 @@ +# SPDX-FileCopyrightText: © 2025 Brett Smith +# SPDX-License-Identifier: Apache-2.0 + +"""EPR workshop MCP server, checkpoint 03: the complete tool set.""" + +import logging +import os +import sys + +import httpx2 +from fastmcp import FastMCP + +# stdout carries the MCP protocol over stdio, so all logging goes to stderr. +logging.basicConfig( + stream=sys.stderr, + level=logging.DEBUG if os.environ.get("EPR_DEBUG") else logging.INFO, + format="%(asctime)s %(name)s:[%(levelname)s] %(message)s", +) +logger = logging.getLogger("epr_workshop") + +EPR_URL = os.environ.get("EPR_URL", "http://localhost:8042") +EPR_TOKEN = os.environ.get("EPR_TOKEN") + +mcp = FastMCP(name="EPR Workshop MCP Server", version="0.3.0") + + +def new_client() -> httpx2.AsyncClient: + """Create an HTTP client for EPR, with the bearer token when one is set. + + Returns: + A new ``httpx2.AsyncClient``; use it as an async context manager. + + Examples: + ``async with new_client() as client: ...`` + """ + headers = {"Authorization": f"Bearer {EPR_TOKEN}"} if EPR_TOKEN else {} + return httpx2.AsyncClient(base_url=EPR_URL, headers=headers) + + +async def epr_request(method: str, path: str, json: dict | None = None) -> str: + """Call EPR and return the response body, or a message if EPR said no. + + Args: + method: The HTTP method. + path: The API path. + json: The JSON body, if any. + + Returns: + The response text, or ``EPR returned : ``. + + Examples: + ``await epr_request("GET", "/api/v1/events/")`` + """ + logger.debug("%s %s", method, path) + async with new_client() as client: + response = await client.request(method, path, json=json) + if response.is_success: + return response.text + return f"EPR returned {response.status_code}: {response.text}" + + +# Each GraphQL search names the input type, the argument, and the fields to return. +SEARCHES = { + "events": ( + "FindEventInput!", + "event", + ["id", "name", "version", "release", "platform_id", "package", "description", "success", "event_receiver_id"], + ), + "event_receivers": ( + "FindEventReceiverInput!", + "event_receiver", + ["id", "name", "type", "version", "description"], + ), + "event_receiver_groups": ( + "FindEventReceiverGroupInput!", + "event_receiver_group", + ["id", "name", "type", "version", "description", "enabled", "event_receiver_ids"], + ), +} + + +async def search(operation: str, criteria: dict) -> str: + """Run one of the GraphQL searches in SEARCHES. + + Args: + operation: A key of SEARCHES. + criteria: The search criteria. + + Returns: + The GraphQL response as JSON text. + + Examples: + ``await search("events", {"name": "foo"})`` + """ + input_type, argument, fields = SEARCHES[operation] + query = f"query ($obj: {input_type}){{{operation}({argument}: $obj) {{ {','.join(fields)} }}}}" + return await epr_request("POST", "/api/v1/graphql/query", {"query": query, "variables": {"obj": criteria}}) + + +@mcp.tool(title="Fetch Event", description="Fetch an event from EPR by its ID") +async def fetch_event(id: str) -> str: + """Fetch an event from the EPR. + + Args: + id: The record's ID. + + Returns: + The record as JSON text. + + Examples: + ``call_tool("fetch_event", {"id": "01JYRZ96R690ZTQ15Q53GEY6E6"})`` + """ + return await epr_request("GET", f"/api/v1/events/{id}") + + +@mcp.tool(title="Fetch Event Receiver", description="Fetch an event receiver from EPR by its ID") +async def fetch_receiver(id: str) -> str: + """Fetch an event receiver from the EPR. + + Args: + id: The record's ID. + + Returns: + The record as JSON text. + + Examples: + ``call_tool("fetch_receiver", {"id": "01JYRZ96R690ZTQ15Q53GEY6E6"})`` + """ + return await epr_request("GET", f"/api/v1/receivers/{id}") + + +@mcp.tool(title="Fetch Event Receiver Group", description="Fetch an event receiver group from EPR by its ID") +async def fetch_group(id: str) -> str: + """Fetch an event receiver group from the EPR. + + Args: + id: The record's ID. + + Returns: + The record as JSON text. + + Examples: + ``call_tool("fetch_group", {"id": "01JYRZ96R690ZTQ15Q53GEY6E6"})`` + """ + return await epr_request("GET", f"/api/v1/groups/{id}") + + +@mcp.tool( + title="Search Events", + description="Search for events. Criteria: name, version, release, platform_id, package, description, success.", +) +async def search_events(data: dict) -> str: + """Search for events in the EPR. + + Args: + data: The search criteria. + + Returns: + The matching records as JSON text. + + Examples: + ``call_tool("search_events", {"data": {"name": "foo"}})`` + """ + return await search("events", data) + + +@mcp.tool( + title="Search Event Receivers", + description="Search for event receivers. Criteria: name, type, version, description.", +) +async def search_receivers(data: dict) -> str: + """Search for event receivers in the EPR. + + Args: + data: The search criteria. + + Returns: + The matching records as JSON text. + + Examples: + ``call_tool("search_receivers", {"data": {"name": "foo"}})`` + """ + return await search("event_receivers", data) + + +@mcp.tool( + title="Search Event Receiver Groups", + description="Search for event receiver groups. Criteria: name, type, version, description.", +) +async def search_groups(data: dict) -> str: + """Search for event receiver groups in the EPR. + + Args: + data: The search criteria. + + Returns: + The matching records as JSON text. + + Examples: + ``call_tool("search_groups", {"data": {"name": "foo"}})`` + """ + return await search("event_receiver_groups", data) + + +@mcp.tool(title="Create Event", description="Create a new event in EPR") +async def create_event(event_data: dict) -> str: + """Create an event in the EPR. + + Args: + event_data: The fields of the new record. + + Returns: + EPR's answer, which holds the new ID. + + Examples: + ``call_tool("create_event", {"event_data": {...}})`` + """ + return await epr_request("POST", "/api/v1/events", event_data) + + +@mcp.tool(title="Create Event Receiver", description="Create a new event receiver in EPR") +async def create_receiver(receiver_data: dict) -> str: + """Create an event receiver in the EPR. + + Args: + receiver_data: The fields of the new record. + + Returns: + EPR's answer, which holds the new ID. + + Examples: + ``call_tool("create_receiver", {"receiver_data": {...}})`` + """ + return await epr_request("POST", "/api/v1/receivers", receiver_data) + + +@mcp.tool(title="Create Event Receiver Group", description="Create a new event receiver group in EPR") +async def create_group(group_data: dict) -> str: + """Create an event receiver group in the EPR. + + Args: + group_data: The fields of the new record. + + Returns: + EPR's answer, which holds the new ID. + + Examples: + ``call_tool("create_group", {"group_data": {...}})`` + """ + return await epr_request("POST", "/api/v1/groups", group_data) + + +if __name__ == "__main__": + logger.info("EPR URL: %s (token configured: %s)", EPR_URL, bool(EPR_TOKEN)) + mcp.run(show_banner=False) diff --git a/docs/tutorials/code/starter_05_tests/conftest.py b/docs/tutorials/code/starter_05_tests/conftest.py new file mode 100644 index 0000000..0e7e6d7 --- /dev/null +++ b/docs/tutorials/code/starter_05_tests/conftest.py @@ -0,0 +1,9 @@ +# SPDX-FileCopyrightText: © 2025 Brett Smith +# SPDX-License-Identifier: Apache-2.0 + +"""Let the tests import the server that sits next to them.""" + +import sys +from pathlib import Path + +sys.path.insert(0, str(Path(__file__).parent)) diff --git a/docs/tutorials/code/starter_05_tests/server.py b/docs/tutorials/code/starter_05_tests/server.py new file mode 100644 index 0000000..4758f17 --- /dev/null +++ b/docs/tutorials/code/starter_05_tests/server.py @@ -0,0 +1,402 @@ +# SPDX-FileCopyrightText: © 2025 Brett Smith +# SPDX-License-Identifier: Apache-2.0 + +"""EPR workshop MCP server, checkpoint 04: validation and error handling.""" + +import json +import logging +import os +import sys +from typing import Annotated, Any + +import httpx2 +from fastmcp import FastMCP +from fastmcp.exceptions import ToolError +from pydantic import BaseModel, ConfigDict, Field + +# stdout carries the MCP protocol over stdio, so all logging goes to stderr. +logging.basicConfig( + stream=sys.stderr, + level=logging.DEBUG if os.environ.get("EPR_DEBUG") else logging.INFO, + format="%(asctime)s %(name)s:[%(levelname)s] %(message)s", +) +logger = logging.getLogger("epr_workshop") + +EPR_URL = os.environ.get("EPR_URL", "http://localhost:8042") +EPR_TOKEN = os.environ.get("EPR_TOKEN") + +mcp = FastMCP(name="EPR Workshop MCP Server", version="0.4.0") + +# --- Input types ----------------------------------------------------------- +# FastMCP turns these annotations into the JSON schema the AI client sees, and +# validates every call against them before your function runs. + +EprId = Annotated[str, Field(pattern=r"^[0-9A-Za-z]{26}$", description="26 character ULID of the record")] + + +class StrictModel(BaseModel): + """Base for tool inputs: unknown fields are errors, not silently dropped. + + Examples: + ``class EventSearch(StrictModel): ...`` + """ + + model_config = ConfigDict(extra="forbid", populate_by_name=True) + + +class EventSearch(StrictModel): + """Criteria for searching events; every field is optional. + + Examples: + ``EventSearch.model_validate({...})`` + """ + + name: str | None = Field(None, description="Event name") + version: str | None = Field(None, description="Event version") + release: str | None = Field(None, description="Release") + platform_id: str | None = Field(None, description="Platform identifier") + package: str | None = Field(None, description="Package type, for example oci") + description: str | None = Field(None, description="Event description") + success: bool | None = Field(None, description="Whether the event succeeded") + event_receiver_id: EprId | None = Field(None, description="ID of the receiving event receiver") + + +class ReceiverSearch(StrictModel): + """Criteria for searching event receivers; every field is optional. + + Examples: + ``ReceiverSearch.model_validate({...})`` + """ + + name: str | None = Field(None, description="Receiver name") + type: str | None = Field(None, description="Receiver type") + version: str | None = Field(None, description="Receiver version") + description: str | None = Field(None, description="Receiver description") + + +class GroupSearch(ReceiverSearch): + """Groups are searched by the same fields as receivers. + + Examples: + ``GroupSearch(name='foo')`` + """ + + +class EventCreate(StrictModel): + """The fields of a new event. + + Examples: + ``EventCreate.model_validate({...})`` + """ + + name: str = Field(description="Event name") + version: str = Field(description="Event version") + release: str = Field(description="Release") + platform_id: str = Field(description="Platform identifier") + package: str = Field(description="Package type, for example oci") + description: str = Field(description="Event description") + payload: dict[str, Any] = Field(description="Event payload; must match the receiver schema") + success: bool = Field(description="Whether the event succeeded") + event_receiver_id: EprId = Field(description="ID of the receiving event receiver") + + +class ReceiverCreate(StrictModel): + """The fields of a new event receiver. + + Examples: + ``ReceiverCreate.model_validate({...})`` + """ + + name: str = Field(description="Receiver name") + type: str = Field(description="Receiver type") + version: str = Field(description="Receiver version") + description: str = Field(description="Receiver description") + schema_: dict[str, Any] = Field(alias="schema", description="JSON schema that event payloads must match") + + +class GroupCreate(StrictModel): + """The fields of a new event receiver group. + + Examples: + ``GroupCreate.model_validate({...})`` + """ + + name: str = Field(description="Group name") + type: str = Field(description="Group type") + version: str = Field(description="Group version") + description: str = Field(description="Group description") + event_receiver_ids: list[EprId] = Field(min_length=1, description="IDs of the receivers in the group") + + +# --- Talking to EPR -------------------------------------------------------- + + +def new_client() -> httpx2.AsyncClient: + """Create an HTTP client for EPR, with the bearer token when one is set. + + Returns: + A new ``httpx2.AsyncClient``; use it as an async context manager. + + Examples: + ``async with new_client() as client: ...`` + """ + headers = {"Authorization": f"Bearer {EPR_TOKEN}"} if EPR_TOKEN else {} + return httpx2.AsyncClient(base_url=EPR_URL, headers=headers) + + +def describe_error(error: Exception, operation: str) -> str: + """Turn an httpx2 exception into a message an AI client can act on. + + Args: + error: The exception. + operation: The tool name. + + Returns: + The message. + + Examples: + ``describe_error(httpx2.ReadTimeout("slow"), "fetch_event")`` + """ + if isinstance(error, httpx2.TimeoutException): + return f"Request to EPR at {EPR_URL} timed out. ({error})" + if isinstance(error, httpx2.TransportError): + # Connection refused, reset, or dropped: the name says which, the message may be empty. + return f"Cannot reach EPR at {EPR_URL}. Is the EPR server running? ({type(error).__name__}: {error})" + if isinstance(error, httpx2.HTTPStatusError): + return f"EPR returned {error.response.status_code} for {operation}: {error.response.text}" + return f"Unexpected error in {operation}: {error}" + + +async def epr_request(operation: str, method: str, path: str, body: Any = None) -> str: + """Call EPR and return the body; failures become ToolError, which MCP marks as errors. + + Args: + operation: The tool name, used in error messages. + method: The HTTP method. + path: The API path. + body: The JSON body, if any. + + Returns: + The response text. + + Raises: + ToolError: If EPR cannot be reached, answers with an error status, or reports errors in the body. + + Examples: + ``await epr_request("fetch_event", "GET", "/api/v1/events/")`` + """ + logger.debug("%s: %s %s", operation, method, path) + try: + async with new_client() as client: + response = await client.request(method, path, json=body) + response.raise_for_status() + except httpx2.HTTPError as error: + message = describe_error(error, operation) + logger.error(message) + raise ToolError(message) from error + # EPR can answer 200 and still report a failure in the body: {"data": null, "errors": [...]}. + try: + errors = json.loads(response.text).get("errors") + except (ValueError, AttributeError): + errors = None + if errors: + details = "; ".join(str(e.get("message", e)) if isinstance(e, dict) else str(e) for e in errors) + message = f"EPR reported an error for {operation}: {details}" + logger.error(message) + raise ToolError(message) + return response.text + + +# Each GraphQL search names the input type, the argument, and the fields to return. +SEARCHES = { + "events": ( + "FindEventInput!", + "event", + ["id", "name", "version", "release", "platform_id", "package", "description", "success", "event_receiver_id"], + ), + "event_receivers": ( + "FindEventReceiverInput!", + "event_receiver", + ["id", "name", "type", "version", "description"], + ), + "event_receiver_groups": ( + "FindEventReceiverGroupInput!", + "event_receiver_group", + ["id", "name", "type", "version", "description", "enabled", "event_receiver_ids"], + ), +} + + +async def search(operation: str, criteria: BaseModel) -> str: + """Run one of the GraphQL searches in SEARCHES. + + Args: + operation: A key of SEARCHES. + criteria: The search criteria. + + Returns: + The GraphQL response as JSON text. + + Examples: + ``await search("events", {"name": "foo"})`` + """ + input_type, argument, fields = SEARCHES[operation] + query = f"query ($obj: {input_type}){{{operation}({argument}: $obj) {{ {','.join(fields)} }}}}" + variables = {"obj": criteria.model_dump(exclude_none=True)} + return await epr_request( + f"search {operation}", "POST", "/api/v1/graphql/query", {"query": query, "variables": variables} + ) + + +# --- Tools ----------------------------------------------------------------- + + +@mcp.tool(title="Fetch Event", description="Fetch an event from EPR by its ID") +async def fetch_event(id: EprId) -> str: + """Fetch an event from the EPR. + + Args: + id: The record's ID. + + Returns: + The record as JSON text. + + Examples: + ``call_tool("fetch_event", {"id": "01JYRZ96R690ZTQ15Q53GEY6E6"})`` + """ + return await epr_request("fetch_event", "GET", f"/api/v1/events/{id}") + + +@mcp.tool(title="Fetch Event Receiver", description="Fetch an event receiver from EPR by its ID") +async def fetch_receiver(id: EprId) -> str: + """Fetch an event receiver from the EPR. + + Args: + id: The record's ID. + + Returns: + The record as JSON text. + + Examples: + ``call_tool("fetch_receiver", {"id": "01JYRZ96R690ZTQ15Q53GEY6E6"})`` + """ + return await epr_request("fetch_receiver", "GET", f"/api/v1/receivers/{id}") + + +@mcp.tool(title="Fetch Event Receiver Group", description="Fetch an event receiver group from EPR by its ID") +async def fetch_group(id: EprId) -> str: + """Fetch an event receiver group from the EPR. + + Args: + id: The record's ID. + + Returns: + The record as JSON text. + + Examples: + ``call_tool("fetch_group", {"id": "01JYRZ96R690ZTQ15Q53GEY6E6"})`` + """ + return await epr_request("fetch_group", "GET", f"/api/v1/groups/{id}") + + +@mcp.tool(title="Search Events", description="Search for events; every criterion is optional") +async def search_events(data: EventSearch) -> str: + """Search for events in the EPR. + + Args: + data: The search criteria. + + Returns: + The matching records as JSON text. + + Examples: + ``call_tool("search_events", {"data": {"name": "foo"}})`` + """ + return await search("events", data) + + +@mcp.tool(title="Search Event Receivers", description="Search for event receivers; every criterion is optional") +async def search_receivers(data: ReceiverSearch) -> str: + """Search for event receivers in the EPR. + + Args: + data: The search criteria. + + Returns: + The matching records as JSON text. + + Examples: + ``call_tool("search_receivers", {"data": {"name": "foo"}})`` + """ + return await search("event_receivers", data) + + +@mcp.tool( + title="Search Event Receiver Groups", description="Search for event receiver groups; every criterion is optional" +) +async def search_groups(data: GroupSearch) -> str: + """Search for event receiver groups in the EPR. + + Args: + data: The search criteria. + + Returns: + The matching records as JSON text. + + Examples: + ``call_tool("search_groups", {"data": {"name": "foo"}})`` + """ + return await search("event_receiver_groups", data) + + +@mcp.tool(title="Create Event", description="Create a new event in EPR") +async def create_event(event_data: EventCreate) -> str: + """Create an event in the EPR. + + Args: + event_data: The fields of the new record. + + Returns: + EPR's answer, which holds the new ID. + + Examples: + ``call_tool("create_event", {"event_data": {...}})`` + """ + return await epr_request("create_event", "POST", "/api/v1/events", event_data.model_dump()) + + +@mcp.tool(title="Create Event Receiver", description="Create a new event receiver in EPR") +async def create_receiver(receiver_data: ReceiverCreate) -> str: + """Create an event receiver in the EPR. + + Args: + receiver_data: The fields of the new record. + + Returns: + EPR's answer, which holds the new ID. + + Examples: + ``call_tool("create_receiver", {"receiver_data": {...}})`` + """ + return await epr_request("create_receiver", "POST", "/api/v1/receivers", receiver_data.model_dump(by_alias=True)) + + +@mcp.tool(title="Create Event Receiver Group", description="Create a new event receiver group in EPR") +async def create_group(group_data: GroupCreate) -> str: + """Create an event receiver group in the EPR. + + Args: + group_data: The fields of the new record. + + Returns: + EPR's answer, which holds the new ID. + + Examples: + ``call_tool("create_group", {"group_data": {...}})`` + """ + return await epr_request("create_group", "POST", "/api/v1/groups", group_data.model_dump()) + + +if __name__ == "__main__": + logger.info("EPR URL: %s (token configured: %s)", EPR_URL, bool(EPR_TOKEN)) + mcp.run(show_banner=False) diff --git a/docs/tutorials/code/starter_05_tests/test_workshop_server.py b/docs/tutorials/code/starter_05_tests/test_workshop_server.py new file mode 100644 index 0000000..ac7c8e4 --- /dev/null +++ b/docs/tutorials/code/starter_05_tests/test_workshop_server.py @@ -0,0 +1,128 @@ +# SPDX-FileCopyrightText: © 2025 Brett Smith +# SPDX-License-Identifier: Apache-2.0 + +"""Tests for the workshop server: no EPR and no network needed. + +An in-memory FastMCP client talks to the server, and httpx2.MockTransport plays EPR. + +Run from the code directory: + uv run pytest starter_05_tests + +This is the starter skeleton for module 05. One test is already written so +you can run the suite right away and see it pass. Add the remaining tests +following the same pattern. +""" + +import json + +import httpx2 +import pytest +import server +from fastmcp import Client + +EPR_ID = "01JYRZ96R690ZTQ15Q53GEY6E6" +EVENT = {"id": EPR_ID, "name": "checkout-service", "version": "1.2.3"} + + +@pytest.fixture +def epr(monkeypatch): + """Replace the EPR client; set epr["respond"] to choose what EPR answers.""" + state = {"requests": [], "respond": lambda request: httpx2.Response(200, json={"data": EVENT})} + + def handler(request): + state["requests"].append(request) + return state["respond"](request) + + monkeypatch.setattr( + server, + "new_client", + lambda: httpx2.AsyncClient(base_url="http://epr.test", transport=httpx2.MockTransport(handler)), + ) + return state + + +async def call(tool, arguments, raise_on_error=True): + """Call a tool through an in-memory client.""" + async with Client(server.mcp) as client: + return await client.call_tool(tool, arguments, raise_on_error=raise_on_error) + + +@pytest.mark.asyncio +async def test_server_lists_nine_tools(): + """Test server lists nine tools.""" + async with Client(server.mcp) as client: + names = {tool.name for tool in await client.list_tools()} + assert names == { + "fetch_event", + "fetch_receiver", + "fetch_group", + "search_events", + "search_receivers", + "search_groups", + "create_event", + "create_receiver", + "create_group", + } + + +@pytest.mark.asyncio +async def test_fetch_event_returns_epr_body(epr): + """Test fetch event returns epr body.""" + result = await call("fetch_event", {"id": EPR_ID}) + assert json.loads(result.content[0].text)["data"]["id"] == EPR_ID + assert epr["requests"][0].url.path == f"/api/v1/events/{EPR_ID}" + + +# TODO: test that fetch_event rejects a malformed ID without calling EPR. +# +# Hint: call with raise_on_error=False, then assert result.is_error +# and that epr["requests"] is empty (EPR was never contacted). +# +# @pytest.mark.asyncio +# async def test_fetch_event_rejects_a_malformed_id_without_calling_epr(epr): +# ... + + +# TODO: test that search_events sends only the criteria that were given. +# +# Hint: set epr["respond"] to return {"data": {"events": []}}, then call +# search_events with one criterion and read the request body to check +# that only that criterion appears in body["variables"]["obj"]. +# +# @pytest.mark.asyncio +# async def test_search_sends_only_the_criteria_that_were_set(epr): +# ... + + +# TODO: test that an unknown search criterion is rejected (strict model). +# +# @pytest.mark.asyncio +# async def test_search_rejects_unknown_criteria(epr): +# ... + + +# TODO: test that create_receiver sends the schema under the "schema" key +# (not "schema_", which is the Python alias to avoid shadowing the builtin). +# +# @pytest.mark.asyncio +# async def test_create_receiver_sends_schema_under_its_epr_name(epr): +# ... + + +# TODO: test that an HTTP error status from EPR becomes a ToolError. +# +# Hint: set epr["respond"] to return httpx2.Response(404, text="not found"), +# then assert result.is_error and "404" in result.content[0].text. +# +# @pytest.mark.asyncio +# async def test_epr_error_status_becomes_a_tool_error(epr): +# ... + + +# TODO: test that an error message in a 200-OK body also becomes a ToolError. +# +# Hint: return {"data": None, "errors": ["event not found"]} in a 200 response. +# +# @pytest.mark.asyncio +# async def test_epr_error_in_a_200_body_becomes_a_tool_error(epr): +# ... diff --git a/docs/tutorials/code/uv.lock b/docs/tutorials/code/uv.lock new file mode 100644 index 0000000..699f1bb --- /dev/null +++ b/docs/tutorials/code/uv.lock @@ -0,0 +1,1466 @@ +version = 1 +revision = 3 +requires-python = ">=3.12" +resolution-markers = [ + "python_full_version >= '3.14'", + "python_full_version < '3.14'", +] + +[[package]] +name = "aiofile" +version = "3.12.3" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "caio" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/14/31/edb06aabd8f8f0b56d659f30800795f40b93cba96be946ce179f6931e3a5/aiofile-3.12.3.tar.gz", hash = "sha256:caa6aa746b5e47e2165f7abd741b6415e49cf4d44fddc0f61844612cc3924d41", size = 21600, upload-time = "2026-08-04T22:59:27.171Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/4e/79/6e45e778c4c3cab39e0937b007b720c15f76c50c6453d153282d0fcc3588/aiofile-3.12.3-py3-none-any.whl", hash = "sha256:5c1bcc9e929c50834608e8cc1a4cc1d7503eb60c15a535b779fd39e2f372c017", size = 22122, upload-time = "2026-08-04T22:59:25.838Z" }, +] + +[[package]] +name = "annotated-types" +version = "0.8.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/5f/56/a8120250d128bed162cd73c76d45f6ef9991f3e068f62a8ee060afa3104a/annotated_types-0.8.0.tar.gz", hash = "sha256:13b2beaad985e05e2d6407ee4c4f35590b11f8d693a258a561055cac8f64cab7", size = 15893, upload-time = "2026-07-23T20:16:13.995Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/99/91/8acff4f5e50511b911bbccb72b8628a49c68ce14148cd9f6431094859a90/annotated_types-0.8.0-py3-none-any.whl", hash = "sha256:f072f4d804ea359e4eaf198b1af7a8b0943881a87f31bb764f8bf219bb9419e0", size = 13427, upload-time = "2026-07-23T20:16:12.938Z" }, +] + +[[package]] +name = "anyio" +version = "4.15.1" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "idna" }, + { name = "typing-extensions", marker = "python_full_version < '3.15'" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/a9/d2/f4d173e22df740bc37b1db102b386ba719b66e95b0f0d751f556b387e6d2/anyio-4.15.1.tar.gz", hash = "sha256:9f28306018cbd6d329e64a36d58256edff76dd996fe423bc957326e578b82a94", size = 276966, upload-time = "2026-09-05T10:42:39.44Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/12/b8/4bd346e22b28902df4d651910f5242c28d84e4a5c2435ca5c3f797ed7e2e/anyio-4.15.1-py3-none-any.whl", hash = "sha256:6152fdbbf9a77fdec97731721bebf7c4c44f7c29b424b0065826173efc7ed101", size = 132079, upload-time = "2026-09-05T10:42:37.923Z" }, +] + +[[package]] +name = "attrs" +version = "26.1.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/9a/8e/82a0fe20a541c03148528be8cac2408564a6c9a0cc7e9171802bc1d26985/attrs-26.1.0.tar.gz", hash = "sha256:d03ceb89cb322a8fd706d4fb91940737b6642aa36998fe130a9bc96c985eff32", size = 952055, upload-time = "2026-03-19T14:22:25.026Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/64/b4/17d4b0b2a2dc85a6df63d1157e028ed19f90d4cd97c36717afef2bc2f395/attrs-26.1.0-py3-none-any.whl", hash = "sha256:c647aa4a12dfbad9333ca4e71fe62ddc36f4e63b2d260a37a8b83d2f043ac309", size = 67548, upload-time = "2026-03-19T14:22:23.645Z" }, +] + +[[package]] +name = "authlib" +version = "1.8.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "cryptography" }, + { name = "joserfc" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/f1/51/bc1729d3cfdc214b4935f4e886e4dd443c3065fd8e1e66423fe84b490f81/authlib-1.8.0.tar.gz", hash = "sha256:f3ecd5f1da737262fb53bf1a4d95c4ea1ad9dd509316587a255c99ab1838a4f0", size = 177759, upload-time = "2026-08-30T12:12:34.833Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/b8/c6/6f124bcfbbfb20fba22c939b4e43a06dccfc0e1ca20e5634ca573cb1e271/authlib-1.8.0-py2.py3-none-any.whl", hash = "sha256:88aebbd9af6757e14e912d5dc007ae1dc1f3e27e3b2152ce7c552ee2c3b3c121", size = 260804, upload-time = "2026-08-30T12:12:33.162Z" }, +] + +[[package]] +name = "beartype" +version = "0.22.9" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/c7/94/1009e248bbfbab11397abca7193bea6626806be9a327d399810d523a07cb/beartype-0.22.9.tar.gz", hash = "sha256:8f82b54aa723a2848a56008d18875f91c1db02c32ef6a62319a002e3e25a975f", size = 1608866, upload-time = "2025-12-13T06:50:30.72Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/71/cc/18245721fa7747065ab478316c7fea7c74777d07f37ae60db2e84f8172e8/beartype-0.22.9-py3-none-any.whl", hash = "sha256:d16c9bbc61ea14637596c5f6fbff2ee99cbe3573e46a716401734ef50c3060c2", size = 1333658, upload-time = "2025-12-13T06:50:28.266Z" }, +] + +[[package]] +name = "cachetools" +version = "7.2.1" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/31/44/71476a5812da1ddf2c9a3efd31ae76d01480a1cf03ed13ac28aa8f2402e4/cachetools-7.2.1.tar.gz", hash = "sha256:b1a7537025c06abf96fcc1443e496af9a3fb95e774e70e1f0af226f73f7f2dcc", size = 41357, upload-time = "2026-10-05T18:40:06.361Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/f0/c9/2a61d784caf0d869a3326728c57c7203f50cc53f3cca2ee76bf924769eb4/cachetools-7.2.1-py3-none-any.whl", hash = "sha256:63aa53dfe7473c10cccdd5a01dedf76ef2c4b73a58840d9396e7d0752cbdac3b", size = 17006, upload-time = "2026-10-05T18:40:04.827Z" }, +] + +[[package]] +name = "caio" +version = "0.12.9" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/56/51/bd8b64bf700f5b1a956a60bb62276b79a094e8cd0ddc60b1b61c3edd496f/caio-0.12.9.tar.gz", hash = "sha256:99e99419b44ab5511f7468c6a452887dd125b8e4042672a7589f0cf01d254ea8", size = 84084, upload-time = "2026-09-26T09:51:49.433Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/08/36/4cf8f5a6fd0ea7234107e5ab38ca5e0058beae7477c24768a6ab51b79e0a/caio-0.12.9-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:554c6ee883a0f1e95236d85b8e7d8187b212668855ac3a858acb80f5e2e82e82", size = 49041, upload-time = "2026-09-26T09:51:03.37Z" }, + { url = "https://files.pythonhosted.org/packages/94/31/3b6e9d644f9337ac6823f25b3cce838569d4b27ac9a3f9a371369f3d15d5/caio-0.12.9-cp312-cp312-manylinux_2_34_aarch64.whl", hash = "sha256:6e72fb0ddd369f712a4ad229ee0f1d7df6852e9b59b36fe8a46210b4c9ea8e82", size = 164686, upload-time = "2026-09-26T09:51:04.88Z" }, + { url = "https://files.pythonhosted.org/packages/71/f7/1894b1ca1fae9317b8b8203f999107e927ca9badafbe0f7a294952fe00cb/caio-0.12.9-cp312-cp312-manylinux_2_34_x86_64.whl", hash = "sha256:f0698976f84dd40024204f0f77cf59ed7446e989575c8ad8cb64cd4b3e2871f3", size = 162375, upload-time = "2026-09-26T09:51:06.448Z" }, + { url = "https://files.pythonhosted.org/packages/21/ce/040af704ea23a6f4383685d05068ec59301e3bb12cc2ca7c664d16a82691/caio-0.12.9-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:a06afa038f76324f439595b7a3242abf090a80b03006ed3d7dbbb9c031baf8a3", size = 162189, upload-time = "2026-09-26T09:51:07.862Z" }, + { url = "https://files.pythonhosted.org/packages/41/b1/d94003593fee5b76d725e5cc51e902439ee3491c6bd4331b232b2ebf12aa/caio-0.12.9-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:ed343077d8178c003b1596f40b1f46955be963a2871a1f85519be823113b24b0", size = 161976, upload-time = "2026-09-26T09:51:09.178Z" }, + { url = "https://files.pythonhosted.org/packages/e8/bf/ed21d62204e4feece79985f45d2ebce6949c9e3d320e9f9e9638e9dc980a/caio-0.12.9-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:ed23f6ad6897fae4c02e3e8d236aa3cc18e766a7c5bb0352ea5e9fb26c5d3335", size = 49024, upload-time = "2026-09-26T09:51:10.472Z" }, + { url = "https://files.pythonhosted.org/packages/cc/c6/fea92dd83cdf28ee20d403a910e194fa5e1a97215a00e5bbbeb699ac582a/caio-0.12.9-cp313-cp313-manylinux_2_34_aarch64.whl", hash = "sha256:c327977b8174337c1aaff27da17ac249d176ef8ea6e2dbf70b49cdd8038d57d3", size = 164835, upload-time = "2026-09-26T09:51:12.213Z" }, + { url = "https://files.pythonhosted.org/packages/ca/0f/8ec37d3d6b47b8c6bd6c68a1d2d9b5de1ea05df59b601575b7003c9439e2/caio-0.12.9-cp313-cp313-manylinux_2_34_x86_64.whl", hash = "sha256:f6ffb3d448016d20d8c40c53864d81bdf7463157969de65841eeb370519dbf78", size = 162567, upload-time = "2026-09-26T09:51:13.559Z" }, + { url = "https://files.pythonhosted.org/packages/ec/5f/b3258150ea0e87f032859df825dd0ec8e9f3a6c798addc6463cf1e4a2298/caio-0.12.9-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:a11421fb4ac591e6fea5512d9a8ad1b488e7b28cf610ede973bbfb4be5177454", size = 162299, upload-time = "2026-09-26T09:51:14.977Z" }, + { url = "https://files.pythonhosted.org/packages/f8/6e/5712cbf5168fdb4c65c44b0435daeeac7c00609cdc1fd3414812691fbb68/caio-0.12.9-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:c3f6dc05486ce4e1027f1d2da4d84c1d6bb815886e76f34a9228d370d86a5537", size = 162155, upload-time = "2026-09-26T09:51:16.395Z" }, + { url = "https://files.pythonhosted.org/packages/3a/6a/5a08b26fae45320c8d6f3b42e6225c5316b39f6cea811ba3f890315b4641/caio-0.12.9-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:5c43eaebf220aeb9a388d309a5352e82562a7b9b2ea0102502204413641cfed7", size = 42777, upload-time = "2026-09-26T09:51:17.929Z" }, + { url = "https://files.pythonhosted.org/packages/44/fd/d84318ae7704b8c427584becaacfc3888fca8ec3fca25904ef479f57fa2a/caio-0.12.9-cp314-cp314-macosx_26_0_arm64.whl", hash = "sha256:bc63db6b4a54b2f1c519424acfb2b7198664e4ef8427d397215a81c0bed9e9e6", size = 42008, upload-time = "2026-09-26T09:51:19.15Z" }, + { url = "https://files.pythonhosted.org/packages/d1/f3/34487be50fbdc4cc809bcbe82eac565376fdfa7c675ca02feca2f96cbc6c/caio-0.12.9-cp314-cp314-manylinux_2_34_aarch64.whl", hash = "sha256:83718f0ba9ff56de9c3ce7a61b463466fbb064be4f087230064abac5d08b8100", size = 165343, upload-time = "2026-09-26T09:51:20.394Z" }, + { url = "https://files.pythonhosted.org/packages/a3/f5/3baf870c5775c1bf2399d971d213d34a30750475010070a595df7f536f7d/caio-0.12.9-cp314-cp314-manylinux_2_34_x86_64.whl", hash = "sha256:4a69de19ef8780ea67f5fffa6fed95af32ed4c036e338a361307314306ac816c", size = 162599, upload-time = "2026-09-26T09:51:21.814Z" }, + { url = "https://files.pythonhosted.org/packages/93/1d/fbc0005d9aa44204f6d106707a3261c19e402ec64381217998df270cbbe5/caio-0.12.9-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:d3d3664c757d59d330381666683cdfa287c5bfff90819868e98ef0bb8c2d2382", size = 162959, upload-time = "2026-09-26T09:51:23.489Z" }, + { url = "https://files.pythonhosted.org/packages/3a/6d/d6274d9a4d637d484314456222c898988ec03c1895d3b9ec2fcefe3c24cd/caio-0.12.9-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:2e152e1a1970d49b6056c1c94547801fcc6b41fc12185db6628ed58ec7785b04", size = 162234, upload-time = "2026-09-26T09:51:24.977Z" }, + { url = "https://files.pythonhosted.org/packages/9e/fc/228e74a8408714cc2e274250055412c1abd02cce62371820ac9da99a2a1d/caio-0.12.9-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:32755af4459fed70d10a5e8c396de3ccb57e02365c7d818937a9794884b172da", size = 42780, upload-time = "2026-09-26T09:51:26.261Z" }, + { url = "https://files.pythonhosted.org/packages/47/20/d9d7ee48d7a3cc3211cb841aa78712676416099025c60cb9e316c321d100/caio-0.12.9-cp314-cp314t-manylinux_2_34_aarch64.whl", hash = "sha256:de4458707370b9f13de2ead07e6719305624b4f0aad665ce6cb2f1452eb4965d", size = 186873, upload-time = "2026-09-26T09:51:27.538Z" }, + { url = "https://files.pythonhosted.org/packages/0e/a9/6fc366300809c09916ee9212711ee470ed5103d5d4895a843633a2ca1ad8/caio-0.12.9-cp314-cp314t-manylinux_2_34_x86_64.whl", hash = "sha256:0a571981c8724f69c34ed4c7619585d552d27fe38bad0daf970dca3e14d6922b", size = 182783, upload-time = "2026-09-26T09:51:28.993Z" }, + { url = "https://files.pythonhosted.org/packages/65/5d/900bb797d8e51d06b5f1aa691dc1f7bf08a01e6a67397c08f8b4c090e01b/caio-0.12.9-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:1c043b15a19e33c0b18b1937493be6730c3b08acc33af6899f669ac8957a3e46", size = 185071, upload-time = "2026-09-26T09:51:30.424Z" }, + { url = "https://files.pythonhosted.org/packages/df/df/94e65a3e77c5cb1f7ce19714084fc1f19f86fa0a1db43c63edc39d6b38d9/caio-0.12.9-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:dada2e1ca5481e5c11201d269ac8e009ce86d34478f4426e9739470b0c2a1030", size = 182583, upload-time = "2026-09-26T09:51:31.921Z" }, + { url = "https://files.pythonhosted.org/packages/c8/36/3ae6214f37413e1451b9fba72a05f5f9d64f9020db5445e2d73fa403e53e/caio-0.12.9-cp315-cp315-macosx_11_0_arm64.whl", hash = "sha256:53d3febc3e46707786a023b28bd21213ac78332db46fae7df2a03c0cc208976d", size = 42019, upload-time = "2026-09-26T09:51:33.226Z" }, + { url = "https://files.pythonhosted.org/packages/c1/0d/9b6cc05b09f66dae9cbb1633ca3c2598496239d636b95e3690db3b2c27e7/caio-0.12.9-cp315-cp315-manylinux_2_34_aarch64.whl", hash = "sha256:6634c57de5883819e0fb423094fe5cb480e81b8f5f46f601eb143e2c762f4c14", size = 166496, upload-time = "2026-09-26T09:51:34.558Z" }, + { url = "https://files.pythonhosted.org/packages/f2/63/ebb69add3f15b4345323f778295b27988b653b191df54060c19a66ea44d5/caio-0.12.9-cp315-cp315-manylinux_2_34_x86_64.whl", hash = "sha256:aa0fe6b459ef45d9d1fe82e22d5d849dcdb07e3a87f56444d1ff799249a08576", size = 163522, upload-time = "2026-09-26T09:51:36Z" }, + { url = "https://files.pythonhosted.org/packages/01/60/aec76058124f8a5b1979351cdfc83757a752c6456c36a6bdd256b743360f/caio-0.12.9-cp315-cp315-musllinux_1_2_aarch64.whl", hash = "sha256:7fee93281b220488a5e6949ac197a52c2f1e877c6e32aec5ce658e9add3eba60", size = 164136, upload-time = "2026-09-26T09:51:37.383Z" }, + { url = "https://files.pythonhosted.org/packages/a4/86/bd5b6553fa6bab7976bf60087c2a73a8546c5bf5499e805d51ea0c33016c/caio-0.12.9-cp315-cp315-musllinux_1_2_x86_64.whl", hash = "sha256:6c28c4789a9c6d8e8b36cac15f85727bd8e4d312c98fc5aa4fceaa4631669786", size = 163131, upload-time = "2026-09-26T09:51:38.868Z" }, + { url = "https://files.pythonhosted.org/packages/29/fa/2842996fdb0a906325c57bc8adf205be4556e33c7ad0d04eec80077ddc3a/caio-0.12.9-cp315-cp315t-macosx_11_0_arm64.whl", hash = "sha256:e600822c774fdb434e43163c7fc0d4dcfaa6540ebbf77e82e5f0dac071b27f8f", size = 42775, upload-time = "2026-09-26T09:51:40.587Z" }, + { url = "https://files.pythonhosted.org/packages/f5/9e/080587a73689f5f0de33f8be75cbb2e35c822d50d7f957150bdcef38dd92/caio-0.12.9-cp315-cp315t-manylinux_2_34_aarch64.whl", hash = "sha256:cc30e0c458d2d6785e72bb5117086ffce61b5c058bee5637c5aea69042db5e86", size = 187497, upload-time = "2026-09-26T09:51:42.074Z" }, + { url = "https://files.pythonhosted.org/packages/49/80/950a557f05c492416e3d5b4ec40d7b6c330567b311141aafe69ecb86a063/caio-0.12.9-cp315-cp315t-manylinux_2_34_x86_64.whl", hash = "sha256:7490517a72f4ad01b39311ff8e909c3cab77f12dddd370ba6deb035313038468", size = 183529, upload-time = "2026-09-26T09:51:43.515Z" }, + { url = "https://files.pythonhosted.org/packages/c9/35/44b405e601c9662223b01b56a38e16920d9633a8897a223399efa791d0b3/caio-0.12.9-cp315-cp315t-musllinux_1_2_aarch64.whl", hash = "sha256:b30f3f36e45afb0814fc828cbb10ef9dd91043ff0b0a14ffe1cd8a348b461179", size = 185758, upload-time = "2026-09-26T09:51:44.98Z" }, + { url = "https://files.pythonhosted.org/packages/fb/8f/2b08f5e117e3663396cfd0d935cdb9218ad3c374d10911ec278fc0c6aee5/caio-0.12.9-cp315-cp315t-musllinux_1_2_x86_64.whl", hash = "sha256:b17b9aca6360f72bf07f1062bd60d8849f3fd5c1cb77f43923d8dec7fdbbb5df", size = 183425, upload-time = "2026-09-26T09:51:46.402Z" }, + { url = "https://files.pythonhosted.org/packages/c0/99/96888ad510c9adf42bfbad9ba139831b58055fd61e1301f6268e9bb490b8/caio-0.12.9-py3-none-any.whl", hash = "sha256:bf12d4f014b2a33e642ed7905b5787656ede2fc24be21f7c086826ff0d32cec3", size = 26154, upload-time = "2026-09-26T09:51:48.071Z" }, +] + +[[package]] +name = "cffi" +version = "2.1.1" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "pycparser", marker = "implementation_name != 'PyPy'" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/9e/ef/008a1939e372c06329a3fce4279c02f328488f3526744906eeec3da7ad5f/cffi-2.1.1.tar.gz", hash = "sha256:dd31f52ea1086513bb9df30f8fcee9b8918323ae067a3d5b78bc826a000712be", size = 530807, upload-time = "2026-08-03T21:21:18.939Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/10/69/43965eccfdead3b9220015fd1320e117be8c6ed01a62ffab76eeb752f5d5/cffi-2.1.1-cp312-cp312-macosx_10_15_x86_64.whl", hash = "sha256:c8c69575568085ba0b1b10c0249d779a214aea6f6522e949a0fc9fb0fcb449d0", size = 184821, upload-time = "2026-08-03T21:19:44.887Z" }, + { url = "https://files.pythonhosted.org/packages/54/7d/16e5a096677b5e313ca80cd5e5170efa3ea44624a82bb111925522da64b1/cffi-2.1.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:f81b3b8f3d4e343550fa4baa0e479bba9f2d29ce9c2e9b51d1ce1718d7442fcf", size = 184719, upload-time = "2026-08-03T21:19:46.129Z" }, + { url = "https://files.pythonhosted.org/packages/56/e6/8941622732edec876dd17d0453dce07317ae96db34f2ec1436c9d3785986/cffi-2.1.1-cp312-cp312-manylinux1_i686.manylinux2014_i686.manylinux_2_17_i686.manylinux_2_5_i686.whl", hash = "sha256:811bd1e21d32de12efca32393a0ab3f5133b54fce9bd44b8bd77ab07da14bf6a", size = 214799, upload-time = "2026-08-03T21:19:47.218Z" }, + { url = "https://files.pythonhosted.org/packages/44/de/f98430906df1545ffde0d543dd124a7a439bc2cd32b36b9c53f805df7333/cffi-2.1.1-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:68e62fe11f30d5ca8289242866f0a5291402d8529ca2178ab8afc5c9694ae890", size = 222389, upload-time = "2026-08-03T21:19:48.331Z" }, + { url = "https://files.pythonhosted.org/packages/6a/5b/717f1526b9957b34456313c31645c5b82b8fb5c3fe9e4752999be7128bfc/cffi-2.1.1-cp312-cp312-manylinux2014_ppc64le.manylinux_2_17_ppc64le.whl", hash = "sha256:4a7c934f7360e8cd64fe9efadcbd10c7c6364f531e432b9a4bf5ccbc9e0e8b50", size = 210249, upload-time = "2026-08-03T21:19:49.543Z" }, + { url = "https://files.pythonhosted.org/packages/64/b3/f8aa4f3e34986c7e4ec45072d1b1b9dd295b6b18007b45518d79726dd725/cffi-2.1.1-cp312-cp312-manylinux2014_s390x.manylinux_2_17_s390x.whl", hash = "sha256:3143d81e29e1e20a9ce10901ec369012947876596f75a222235965f2b7ae832e", size = 208775, upload-time = "2026-08-03T21:19:50.918Z" }, + { url = "https://files.pythonhosted.org/packages/b1/db/dceb9dd5b231e1da801793f8acc9f3c52a7e1afe40bb1aae37e02b0faad5/cffi-2.1.1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:c1453022f490d2459a11819d83ad1d586e9ff65a12ac3e705ffebd46d3685dcf", size = 221822, upload-time = "2026-08-03T21:19:52.054Z" }, + { url = "https://files.pythonhosted.org/packages/a0/d2/6cd24ae3be000a634109c247d1475d62e5616d0dc78c82770942ec384248/cffi-2.1.1-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:208f941bb9d18e768138677f0a6d2ce01f590df56043dda1df1535ac57c88517", size = 225232, upload-time = "2026-08-03T21:19:53.109Z" }, + { url = "https://files.pythonhosted.org/packages/cb/52/3fa190537004dd7f0ab860a6dc7c0175b8667f68d1e618a46f5498d30250/cffi-2.1.1-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:210019b6c7cf07f081b4c54635c8cf744377001350e29cc0f81c4377b4797735", size = 223597, upload-time = "2026-08-03T21:19:54.515Z" }, + { url = "https://files.pythonhosted.org/packages/80/fb/0bb75b7039588c074b37ae99f40d9bfddf990ecb2fbc346ebccd2e56b9be/cffi-2.1.1-cp312-cp312-win32.whl", hash = "sha256:046bfc24911b37851ee1b51aab8bffe713d89c68c6a057b09484ce9fd5f69b4e", size = 175292, upload-time = "2026-08-03T21:19:55.566Z" }, + { url = "https://files.pythonhosted.org/packages/d9/79/615cc094e2fb508cade7de88d3b4f6c4ec2bab695c97bce9153dc65aadf5/cffi-2.1.1-cp312-cp312-win_amd64.whl", hash = "sha256:f53e442b08449d42821fa4a4fba000095af9f62742a500f978a9f557ec44339a", size = 185919, upload-time = "2026-08-03T21:19:56.89Z" }, + { url = "https://files.pythonhosted.org/packages/70/c6/d0ea84713fe46b243a436a18fcd47d639732747e21635c8a27191b06dc30/cffi-2.1.1-cp312-cp312-win_arm64.whl", hash = "sha256:7bde5e4cc5c10140859842b9d383af292b22639a4dffb725314baf45968cef80", size = 180093, upload-time = "2026-08-03T21:19:58.155Z" }, + { url = "https://files.pythonhosted.org/packages/9d/f4/035513d4117049066b4779dc3b7c0c0fdad175fa13731c9f4003f1cd1478/cffi-2.1.1-cp313-cp313-ios_13_0_arm64_iphoneos.whl", hash = "sha256:b5bdfd1c873d4e093aabc0ca84c4ca6dbc4f752afb5c86f146d9742580c9da2e", size = 194248, upload-time = "2026-08-03T21:19:59.399Z" }, + { url = "https://files.pythonhosted.org/packages/76/af/2aeb4dbb5fc41a04161ae9ff1518de7cec08e164f44a8ce6a4cf7fd2cd1d/cffi-2.1.1-cp313-cp313-ios_13_0_arm64_iphonesimulator.whl", hash = "sha256:31348097ff5bbe827ccc41795d4dd099d9f0625e7def00ee653c137a490c2a6c", size = 196908, upload-time = "2026-08-03T21:20:00.746Z" }, + { url = "https://files.pythonhosted.org/packages/a7/46/2e5fdde8555706dd98139a910ca11be02809f3f605ce956f655d0214e100/cffi-2.1.1-cp313-cp313-macosx_10_15_x86_64.whl", hash = "sha256:9d2055050ea716bd38b7f7f1579c275386646b4894c155a3e2f3cd62ed41b7c6", size = 184805, upload-time = "2026-08-03T21:20:02.02Z" }, + { url = "https://files.pythonhosted.org/packages/55/41/4c7042f317b9217502988f0873af87e16ad606dc20f84e546e3e6ce9764c/cffi-2.1.1-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:19ee6127ee34de7d83ce3d371ebc5ed91addbdcc39f9ab15ce4eb35a4e534971", size = 184764, upload-time = "2026-08-03T21:20:03.141Z" }, + { url = "https://files.pythonhosted.org/packages/43/1f/1c3d90d91811c8f86ced9ed637956c54bfe5b79ca98fe976d7f8c8979f6b/cffi-2.1.1-cp313-cp313-manylinux1_i686.manylinux2014_i686.manylinux_2_17_i686.manylinux_2_5_i686.whl", hash = "sha256:6a8dddef476fab96d066d578fc88526767b836ab5ab21754e1d5bf3879c31c7c", size = 214722, upload-time = "2026-08-03T21:20:04.377Z" }, + { url = "https://files.pythonhosted.org/packages/37/6f/3b5ce4c3b2192d250f04908f2bfd91ef34552ec8f7716a5d4abdb8d67bb2/cffi-2.1.1-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:f16c709686a78c727bbbf059f92b0bf41c6fc60deec706d2dc19f529175a6125", size = 222369, upload-time = "2026-08-03T21:20:05.544Z" }, + { url = "https://files.pythonhosted.org/packages/02/10/4b3c75dde3d9663c9e02ba05c2668b954f671d4bbe346413ca8c696b295a/cffi-2.1.1-cp313-cp313-manylinux2014_ppc64le.manylinux_2_17_ppc64le.whl", hash = "sha256:fcd22650c908d7b7da162bbfaab594a1227a15d1643a98c68b122ac642fa2264", size = 210175, upload-time = "2026-08-03T21:20:06.75Z" }, + { url = "https://files.pythonhosted.org/packages/df/62/14f74b9543e605d17701dc797b815958b8bb70b7624ce1b832ddad48ed6c/cffi-2.1.1-cp313-cp313-manylinux2014_s390x.manylinux_2_17_s390x.whl", hash = "sha256:aa9511c62d14da7aacc9b4bf51f3f697a621e83b2d6919008243c3aad168eea3", size = 208670, upload-time = "2026-08-03T21:20:08.04Z" }, + { url = "https://files.pythonhosted.org/packages/95/95/86342356ff5953b3fb06f7ef7c5bee212d45e770abc7218d451b9148313c/cffi-2.1.1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:a931079504ecc49efed7744c476a5c343a92fabf66dec2db95edb1b2fdc770e2", size = 221824, upload-time = "2026-08-03T21:20:09.274Z" }, + { url = "https://files.pythonhosted.org/packages/eb/ff/7b3429ff53aafe931ed8a5fc69f481bbef7ba6de87ddcbb63d08f483f613/cffi-2.1.1-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:a2d7755bef5a12ed488f4ef1f1b69ee9191d7396083b755a5d2295f6edb4768b", size = 225148, upload-time = "2026-08-03T21:20:10.7Z" }, + { url = "https://files.pythonhosted.org/packages/34/34/a95870b9221e09cf4f2ce3178b1a210abdfe63a1bd357da940418d7b8d15/cffi-2.1.1-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:e0bcb7e0f677f543555d2adff3bf19c05f66cdb4796e5ff602442ab2fe3c4ef7", size = 223564, upload-time = "2026-08-03T21:20:12.165Z" }, + { url = "https://files.pythonhosted.org/packages/70/ea/839b50531021a647fb5e929f72cf97bc1ff702b5472166164b5b6e76b851/cffi-2.1.1-cp313-cp313-win32.whl", hash = "sha256:334644fbac4eff73d985a17a91226df55d0f394160c4cfb880e084c8f7161cac", size = 175263, upload-time = "2026-08-03T21:20:13.559Z" }, + { url = "https://files.pythonhosted.org/packages/60/a6/8b149b2c3f2e11aaa1618ef64500b45f50f22c57a977a4dff1aff1f91042/cffi-2.1.1-cp313-cp313-win_amd64.whl", hash = "sha256:1aa5645c30469b09530c4ebca77ebf8f17618293c58f8549cb1a543a50236e7d", size = 185688, upload-time = "2026-08-03T21:20:14.69Z" }, + { url = "https://files.pythonhosted.org/packages/01/9a/11f687cb39d6a3504060d5242f04f48c735afb4d3d533958a20594890cb2/cffi-2.1.1-cp313-cp313-win_arm64.whl", hash = "sha256:63bbfd5ded17c4840ac07cd8f1c21ba9d9708141f840b324f422f41b207e3973", size = 180078, upload-time = "2026-08-03T21:20:15.917Z" }, + { url = "https://files.pythonhosted.org/packages/d3/7b/d6bbf82b8b96e7391438898c42f5bd96dd02030fd5b64937d248220003e2/cffi-2.1.1-cp314-cp314-ios_13_0_arm64_iphoneos.whl", hash = "sha256:7dbb61fe3a7699468030f71bbe5f8a0e326a151daa91beb11a6fc1f980c55e1c", size = 194064, upload-time = "2026-08-03T21:20:17.148Z" }, + { url = "https://files.pythonhosted.org/packages/94/e6/bcc91b283be94735e268487a054004f0aa19947b6348fa367db53230abc8/cffi-2.1.1-cp314-cp314-ios_13_0_arm64_iphonesimulator.whl", hash = "sha256:f24fb43132a4c6b4cb4eb029492919b2db645be6808d738f244fd146c03c32cb", size = 196720, upload-time = "2026-08-03T21:20:18.268Z" }, + { url = "https://files.pythonhosted.org/packages/d9/99/c4b0c17cacdc9c3b8f280026286a9826d6a208c0f047591a3c3ce99b91fd/cffi-2.1.1-cp314-cp314-macosx_10_15_x86_64.whl", hash = "sha256:d28630f5854ab07ab1fd4aba756de52326c82e6be15d414b12793f1975048b54", size = 184964, upload-time = "2026-08-03T21:20:19.708Z" }, + { url = "https://files.pythonhosted.org/packages/b3/a9/9db617d05d7367c1ad0ab00b3aa6e6f9281edd689b4ee9ea0e5a84e89c97/cffi-2.1.1-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:661c298b4821edebead0c91edd2b00374d67ad7c5a1f7a91d4442633b79d6a72", size = 184962, upload-time = "2026-08-03T21:20:20.833Z" }, + { url = "https://files.pythonhosted.org/packages/67/b8/b42132ca113dc567d37684437b46ca1dafc885902b02a110a02d5b511857/cffi-2.1.1-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:58acb8ab8e295e6c5ea12f888cbb13cf21511ef2a3303a23f4325c29d17fe5c1", size = 222328, upload-time = "2026-08-03T21:20:22.118Z" }, + { url = "https://files.pythonhosted.org/packages/80/10/c5c0cbf0a657aecf59ef511409734230bf556f05a0d6c9eed7aa5c0a0166/cffi-2.1.1-cp314-cp314-manylinux2014_ppc64le.manylinux_2_17_ppc64le.whl", hash = "sha256:456a61fa52d579ebf9df2e9552ead5129855dbaff6c1e5a9b1bc408809bdc062", size = 209985, upload-time = "2026-08-03T21:20:23.401Z" }, + { url = "https://files.pythonhosted.org/packages/d5/6c/bfa0b87b03b9238148beca990292843c9396ba069b54496596594173de7b/cffi-2.1.1-cp314-cp314-manylinux2014_s390x.manylinux_2_17_s390x.whl", hash = "sha256:a4f00aa42f75d6e4595e8866e748cc1705adc0cddfeb2ca86d0d03993d63ba03", size = 208530, upload-time = "2026-08-03T21:20:24.628Z" }, + { url = "https://files.pythonhosted.org/packages/e9/02/4e7d553a7ac4b4238b38b3c1b80d486e9d4436f8d2acbf87a0997fe3f402/cffi-2.1.1-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:b0431303acaea1089ad4b3e9ce4e6518193def1118d4073ca848635ee4ea2e96", size = 221525, upload-time = "2026-08-03T21:20:25.758Z" }, + { url = "https://files.pythonhosted.org/packages/82/1d/a4aaf9babd75acb4d5f223bff71533bee748dd770a382619a798960ee9ba/cffi-2.1.1-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:64faea20f4e2613363a1a9b9c7dd73058f3ecd00133a511e72ad7c511658f527", size = 225053, upload-time = "2026-08-03T21:20:26.985Z" }, + { url = "https://files.pythonhosted.org/packages/81/10/5dc0e7bdd18e22107054288283380fc97a06ae3f1656a106908d666a3c88/cffi-2.1.1-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:5c58fe613dc5e5336357eff555824a314d8e43282600435c8d1cb6a7a2fedd13", size = 223213, upload-time = "2026-08-03T21:20:28.277Z" }, + { url = "https://files.pythonhosted.org/packages/0b/e9/d0061c364cde06ee43168a0d076ac1da512cbc380d44767b844ba34fe2b6/cffi-2.1.1-cp314-cp314-win32.whl", hash = "sha256:1a18a57b58cfb21fc28d72e876acf10eaed67a1ed96226f92af4df681d571c4c", size = 177682, upload-time = "2026-08-03T21:20:44.288Z" }, + { url = "https://files.pythonhosted.org/packages/a7/06/1c3e01e3ba14c39f6d10bfbac52753b7e22259e38088e5cfe1d704918690/cffi-2.1.1-cp314-cp314-win_amd64.whl", hash = "sha256:3222ba5d678f80a030e6afbcc33dc1ae5cb45facabb61cee2c7016b8432fde48", size = 187949, upload-time = "2026-08-03T21:20:45.623Z" }, + { url = "https://files.pythonhosted.org/packages/87/5b/da4e39efe18eeb89cf580ea9cfc66b6a7c3eadb808fc0cc1d3a295cb5a5d/cffi-2.1.1-cp314-cp314-win_arm64.whl", hash = "sha256:ab36d55f9ed2d067327667c2fea18dda018eb628dd6347aa01dda6cf1f5d3836", size = 182947, upload-time = "2026-08-03T21:20:46.955Z" }, + { url = "https://files.pythonhosted.org/packages/23/59/40338bf421c5accea1d45158170c87006ef1cd371b05c077e76476949728/cffi-2.1.1-cp314-cp314t-macosx_10_15_x86_64.whl", hash = "sha256:7750c6449dff7864bb9bb27ddfb0267756189201a3afc911d82b3caacd70dfc3", size = 188504, upload-time = "2026-08-03T21:20:29.495Z" }, + { url = "https://files.pythonhosted.org/packages/7d/47/5ecf1023850036e674c77ec4de86182d309ae344e39e7cba984b7df5d647/cffi-2.1.1-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:0beceaabe56af686895136a2de78db54ecd8e4046b236b8fd6d6cb61389e9bf2", size = 188259, upload-time = "2026-08-03T21:20:31.291Z" }, + { url = "https://files.pythonhosted.org/packages/2a/9c/92934c3bea9f785b23eba304538c0b4d37a2a96d2431eb3a1bc87a11aa19/cffi-2.1.1-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:49cbc70e6542d4ccccb936558d1064a8012541e78f821f955cff24e357776c94", size = 223864, upload-time = "2026-08-03T21:20:32.571Z" }, + { url = "https://files.pythonhosted.org/packages/4d/45/ba4c93527bc38616a8bd36488acb69a2212d60486794f0c1f318949bbb76/cffi-2.1.1-cp314-cp314t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.whl", hash = "sha256:e2d65b31f36619cda3999b78b2aa9632e76b78448e7a56fc4240824200e7c4fc", size = 211538, upload-time = "2026-08-03T21:20:33.808Z" }, + { url = "https://files.pythonhosted.org/packages/80/e9/b6ef565e452acb932fb0cb5443f44a78efbd1233e566f02b5a83855e9115/cffi-2.1.1-cp314-cp314t-manylinux2014_s390x.manylinux_2_17_s390x.whl", hash = "sha256:28907ab9bfb6aa13184cfc17c6b8e1023c5ab6fd7076d8c20a35e59fe04f8f29", size = 210688, upload-time = "2026-08-03T21:20:34.974Z" }, + { url = "https://files.pythonhosted.org/packages/9a/95/eff5f0cee78d2eabc7eebffec40d3fc1876b5f3c95582e018bb4b99601f2/cffi-2.1.1-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:51b31d1c98274844cfd7838ce00bfc27c7423a4dc00fc0772fc3331c2cc90676", size = 223803, upload-time = "2026-08-03T21:20:36.564Z" }, + { url = "https://files.pythonhosted.org/packages/fa/01/579d39fb8bef00a335a23d83757b44feb24cd6345a2c451b64cb67b9c362/cffi-2.1.1-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:5e7cecbaadb83884793e05828cee59b210b24583b9c7425d0ba6a754fe22eb4e", size = 226763, upload-time = "2026-08-03T21:20:37.816Z" }, + { url = "https://files.pythonhosted.org/packages/8d/b0/0b44f47c60b01b57b6e2bbd92343f13a85a1d93bc46ccf6e47e244acd99c/cffi-2.1.1-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:25792eac27877609e7bb06d42ff88278a6624fff2ba9bbb523c09616b117e80f", size = 225688, upload-time = "2026-08-03T21:20:38.959Z" }, + { url = "https://files.pythonhosted.org/packages/eb/d2/3b7176cb570a1d3e27faf67b72f591af508036e0d8b2be2ef9af9e8c84bb/cffi-2.1.1-cp314-cp314t-win32.whl", hash = "sha256:8ef53b2de9bcb9197d31854256575d59dbac0cba72ac627bb291ef5eceb74be4", size = 182868, upload-time = "2026-08-03T21:20:40.388Z" }, + { url = "https://files.pythonhosted.org/packages/56/78/31f00c1bcd97c9bbf55f1bfdf5bc809a5de8887473e90bb9960dca825e80/cffi-2.1.1-cp314-cp314t-win_amd64.whl", hash = "sha256:616f097f2fe415bc92a247f02e11f634e1f9e9a83d327e3c915c15089c87869e", size = 194104, upload-time = "2026-08-03T21:20:41.725Z" }, + { url = "https://files.pythonhosted.org/packages/7b/1b/58496f2ed0a35de575250c02a43ab3cc2c04d494a88fed31c1cabc0fd176/cffi-2.1.1-cp314-cp314t-win_arm64.whl", hash = "sha256:ad2c86c495b899d862ea0f4b42891b8713a3bd45dd4105c7fd51c2a72f39f3a5", size = 186402, upload-time = "2026-08-03T21:20:43.042Z" }, + { url = "https://files.pythonhosted.org/packages/c1/8f/9ebe220eab48a093d1a5a5e339ab0dc7316eef3bb04d63c42f0251b61f50/cffi-2.1.1-cp315-cp315-ios_13_0_arm64_iphoneos.whl", hash = "sha256:dddad92b554513a31f272570678ba307fb9f618f05e3d4a5eacafff9eae03e1d", size = 194043, upload-time = "2026-08-03T21:20:48.179Z" }, + { url = "https://files.pythonhosted.org/packages/ff/69/844bad3ece306c4782c2ecb93597035b6690d48704b803914c199da1e8b3/cffi-2.1.1-cp315-cp315-ios_13_0_arm64_iphonesimulator.whl", hash = "sha256:da0e573f9f97159390c89d9f1a9e41908b66d408cc5b58d08cf3847d844c531b", size = 196737, upload-time = "2026-08-03T21:20:49.457Z" }, + { url = "https://files.pythonhosted.org/packages/1b/8a/af668013284634733f02d683458a0728739c7d6ddb5e14cb0c20832266fe/cffi-2.1.1-cp315-cp315-macosx_10_15_x86_64.whl", hash = "sha256:fb92203a88b3d3053034db775110081c49d28be6551923805e039924093761e4", size = 184933, upload-time = "2026-08-03T21:20:50.639Z" }, + { url = "https://files.pythonhosted.org/packages/0c/75/2f5207ff6d1a613133b23a5203cc0c2a628313b5eb3974d7956ae3c57950/cffi-2.1.1-cp315-cp315-macosx_11_0_arm64.whl", hash = "sha256:2ae64be792b8966f2c69538199728b290e34726562896df1e5dc8ffd8d8188e8", size = 185002, upload-time = "2026-08-03T21:20:52.173Z" }, + { url = "https://files.pythonhosted.org/packages/e2/31/9e1313b0a6e30e91b3b3d3fff51ae99c857c07738e3afcce1f7334e1b7ab/cffi-2.1.1-cp315-cp315-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:507a24c282e0f42f8ed737cf048572cbf580468da5555764a8331735e9c736b6", size = 222271, upload-time = "2026-08-03T21:20:53.462Z" }, + { url = "https://files.pythonhosted.org/packages/50/e3/f6234a833e6e08c7007003074723c406559eecf9b48dfc97471e5a8eb7a0/cffi-2.1.1-cp315-cp315-manylinux2014_ppc64le.manylinux_2_17_ppc64le.whl", hash = "sha256:246fa40ce8645a614ff682e0b70f37134e460eaf93a775e0cbe3cca585a67a80", size = 209919, upload-time = "2026-08-03T21:20:54.783Z" }, + { url = "https://files.pythonhosted.org/packages/0d/fc/5f74e293fced6edb51af3a46c4ccf6c23c9943774ecb375ddbd522c76add/cffi-2.1.1-cp315-cp315-manylinux2014_s390x.manylinux_2_17_s390x.whl", hash = "sha256:471cee653ae88de62096552e6d24ccb4a5adb8c8c9f10b5054d0122c15bf2779", size = 208529, upload-time = "2026-08-03T21:20:56.066Z" }, + { url = "https://files.pythonhosted.org/packages/44/16/29e6d01b388bef055ecd6ca8244b3f4d336bd09e92d5d892187b9601084e/cffi-2.1.1-cp315-cp315-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:aeae0e330c9f6acd681f647d46cefd30c29f93e3392882e792e82080c9691399", size = 221630, upload-time = "2026-08-03T21:20:57.336Z" }, + { url = "https://files.pythonhosted.org/packages/a4/18/fa7f1f6857d5eb88a4ca99ffcbfb7c387a287ccc154c64a73e86314745d7/cffi-2.1.1-cp315-cp315-musllinux_1_2_aarch64.whl", hash = "sha256:42a494cee34437f05546455144f2b5d9ac09b1face62bcfce597d2e521066688", size = 225134, upload-time = "2026-08-03T21:20:58.675Z" }, + { url = "https://files.pythonhosted.org/packages/e0/9f/e8e3dfa04a1b4c241f8c91faacad872b4d4efd051d49764ad4e2fd4b9fea/cffi-2.1.1-cp315-cp315-musllinux_1_2_x86_64.whl", hash = "sha256:cc572dace3f60ef98d7b12ff411d20f5362feb31a0439eab0085bbfd349982d7", size = 223197, upload-time = "2026-08-03T21:20:59.968Z" }, + { url = "https://files.pythonhosted.org/packages/f8/7e/8debeb04f1ab9fe2a6963964cd6f1aaf7192627b83926586a6a4e089c9fa/cffi-2.1.1-cp315-cp315-win32.whl", hash = "sha256:4f42141fc14250de6dde5ee7ea4432be017252d91f19c5ad043c084cea629cac", size = 177683, upload-time = "2026-08-03T21:21:14.901Z" }, + { url = "https://files.pythonhosted.org/packages/e0/31/5158704cc474ab65c1647932e88be78dc0873f47130e253be38bcaf13d01/cffi-2.1.1-cp315-cp315-win_amd64.whl", hash = "sha256:e6e8cff14d6fb0be70a09c0bdc58096f501952d04624ebf867e0e56da2df8960", size = 187897, upload-time = "2026-08-03T21:21:16.108Z" }, + { url = "https://files.pythonhosted.org/packages/cc/4b/b3a2da8570c704ffc0f9762cdc3ec0f02c8573798e0b5cf7f11c82bbb70f/cffi-2.1.1-cp315-cp315-win_arm64.whl", hash = "sha256:27350daa11d4f10c540e6e89dada4c54feb7256ad03e9a4dc075ebad7ba360d1", size = 182935, upload-time = "2026-08-03T21:21:17.271Z" }, + { url = "https://files.pythonhosted.org/packages/d0/ef/5443574510a1207e6f6bc38ba6e1f1de36cb48fef07b2728bb896a21f430/cffi-2.1.1-cp315-cp315t-macosx_10_15_x86_64.whl", hash = "sha256:c26608d2222fb1e94487e4a387d85f13eb55d5ed725cb25a0c589ac4ee60e7bc", size = 188464, upload-time = "2026-08-03T21:21:01.163Z" }, + { url = "https://files.pythonhosted.org/packages/7e/ae/a56fa8c4686ad50e148fcbc8d3ae0d03915ff5c30d795058988c24118cef/cffi-2.1.1-cp315-cp315t-macosx_11_0_arm64.whl", hash = "sha256:4be96343e422f2dfcd12ab5c9f5aebe03f82f737c6bffeca6830b3875cb44aab", size = 188262, upload-time = "2026-08-03T21:21:02.382Z" }, + { url = "https://files.pythonhosted.org/packages/53/b2/6187f46f2912276a3ae284076109cc5c8680482f11f766ccf26db4a86427/cffi-2.1.1-cp315-cp315t-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:937c0052c05a31ca1daf18de3158eed4dbfcb9cc107adbea227728d647be701e", size = 223779, upload-time = "2026-08-03T21:21:03.553Z" }, + { url = "https://files.pythonhosted.org/packages/8a/f6/c3ad28bd19f77047a03084424fbd4cbe997303267c14423737324be0385d/cffi-2.1.1-cp315-cp315t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.whl", hash = "sha256:df423d40ee8654634421812bc3b196da3f9bd7d32929da813f8394c4348a5358", size = 211520, upload-time = "2026-08-03T21:21:04.863Z" }, + { url = "https://files.pythonhosted.org/packages/a0/cd/ccac9013a5bd9fd764de118674ab9c805b5ca10c19270d90ee273f8b2240/cffi-2.1.1-cp315-cp315t-manylinux2014_s390x.manylinux_2_17_s390x.whl", hash = "sha256:a730a083190634c65cca36ba5f489531576ebd79bcd5c8e172130f6453127231", size = 210673, upload-time = "2026-08-03T21:21:06.223Z" }, + { url = "https://files.pythonhosted.org/packages/52/86/2976131c639aead931c5bee5aba67e4b09fbeb8018b6f282f70803f923a7/cffi-2.1.1-cp315-cp315t-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:363e05fa78e15116c3c32c210ee36884fd6b9afa6d440e47112c3bd511d64cb6", size = 223835, upload-time = "2026-08-03T21:21:07.539Z" }, + { url = "https://files.pythonhosted.org/packages/ac/0c/33a7aeab2f9c76918c52e084beb39c570db3588133412929e8ec06fab90b/cffi-2.1.1-cp315-cp315t-musllinux_1_2_aarch64.whl", hash = "sha256:770de9db11e84213beec501cfcaa013b019820ca881e03344dea5844f7876d94", size = 226705, upload-time = "2026-08-03T21:21:08.774Z" }, + { url = "https://files.pythonhosted.org/packages/e3/26/2cde30fdde421130bfc18f70395731a6e6b2053c6a1978a5258ff04e72fa/cffi-2.1.1-cp315-cp315t-musllinux_1_2_x86_64.whl", hash = "sha256:7da0c5eff80f0197f3b3d1232ec5a682a9325f4ae9016a78f5f5ca35f9ced1f5", size = 225539, upload-time = "2026-08-03T21:21:09.911Z" }, + { url = "https://files.pythonhosted.org/packages/6d/cd/a361394c94b2129d604bb846f624a8e88255a3ee33129c434a00d715e64f/cffi-2.1.1-cp315-cp315t-win32.whl", hash = "sha256:06c72bb76605a4b0cd0aad6930b69d4baf7dd5d806cfc409b824191099700e66", size = 182707, upload-time = "2026-08-03T21:21:11.226Z" }, + { url = "https://files.pythonhosted.org/packages/9b/b5/ba2b299993c26577d529b6ae29841f9e15b9fcf004d65f423f4fcf94ade9/cffi-2.1.1-cp315-cp315t-win_amd64.whl", hash = "sha256:d9c275eaacd24aa73f94ffd6de08fc3f932424d8b6c376f4bed7cde376fe7bc3", size = 193772, upload-time = "2026-08-03T21:21:12.39Z" }, + { url = "https://files.pythonhosted.org/packages/aa/29/35e016098c814cd93de9cd320c66b5bfba14dc6ecedd3cb518fa7c408c69/cffi-2.1.1-cp315-cp315t-win_arm64.whl", hash = "sha256:d18e5ac0f2f03f4f518d3e23db0f0cad7faa1da8620e9c09461d443bbf6e6692", size = 186360, upload-time = "2026-08-03T21:21:13.636Z" }, +] + +[[package]] +name = "click" +version = "8.5.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/c7/0e/7fa0ef50764b67090eca4114772a2abf8b6148198475e54c660b97caeee6/click-8.5.0.tar.gz", hash = "sha256:ba0d2089de75ea0310e2dde03160e6ca10009947fb95a182f9b54021bb272e34", size = 382235, upload-time = "2026-08-26T13:33:14.56Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/58/50/6c0d534c5f134586a8e1ba4e330569e32f057e33372ae556463212fb4cd3/click-8.5.0-py3-none-any.whl", hash = "sha256:255bc9599cf7748b4b1a446ccc735421bd08a2ae529a8b88597d3de5664ee360", size = 125251, upload-time = "2026-08-26T13:33:12.928Z" }, +] + +[[package]] +name = "colorama" +version = "0.4.6" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/d8/53/6f443c9a4a8358a93a6792e2acffb9d9d5cb0a5cfd8802644b7b1c9a02e4/colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44", size = 27697, upload-time = "2022-10-25T02:36:22.414Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/d1/d6/3965ed04c63042e047cb6a3e6ed1a63a35087b6a609aa3a15ed8ac56c221/colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6", size = 25335, upload-time = "2022-10-25T02:36:20.889Z" }, +] + +[[package]] +name = "cryptography" +version = "50.0.2" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "cffi", marker = "platform_python_implementation != 'PyPy'" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/9d/af/182eb91b0df3fe75c4d9f26fe70684569566745f6ba7e5c9c73a862c5252/cryptography-50.0.2.tar.gz", hash = "sha256:7b46165bb56eb4704e2eaaf86f3c940d19154535d9b0ca7d6d590b04060e00d5", size = 880623, upload-time = "2026-09-30T15:30:04.884Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/e5/56/d194340cc4a57535e82e1bee9e89667ac4b7c13b5d3f59686deae3094dd5/cryptography-50.0.2-cp311-abi3-macosx_11_0_arm64.whl", hash = "sha256:fa8f5efb344d6908a1ce62f4a24e2e5780f825d6f53f5f50ec5ffacac72936cb", size = 3914904, upload-time = "2026-09-30T14:43:44.339Z" }, + { url = "https://files.pythonhosted.org/packages/d9/69/c9bd862c3bf43d6399c433caf002df16e2dffd4be49bdf515cda38038711/cryptography-50.0.2-cp311-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:79def8d059362e7831389ed3be0ecdf58a89386e1271e35dd9f5af84e81bffd0", size = 4731146, upload-time = "2026-09-30T14:43:47.113Z" }, + { url = "https://files.pythonhosted.org/packages/21/69/64cef1f702bf6657e0cc186ed1a2891d50d29fb41586b254e1c07adea261/cryptography-50.0.2-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:630ebfea3bf689d075f82316324ff7433dc447fe6bc1bfc76524b74b4a9567d2", size = 4719841, upload-time = "2026-09-30T14:43:49.01Z" }, + { url = "https://files.pythonhosted.org/packages/38/6b/61a3f8d8c5e1e49a6cddccafc4015cc1c0021360ab0acb4080e7a423644a/cryptography-50.0.2-cp311-abi3-manylinux_2_28_aarch64.whl", hash = "sha256:f9f6143a8c75945eb960d9eb98905a441394abfa24afaae239d514ffb2586480", size = 4738340, upload-time = "2026-09-30T14:43:50.932Z" }, + { url = "https://files.pythonhosted.org/packages/7b/2e/7212ca32fd43dc91f2f41db20160b268098874b4c9a0e7be94d6835f5b2e/cryptography-50.0.2-cp311-abi3-manylinux_2_28_ppc64le.whl", hash = "sha256:a582ab2ae1d34f67112cadc86702774c9ea4374df6bca6afe672817203c99134", size = 5367029, upload-time = "2026-09-30T14:43:52.911Z" }, + { url = "https://files.pythonhosted.org/packages/1a/f1/b474e930c4d910328780e3940da76f5aa5cbc48ce1fc14e44d239d9ea9db/cryptography-50.0.2-cp311-abi3-manylinux_2_28_x86_64.whl", hash = "sha256:4061c0079120205fb760c58acab6443e217307dcf05e3702cf970e0689972856", size = 4753050, upload-time = "2026-09-30T14:43:55.272Z" }, + { url = "https://files.pythonhosted.org/packages/7c/52/9af10e80ac16b0fcc2123f9cbd5e7afbd0fd5075bb7a607c592258a39cda/cryptography-50.0.2-cp311-abi3-manylinux_2_31_armv7l.whl", hash = "sha256:ac9ed99d81760c62fe89d5f0815cdfa1ba9a35141cf30f1c2d044f04b4803d2e", size = 4376724, upload-time = "2026-09-30T14:43:57.24Z" }, + { url = "https://files.pythonhosted.org/packages/71/37/6202e488cc1eb625ea110c292c6bda92823176e023f427d8d5660ce8d632/cryptography-50.0.2-cp311-abi3-manylinux_2_34_aarch64.whl", hash = "sha256:87e9ce85beb6b328ba370cc6e6aea483c92617b4c95b1d33a49297eb662bfb04", size = 4737859, upload-time = "2026-09-30T14:43:59.541Z" }, + { url = "https://files.pythonhosted.org/packages/8f/30/e86d7d518489b0ae2497091a35287abcb1a2ce4037837a34afbe9b1d6964/cryptography-50.0.2-cp311-abi3-manylinux_2_34_ppc64le.whl", hash = "sha256:f265528741e048bce55c3463ed721fb0aa45a5888d8add8cfeccb3035451bbdc", size = 5324103, upload-time = "2026-09-30T14:44:01.901Z" }, + { url = "https://files.pythonhosted.org/packages/d3/69/2c833a049475e0a3444e94c7d0aca0aa51d166374a449b09e92ac98138de/cryptography-50.0.2-cp311-abi3-manylinux_2_34_x86_64.whl", hash = "sha256:9dab55f57c74c3cad24c323bacbbd04be4705ba6eb0d92e920b1fc4837ed5079", size = 4752576, upload-time = "2026-09-30T14:44:04.545Z" }, + { url = "https://files.pythonhosted.org/packages/6c/5d/906970b83bbfc1f5bbfb677a143c181f2801f23b6a7204a3b47c42c97e65/cryptography-50.0.2-cp311-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:25784ce8b9621c90c643efb9e1e2162ab3b0224cae446ad5e70e7fcb1ce18b51", size = 4870819, upload-time = "2026-09-30T14:44:06.884Z" }, + { url = "https://files.pythonhosted.org/packages/68/e3/f2298d3bb55e0c4a91841ec4d01b3f020ba8c5fbf15ccdcc6dcf03f97025/cryptography-50.0.2-cp311-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:85d0d9a31b9098e98534226d5686b47264b95e62ce459dc2e62fdfc809f9fe93", size = 5030152, upload-time = "2026-09-30T14:44:09.443Z" }, + { url = "https://files.pythonhosted.org/packages/9a/4f/adfc442765721292fff86d314ce385d3249d22db42295c0dd057727b60f3/cryptography-50.0.2-cp311-abi3-win_amd64.whl", hash = "sha256:7afa5a6602a9f29af1f3a2965f831bae7c9d5d597b7cbb716d41ab3b7d89879c", size = 3824692, upload-time = "2026-09-30T14:44:11.671Z" }, + { url = "https://files.pythonhosted.org/packages/ce/cb/52eb3770c0d0be2702a98c6e96065ddc0a2877cf0845aa9c23397c142cd4/cryptography-50.0.2-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:f785f6161f202ab04d8ca194158968798e480ca058943907972da5f12e2881e8", size = 3892731, upload-time = "2026-09-30T14:44:13.485Z" }, + { url = "https://files.pythonhosted.org/packages/19/8e/aa1fc533d4546b127b45de8aa024eb5933d23eff9debfe25931e56861095/cryptography-50.0.2-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:0ecbc5652bdb6fc9eaf89a7d196e20941adfe812f43bc4ca05d9150496821047", size = 4710431, upload-time = "2026-09-30T14:44:15.427Z" }, + { url = "https://files.pythonhosted.org/packages/6a/64/72bc3f75176e7e406b748a3e3830432b8c51297b38368713df04dc04898a/cryptography-50.0.2-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:ab50ee449bf968271e820086f10a33d101dd060370abc10bcd22279be2656539", size = 4694824, upload-time = "2026-09-30T14:44:17.69Z" }, + { url = "https://files.pythonhosted.org/packages/4e/c6/62c77550edfa5ca3f14bf44a1e6739b9fa09d6e998a11d97ed8213bccc98/cryptography-50.0.2-cp314-cp314t-manylinux_2_28_aarch64.whl", hash = "sha256:a9f7355e6fab51f6c369b86fb7571cffa05edee2c2121e0380a37fb9ac1cd5c1", size = 4716967, upload-time = "2026-09-30T14:44:19.661Z" }, + { url = "https://files.pythonhosted.org/packages/f4/37/cce70f150c432914460157a6ecc161752e053aa5ec0ef3b3f7dc6e31039a/cryptography-50.0.2-cp314-cp314t-manylinux_2_28_ppc64le.whl", hash = "sha256:94e5e9f108ee10471288214d3d233fbfbb492840a8457eb85178d643ddeb32c7", size = 5328676, upload-time = "2026-09-30T14:44:21.744Z" }, + { url = "https://files.pythonhosted.org/packages/aa/9a/6f2f0304d634ceafdeaf23e84537336664ac419b5d07611675c2ad3f6b7a/cryptography-50.0.2-cp314-cp314t-manylinux_2_28_x86_64.whl", hash = "sha256:241449bf940a5d27309bd317e6f9a2af6932113818bb2b8f5c59ddc7ef16da18", size = 4727698, upload-time = "2026-09-30T14:44:24.178Z" }, + { url = "https://files.pythonhosted.org/packages/1d/de/66bcf9244d118663b2e1aaded8990f4640e3d7b7411870a5765f252074d2/cryptography-50.0.2-cp314-cp314t-manylinux_2_31_armv7l.whl", hash = "sha256:d8947001be83df1394050758ce0e745dd74fb134eef0a4b5124208dfc3a68c37", size = 4354821, upload-time = "2026-09-30T14:44:26.263Z" }, + { url = "https://files.pythonhosted.org/packages/bd/e6/db28a28c7b6c676addce89136de3d8db49ea825a8c863472e36e42ead4ad/cryptography-50.0.2-cp314-cp314t-manylinux_2_34_aarch64.whl", hash = "sha256:4a20ce1e5cb4284a86692fdcba7cb8754185c6b2e5c56fcef3751cf451d3cdc2", size = 4716748, upload-time = "2026-09-30T14:44:28.447Z" }, + { url = "https://files.pythonhosted.org/packages/30/96/01546c7f69ea0e2ab790a2e4f0934a4052fb9b388147fbf83c2fd72f1e57/cryptography-50.0.2-cp314-cp314t-manylinux_2_34_ppc64le.whl", hash = "sha256:84f964e537f916e2cc85199e5a88742e964939b575ac8598b3f9d6cc416cdaf1", size = 5285085, upload-time = "2026-09-30T14:44:30.704Z" }, + { url = "https://files.pythonhosted.org/packages/6c/01/03263395f74d50b071e9e66daace3f8bef80493e5d410726f2ba8554736b/cryptography-50.0.2-cp314-cp314t-manylinux_2_34_x86_64.whl", hash = "sha256:828d49b0ff5a0e3975865571c5d91dbbdd0d38d8289b249a163e9425413a5e05", size = 4727268, upload-time = "2026-09-30T14:44:32.92Z" }, + { url = "https://files.pythonhosted.org/packages/eb/94/2bfe8f29ec0cc9c0d99359c4161adf32858e4934b72c6d100d2ac0bbe962/cryptography-50.0.2-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:deb9fde5c60e437ee4821bc9bc39ff31b42135c27e1dc61ef0a629389c1de62e", size = 4849503, upload-time = "2026-09-30T14:44:34.969Z" }, + { url = "https://files.pythonhosted.org/packages/54/44/e80651ecbf0e42b62e2bb5f5768916e07eea72e1297338956a61df361f88/cryptography-50.0.2-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:8c71ba2cd31fc93748c38e1b613200ff1c2665cbfd5341fe3a61cfde35a1430e", size = 5004057, upload-time = "2026-09-30T14:44:37.064Z" }, + { url = "https://files.pythonhosted.org/packages/f8/cc/1d33befb3cd7ea7e77d2d73f43f2066471da1b21f24a6156efcaabf6d2e8/cryptography-50.0.2-cp314-cp314t-win_amd64.whl", hash = "sha256:78198641e5be9521beea5aa782bb551a58068d10e6eb04c9c680c1b69f2e7d45", size = 3795868, upload-time = "2026-09-30T14:44:39.71Z" }, + { url = "https://files.pythonhosted.org/packages/2d/49/93f6a6e7a87c9aa68d44d3e1cdb5fe8f60c90d5d2f46acae9a56892816b8/cryptography-50.0.2-cp315-abi3.abi3t-macosx_11_0_arm64.whl", hash = "sha256:edc3342adf8f697fc5f59c887a304356f147b397809440ed64e2fa6af2f50f37", size = 4133708, upload-time = "2026-09-30T14:44:41.807Z" }, + { url = "https://files.pythonhosted.org/packages/8c/75/32ac2a56243d778805c16ca6a32b8f74fb757df7e28d7ecb560afafb59cf/cryptography-50.0.2-cp315-abi3.abi3t-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:d370b8d1dfcdf7130178137f6fbee6140774a1acc6cacefc4b42643ec11d0a3a", size = 4956267, upload-time = "2026-09-30T14:44:43.693Z" }, + { url = "https://files.pythonhosted.org/packages/aa/a4/2c8d734e43d97f0842ee9f1b7b4bfb3d0cf5e19edebf43c2afe6675c2320/cryptography-50.0.2-cp315-abi3.abi3t-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:f2f9bd7f90c64fe89253f0a2c05e3c4856072660429ce8831b4235bf29403a67", size = 4966465, upload-time = "2026-09-30T14:44:45.769Z" }, + { url = "https://files.pythonhosted.org/packages/c2/58/ee288c829a6f41f6235ae9dd33d82fd19b45442b65b4c8a3da36963d9f7a/cryptography-50.0.2-cp315-abi3.abi3t-manylinux_2_28_aarch64.whl", hash = "sha256:e275096ea1e60cc595cda2836fd4a6c725d1125108b868be17f53684d164e2cc", size = 4959356, upload-time = "2026-09-30T14:44:48.211Z" }, + { url = "https://files.pythonhosted.org/packages/92/20/9ded6d51ddd9897f6b6e81fb9ebea7951d7cc5d6c890b0ed8abf77a51a80/cryptography-50.0.2-cp315-abi3.abi3t-manylinux_2_28_ppc64le.whl", hash = "sha256:b13478603dcd0a2479ff8e87e2c19a7d525734686fe3c49542472293a204212d", size = 5548822, upload-time = "2026-09-30T14:44:50.86Z" }, + { url = "https://files.pythonhosted.org/packages/02/a8/8df951850d6b31d2a00218f19e2b3f999523437ed7a819df7fa427942fca/cryptography-50.0.2-cp315-abi3.abi3t-manylinux_2_28_x86_64.whl", hash = "sha256:58a0c478eeca76fe5e07993c5a0703def34a6dc6a0cda4f5564639b33112ffe7", size = 5001199, upload-time = "2026-09-30T14:44:53.379Z" }, + { url = "https://files.pythonhosted.org/packages/8b/f9/36b3022218ce75b7cdf068fb95f809f9bd0d820e4955ef43b90c255cc7ac/cryptography-50.0.2-cp315-abi3.abi3t-manylinux_2_31_armv7l.whl", hash = "sha256:d38cdff612d06fa6a32840d5e1b1f7a27cee4a349aa9085d94a67789d6bfd408", size = 4629333, upload-time = "2026-09-30T14:44:55.635Z" }, + { url = "https://files.pythonhosted.org/packages/8c/72/20f99a219f6af47cdd1cbd978c243b92d71496e168a746138af44ded4f29/cryptography-50.0.2-cp315-abi3.abi3t-manylinux_2_34_aarch64.whl", hash = "sha256:fdd28f912fccfec1846a94e2e1e8f9b0012f557f0c46fe4f3eb0d7a87afcf90b", size = 4958822, upload-time = "2026-09-30T14:44:59.639Z" }, + { url = "https://files.pythonhosted.org/packages/f2/20/196f112617fb08eb4d608a2a6c422373d46f9cc2857f38fc0667033c0899/cryptography-50.0.2-cp315-abi3.abi3t-manylinux_2_34_ppc64le.whl", hash = "sha256:cbc8738fd8526d80f35cb3a40d41f41a2e7030bb3b18b09a6778ef63d291c2fd", size = 5506351, upload-time = "2026-09-30T14:45:02.267Z" }, + { url = "https://files.pythonhosted.org/packages/24/95/83378121ef3eaaaf71d4b781577ff794acb39b9e1b87a3f156898c8497ed/cryptography-50.0.2-cp315-abi3.abi3t-manylinux_2_34_x86_64.whl", hash = "sha256:e105ab60406787da31fccc883fc0f733af1efd78f0136a4599692c4083a73d0c", size = 5000859, upload-time = "2026-09-30T14:45:05.009Z" }, + { url = "https://files.pythonhosted.org/packages/22/f7/70fd7ae4d1dbfa7ba29b02e1b9068771519a86027756510b700ce81086a8/cryptography-50.0.2-cp315-abi3.abi3t-musllinux_1_2_aarch64.whl", hash = "sha256:6f8700550aa1474a91e5dc07049c46f98b423b5b1ddd0483e0b51362eeeaf5be", size = 5092151, upload-time = "2026-09-30T15:29:15.932Z" }, + { url = "https://files.pythonhosted.org/packages/d4/be/688367b74de86984bd58d8efacfc7c9e68b89a6a22ced0fb4f38db50254a/cryptography-50.0.2-cp315-abi3.abi3t-musllinux_1_2_x86_64.whl", hash = "sha256:c71be1cbfa5cd9a41ee452acf1eccd82b2c05950358b106ec8ceb83411d1a020", size = 5286120, upload-time = "2026-09-30T15:29:18.309Z" }, + { url = "https://files.pythonhosted.org/packages/39/d1/55f8a3f2ef5d1529e16835ef10cf0fe3d559ce237b46dddc440c0bba3649/cryptography-50.0.2-cp315-abi3.abi3t-win_amd64.whl", hash = "sha256:c423ab384a46c4dff7217b2ea5ba2e11cffdeab6441acd04cf65a369caf0366c", size = 4111557, upload-time = "2026-09-30T15:29:20.155Z" }, + { url = "https://files.pythonhosted.org/packages/23/ad/ac987755d00e1e64273760228d2635ae38dae2be83e3c6e0d3289d91dec3/cryptography-50.0.2-cp39-abi3-macosx_11_0_arm64.whl", hash = "sha256:0ec5f09541743261e66e291b4a0cbf0fb2997aeaab6d9e9c740b9dba1b58d1c2", size = 3943588, upload-time = "2026-09-30T15:29:22.265Z" }, + { url = "https://files.pythonhosted.org/packages/d5/8d/6d585339bedf85d45044c85d8412dac53f2bb6f918e8b7777efba1787844/cryptography-50.0.2-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:c5e67125c7dca78d199ec4e116aa93dbb83494808ecbb8211a2cb09b1bf41dbd", size = 4756166, upload-time = "2026-09-30T15:29:24.58Z" }, + { url = "https://files.pythonhosted.org/packages/bf/f1/1c1f6874e8550cfddd4b688ceb38cefb6ed15ceed224d56f133f3d88c214/cryptography-50.0.2-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:ee247f5c245c9a2fe7c8e2214e295918838e44e00a45a6718451e4004219e767", size = 4749145, upload-time = "2026-09-30T15:29:26.807Z" }, + { url = "https://files.pythonhosted.org/packages/c1/63/61b15dc1a8de03fe0adbe3fd7608b3ad5c73bf50993bbcb1faaa930afe33/cryptography-50.0.2-cp39-abi3-manylinux_2_28_aarch64.whl", hash = "sha256:dfe9763530994147d9af1def057a5b9658b00e8f8fe8743d144d1e0911c2e454", size = 4763638, upload-time = "2026-09-30T15:29:28.588Z" }, + { url = "https://files.pythonhosted.org/packages/fc/35/b345bdfa40c9126df1a9d33236aa98418367931b8725f84fc3ae2b98dc59/cryptography-50.0.2-cp39-abi3-manylinux_2_28_ppc64le.whl", hash = "sha256:58ddb5a8e3179d12f19e4ea34d2d32e9d63a4baa142c875c1eb59f41b7243acd", size = 5382217, upload-time = "2026-09-30T15:29:30.589Z" }, + { url = "https://files.pythonhosted.org/packages/4f/87/ef344a9e616871f2519c22d6afcda79ddd5d35e9592d95eb6e677608d055/cryptography-50.0.2-cp39-abi3-manylinux_2_28_x86_64.whl", hash = "sha256:f21e8a22c8605750c7af886bab299a363721264061b4ac0a30efb73cfd58efc5", size = 4781387, upload-time = "2026-09-30T15:29:32.605Z" }, + { url = "https://files.pythonhosted.org/packages/90/5b/f2fdb13cd0b96f6f932c8627bb292a45f11c64d21620a8e120aee9a3b848/cryptography-50.0.2-cp39-abi3-manylinux_2_31_armv7l.whl", hash = "sha256:9c8402a82ea0dc4ceeab793db05f0fafa8ca139ca34fcde5df0f596103c74107", size = 4403790, upload-time = "2026-09-30T15:29:34.374Z" }, + { url = "https://files.pythonhosted.org/packages/bc/ce/7e4f662b1e3c393513569e402cfc85ac7da0bd3d5435e122a3140219eb2d/cryptography-50.0.2-cp39-abi3-manylinux_2_34_aarch64.whl", hash = "sha256:0ddc924c04591c2811ca024d62ecad4f7f6f08af8939c211438f48a16bd23602", size = 4764319, upload-time = "2026-09-30T15:29:36.149Z" }, + { url = "https://files.pythonhosted.org/packages/3c/3f/86ff33ce34cc0de6847fb96e035a1a760d81652e38643f617c02ad32ef7a/cryptography-50.0.2-cp39-abi3-manylinux_2_34_ppc64le.whl", hash = "sha256:a6557e5f38e065ca9fbdaf7cfc7435ecb1d113aa81a022d1b51921ee7432e227", size = 5338560, upload-time = "2026-09-30T15:29:39.053Z" }, + { url = "https://files.pythonhosted.org/packages/40/cf/6b5c8e2fd9202d98988ab7cb5cc5c991704c4ad55f492ff408e4969f83f1/cryptography-50.0.2-cp39-abi3-manylinux_2_34_x86_64.whl", hash = "sha256:1981f1db4630889b9ef7803fadef12b056f428cb6b85c27ba57b774793b6093c", size = 4780973, upload-time = "2026-09-30T15:29:41.251Z" }, + { url = "https://files.pythonhosted.org/packages/10/bf/8d6ebc7dded797bd0f0160d52188021211f011a2b164ef0ae1dac4587465/cryptography-50.0.2-cp39-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:7a8701d6b584d76e909e3d305b7d126b41439876a5aaf76cddc67fc230eafa2e", size = 4897738, upload-time = "2026-09-30T15:29:43.106Z" }, + { url = "https://files.pythonhosted.org/packages/d4/aa/f3f6e0de7e6253b8baa8b2d8fb9d50924fa75cee3d4624bd4bc1208ee923/cryptography-50.0.2-cp39-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:ce47f66801c20ec6c6632453bb5960fe38939e9306970b48b3a5a26de7745d94", size = 5058280, upload-time = "2026-09-30T15:29:44.827Z" }, + { url = "https://files.pythonhosted.org/packages/f6/b6/a1faf3a27ae9405fb34b1713cc73b2d8a26b04d5c561578fa2e6ef3e5bb9/cryptography-50.0.2-cp39-abi3-win_amd64.whl", hash = "sha256:4e81d95e5bafc2d6e34e4bed780e53e4d5b9a2f928573428aa4d35fbec1eb0de", size = 3854095, upload-time = "2026-09-30T15:29:46.782Z" }, +] + +[[package]] +name = "cyclopts" +version = "5.1.1" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "attrs" }, + { name = "docstring-parser" }, + { name = "rich" }, + { name = "rich-rst" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/85/8c/7a7f5a3af1845cb6b9c28bf2a6db1bc510a6b9661109138c70ab6d8d650a/cyclopts-5.1.1.tar.gz", hash = "sha256:252fe37b01a80f10933f91c312db551e4e86ffd87bee401ab2ed091769135426", size = 237903, upload-time = "2026-10-01T00:00:02.762Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/2a/37/1afff6923395f2f0ce730bae8851371b7418be17dc44d90ba80f72799240/cyclopts-5.1.1-py3-none-any.whl", hash = "sha256:ff0da67b2d2d8fe716d20ab82c698277ef30a8fb75d24e9b38a06f56c44931fd", size = 279527, upload-time = "2026-10-01T00:00:00.485Z" }, +] + +[[package]] +name = "dnspython" +version = "2.8.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/8c/8b/57666417c0f90f08bcafa776861060426765fdb422eb10212086fb811d26/dnspython-2.8.0.tar.gz", hash = "sha256:181d3c6996452cb1189c4046c61599b84a5a86e099562ffde77d26984ff26d0f", size = 368251, upload-time = "2025-09-07T18:58:00.022Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/ba/5a/18ad964b0086c6e62e2e7500f7edc89e3faa45033c71c1893d34eed2b2de/dnspython-2.8.0-py3-none-any.whl", hash = "sha256:01d9bbc4a2d76bf0db7c1f729812ded6d912bd318d3b1cf81d30c0f845dbf3af", size = 331094, upload-time = "2025-09-07T18:57:58.071Z" }, +] + +[[package]] +name = "docstring-parser" +version = "0.18.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/e0/4d/f332313098c1de1b2d2ff91cf2674415cc7cddab2ca1b01ae29774bd5fdf/docstring_parser-0.18.0.tar.gz", hash = "sha256:292510982205c12b1248696f44959db3cdd1740237a968ea1e2e7a900eeb2015", size = 29341, upload-time = "2026-04-14T04:09:19.867Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/a7/5f/ed01f9a3cdffbd5a008556fc7b2a08ddb1cc6ace7effa7340604b1d16699/docstring_parser-0.18.0-py3-none-any.whl", hash = "sha256:b3fcbed555c47d8479be0796ef7e19c2670d428d72e96da63f3a40122860374b", size = 22484, upload-time = "2026-04-14T04:09:18.638Z" }, +] + +[[package]] +name = "email-validator" +version = "2.3.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "dnspython" }, + { name = "idna" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/f5/22/900cb125c76b7aaa450ce02fd727f452243f2e91a61af068b40adba60ea9/email_validator-2.3.0.tar.gz", hash = "sha256:9fc05c37f2f6cf439ff414f8fc46d917929974a82244c20eb10231ba60c54426", size = 51238, upload-time = "2025-08-26T13:09:06.831Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/de/15/545e2b6cf2e3be84bc1ed85613edd75b8aea69807a71c26f4ca6a9258e82/email_validator-2.3.0-py3-none-any.whl", hash = "sha256:80f13f623413e6b197ae73bb10bf4eb0908faf509ad8362c5edeb0be7fd450b4", size = 35604, upload-time = "2025-08-26T13:09:05.858Z" }, +] + +[[package]] +name = "epr-workshop" +version = "0.1.0" +source = { virtual = "." } +dependencies = [ + { name = "fastmcp" }, + { name = "httpx2" }, + { name = "pydantic" }, +] + +[package.dev-dependencies] +dev = [ + { name = "pytest" }, + { name = "pytest-asyncio" }, +] + +[package.metadata] +requires-dist = [ + { name = "fastmcp", specifier = "==4.0.11" }, + { name = "httpx2", specifier = "==2.13.1" }, + { name = "pydantic", specifier = ">=2.12" }, +] + +[package.metadata.requires-dev] +dev = [ + { name = "pytest", specifier = ">=8" }, + { name = "pytest-asyncio", specifier = ">=0.24" }, +] + +[[package]] +name = "exceptiongroup" +version = "1.3.1" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "typing-extensions", marker = "python_full_version < '3.13'" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/50/79/66800aadf48771f6b62f7eb014e352e5d06856655206165d775e675a02c9/exceptiongroup-1.3.1.tar.gz", hash = "sha256:8b412432c6055b0b7d14c310000ae93352ed6754f70fa8f7c34141f91c4e3219", size = 30371, upload-time = "2025-11-21T23:01:54.787Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/8a/0e/97c33bf5009bdbac74fd2beace167cab3f978feb69cc36f1ef79360d6c4e/exceptiongroup-1.3.1-py3-none-any.whl", hash = "sha256:a7a39a3bd276781e98394987d3a5701d0c4edffb633bb7a5144577f82c773598", size = 16740, upload-time = "2025-11-21T23:01:53.443Z" }, +] + +[[package]] +name = "fastmcp" +version = "4.0.11" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "fastmcp-slim", extra = ["client", "server"] }, +] +sdist = { url = "https://files.pythonhosted.org/packages/e4/ca/e76fde836e6e443f49b1a16ad91fa71715ec220141261a290c9241024857/fastmcp-4.0.11.tar.gz", hash = "sha256:55fc7b8e25d4f8365818ba93f7008d1b6e646ce7fe8ae49342687243ccbef9f2", size = 42606797, upload-time = "2026-10-04T16:58:10.598Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/49/0c/6c97f76e4ca6cd26fe056d6668ec4a550b2368d3699e6a50789aed226849/fastmcp-4.0.11-py3-none-any.whl", hash = "sha256:defbc5f2566a702f45817d1acead120dfa8127d60b1c1512b3200232ead13a44", size = 8161, upload-time = "2026-10-04T16:58:08.278Z" }, +] + +[[package]] +name = "fastmcp-slim" +version = "4.0.11" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "mcp-types" }, + { name = "platformdirs" }, + { name = "pydantic", extra = ["email"] }, + { name = "pydantic-settings" }, + { name = "python-dotenv" }, + { name = "rich" }, + { name = "typing-extensions" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/02/d3/8d247edc9120c3be157315acd6df17c9790358c39ea45d0f9dfcec6a094b/fastmcp_slim-4.0.11.tar.gz", hash = "sha256:9152aac74d8837bc37576f5f3d83f17567250a9dfcd8187133c43faaaa9dd06f", size = 722160, upload-time = "2026-10-04T16:56:07.286Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/47/69/0b4fbe30298c9c6cc123ba8ac63e78583b3567ac04f7d125f3c2309a6e9e/fastmcp_slim-4.0.11-py3-none-any.whl", hash = "sha256:524905197e318d934908594f16fedea559d44dd682bd763d40f3556233a2b1d9", size = 898247, upload-time = "2026-10-04T16:56:05.97Z" }, +] + +[package.optional-dependencies] +client = [ + { name = "authlib" }, + { name = "exceptiongroup" }, + { name = "httpx2" }, + { name = "mcp" }, + { name = "opentelemetry-api" }, + { name = "py-key-value-aio", extra = ["filetree", "keyring", "memory"] }, + { name = "starlette" }, +] +server = [ + { name = "authlib" }, + { name = "cyclopts" }, + { name = "exceptiongroup" }, + { name = "griffelib" }, + { name = "httpx2" }, + { name = "joserfc" }, + { name = "jsonref" }, + { name = "jsonschema-path" }, + { name = "mcp" }, + { name = "openapi-pydantic" }, + { name = "opentelemetry-api" }, + { name = "packaging" }, + { name = "py-key-value-aio", extra = ["filetree", "keyring", "memory"] }, + { name = "pyperclip" }, + { name = "python-multipart" }, + { name = "pyyaml" }, + { name = "starlette" }, + { name = "uncalled-for" }, + { name = "uvicorn" }, + { name = "watchfiles" }, + { name = "websockets" }, +] + +[[package]] +name = "griffelib" +version = "2.3.2" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/2b/27/b55f1a5278918be765fb2fd8b20966bc72bbdd3f789f031937cceea7834a/griffelib-2.3.2.tar.gz", hash = "sha256:df00c7a0dee3d86268d76788997a1859272cb1fb7b865658e043d2c0c3d52e60", size = 234729, upload-time = "2026-10-06T09:54:37.222Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/04/e5/0ae74c83c1cab2c14daadf28bd0143eb14bb81503834af987b66badc7b61/griffelib-2.3.2-py3-none-any.whl", hash = "sha256:8e710afededd5607f95bf3c8ccc175ee306e7084459faf27b9f9f44ef2a7a274", size = 169420, upload-time = "2026-10-06T09:54:32.038Z" }, +] + +[[package]] +name = "h11" +version = "0.16.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/01/ee/02a2c011bdab74c6fb3c75474d40b3052059d95df7e73351460c8588d963/h11-0.16.0.tar.gz", hash = "sha256:4e35b956cf45792e4caa5885e69fba00bdbc6ffafbfa020300e549b208ee5ff1", size = 101250, upload-time = "2025-04-24T03:35:25.427Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/04/4b/29cac41a4d98d144bf5f6d33995617b185d14b22401f75ca86f384e87ff1/h11-0.16.0-py3-none-any.whl", hash = "sha256:63cf8bbe7522de3bf65932fda1d9c2772064ffb3dae62d55932da54b31cb6c86", size = 37515, upload-time = "2025-04-24T03:35:24.344Z" }, +] + +[[package]] +name = "httpcore2" +version = "2.13.1" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "h11" }, + { name = "truststore" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/cb/f3/1db7aa2bc2524062192bb0e0323969492d1883152a232fe36eea65f4e35c/httpcore2-2.13.1.tar.gz", hash = "sha256:e0aa977abe17e69a3b820a24542a6fa88702676d83880b8d194dcd18408e5103", size = 68071, upload-time = "2026-09-23T07:47:22.372Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/09/ba/a4568248771ce81957bfb7cc600264a40fbcda092391ee1c415c50be4bea/httpcore2-2.13.1-py3-none-any.whl", hash = "sha256:e1e05d4f25f7d7d496bfb96748f6f4b67657b03da069b3a68c36069f3db73d0a", size = 83423, upload-time = "2026-09-23T07:47:19.365Z" }, +] + +[[package]] +name = "httpx2" +version = "2.13.1" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "anyio", marker = "sys_platform != 'emscripten'" }, + { name = "httpcore2", marker = "sys_platform != 'emscripten'" }, + { name = "httpx2-jsfetch", marker = "sys_platform == 'emscripten'" }, + { name = "idna" }, + { name = "truststore", marker = "sys_platform != 'emscripten'" }, + { name = "typing-extensions", marker = "python_full_version < '3.13'" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/d5/44/474bef2a0e9d90f1715d32cb98b0738695ca17ba324095fb2497ed7fbd59/httpx2-2.13.1.tar.gz", hash = "sha256:e48744a19e3af5ee48313d0ce5fe941d5422fae5705ea922a4aabf94d7800dfa", size = 100405, upload-time = "2026-09-23T07:47:23.052Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/d8/9c/6fe8931fd9f381042a9e4c7d5a7b4cbf7016b252bec0c99a49fce42c3326/httpx2-2.13.1-py3-none-any.whl", hash = "sha256:6dff50fabc270ee5fd25d845d0b078ed20564579744d6d962850975996d2f9a4", size = 95597, upload-time = "2026-09-23T07:47:20.995Z" }, +] + +[[package]] +name = "httpx2-jsfetch" +version = "1.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/cd/c4/0e5636363151a2a1795e0a77617168b9ca438e1748ec05fc9b5687f93d64/httpx2_jsfetch-1.0.tar.gz", hash = "sha256:70a0e3eabfef7cce5ad9c629f7d01ca05e418f586646f4ddf14782e4c1454c60", size = 6872, upload-time = "2026-08-07T00:13:07.492Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/9b/43/832f631d32e4f1211caa2ba368317739fe71f0b8530e4c9d15dc454bac2a/httpx2_jsfetch-1.0-py3-none-any.whl", hash = "sha256:cb916b707601e69a07721aabc8f3f6659be3a6893bc1ff5c6f9e02241df2da32", size = 6382, upload-time = "2026-08-07T00:13:06.567Z" }, +] + +[[package]] +name = "idna" +version = "3.20" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/f5/08/8eea9d4b8302028f3abb2c0813953f7aec26d33b7a8960ed760e65ff29fa/idna-3.20.tar.gz", hash = "sha256:a7db850025b95ded1eae8a46181a1a6c56c92c96f0e2b005d9ff8dc0210cab44", size = 216463, upload-time = "2026-09-17T14:11:04.752Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/58/a2/bb081bab032533a855d44de1d56f8e8426114ff1ba5d1f07a438a0a654f8/idna-3.20-py3-none-any.whl", hash = "sha256:ab7ae7122974553370f0bdb919e1a960b2cd1bc1ef0276416d896db81c14582c", size = 69583, upload-time = "2026-09-17T14:11:03.168Z" }, +] + +[[package]] +name = "iniconfig" +version = "2.3.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/72/34/14ca021ce8e5dfedc35312d08ba8bf51fdd999c576889fc2c24cb97f4f10/iniconfig-2.3.0.tar.gz", hash = "sha256:c76315c77db068650d49c5b56314774a7804df16fee4402c1f19d6d15d8c4730", size = 20503, upload-time = "2025-10-18T21:55:43.219Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/cb/b1/3846dd7f199d53cb17f49cba7e651e9ce294d8497c8c150530ed11865bb8/iniconfig-2.3.0-py3-none-any.whl", hash = "sha256:f631c04d2c48c52b84d0d0549c99ff3859c98df65b3101406327ecc7d53fbf12", size = 7484, upload-time = "2025-10-18T21:55:41.639Z" }, +] + +[[package]] +name = "jaraco-classes" +version = "3.4.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "more-itertools" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/06/c0/ed4a27bc5571b99e3cff68f8a9fa5b56ff7df1c2251cc715a652ddd26402/jaraco.classes-3.4.0.tar.gz", hash = "sha256:47a024b51d0239c0dd8c8540c6c7f484be3b8fcf0b2d85c13825780d3b3f3acd", size = 11780, upload-time = "2024-03-31T07:27:36.643Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/7f/66/b15ce62552d84bbfcec9a4873ab79d993a1dd4edb922cbfccae192bd5b5f/jaraco.classes-3.4.0-py3-none-any.whl", hash = "sha256:f662826b6bed8cace05e7ff873ce0f9283b5c924470fe664fff1c2f00f581790", size = 6777, upload-time = "2024-03-31T07:27:34.792Z" }, +] + +[[package]] +name = "jaraco-context" +version = "6.1.2" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/af/50/4763cd07e722bb6285316d390a164bc7e479db9d90daa769f22578f698b4/jaraco_context-6.1.2.tar.gz", hash = "sha256:f1a6c9d391e661cc5b8d39861ff077a7dc24dc23833ccee564b234b81c82dfe3", size = 16801, upload-time = "2026-03-20T22:13:33.922Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/f2/58/bc8954bda5fcda97bd7c19be11b85f91973d67a706ed4a3aec33e7de22db/jaraco_context-6.1.2-py3-none-any.whl", hash = "sha256:bf8150b79a2d5d91ae48629d8b427a8f7ba0e1097dd6202a9059f29a36379535", size = 7871, upload-time = "2026-03-20T22:13:32.808Z" }, +] + +[[package]] +name = "jaraco-functools" +version = "4.6.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "more-itertools" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/6c/1f/c23395957d41ccf27c4e535c3d334c4051e5395b3752057ba4cbaec35c56/jaraco_functools-4.6.0.tar.gz", hash = "sha256:880c577ec9720b3a052d5bc611fb9f2269b3d87902ef42440df443b88e443280", size = 20837, upload-time = "2026-07-14T01:28:02.544Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/02/36/ecc85bc96c273dc8a11273ed4782272975e6338d4a3e9228621175edf0e3/jaraco_functools-4.6.0-py3-none-any.whl", hash = "sha256:99e3dc0060c5cbe8fcd1cdb36258e2a65ca40f1566b2033b12abb1bb44dd3c30", size = 11677, upload-time = "2026-07-14T01:28:01.59Z" }, +] + +[[package]] +name = "jeepney" +version = "0.9.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/7b/6f/357efd7602486741aa73ffc0617fb310a29b588ed0fd69c2399acbb85b0c/jeepney-0.9.0.tar.gz", hash = "sha256:cf0e9e845622b81e4a28df94c40345400256ec608d0e55bb8a3feaa9163f5732", size = 106758, upload-time = "2025-02-27T18:51:01.684Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/b2/a3/e137168c9c44d18eff0376253da9f1e9234d0239e0ee230d2fee6cea8e55/jeepney-0.9.0-py3-none-any.whl", hash = "sha256:97e5714520c16fc0a45695e5365a2e11b81ea79bba796e26f9f1d178cb182683", size = 49010, upload-time = "2025-02-27T18:51:00.104Z" }, +] + +[[package]] +name = "joserfc" +version = "1.7.5" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "cryptography" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/19/94/80fea1514b7c6d7d37804d3fe9ca81455f633347fc98731bd71ffe1faa17/joserfc-1.7.5.tar.gz", hash = "sha256:d5ff536e658e17664f8c1b1ab60dc4aa62aa973fcef1edd33cc44bda45d6f5ea", size = 234990, upload-time = "2026-08-29T13:05:42.057Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/67/c5/82addfd375e5ee6520644e0553e4aadde92d668c4fc99cc716d337fe7bb3/joserfc-1.7.5-py3-none-any.whl", hash = "sha256:add2c2c84e8373b084d526a8b53daba5d7a513a118cd2dcd9fc9f979d0922159", size = 71269, upload-time = "2026-08-29T13:05:40.718Z" }, +] + +[[package]] +name = "jsonref" +version = "1.1.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/aa/0d/c1f3277e90ccdb50d33ed5ba1ec5b3f0a242ed8c1b1a85d3afeb68464dca/jsonref-1.1.0.tar.gz", hash = "sha256:32fe8e1d85af0fdefbebce950af85590b22b60f9e95443176adbde4e1ecea552", size = 8814, upload-time = "2023-01-16T16:10:04.455Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/0c/ec/e1db9922bceb168197a558a2b8c03a7963f1afe93517ddd3cf99f202f996/jsonref-1.1.0-py3-none-any.whl", hash = "sha256:590dc7773df6c21cbf948b5dac07a72a251db28b0238ceecce0a2abfa8ec30a9", size = 9425, upload-time = "2023-01-16T16:10:02.255Z" }, +] + +[[package]] +name = "jsonschema" +version = "4.26.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "attrs" }, + { name = "jsonschema-specifications" }, + { name = "referencing" }, + { name = "rpds-py" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/b3/fc/e067678238fa451312d4c62bf6e6cf5ec56375422aee02f9cb5f909b3047/jsonschema-4.26.0.tar.gz", hash = "sha256:0c26707e2efad8aa1bfc5b7ce170f3fccc2e4918ff85989ba9ffa9facb2be326", size = 366583, upload-time = "2026-01-07T13:41:07.246Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/69/90/f63fb5873511e014207a475e2bb4e8b2e570d655b00ac19a9a0ca0a385ee/jsonschema-4.26.0-py3-none-any.whl", hash = "sha256:d489f15263b8d200f8387e64b4c3a75f06629559fb73deb8fdfb525f2dab50ce", size = 90630, upload-time = "2026-01-07T13:41:05.306Z" }, +] + +[[package]] +name = "jsonschema-path" +version = "0.5.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "attrs" }, + { name = "pathable" }, + { name = "pyyaml" }, + { name = "referencing" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/39/79/cd02a4df6d9270efdc7d3feefe6edd730b0820c39eeaa107a2faee8322d5/jsonschema_path-0.5.0.tar.gz", hash = "sha256:493b156ba895c97602655b620a8456caa2ce08c1aa389f5a7addec065e6e855c", size = 19597, upload-time = "2026-05-19T20:45:00.971Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/04/2c/9e69d73c4297508be9e3b64a970ea3971b3eb8db64ffc5802d40bd25981f/jsonschema_path-0.5.0-py3-none-any.whl", hash = "sha256:2790a070bc7abb08ea3dbe4d340ece4efadf639223001f020c7503229ba068e2", size = 24077, upload-time = "2026-05-19T20:44:59.225Z" }, +] + +[[package]] +name = "jsonschema-specifications" +version = "2025.9.1" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "referencing" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/19/74/a633ee74eb36c44aa6d1095e7cc5569bebf04342ee146178e2d36600708b/jsonschema_specifications-2025.9.1.tar.gz", hash = "sha256:b540987f239e745613c7a9176f3edb72b832a4ac465cf02712288397832b5e8d", size = 32855, upload-time = "2025-09-08T01:34:59.186Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/41/45/1a4ed80516f02155c51f51e8cedb3c1902296743db0bbc66608a0db2814f/jsonschema_specifications-2025.9.1-py3-none-any.whl", hash = "sha256:98802fee3a11ee76ecaca44429fda8a41bff98b00a0f2838151b113f210cc6fe", size = 18437, upload-time = "2025-09-08T01:34:57.871Z" }, +] + +[[package]] +name = "keyring" +version = "25.7.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "jaraco-classes" }, + { name = "jaraco-context" }, + { name = "jaraco-functools" }, + { name = "jeepney", marker = "sys_platform == 'linux'" }, + { name = "pywin32-ctypes", marker = "sys_platform == 'win32'" }, + { name = "secretstorage", marker = "sys_platform == 'linux'" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/43/4b/674af6ef2f97d56f0ab5153bf0bfa28ccb6c3ed4d1babf4305449668807b/keyring-25.7.0.tar.gz", hash = "sha256:fe01bd85eb3f8fb3dd0405defdeac9a5b4f6f0439edbb3149577f244a2e8245b", size = 63516, upload-time = "2025-11-16T16:26:09.482Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/81/db/e655086b7f3a705df045bf0933bdd9c2f79bb3c97bfef1384598bb79a217/keyring-25.7.0-py3-none-any.whl", hash = "sha256:be4a0b195f149690c166e850609a477c532ddbfbaed96a404d4e43f8d5e2689f", size = 39160, upload-time = "2025-11-16T16:26:08.402Z" }, +] + +[[package]] +name = "markdown-it-py" +version = "4.2.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "mdurl" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/06/ff/7841249c247aa650a76b9ee4bbaeae59370dc8bfd2f6c01f3630c35eb134/markdown_it_py-4.2.0.tar.gz", hash = "sha256:04a21681d6fbb623de53f6f364d352309d4094dd4194040a10fd51833e418d49", size = 82454, upload-time = "2026-05-07T12:08:28.36Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/b3/81/4da04ced5a082363ecfa159c010d200ecbd959ae410c10c0264a38cac0f5/markdown_it_py-4.2.0-py3-none-any.whl", hash = "sha256:9f7ebbcd14fe59494226453aed97c1070d83f8d24b6fc3a3bcf9a38092641c4a", size = 91687, upload-time = "2026-05-07T12:08:27.182Z" }, +] + +[[package]] +name = "mcp" +version = "2.3.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "anyio" }, + { name = "httpx2" }, + { name = "jsonschema" }, + { name = "mcp-types" }, + { name = "opentelemetry-api" }, + { name = "pydantic" }, + { name = "pyjwt", extra = ["crypto"] }, + { name = "python-multipart" }, + { name = "pywin32", marker = "sys_platform == 'win32'" }, + { name = "sse-starlette" }, + { name = "starlette" }, + { name = "typing-extensions" }, + { name = "typing-inspection" }, + { name = "uvicorn", marker = "sys_platform != 'emscripten'" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/9d/8d/e0d339616f4810e9051d4aba6887afab289ab1f81875fe908b606cdfd0e3/mcp-2.3.0.tar.gz", hash = "sha256:8b147a50441cf059dc88c684e0aeed3687f0aa0f39c6cde7b90330effd2b34d8", size = 4171955, upload-time = "2026-10-02T22:06:56.091Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/20/d7/4a2878f128df729db3ca04e71bfce26405cc2e0c9ebe19c592feeb4c61b9/mcp-2.3.0-py3-none-any.whl", hash = "sha256:dd0c44c089d16453e8ae31a3877a0054d7a2314caaa81f5e0541b9b1734b2377", size = 368664, upload-time = "2026-10-02T22:06:52.119Z" }, +] + +[[package]] +name = "mcp-types" +version = "2.3.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "pydantic" }, + { name = "typing-extensions" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/9e/2d/7c251e34207f6c51000312fc8839111ac45cfe02023f90b44e7f1051dd8e/mcp_types-2.3.0.tar.gz", hash = "sha256:d1e46549edb35ee19a94940fcee6d1addd7e589ab7ea92dda83f5d84781fc362", size = 65898, upload-time = "2026-10-02T22:06:57.863Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/ce/48/32583066b155bb5d4507e7887dc88ee23118cc4de8e2a12870c49719e2a8/mcp_types-2.3.0-py3-none-any.whl", hash = "sha256:968efdbdaedfab06adae40d378a34395f1090c5921d4be3c9cde283aaf76d91d", size = 69108, upload-time = "2026-10-02T22:06:54.099Z" }, +] + +[[package]] +name = "mdurl" +version = "0.1.2" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/d6/54/cfe61301667036ec958cb99bd3efefba235e65cdeb9c84d24a8293ba1d90/mdurl-0.1.2.tar.gz", hash = "sha256:bb413d29f5eea38f31dd4754dd7377d4465116fb207585f97bf925588687c1ba", size = 8729, upload-time = "2022-08-14T12:40:10.846Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/b3/38/89ba8ad64ae25be8de66a6d463314cf1eb366222074cfda9ee839c56a4b4/mdurl-0.1.2-py3-none-any.whl", hash = "sha256:84008a41e51615a49fc9966191ff91509e3c40b939176e643fd50a5c2196b8f8", size = 9979, upload-time = "2022-08-14T12:40:09.779Z" }, +] + +[[package]] +name = "more-itertools" +version = "11.1.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/de/1d/f4da6f02cdffe04d6362210b807146a26044c88d839208aec273bb0d9184/more_itertools-11.1.0.tar.gz", hash = "sha256:48e8f4d9e7e5878571ecf6f2b4e57634f93cd474cc8cfbd2376f2d11b396e30d", size = 145772, upload-time = "2026-05-22T14:14:29.909Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/e8/3d/1087453384dbde46a8c7f9356eead2c58be8a7bf156bca40243377c85715/more_itertools-11.1.0-py3-none-any.whl", hash = "sha256:4b65538ae22f6fed0ce4874efd317463a7489796a0939fa66824dd542125a192", size = 72226, upload-time = "2026-05-22T14:14:28.824Z" }, +] + +[[package]] +name = "openapi-pydantic" +version = "0.6.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "pydantic" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/2b/32/0c9bd3e4e847cd6117b64dbef4cf810faa9cdbd6689323b811569cc8a1b8/openapi_pydantic-0.6.0.tar.gz", hash = "sha256:11f3ac6ad41521fc156381ec587246b0c0ecea523bd9565ed74d3e7fac9d91cd", size = 1667049, upload-time = "2026-10-02T12:20:00.508Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/31/57/9d3eb823a03c33e9d4c810e6a3276e3a6dc820a7fdc0961db2c04e613817/openapi_pydantic-0.6.0-py3-none-any.whl", hash = "sha256:8bd6d548a250da37db96f461bcd52b3468e8834ad7d6db14b00a6b2ebbd163a3", size = 96931, upload-time = "2026-10-02T12:19:58.917Z" }, +] + +[[package]] +name = "opentelemetry-api" +version = "1.45.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "typing-extensions" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/1f/dc/e12c1fe1ed8a7b7149777127b1a0e12ce5bd5a81d97408bedc2128c260f5/opentelemetry_api-1.45.0.tar.gz", hash = "sha256:711ede81773c8025c2c03dac0450bc89f3d30aea6eabcc815c570d4e35a963f7", size = 72115, upload-time = "2026-09-25T12:32:28.399Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/44/b9/040d1a1c7836922828e6480cd2366bb8fe0ebf75b413d2bb51a9b0e7f78f/opentelemetry_api-1.45.0-py3-none-any.whl", hash = "sha256:80e068aba7cd56c8b58512d6a36f8d25cb1dfaa0c0a4cc1c938ccf9f362d9cb3", size = 60020, upload-time = "2026-09-25T12:32:03.192Z" }, +] + +[[package]] +name = "packaging" +version = "26.3" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/7d/fa/3944b40b07da9ce895c0e6303a5ab7d53da063554f534556b134a54d6093/packaging-26.3.tar.gz", hash = "sha256:94edc256424af38762eb31306eed28beb9f0efc50a8837492c9d6fd6004aed79", size = 313412, upload-time = "2026-08-04T18:15:28.737Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/63/34/ba1c580383c9eada3711951fef0795c80b829a078d72188184bcab9dd527/packaging-26.3-py3-none-any.whl", hash = "sha256:d7193f7c8e4e93f444fde0262bf90af30e16fa0ad0ad44cb553c87339b23cd1c", size = 129956, upload-time = "2026-08-04T18:15:27.159Z" }, +] + +[[package]] +name = "pathable" +version = "0.6.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/66/f3/5a20387de9bcd0607871bfc2198ee0e15836da7baa4592ccd7f24c27c986/pathable-0.6.0.tar.gz", hash = "sha256:6404b8b82aef5ff0fd478934137128b99b12212ba35afdde5525ca4f8388ea58", size = 18970, upload-time = "2026-05-19T18:15:11.911Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/a2/e8/6d75ffd9784bce2e93d1ae4415649427e39a53bb172d4672b2b59c6f0a7b/pathable-0.6.0-py3-none-any.whl", hash = "sha256:82c4ca6c98c502ad12e0d4e9779b6210afee93c38990988c8c5d1b49bdcdf566", size = 18983, upload-time = "2026-05-19T18:15:10.728Z" }, +] + +[[package]] +name = "platformdirs" +version = "4.12.3" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/42/23/4a86fc741c38c5b69792a4ef954b281afa69bea9f083f881de1b0d23bc07/platformdirs-4.12.3.tar.gz", hash = "sha256:427fc0bb321ae0c5b037fa03238ca74820437be162e78b4848c4d4055b9b766c", size = 59538, upload-time = "2026-10-03T23:40:46.595Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/c5/9b/6ce1ead737fe496611bda600c263b9a11ae7bd8f41bb13f9bd7e0a2c37a4/platformdirs-4.12.3-py3-none-any.whl", hash = "sha256:080f3b39423b5abfca9a23d84c4e9795f54d395cd8459867a8ded44084fcd5f8", size = 32493, upload-time = "2026-10-03T23:40:45.104Z" }, +] + +[[package]] +name = "pluggy" +version = "1.6.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/f9/e2/3e91f31a7d2b083fe6ef3fa267035b518369d9511ffab804f839851d2779/pluggy-1.6.0.tar.gz", hash = "sha256:7dcc130b76258d33b90f61b658791dede3486c3e6bfb003ee5c9bfb396dd22f3", size = 69412, upload-time = "2025-05-15T12:30:07.975Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/54/20/4d324d65cc6d9205fabedc306948156824eb9f0ee1633355a8f7ec5c66bf/pluggy-1.6.0-py3-none-any.whl", hash = "sha256:e920276dd6813095e9377c0bc5566d94c932c33b27a3e3945d8389c374dd4746", size = 20538, upload-time = "2025-05-15T12:30:06.134Z" }, +] + +[[package]] +name = "py-key-value-aio" +version = "0.4.6" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "beartype" }, + { name = "typing-extensions" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/ca/99/c346e3474853801ec5ecf4c3ee60cfc6060327ebc31424df4e346620dde4/py_key_value_aio-0.4.6.tar.gz", hash = "sha256:267c03c3e24cb99d3097612f8a5cfd8e11785c6a2975e272db0e303ea1850bfd", size = 112876, upload-time = "2026-09-18T15:29:52.002Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/9a/46/12871550fb0613d149144bb9d41f22680d5f46717bc45a76eb5798c20c3f/py_key_value_aio-0.4.6-py3-none-any.whl", hash = "sha256:820b30c7959fc738ea3d00160cdb10cd258f51e38737b2add530defeea1ded77", size = 171289, upload-time = "2026-09-18T15:29:50.665Z" }, +] + +[package.optional-dependencies] +filetree = [ + { name = "aiofile" }, + { name = "anyio" }, +] +keyring = [ + { name = "keyring" }, +] +memory = [ + { name = "cachetools" }, +] + +[[package]] +name = "pycparser" +version = "3.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/1b/7d/92392ff7815c21062bea51aa7b87d45576f649f16458d78b7cf94b9ab2e6/pycparser-3.0.tar.gz", hash = "sha256:600f49d217304a5902ac3c37e1281c9fe94e4d0489de643a9504c5cdfdfc6b29", size = 103492, upload-time = "2026-01-21T14:26:51.89Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/0c/c3/44f3fbbfa403ea2a7c779186dc20772604442dde72947e7d01069cbe98e3/pycparser-3.0-py3-none-any.whl", hash = "sha256:b727414169a36b7d524c1c3e31839a521725078d7b2ff038656844266160a992", size = 48172, upload-time = "2026-01-21T14:26:50.693Z" }, +] + +[[package]] +name = "pydantic" +version = "2.13.5" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "annotated-types" }, + { name = "pydantic-core" }, + { name = "typing-extensions" }, + { name = "typing-inspection" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/53/ef/fc4f868f4e2cee79f863883abffceff107875f569b848507319842d2a681/pydantic-2.13.5.tar.gz", hash = "sha256:51a9c5f7b2f8e636f04c6cada605d9b6a3bf1348fdf945a3d8869b19bba0ee08", size = 845750, upload-time = "2026-08-28T14:04:00.916Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/eb/47/c95ffc2009878c7aac0c5e08528022dcb885933252a88b5f170058014464/pydantic-2.13.5-py3-none-any.whl", hash = "sha256:346a034f080da3755d8e9cb5e00e8b07de1d39e4f6e2c87d8ab7cafa0b269a73", size = 472589, upload-time = "2026-08-28T14:03:59.136Z" }, +] + +[package.optional-dependencies] +email = [ + { name = "email-validator" }, +] + +[[package]] +name = "pydantic-core" +version = "2.46.5" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "typing-extensions" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/af/f9/8a06bea35ef8daf588f707784c973a7046e0034c8d8cfb08828eeffb8b75/pydantic_core-2.46.5.tar.gz", hash = "sha256:10416c15b8839ecc4ef4d0885da76da6fd0f67333a0eb8aff6d93c4b8f2910fc", size = 472262, upload-time = "2026-08-28T10:01:31.677Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/82/3f/76358795aa7a8c6d4f36e2cb828ad1c90ee118e1393a9281664f5aade9d4/pydantic_core-2.46.5-cp312-cp312-macosx_10_12_x86_64.whl", hash = "sha256:b9fe6fb92520e3fd61f2e49000b6911b188824f089b75973ea06d6267f0b476d", size = 2076516, upload-time = "2026-08-28T09:58:21.576Z" }, + { url = "https://files.pythonhosted.org/packages/db/50/26b091836076ce4cb2fac264186936acc069e0595772cfd02a563bc4761a/pydantic_core-2.46.5-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:a39ac25a9a2fa4072efdb429833c4a4c8009a51ff9eea3eeae131713cd27991e", size = 1922874, upload-time = "2026-08-28T09:58:23.766Z" }, + { url = "https://files.pythonhosted.org/packages/09/f0/2a8ce3849e299d44e2d2c196b6082643a3235565a735cb51db7a6261f614/pydantic_core-2.46.5-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4fdc8b93a41521988916eeaa271173fcca7fa0803d62f87675aac8dcec1c8e29", size = 1951772, upload-time = "2026-08-28T09:58:25.435Z" }, + { url = "https://files.pythonhosted.org/packages/87/46/ac0dc8bdd9e6048183a14eb127764e7ad9240021c17513074a4711b0e31e/pydantic_core-2.46.5-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:b98134087d9de723658d17a42c7d0da8d6e2ef08015dee7dc93889047315f5e4", size = 2031832, upload-time = "2026-08-28T09:58:27.102Z" }, + { url = "https://files.pythonhosted.org/packages/c4/c2/339de5bef7be36301a2231eaa52e62163742c2281f11b5f4892bc79785cd/pydantic_core-2.46.5-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:e652ab17569c94bff5475520f907b7148b8c24036a8ebbe5cf7cf7493d28579a", size = 2208645, upload-time = "2026-08-28T09:58:28.948Z" }, + { url = "https://files.pythonhosted.org/packages/7b/a0/9ff22b797724262da14427abaed4dd1d864a139693fc5e7809114376a716/pydantic_core-2.46.5-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:d925f3d9afd05a8c0fb3a1031463a8d59ebe5e2afad297e29c78be19e13b4e62", size = 2265935, upload-time = "2026-08-28T09:58:30.625Z" }, + { url = "https://files.pythonhosted.org/packages/c0/a4/eb9409ec0736e50aa70a412f16c204ed149516846912f7e6724d4c73ee53/pydantic_core-2.46.5-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0fc5be0abd4a407e200d844b404e33639a554e7bd0d448e7b9ae181be4789ac2", size = 2066284, upload-time = "2026-08-28T09:58:32.289Z" }, + { url = "https://files.pythonhosted.org/packages/c0/02/7f6156ffc926857f1c37c07d9a388682865a81830ab6a1b637082c25e399/pydantic_core-2.46.5-cp312-cp312-manylinux_2_31_riscv64.whl", hash = "sha256:816ff0a6550ffc06c098ccd2e0698600f9aa7da192a79eaa6f9af504a35db869", size = 2105889, upload-time = "2026-08-28T09:58:33.986Z" }, + { url = "https://files.pythonhosted.org/packages/92/b1/e781d357ebe09fc929f995700f1b3503e8897f1cece183ecb1300d4d67e9/pydantic_core-2.46.5-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:c7ea57fc63aa7da93a1bd2d644e6577befae10c52c4e36377635eea1056a74f5", size = 2158006, upload-time = "2026-08-28T09:58:35.647Z" }, + { url = "https://files.pythonhosted.org/packages/70/0a/644597d84ab400e50609c192120b85c9681c22d3a20461b9060a79be0a7a/pydantic_core-2.46.5-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:efd62a42486f1bda5d24cb4f63d15a3c7768375fe83d36f9417b4ad7a2fb20b3", size = 2158408, upload-time = "2026-08-28T09:58:37.38Z" }, + { url = "https://files.pythonhosted.org/packages/1e/ee/ca3b7b3a4b3769ffe9ce9432a7c9be755de9593a46d3b0d54d0409323e44/pydantic_core-2.46.5-cp312-cp312-musllinux_1_1_armv7l.whl", hash = "sha256:2bc9419666990c06d7397831f2126a1ecc3594aaa3ff7de5bf2d066802f4e07b", size = 2309609, upload-time = "2026-08-28T09:58:39.22Z" }, + { url = "https://files.pythonhosted.org/packages/ce/52/39fa1f451486019524ca685020390e7ca351832fd874530ba30c8628e6dc/pydantic_core-2.46.5-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:18a09e1e1011b462f2e32774f25859ef1223d5c2b0546a633cf56654710721e0", size = 2342618, upload-time = "2026-08-28T09:58:40.89Z" }, + { url = "https://files.pythonhosted.org/packages/81/5e/468fc630568c61dcef3cd47ad32ffbeed9af643f49208d1ea86ab4f890c4/pydantic_core-2.46.5-cp312-cp312-win32.whl", hash = "sha256:5cb482e9e84c851f4e623fe4acc1ced89168cf1fe18f7089db4548c8f5bbb65b", size = 1939475, upload-time = "2026-08-28T09:58:42.591Z" }, + { url = "https://files.pythonhosted.org/packages/cf/c9/4c19f41b84cf6b622a72fbeed7665b25d47a187d68d47d0d430c07f23268/pydantic_core-2.46.5-cp312-cp312-win_amd64.whl", hash = "sha256:5e81740c09e310f5aa5cbd3e434a01c154d4bef93241c7877b39f211d2b78ba8", size = 2043140, upload-time = "2026-08-28T09:58:44.272Z" }, + { url = "https://files.pythonhosted.org/packages/af/dd/0c1a050299147c746e5256db16d645ab5efd4f78c59937d581a0524e74a2/pydantic_core-2.46.5-cp312-cp312-win_arm64.whl", hash = "sha256:f7b0ec93a2893de856652154d73b7ba622f26fa97726487dcac373de5f4c6084", size = 1997729, upload-time = "2026-08-28T09:58:46.13Z" }, + { url = "https://files.pythonhosted.org/packages/f5/37/5abe39a8372a61d3dc3c1338fc504281c01b32fdb3169cd7187153b56d3e/pydantic_core-2.46.5-cp313-cp313-macosx_10_12_x86_64.whl", hash = "sha256:b7ca9034437b6022f941f4857459562ee00a560b97e7cce8a0ec5a74fc6766e0", size = 2075885, upload-time = "2026-08-28T09:58:47.856Z" }, + { url = "https://files.pythonhosted.org/packages/21/43/6323b1f8b217780454c61304bcd2b38ae4762f50754414124603ccc90bb2/pydantic_core-2.46.5-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:f332f0e72a5a0400141f830744e141bf9f97917878dbe968669e8a7fefea78ff", size = 1922768, upload-time = "2026-08-28T09:58:49.58Z" }, + { url = "https://files.pythonhosted.org/packages/0f/a3/c05ca796e1197618a774b01e596aeedfefc2f7d8c01ae3054e910b120e8a/pydantic_core-2.46.5-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:193375f3548919d3f0b60936ca113ada3e38f264f91b9b8e0508efaad57be931", size = 1951241, upload-time = "2026-08-28T09:58:51.511Z" }, + { url = "https://files.pythonhosted.org/packages/68/32/33bc39ac705c52cffc908e8389f9754fdb208aea5c69cceddf4eb3ce99af/pydantic_core-2.46.5-cp313-cp313-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:79bdfa52f843137045b2d081cc05c120ba6665d29b7559c2c47690906f39279f", size = 2031975, upload-time = "2026-08-28T09:58:53.166Z" }, + { url = "https://files.pythonhosted.org/packages/b0/70/2333e885c0f6a67bc105c5916965dac9b57f2718ee20d81d1a06a4ebdc13/pydantic_core-2.46.5-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:24922243639cbdac66c75fcb6fd6495a9cb52b213d62f9a0d16f0310b1ff8038", size = 2208542, upload-time = "2026-08-28T09:58:55.017Z" }, + { url = "https://files.pythonhosted.org/packages/f7/ea/296debfb4264207bbda5936133892e027c0a58875ad53ebd512fba8ec3a2/pydantic_core-2.46.5-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:c76fe65e607be28c7fd4d56fc3c42b1583aa058ce3408b7ad0fd540171d31f9f", size = 2264692, upload-time = "2026-08-28T09:58:56.767Z" }, + { url = "https://files.pythonhosted.org/packages/d3/f2/9e4de77a6271e07a76d2d58b11c091a979c191ed2939bf80067568b369d2/pydantic_core-2.46.5-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6f7b393a8b3da82f5c1fc0751e6d01ac6c55b93c18226a60bdfba4a724efafd1", size = 2066633, upload-time = "2026-08-28T09:58:58.531Z" }, + { url = "https://files.pythonhosted.org/packages/8d/db/f9e9d0c97445987b2084823d5c240de88087338f04fc2cfaa2df186b8049/pydantic_core-2.46.5-cp313-cp313-manylinux_2_31_riscv64.whl", hash = "sha256:7ac031912d54f3d83ef3b3eb98dfabc1608802e2202263d25957eeed40b94761", size = 2105235, upload-time = "2026-08-28T09:59:00.421Z" }, + { url = "https://files.pythonhosted.org/packages/07/c5/79169b047b3b2c3e99e04bc76372af9637e0bf6db638274fa927df96369e/pydantic_core-2.46.5-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:837b396ca3d7b74091ca623f6cbd8351bd42d670a79c2683e79fb089f06a2de5", size = 2157367, upload-time = "2026-08-28T09:59:02.442Z" }, + { url = "https://files.pythonhosted.org/packages/26/b5/ba6057afb7c291bd449f51b867f95aef2072941c4ce4e5c31d6ffd132d3b/pydantic_core-2.46.5-cp313-cp313-musllinux_1_1_aarch64.whl", hash = "sha256:5ee239d575f80b08eca11f6e20f90c4c695de7825c67eefe6091fbf20dda648e", size = 2158420, upload-time = "2026-08-28T09:59:04.2Z" }, + { url = "https://files.pythonhosted.org/packages/6e/28/2057abecaafdc22912afa819603a51f0a62d40643b7c4871c51721fea9be/pydantic_core-2.46.5-cp313-cp313-musllinux_1_1_armv7l.whl", hash = "sha256:e80675d75ae2cd14372cb65cad5400d9347a3d3f6c13000183f22dfd027283ed", size = 2309588, upload-time = "2026-08-28T09:59:06.048Z" }, + { url = "https://files.pythonhosted.org/packages/71/9d/881156dc404e27479c4246128d73538464cab4a239bec61995e227644c30/pydantic_core-2.46.5-cp313-cp313-musllinux_1_1_x86_64.whl", hash = "sha256:9c4b71f10dd532fb7a5cbc8f58707779e64f03a258c2bf8bfbaecfcd9970b519", size = 2341866, upload-time = "2026-08-28T09:59:08.539Z" }, + { url = "https://files.pythonhosted.org/packages/5a/38/d66f443a259f84d13babdceae568e572b0ed26da17ca5d0a649ebb110a67/pydantic_core-2.46.5-cp313-cp313-win32.whl", hash = "sha256:97bf8de4d541598c94a59344eeb988a94c08ff76b5723c41f6567ec18c7892ea", size = 1938580, upload-time = "2026-08-28T09:59:10.402Z" }, + { url = "https://files.pythonhosted.org/packages/2c/1e/1d5371213f4cc9a7ed70c0bfcc7911de22311ee99a662a56077d7292d2ac/pydantic_core-2.46.5-cp313-cp313-win_amd64.whl", hash = "sha256:15f4a94963c95accac15b7b657bb177d3ad82bb90b0d0526d9a9b85079925db5", size = 2041980, upload-time = "2026-08-28T09:59:12.396Z" }, + { url = "https://files.pythonhosted.org/packages/5a/48/4222d90b1c67568bace4dec6dca6271449c66de3595d72b6d098f5fde597/pydantic_core-2.46.5-cp313-cp313-win_arm64.whl", hash = "sha256:d22a945598fb91236b4dd793a6e42e4f3dd7740bb5aace5ebd7d4c08d13bb575", size = 1997213, upload-time = "2026-08-28T09:59:14.245Z" }, + { url = "https://files.pythonhosted.org/packages/8e/8a/14596f2a8367da50cf7cbac48169ee5d9c8e11d486a3b527082384630c72/pydantic_core-2.46.5-cp314-cp314-macosx_10_12_x86_64.whl", hash = "sha256:c1c43ad4339643d70ebb8124e1305a7dab423001eff58bb41a0f731adbc98355", size = 2074081, upload-time = "2026-08-28T09:59:16.141Z" }, + { url = "https://files.pythonhosted.org/packages/ae/d5/d8a4eb6d6c7f66b91dd37c576d76e9e60fba900caf5372c17bcf949febc2/pydantic_core-2.46.5-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:1a353f84de772f423b5ffb11d7ae352fbbef0f446f3c0b0af0f8236d7233606e", size = 1920497, upload-time = "2026-08-28T09:59:18.065Z" }, + { url = "https://files.pythonhosted.org/packages/8e/26/092079428f86e927e030b2c0ced87df69dbb1c875cdeaa67bf42ea2be746/pydantic_core-2.46.5-cp314-cp314-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5086029a57366b8cf81b130a43908738095c270c21a8d7f0e8bdfdb89718e2f3", size = 1952130, upload-time = "2026-08-28T09:59:20.476Z" }, + { url = "https://files.pythonhosted.org/packages/08/c3/8ec0e290a9ebaebd64047bf5fda94be835c6b1551b02437e4b76778fbcd7/pydantic_core-2.46.5-cp314-cp314-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:46c25dda9d092a06c08db76ffe0a197107904d0dfac653f7d5306bbcd6d6119c", size = 2026371, upload-time = "2026-08-28T09:59:22.227Z" }, + { url = "https://files.pythonhosted.org/packages/01/72/4fd20ad520fb8da0157f95b27a7eb05a72790ef08138e7701ac972c342ea/pydantic_core-2.46.5-cp314-cp314-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:37ea7b83c935e5b0d68c9449b82651accf78a10828b2c02b2f2d9e9496446c21", size = 2202822, upload-time = "2026-08-28T09:59:24.277Z" }, + { url = "https://files.pythonhosted.org/packages/31/b0/d16e0771206b29314f0d52198b720be21e8a99ab2bf11e3bc0d7c9cebdff/pydantic_core-2.46.5-cp314-cp314-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:e64e88d5585bea9ce95861079de72006c7fa6d3df4e3a3b65ba31eb979c15c9f", size = 2262756, upload-time = "2026-08-28T09:59:26.608Z" }, + { url = "https://files.pythonhosted.org/packages/2c/9b/59634b7ac631c63b2a37760eb6943af3e29573d6b59a4abc5e7f019d4cee/pydantic_core-2.46.5-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:54d510bac3ee52247af28ed4bb18a1e799f040ac60fd2bf5ccd4c92f1fbe786f", size = 2068352, upload-time = "2026-08-28T09:59:29.044Z" }, + { url = "https://files.pythonhosted.org/packages/08/7c/570abb1ad2155348dc754ea91be22e5aaa18eb6d69a6068f7c6f2679a6ed/pydantic_core-2.46.5-cp314-cp314-manylinux_2_31_riscv64.whl", hash = "sha256:a2a5e1d0ff29adddc9f6d6821a66302e4493f8ca898b715b6b1182c2c201ea0a", size = 2104777, upload-time = "2026-08-28T09:59:30.95Z" }, + { url = "https://files.pythonhosted.org/packages/8e/25/5bf74adc65a1ac5b7be3f6cb0bcb5433615c1598a801c19d830d84c98ded/pydantic_core-2.46.5-cp314-cp314-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:03b9666e41e35d8909852ba191a0607520f81b74eaf12ccf8737005dbb313821", size = 2156312, upload-time = "2026-08-28T09:59:32.604Z" }, + { url = "https://files.pythonhosted.org/packages/90/6a/2ef38830675e050121040618135564ed56b860b45433b02d9b4ebece46f3/pydantic_core-2.46.5-cp314-cp314-musllinux_1_1_aarch64.whl", hash = "sha256:a91c17edf6eea2402cb5457b4c89e99bc5ed1004aa34c4adf1d4258c1a5c22c2", size = 2150067, upload-time = "2026-08-28T09:59:34.453Z" }, + { url = "https://files.pythonhosted.org/packages/90/ef/a7dbb03a14a64c2a4621f989c615ed9a892535a6cad938fc27079f919d80/pydantic_core-2.46.5-cp314-cp314-musllinux_1_1_armv7l.whl", hash = "sha256:b49924c73a235e969511bf2aabdff3beebf9820931f646c80274d5d780010c47", size = 2304516, upload-time = "2026-08-28T09:59:36.194Z" }, + { url = "https://files.pythonhosted.org/packages/68/f8/6bb4c4b80e8a6fde1904c64a51c62a1d04fcdfa3ea521a66b2ddefa1d885/pydantic_core-2.46.5-cp314-cp314-musllinux_1_1_x86_64.whl", hash = "sha256:2cbd9a5eff05e51c447c34dfa4632145b26b09120cf04bd0c871e44c1a5e1c9a", size = 2335223, upload-time = "2026-08-28T09:59:37.931Z" }, + { url = "https://files.pythonhosted.org/packages/2a/80/f46b8c681195190b2c1f1c7c0a81abce60663e987613e09ef64d433dd96b/pydantic_core-2.46.5-cp314-cp314-win32.whl", hash = "sha256:2d5d76654becf5efd62c9e51c3756c67b49498b0c9a40884934c40807adbd074", size = 1934827, upload-time = "2026-08-28T09:59:39.836Z" }, + { url = "https://files.pythonhosted.org/packages/f7/3c/60674207246bc0a4009d2391b7c7251c7159f279c8d2ab8aae8ef46f3dee/pydantic_core-2.46.5-cp314-cp314-win_amd64.whl", hash = "sha256:fa10ef4112775900e7a0661068635eb67b2ab824fbde764de6e0e21982a93db0", size = 2042648, upload-time = "2026-08-28T09:59:41.792Z" }, + { url = "https://files.pythonhosted.org/packages/69/0c/117c562c7c1babdf44576b72a5e496906506c93690387ecfbca7c729ae2e/pydantic_core-2.46.5-cp314-cp314-win_arm64.whl", hash = "sha256:045ab3b6d308439e32b81cc173bba5b9018bc6ed896afd0c65b3b009b1699af5", size = 1989652, upload-time = "2026-08-28T09:59:43.702Z" }, + { url = "https://files.pythonhosted.org/packages/e8/66/9336ae58f9eb68c41d121894e52c4c89eccb07eb8f602a04ee9c3f37736a/pydantic_core-2.46.5-cp314-cp314t-macosx_10_12_x86_64.whl", hash = "sha256:8816f3d218beb4b787de5c9759c259b8fa61f9dec42dc7811f320a33771778b7", size = 2065829, upload-time = "2026-08-28T09:59:45.364Z" }, + { url = "https://files.pythonhosted.org/packages/c5/02/bc19b47a96c2d3109760711acf22369e56bd7e405ca52f7ade164d2ead57/pydantic_core-2.46.5-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:bce57638e08ac148e5778cce7feb968307a727d66f8e2274a543d0cf0c9ad6a3", size = 1905716, upload-time = "2026-08-28T09:59:47.18Z" }, + { url = "https://files.pythonhosted.org/packages/52/a4/70b47c0509923dd98ccfed04fb3e32ea3849c82a0ff2205bb41009b43c00/pydantic_core-2.46.5-cp314-cp314t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:976e1128455aa595ea04c79ccfedff1aaeab96ee013fcc916bed120c4f0ad94f", size = 1934216, upload-time = "2026-08-28T09:59:49.241Z" }, + { url = "https://files.pythonhosted.org/packages/52/ab/aa03b65f7bb198585edf806b906c3223ecf1795543e39e23aec4cce27ad2/pydantic_core-2.46.5-cp314-cp314t-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:e7b891faeedeafba41b2983e5001a81b6a915b69544c7e7570d1989ce1c36ac7", size = 2010635, upload-time = "2026-08-28T09:59:51.692Z" }, + { url = "https://files.pythonhosted.org/packages/3c/8b/0da06343f30b84ec549aafd309c6456223d5dc8bd36af504c573faad561d/pydantic_core-2.46.5-cp314-cp314t-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:5f194189415698233dd1114a093a9b56e61e2c57e11b469be3b0506f46f0771c", size = 2209369, upload-time = "2026-08-28T09:59:53.582Z" }, + { url = "https://files.pythonhosted.org/packages/d6/5b/844c4defaa34a3df66eb9257087d121d70c201298b96abdf9f492fc2f1bf/pydantic_core-2.46.5-cp314-cp314t-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:82a36973cf8a2ef5406f4fe2edbf8ed0c99629535d959e0b100c76a32535a111", size = 2253238, upload-time = "2026-08-28T09:59:55.484Z" }, + { url = "https://files.pythonhosted.org/packages/f4/64/a4e536cb16d7f61a7fd3120b46c577fc7fa7325992f69c4f52bc786d77d8/pydantic_core-2.46.5-cp314-cp314t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:cdbb78909f52b981d3b2d56b97328d71eb0b974c36bd77c920123a7ebb192829", size = 2065740, upload-time = "2026-08-28T09:59:58.038Z" }, + { url = "https://files.pythonhosted.org/packages/5f/75/aaa38c6bc2d085f6605b34eabdc6a8a4e0b2e61fc9c8e6e52b28e97b3125/pydantic_core-2.46.5-cp314-cp314t-manylinux_2_31_riscv64.whl", hash = "sha256:52e24eacdb536cade636aa90fb851835222becff8484b7001fdc78cb0290f2aa", size = 2087425, upload-time = "2026-08-28T09:59:59.898Z" }, + { url = "https://files.pythonhosted.org/packages/55/ae/fcab4cfc39aba3689e1d20c8b5250ad280957022c09af2ed9cd585602a5e/pydantic_core-2.46.5-cp314-cp314t-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:37ae34309d7bd8c0d61ab839668058f2a7962ea1fc51d105d2db228fe0618034", size = 2139306, upload-time = "2026-08-28T10:00:03.057Z" }, + { url = "https://files.pythonhosted.org/packages/2d/f4/f1d03a4bc9d9acbc62f4d742b8a319af52f71885079868b2ff8e48a651ee/pydantic_core-2.46.5-cp314-cp314t-musllinux_1_1_aarch64.whl", hash = "sha256:0cdbada856a1c69a7624a64d3d9aefe79300bd6ef827b43a4f265010b9b55184", size = 2144589, upload-time = "2026-08-28T10:00:05.645Z" }, + { url = "https://files.pythonhosted.org/packages/83/f3/7a53bb1356de514a4cd295f25b6ac39237895620c0462d2592b76c16e114/pydantic_core-2.46.5-cp314-cp314t-musllinux_1_1_armv7l.whl", hash = "sha256:545f26c504b27c3758439a5e6d9349931f0a04f855668d5fe323c89e82300a38", size = 2288882, upload-time = "2026-08-28T10:00:07.931Z" }, + { url = "https://files.pythonhosted.org/packages/cd/94/5a81583660c175c59d49ffb09f4b3a44debeaf86a19fca664ae1cdd9ee32/pydantic_core-2.46.5-cp314-cp314t-musllinux_1_1_x86_64.whl", hash = "sha256:ff218293c9c806138dca139765e3b067621be52bcd93cdc14c7711be7ddc90a9", size = 2335210, upload-time = "2026-08-28T10:00:10.177Z" }, + { url = "https://files.pythonhosted.org/packages/5a/9f/5d685c2693b972d1a59c998586e8823712b66603aeff47ee60a4bdaafd37/pydantic_core-2.46.5-cp314-cp314t-win32.whl", hash = "sha256:97cf3eb53a8cccacf9d46686a0926186c9bfb5574f2ed66d3639d5fe117cd3a9", size = 1921180, upload-time = "2026-08-28T10:00:12.35Z" }, + { url = "https://files.pythonhosted.org/packages/70/12/5c94ee16d65a37a15f9e869f5e6256df111154491173801a4c5e800ab548/pydantic_core-2.46.5-cp314-cp314t-win_amd64.whl", hash = "sha256:d2f9fc07a8042a8f95925b35c4f04f469707c981fc33245b6ca187cf5d2dd290", size = 2020515, upload-time = "2026-08-28T10:00:14.774Z" }, + { url = "https://files.pythonhosted.org/packages/63/19/67830dda664e6bdf9285ee2e40f355d0d7d6b92aa0c42e8d217bb8d33d36/pydantic_core-2.46.5-cp314-cp314t-win_arm64.whl", hash = "sha256:acf8a67ba51f4ca9ddbd0e6b3000a65ac51ab734661778b3e7ba64d99a710f2f", size = 1989276, upload-time = "2026-08-28T10:00:16.984Z" }, + { url = "https://files.pythonhosted.org/packages/df/dd/053c2e4303f791f3b8f8a14ab0b22008e8eb21d868c0c90b4f9be705b76a/pydantic_core-2.46.5-graalpy312-graalpy250_312_native-macosx_10_12_x86_64.whl", hash = "sha256:013d6f3483d81e02e7c328831808f336c8596ee33b4bd4026b9ffb1e960b8942", size = 2062540, upload-time = "2026-08-28T10:01:00.318Z" }, + { url = "https://files.pythonhosted.org/packages/d7/dd/a18df751a5e37dd51bfad7f68e766999125bebe68c9e1d10a493ad01bd63/pydantic_core-2.46.5-graalpy312-graalpy250_312_native-macosx_11_0_arm64.whl", hash = "sha256:e9c134bb666dd54b778b9fc0d2b50cbb7f979b9e3716f26a88c9ab3b6fc1dd0f", size = 1902040, upload-time = "2026-08-28T10:01:02.529Z" }, + { url = "https://files.pythonhosted.org/packages/b7/13/01d40f9d07ce8a779fd6e0bd8ad4fba91309500dd67b869e2e219d261a6d/pydantic_core-2.46.5-graalpy312-graalpy250_312_native-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:347ec774390c87326a2e4929d58d3f7e8763a104d5d35f4cd595a4c952366433", size = 1967479, upload-time = "2026-08-28T10:01:05.004Z" }, + { url = "https://files.pythonhosted.org/packages/fa/04/c81d4841331c2178b6fb09ae225425e110ed72d990c9fe556c4ec03d1013/pydantic_core-2.46.5-graalpy312-graalpy250_312_native-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8e24d8f05fa2d28513d94e877e9c75ad66175376209b3977f916e240e623193c", size = 2111034, upload-time = "2026-08-28T10:01:07.345Z" }, +] + +[[package]] +name = "pydantic-settings" +version = "2.15.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "pydantic" }, + { name = "python-dotenv" }, + { name = "typing-inspection" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/68/ca/31c57507b13119d7d3cfa1576dad2911a4861e3be07b579395f4e9d393f9/pydantic_settings-2.15.0.tar.gz", hash = "sha256:694b793e84f766ba76a90ebdefc01d0a9a045dab0382bee70393da93712ad117", size = 261253, upload-time = "2026-08-07T09:24:57.419Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/30/a4/2bffa9f8e804325a09867f0e9d30795c80ea9f8d62560bd1b6ad6220eb2f/pydantic_settings-2.15.0-py3-none-any.whl", hash = "sha256:0ba092c291c94baceb5eff768aa0d56400a457585bc0175925a5a5510303da42", size = 69413, upload-time = "2026-08-07T09:24:55.839Z" }, +] + +[[package]] +name = "pygments" +version = "2.21.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/49/2e/ced460408999b33da6b31b0021b0f37d329e202d4169aeb164493778f25b/pygments-2.21.0.tar.gz", hash = "sha256:610ca751c9bc2492b38eb9a38a7fbc93edbbb2d7182edaf34e66ae493dee5c8c", size = 5005329, upload-time = "2026-08-17T08:02:48.824Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/71/46/17f022dd3e953bf20a04a028a21ec746d942f8d2af30fa0f124fa0e6a684/pygments-2.21.0-py3-none-any.whl", hash = "sha256:2363c69b61c4a97c838da3b130dcd6468f4848992b21a82f2a63ec34377137d9", size = 1250147, upload-time = "2026-08-17T08:02:44.912Z" }, +] + +[[package]] +name = "pyjwt" +version = "2.15.1" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/43/ea/5194e52748b0da83d71e082d75496eaec6e58f419f5e184786ded517e6a9/pyjwt-2.15.1.tar.gz", hash = "sha256:4f259e80cdfb6b3fc18a7de51fd1ef9ec79652f25019bae68975ca2468a34df8", size = 121252, upload-time = "2026-09-28T18:40:42.598Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/50/ca/44de4e75f8aadc457f0634be3b542815078ded46dca30efb960edeecad6e/pyjwt-2.15.1-py3-none-any.whl", hash = "sha256:42d59d631f7768a1028a64c7ff581a9bf7519804daf91fc5b6c56e30eec5e193", size = 33860, upload-time = "2026-09-28T18:40:41.429Z" }, +] + +[package.optional-dependencies] +crypto = [ + { name = "cryptography" }, +] + +[[package]] +name = "pyperclip" +version = "1.11.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/e8/52/d87eba7cb129b81563019d1679026e7a112ef76855d6159d24754dbd2a51/pyperclip-1.11.0.tar.gz", hash = "sha256:244035963e4428530d9e3a6101a1ef97209c6825edab1567beac148ccc1db1b6", size = 12185, upload-time = "2025-09-26T14:40:37.245Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/df/80/fc9d01d5ed37ba4c42ca2b55b4339ae6e200b456be3a1aaddf4a9fa99b8c/pyperclip-1.11.0-py3-none-any.whl", hash = "sha256:299403e9ff44581cb9ba2ffeed69c7aa96a008622ad0c46cb575ca75b5b84273", size = 11063, upload-time = "2025-09-26T14:40:36.069Z" }, +] + +[[package]] +name = "pytest" +version = "9.1.1" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "colorama", marker = "sys_platform == 'win32'" }, + { name = "iniconfig" }, + { name = "packaging" }, + { name = "pluggy" }, + { name = "pygments" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/e4/47/b9efed96c114afcfa3c9d3fe98a76a1d14c74a9e266d397cf6eb64be5e01/pytest-9.1.1.tar.gz", hash = "sha256:1088fbde8f2b49d95a549a195707afa7a76a3ce9bcadc26b6d71f0ffda5fe313", size = 1636369, upload-time = "2026-06-19T10:58:32.857Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/24/25/1de2678b631f5a49215c6c96fff41ba892b0a34df68d6d80292b1b48aa7f/pytest-9.1.1-py3-none-any.whl", hash = "sha256:37a86b45efb9a47a61a36449063e8e18d0cab3161329fc099eb21783169c4f0c", size = 386536, upload-time = "2026-06-19T10:58:31.347Z" }, +] + +[[package]] +name = "pytest-asyncio" +version = "1.4.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "pytest" }, + { name = "typing-extensions", marker = "python_full_version < '3.13'" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/43/7c/d36d04db312ecf4298932ef77e6e4a9e8ad017906e24e34f0b0c361a2473/pytest_asyncio-1.4.0.tar.gz", hash = "sha256:c6c0d2259945122819f171a32ecea2c349ead889ee28176caaf492143424be42", size = 58514, upload-time = "2026-05-26T09:56:04.083Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/03/e2/08a497ef684b88559c9cc5f4ad53a37e7b99e727094a86d6ea32536d5d3c/pytest_asyncio-1.4.0-py3-none-any.whl", hash = "sha256:933ca923a23075a87fb7070c0ec272a6848489824d887c85c812670932835aa1", size = 16930, upload-time = "2026-05-26T09:56:02.576Z" }, +] + +[[package]] +name = "python-dotenv" +version = "1.2.4" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/74/26/2fbeedb218a787a5eea551c7532cac4e009f83d689dd2faa0d0353473f86/python_dotenv-1.2.4.tar.gz", hash = "sha256:f0d53e69935a851c0dcc78f3ab7aaccd8cabef0b92382b576b824212902873c0", size = 60824, upload-time = "2026-10-01T05:36:10Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/60/d1/38f3a3405989a89ac18390803e70c6ad7c7760da4f9b83cbeca0c44a0c72/python_dotenv-1.2.4-py3-none-any.whl", hash = "sha256:42269a8a5b3fd54ffa6f3d84b18abed50064717576b4ecf03dc4a55d8aa04fdc", size = 23266, upload-time = "2026-10-01T05:36:08.633Z" }, +] + +[[package]] +name = "python-multipart" +version = "0.0.32" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/5b/42/55c32bb9b12693c092ad250a0e82edb5b31ddeda6eb772de5f308b3804ad/python_multipart-0.0.32.tar.gz", hash = "sha256:be54b7f3fa167bb83e4fcd936b887b708f4e57fe75911c02aebf53efaf8d938e", size = 46881, upload-time = "2026-06-04T16:18:58.647Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/e1/04/e8135ebd1ad02c56ec633277529b2602ff99ff634be76cdba5744cf554fd/python_multipart-0.0.32-py3-none-any.whl", hash = "sha256:ff6d3f776f16878c894e52e107296ffc890e913c611b1a4ec6c44e2821fe2e23", size = 30042, upload-time = "2026-06-04T16:18:57.319Z" }, +] + +[[package]] +name = "pywin32" +version = "312" +source = { registry = "https://pypi.org/simple" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/83/ff/32aa7d2ed0ab12b323aaa64f9b75e6ad4f8fd09f9ccfc28c79414d46838d/pywin32-312-cp312-cp312-win32.whl", hash = "sha256:dab4f65ac9c4e48400a2a0530c46c3c579cd5905ecd11b80692373915269208b", size = 6371877, upload-time = "2026-06-04T07:49:28.836Z" }, + { url = "https://files.pythonhosted.org/packages/03/d9/77040d3b43df3f3be32ea289433d660d2727f5ba327bc73be835127d9d60/pywin32-312-cp312-cp312-win_amd64.whl", hash = "sha256:b457f6d628a47e8a7346ce22acb7e1a46a4a78b52e1d17e1af56871bd19a93bc", size = 6914841, upload-time = "2026-06-04T07:49:31.85Z" }, + { url = "https://files.pythonhosted.org/packages/e3/cc/7b1ec671775756020a0ee7f4feeaf3c568f0ab86bd3900088cf986937a92/pywin32-312-cp312-cp312-win_arm64.whl", hash = "sha256:6017c58e12f6809fbb0555b75df144c2922a9ffd18e4b9b5afa863b6c1a9d950", size = 6727901, upload-time = "2026-06-04T07:49:34.244Z" }, + { url = "https://files.pythonhosted.org/packages/2d/41/12fbfd7f36ed2146d8bc9de96c2741296bf0d490b98508496cff322e274c/pywin32-312-cp313-cp313-win32.whl", hash = "sha256:7a27df850933d16a8eabfbaeb73d52b273e2da667f80d70b01a89d1f6828d02c", size = 6370184, upload-time = "2026-06-04T07:49:36.253Z" }, + { url = "https://files.pythonhosted.org/packages/ba/db/36a78e3403099d31d9746d13fdcde5accc43c1155f375a34d15983a479a7/pywin32-312-cp313-cp313-win_amd64.whl", hash = "sha256:c53e878d15a1c44788082bfe712a905433473aa38f86375b7cf8b45e3acbaaf9", size = 6914298, upload-time = "2026-06-04T07:49:38.876Z" }, + { url = "https://files.pythonhosted.org/packages/84/37/c1697194092b76de9ed47ca124323f02c57ffc8a45c06f88a3d5acaf01eb/pywin32-312-cp313-cp313-win_arm64.whl", hash = "sha256:59aba5d5940842075343a5ddc6b11f1cdf0d1567fe745290359dfbcc7c2eb831", size = 6727640, upload-time = "2026-06-04T07:49:41.083Z" }, + { url = "https://files.pythonhosted.org/packages/fc/2b/1f3cded5822fd49c02f40544cbb5f58c7cfd6b1694869fd476cb6170ee97/pywin32-312-cp314-cp314-win32.whl", hash = "sha256:a77a90fbb6881238d2ca9c6fd797b25817f3768fe78d214a90137ff055a75f5b", size = 6468928, upload-time = "2026-06-04T07:49:43.188Z" }, + { url = "https://files.pythonhosted.org/packages/21/82/3bf86d2e2808902013132e1ce905a7da0da53790f3836c64bf44d55e24f3/pywin32-312-cp314-cp314-win_amd64.whl", hash = "sha256:a4dd3a848290ef724347b19f301045831d8e802fa4464f491b98b1e0a081432e", size = 7024157, upload-time = "2026-06-04T07:49:45.34Z" }, + { url = "https://files.pythonhosted.org/packages/a4/0e/73f6d6800b4f27655abd9e9f6aaeaefcddb2b946e4674efa2bab184a7f7b/pywin32-312-cp314-cp314-win_arm64.whl", hash = "sha256:9fce94568364e0155e6dfb781ac5d95903be8baf28670632beab1b523f300daa", size = 6839598, upload-time = "2026-06-04T07:49:47.613Z" }, + { url = "https://files.pythonhosted.org/packages/eb/61/caa39686032d2ebdd04ff0ab5cbe163126c0066d98e00c9018646e42393b/pywin32-312-cp315-cp315-win32.whl", hash = "sha256:5c1fbe4a937a73ae9297384a3da38518cbc694c68ad8a809b2e19acd350f03ed", size = 6471159, upload-time = "2026-06-04T07:49:50.035Z" }, + { url = "https://files.pythonhosted.org/packages/0f/cd/7e1de64a4a6f69c04214169657ccab0d93a670ea50e35eb8f489d7378249/pywin32-312-cp315-cp315-win_amd64.whl", hash = "sha256:c2f03a0f73f804a13c2735b99392b0cd426bb4f2c4d0178e5ac966a0f21618d5", size = 7025293, upload-time = "2026-06-04T07:49:54.857Z" }, + { url = "https://files.pythonhosted.org/packages/23/ed/4532e9388e65fa16b46776ef47ad631a64eda1631884488af707666350ed/pywin32-312-cp315-cp315-win_arm64.whl", hash = "sha256:a8597d28f267b39074aef51fa593530082b39cbe5a074226096857b1fed2dfb9", size = 6840337, upload-time = "2026-06-04T07:49:57.531Z" }, +] + +[[package]] +name = "pywin32-ctypes" +version = "0.2.3" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/85/9f/01a1a99704853cb63f253eea009390c88e7131c67e66a0a02099a8c917cb/pywin32-ctypes-0.2.3.tar.gz", hash = "sha256:d162dc04946d704503b2edc4d55f3dba5c1d539ead017afa00142c38b9885755", size = 29471, upload-time = "2024-08-14T10:15:34.626Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/de/3d/8161f7711c017e01ac9f008dfddd9410dff3674334c233bde66e7ba65bbf/pywin32_ctypes-0.2.3-py3-none-any.whl", hash = "sha256:8a1513379d709975552d202d942d9837758905c8d01eb82b8bcc30918929e7b8", size = 30756, upload-time = "2024-08-14T10:15:33.187Z" }, +] + +[[package]] +name = "pyyaml" +version = "6.0.3" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/05/8e/961c0007c59b8dd7729d542c61a4d537767a59645b82a0b521206e1e25c2/pyyaml-6.0.3.tar.gz", hash = "sha256:d76623373421df22fb4cf8817020cbb7ef15c725b9d5e45f17e189bfc384190f", size = 130960, upload-time = "2025-09-25T21:33:16.546Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/d1/33/422b98d2195232ca1826284a76852ad5a86fe23e31b009c9886b2d0fb8b2/pyyaml-6.0.3-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:7f047e29dcae44602496db43be01ad42fc6f1cc0d8cd6c83d342306c32270196", size = 182063, upload-time = "2025-09-25T21:32:11.445Z" }, + { url = "https://files.pythonhosted.org/packages/89/a0/6cf41a19a1f2f3feab0e9c0b74134aa2ce6849093d5517a0c550fe37a648/pyyaml-6.0.3-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:fc09d0aa354569bc501d4e787133afc08552722d3ab34836a80547331bb5d4a0", size = 173973, upload-time = "2025-09-25T21:32:12.492Z" }, + { url = "https://files.pythonhosted.org/packages/ed/23/7a778b6bd0b9a8039df8b1b1d80e2e2ad78aa04171592c8a5c43a56a6af4/pyyaml-6.0.3-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:9149cad251584d5fb4981be1ecde53a1ca46c891a79788c0df828d2f166bda28", size = 775116, upload-time = "2025-09-25T21:32:13.652Z" }, + { url = "https://files.pythonhosted.org/packages/65/30/d7353c338e12baef4ecc1b09e877c1970bd3382789c159b4f89d6a70dc09/pyyaml-6.0.3-cp312-cp312-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:5fdec68f91a0c6739b380c83b951e2c72ac0197ace422360e6d5a959d8d97b2c", size = 844011, upload-time = "2025-09-25T21:32:15.21Z" }, + { url = "https://files.pythonhosted.org/packages/8b/9d/b3589d3877982d4f2329302ef98a8026e7f4443c765c46cfecc8858c6b4b/pyyaml-6.0.3-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:ba1cc08a7ccde2d2ec775841541641e4548226580ab850948cbfda66a1befcdc", size = 807870, upload-time = "2025-09-25T21:32:16.431Z" }, + { url = "https://files.pythonhosted.org/packages/05/c0/b3be26a015601b822b97d9149ff8cb5ead58c66f981e04fedf4e762f4bd4/pyyaml-6.0.3-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:8dc52c23056b9ddd46818a57b78404882310fb473d63f17b07d5c40421e47f8e", size = 761089, upload-time = "2025-09-25T21:32:17.56Z" }, + { url = "https://files.pythonhosted.org/packages/be/8e/98435a21d1d4b46590d5459a22d88128103f8da4c2d4cb8f14f2a96504e1/pyyaml-6.0.3-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:41715c910c881bc081f1e8872880d3c650acf13dfa8214bad49ed4cede7c34ea", size = 790181, upload-time = "2025-09-25T21:32:18.834Z" }, + { url = "https://files.pythonhosted.org/packages/74/93/7baea19427dcfbe1e5a372d81473250b379f04b1bd3c4c5ff825e2327202/pyyaml-6.0.3-cp312-cp312-win32.whl", hash = "sha256:96b533f0e99f6579b3d4d4995707cf36df9100d67e0c8303a0c55b27b5f99bc5", size = 137658, upload-time = "2025-09-25T21:32:20.209Z" }, + { url = "https://files.pythonhosted.org/packages/86/bf/899e81e4cce32febab4fb42bb97dcdf66bc135272882d1987881a4b519e9/pyyaml-6.0.3-cp312-cp312-win_amd64.whl", hash = "sha256:5fcd34e47f6e0b794d17de1b4ff496c00986e1c83f7ab2fb8fcfe9616ff7477b", size = 154003, upload-time = "2025-09-25T21:32:21.167Z" }, + { url = "https://files.pythonhosted.org/packages/1a/08/67bd04656199bbb51dbed1439b7f27601dfb576fb864099c7ef0c3e55531/pyyaml-6.0.3-cp312-cp312-win_arm64.whl", hash = "sha256:64386e5e707d03a7e172c0701abfb7e10f0fb753ee1d773128192742712a98fd", size = 140344, upload-time = "2025-09-25T21:32:22.617Z" }, + { url = "https://files.pythonhosted.org/packages/d1/11/0fd08f8192109f7169db964b5707a2f1e8b745d4e239b784a5a1dd80d1db/pyyaml-6.0.3-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:8da9669d359f02c0b91ccc01cac4a67f16afec0dac22c2ad09f46bee0697eba8", size = 181669, upload-time = "2025-09-25T21:32:23.673Z" }, + { url = "https://files.pythonhosted.org/packages/b1/16/95309993f1d3748cd644e02e38b75d50cbc0d9561d21f390a76242ce073f/pyyaml-6.0.3-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:2283a07e2c21a2aa78d9c4442724ec1eb15f5e42a723b99cb3d822d48f5f7ad1", size = 173252, upload-time = "2025-09-25T21:32:25.149Z" }, + { url = "https://files.pythonhosted.org/packages/50/31/b20f376d3f810b9b2371e72ef5adb33879b25edb7a6d072cb7ca0c486398/pyyaml-6.0.3-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:ee2922902c45ae8ccada2c5b501ab86c36525b883eff4255313a253a3160861c", size = 767081, upload-time = "2025-09-25T21:32:26.575Z" }, + { url = "https://files.pythonhosted.org/packages/49/1e/a55ca81e949270d5d4432fbbd19dfea5321eda7c41a849d443dc92fd1ff7/pyyaml-6.0.3-cp313-cp313-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:a33284e20b78bd4a18c8c2282d549d10bc8408a2a7ff57653c0cf0b9be0afce5", size = 841159, upload-time = "2025-09-25T21:32:27.727Z" }, + { url = "https://files.pythonhosted.org/packages/74/27/e5b8f34d02d9995b80abcef563ea1f8b56d20134d8f4e5e81733b1feceb2/pyyaml-6.0.3-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:0f29edc409a6392443abf94b9cf89ce99889a1dd5376d94316ae5145dfedd5d6", size = 801626, upload-time = "2025-09-25T21:32:28.878Z" }, + { url = "https://files.pythonhosted.org/packages/f9/11/ba845c23988798f40e52ba45f34849aa8a1f2d4af4b798588010792ebad6/pyyaml-6.0.3-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:f7057c9a337546edc7973c0d3ba84ddcdf0daa14533c2065749c9075001090e6", size = 753613, upload-time = "2025-09-25T21:32:30.178Z" }, + { url = "https://files.pythonhosted.org/packages/3d/e0/7966e1a7bfc0a45bf0a7fb6b98ea03fc9b8d84fa7f2229e9659680b69ee3/pyyaml-6.0.3-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:eda16858a3cab07b80edaf74336ece1f986ba330fdb8ee0d6c0d68fe82bc96be", size = 794115, upload-time = "2025-09-25T21:32:31.353Z" }, + { url = "https://files.pythonhosted.org/packages/de/94/980b50a6531b3019e45ddeada0626d45fa85cbe22300844a7983285bed3b/pyyaml-6.0.3-cp313-cp313-win32.whl", hash = "sha256:d0eae10f8159e8fdad514efdc92d74fd8d682c933a6dd088030f3834bc8e6b26", size = 137427, upload-time = "2025-09-25T21:32:32.58Z" }, + { url = "https://files.pythonhosted.org/packages/97/c9/39d5b874e8b28845e4ec2202b5da735d0199dbe5b8fb85f91398814a9a46/pyyaml-6.0.3-cp313-cp313-win_amd64.whl", hash = "sha256:79005a0d97d5ddabfeeea4cf676af11e647e41d81c9a7722a193022accdb6b7c", size = 154090, upload-time = "2025-09-25T21:32:33.659Z" }, + { url = "https://files.pythonhosted.org/packages/73/e8/2bdf3ca2090f68bb3d75b44da7bbc71843b19c9f2b9cb9b0f4ab7a5a4329/pyyaml-6.0.3-cp313-cp313-win_arm64.whl", hash = "sha256:5498cd1645aa724a7c71c8f378eb29ebe23da2fc0d7a08071d89469bf1d2defb", size = 140246, upload-time = "2025-09-25T21:32:34.663Z" }, + { url = "https://files.pythonhosted.org/packages/9d/8c/f4bd7f6465179953d3ac9bc44ac1a8a3e6122cf8ada906b4f96c60172d43/pyyaml-6.0.3-cp314-cp314-macosx_10_13_x86_64.whl", hash = "sha256:8d1fab6bb153a416f9aeb4b8763bc0f22a5586065f86f7664fc23339fc1c1fac", size = 181814, upload-time = "2025-09-25T21:32:35.712Z" }, + { url = "https://files.pythonhosted.org/packages/bd/9c/4d95bb87eb2063d20db7b60faa3840c1b18025517ae857371c4dd55a6b3a/pyyaml-6.0.3-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:34d5fcd24b8445fadc33f9cf348c1047101756fd760b4dacb5c3e99755703310", size = 173809, upload-time = "2025-09-25T21:32:36.789Z" }, + { url = "https://files.pythonhosted.org/packages/92/b5/47e807c2623074914e29dabd16cbbdd4bf5e9b2db9f8090fa64411fc5382/pyyaml-6.0.3-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:501a031947e3a9025ed4405a168e6ef5ae3126c59f90ce0cd6f2bfc477be31b7", size = 766454, upload-time = "2025-09-25T21:32:37.966Z" }, + { url = "https://files.pythonhosted.org/packages/02/9e/e5e9b168be58564121efb3de6859c452fccde0ab093d8438905899a3a483/pyyaml-6.0.3-cp314-cp314-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:b3bc83488de33889877a0f2543ade9f70c67d66d9ebb4ac959502e12de895788", size = 836355, upload-time = "2025-09-25T21:32:39.178Z" }, + { url = "https://files.pythonhosted.org/packages/88/f9/16491d7ed2a919954993e48aa941b200f38040928474c9e85ea9e64222c3/pyyaml-6.0.3-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:c458b6d084f9b935061bc36216e8a69a7e293a2f1e68bf956dcd9e6cbcd143f5", size = 794175, upload-time = "2025-09-25T21:32:40.865Z" }, + { url = "https://files.pythonhosted.org/packages/dd/3f/5989debef34dc6397317802b527dbbafb2b4760878a53d4166579111411e/pyyaml-6.0.3-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:7c6610def4f163542a622a73fb39f534f8c101d690126992300bf3207eab9764", size = 755228, upload-time = "2025-09-25T21:32:42.084Z" }, + { url = "https://files.pythonhosted.org/packages/d7/ce/af88a49043cd2e265be63d083fc75b27b6ed062f5f9fd6cdc223ad62f03e/pyyaml-6.0.3-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:5190d403f121660ce8d1d2c1bb2ef1bd05b5f68533fc5c2ea899bd15f4399b35", size = 789194, upload-time = "2025-09-25T21:32:43.362Z" }, + { url = "https://files.pythonhosted.org/packages/23/20/bb6982b26a40bb43951265ba29d4c246ef0ff59c9fdcdf0ed04e0687de4d/pyyaml-6.0.3-cp314-cp314-win_amd64.whl", hash = "sha256:4a2e8cebe2ff6ab7d1050ecd59c25d4c8bd7e6f400f5f82b96557ac0abafd0ac", size = 156429, upload-time = "2025-09-25T21:32:57.844Z" }, + { url = "https://files.pythonhosted.org/packages/f4/f4/a4541072bb9422c8a883ab55255f918fa378ecf083f5b85e87fc2b4eda1b/pyyaml-6.0.3-cp314-cp314-win_arm64.whl", hash = "sha256:93dda82c9c22deb0a405ea4dc5f2d0cda384168e466364dec6255b293923b2f3", size = 143912, upload-time = "2025-09-25T21:32:59.247Z" }, + { url = "https://files.pythonhosted.org/packages/7c/f9/07dd09ae774e4616edf6cda684ee78f97777bdd15847253637a6f052a62f/pyyaml-6.0.3-cp314-cp314t-macosx_10_13_x86_64.whl", hash = "sha256:02893d100e99e03eda1c8fd5c441d8c60103fd175728e23e431db1b589cf5ab3", size = 189108, upload-time = "2025-09-25T21:32:44.377Z" }, + { url = "https://files.pythonhosted.org/packages/4e/78/8d08c9fb7ce09ad8c38ad533c1191cf27f7ae1effe5bb9400a46d9437fcf/pyyaml-6.0.3-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:c1ff362665ae507275af2853520967820d9124984e0f7466736aea23d8611fba", size = 183641, upload-time = "2025-09-25T21:32:45.407Z" }, + { url = "https://files.pythonhosted.org/packages/7b/5b/3babb19104a46945cf816d047db2788bcaf8c94527a805610b0289a01c6b/pyyaml-6.0.3-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:6adc77889b628398debc7b65c073bcb99c4a0237b248cacaf3fe8a557563ef6c", size = 831901, upload-time = "2025-09-25T21:32:48.83Z" }, + { url = "https://files.pythonhosted.org/packages/8b/cc/dff0684d8dc44da4d22a13f35f073d558c268780ce3c6ba1b87055bb0b87/pyyaml-6.0.3-cp314-cp314t-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:a80cb027f6b349846a3bf6d73b5e95e782175e52f22108cfa17876aaeff93702", size = 861132, upload-time = "2025-09-25T21:32:50.149Z" }, + { url = "https://files.pythonhosted.org/packages/b1/5e/f77dc6b9036943e285ba76b49e118d9ea929885becb0a29ba8a7c75e29fe/pyyaml-6.0.3-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:00c4bdeba853cc34e7dd471f16b4114f4162dc03e6b7afcc2128711f0eca823c", size = 839261, upload-time = "2025-09-25T21:32:51.808Z" }, + { url = "https://files.pythonhosted.org/packages/ce/88/a9db1376aa2a228197c58b37302f284b5617f56a5d959fd1763fb1675ce6/pyyaml-6.0.3-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:66e1674c3ef6f541c35191caae2d429b967b99e02040f5ba928632d9a7f0f065", size = 805272, upload-time = "2025-09-25T21:32:52.941Z" }, + { url = "https://files.pythonhosted.org/packages/da/92/1446574745d74df0c92e6aa4a7b0b3130706a4142b2d1a5869f2eaa423c6/pyyaml-6.0.3-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:16249ee61e95f858e83976573de0f5b2893b3677ba71c9dd36b9cf8be9ac6d65", size = 829923, upload-time = "2025-09-25T21:32:54.537Z" }, + { url = "https://files.pythonhosted.org/packages/f0/7a/1c7270340330e575b92f397352af856a8c06f230aa3e76f86b39d01b416a/pyyaml-6.0.3-cp314-cp314t-win_amd64.whl", hash = "sha256:4ad1906908f2f5ae4e5a8ddfce73c320c2a1429ec52eafd27138b7f1cbe341c9", size = 174062, upload-time = "2025-09-25T21:32:55.767Z" }, + { url = "https://files.pythonhosted.org/packages/f1/12/de94a39c2ef588c7e6455cfbe7343d3b2dc9d6b6b2f40c4c6565744c873d/pyyaml-6.0.3-cp314-cp314t-win_arm64.whl", hash = "sha256:ebc55a14a21cb14062aa4162f906cd962b28e2e9ea38f9b4391244cd8de4ae0b", size = 149341, upload-time = "2025-09-25T21:32:56.828Z" }, +] + +[[package]] +name = "referencing" +version = "0.37.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "attrs" }, + { name = "rpds-py" }, + { name = "typing-extensions", marker = "python_full_version < '3.13'" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/22/f5/df4e9027acead3ecc63e50fe1e36aca1523e1719559c499951bb4b53188f/referencing-0.37.0.tar.gz", hash = "sha256:44aefc3142c5b842538163acb373e24cce6632bd54bdb01b21ad5863489f50d8", size = 78036, upload-time = "2025-10-13T15:30:48.871Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/2c/58/ca301544e1fa93ed4f80d724bf5b194f6e4b945841c5bfd555878eea9fcb/referencing-0.37.0-py3-none-any.whl", hash = "sha256:381329a9f99628c9069361716891d34ad94af76e461dcb0335825aecc7692231", size = 26766, upload-time = "2025-10-13T15:30:47.625Z" }, +] + +[[package]] +name = "rich" +version = "15.0.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "markdown-it-py" }, + { name = "pygments" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/c0/8f/0722ca900cc807c13a6a0c696dacf35430f72e0ec571c4275d2371fca3e9/rich-15.0.0.tar.gz", hash = "sha256:edd07a4824c6b40189fb7ac9bc4c52536e9780fbbfbddf6f1e2502c31b068c36", size = 230680, upload-time = "2026-04-12T08:24:00.75Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/82/3b/64d4899d73f91ba49a8c18a8ff3f0ea8f1c1d75481760df8c68ef5235bf5/rich-15.0.0-py3-none-any.whl", hash = "sha256:33bd4ef74232fb73fe9279a257718407f169c09b78a87ad3d296f548e27de0bb", size = 310654, upload-time = "2026-04-12T08:24:02.83Z" }, +] + +[[package]] +name = "rich-rst" +version = "2.2.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "pygments" }, + { name = "rich" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/cf/0e/faf7c7e36630561e3e9611730c47510cd972dd5fde8f95941ff78f76accd/rich_rst-2.2.0.tar.gz", hash = "sha256:b1e6a67f8f694a6f36035624bf73e2b1a0a4be13edaf3ba5e654d9758b61073a", size = 326270, upload-time = "2026-09-27T19:12:42.163Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/d1/4e/716b42bf066e180c1235783b46f095a5d871d05dca7006d2295aac29c491/rich_rst-2.2.0-py3-none-any.whl", hash = "sha256:1ea1c43813dc4a8d86475fce27ffb74e0ada3d4656c9f8130ba2a59868055fe9", size = 279274, upload-time = "2026-09-27T19:12:40.548Z" }, +] + +[[package]] +name = "rpds-py" +version = "2026.9.1" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/42/68/3bd46b8a5e01d3c2ebdf9c5e9497912e3fe0cde02bac21a7130ca866e403/rpds_py-2026.9.1.tar.gz", hash = "sha256:4793ef7f78268b124b73fa933440f01d258bbae01de9fa53e9080c9ab0425a12", size = 63948, upload-time = "2026-10-04T16:32:36.469Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/5d/34/a828586ea3329fbb50895b50e9cf98ca3d924a9f41a0b26d443bff1b3794/rpds_py-2026.9.1-cp312-cp312-macosx_10_12_x86_64.whl", hash = "sha256:50906f5aea24b5a865cbd0a589698288631d9f3a54c3a937c83aefa95a0d14af", size = 346822, upload-time = "2026-10-04T16:29:16.258Z" }, + { url = "https://files.pythonhosted.org/packages/90/81/ac6a0d064982251856ce009c9e1dd51a34110b3c055aa7d1aad18b4899a3/rpds_py-2026.9.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:e21c1429e205828ea886a2293a4a2c8e01f4c25d9893ca330e97a6cf73f52e7b", size = 341380, upload-time = "2026-10-04T16:29:17.706Z" }, + { url = "https://files.pythonhosted.org/packages/42/ff/bf7d54f362748fd6a49277b9d6531c394074110fedf50ad791ec59133fbb/rpds_py-2026.9.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2693b2728bbcc48d09a981a356954b0c47c53ff25b545856f28a889ea619f69a", size = 373053, upload-time = "2026-10-04T16:29:19.063Z" }, + { url = "https://files.pythonhosted.org/packages/60/de/74b0ccdbbd28687b9b5fdb34c1cabed88352182facaced9d6f5486b8b9ed/rpds_py-2026.9.1-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:8601470267d938bcb7f3ab1a336100af51a4fd5b6ed030ef52461bb3ef5e7e07", size = 377742, upload-time = "2026-10-04T16:29:20.543Z" }, + { url = "https://files.pythonhosted.org/packages/c2/6d/b979775a3057b2a5c26d75ecbff60a20a24ef081db6dd76836fca3f20247/rpds_py-2026.9.1-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:3890a6aa36e6baa53d5258a2a25d3ef8b37ad165a6ab27a892d7c3e3a432cd69", size = 487289, upload-time = "2026-10-04T16:29:21.958Z" }, + { url = "https://files.pythonhosted.org/packages/1d/5d/7c34734ce3ece943d9d6ee0122a74a21bbc75b47acb5b7053c83f6efb1ed/rpds_py-2026.9.1-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:6b5b393eda5ea42cca1c1a6665f2a4882b4fd5d1777e41ce0545a107fb008c9d", size = 390710, upload-time = "2026-10-04T16:29:23.378Z" }, + { url = "https://files.pythonhosted.org/packages/1d/6d/b26eb1e75395925b3a142ed351cbed2ec8212f5c9d937aee3df32c701baa/rpds_py-2026.9.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:addeda51556dac7c1a2f14cda62db8b621cd12afba3091d03a96c72932387eab", size = 371261, upload-time = "2026-10-04T16:29:25.1Z" }, + { url = "https://files.pythonhosted.org/packages/7c/98/b2fdfe10301a9e27af21e634337fbba7baac0bc17fe44619a17c26bba2cb/rpds_py-2026.9.1-cp312-cp312-manylinux_2_31_riscv64.whl", hash = "sha256:d9edf30457d74eebfd76b045535e36f1cd89062566a128a0db2145ca042d787e", size = 376075, upload-time = "2026-10-04T16:29:26.748Z" }, + { url = "https://files.pythonhosted.org/packages/c5/b1/c4b8d954e49c3c69cf8063c0c9e0919c99f3d2cecc46311606a1cbe835dc/rpds_py-2026.9.1-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:815d26356930846a40c7bc1366e7b1b0320ab8a063e66c11298a208bed0fd237", size = 399358, upload-time = "2026-10-04T16:29:28.282Z" }, + { url = "https://files.pythonhosted.org/packages/b3/59/9559a7293c97dff0cbb293efffbd36644103883ecc27741af8ef90c84ca8/rpds_py-2026.9.1-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:3b5a6f40f0a1486b4b36c888123afc67acdbd9f33235927acf5ff295429a0ba3", size = 550267, upload-time = "2026-10-04T16:29:29.851Z" }, + { url = "https://files.pythonhosted.org/packages/6c/9d/6dc60e49511de4c8b00e74f9c1d43aed4d27f712cdb1ade92f2c199cbf64/rpds_py-2026.9.1-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:b5b8b0753718d258fd454283fbd57e14545d3b40583fa672e27cb4f987626bcc", size = 614018, upload-time = "2026-10-04T16:29:31.54Z" }, + { url = "https://files.pythonhosted.org/packages/fb/bc/92a4ecf27301b886232a413360f6b348a81d55ffef654f2ebda5970ebc3d/rpds_py-2026.9.1-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:46d80bc76b51a6c24f9944368c28d38b8bcbcea1da4f2f8d3ebc31a67e8c6ec6", size = 578509, upload-time = "2026-10-04T16:29:33.01Z" }, + { url = "https://files.pythonhosted.org/packages/08/53/efb97f2e6589b7ab8394385a73870e0b2ab2a195281c117b21fd6d7d4855/rpds_py-2026.9.1-cp312-cp312-win32.whl", hash = "sha256:befc2d6a953e563f8a7bfd87a42c22ebf8a3e980dcb7b6a4d17b70b0e914e8a3", size = 205401, upload-time = "2026-10-04T16:29:34.451Z" }, + { url = "https://files.pythonhosted.org/packages/1c/84/1700cc748d0eaa747486e4e82882d2575224e6e9a3148df583058850c629/rpds_py-2026.9.1-cp312-cp312-win_amd64.whl", hash = "sha256:5ce8943f79c2210f7abcc28e86367b03b28d95027fd01c46d2472373ae70c86f", size = 222923, upload-time = "2026-10-04T16:29:35.709Z" }, + { url = "https://files.pythonhosted.org/packages/c3/89/0302215373c2f8b4408b0fdfee955368cc378a98ff59508d47a7e0dc2dbf/rpds_py-2026.9.1-cp312-cp312-win_arm64.whl", hash = "sha256:501909f2e4a1e2dee528ef766fe3c469060ebc17e54a8383d404ba07a81a6f02", size = 218415, upload-time = "2026-10-04T16:29:37.263Z" }, + { url = "https://files.pythonhosted.org/packages/83/ea/ee88fd9e756ff93fb6b1182a47ec09504a242620e33ce1d20679efefe841/rpds_py-2026.9.1-cp313-cp313-macosx_10_12_x86_64.whl", hash = "sha256:a36b70596407634ca82d4b989a3729074a008537a0522e4c8046a67c729103e9", size = 346229, upload-time = "2026-10-04T16:29:38.82Z" }, + { url = "https://files.pythonhosted.org/packages/57/71/a097d6552f837500fc36e6b23d09cfb9890c3cc47531f9ca64e149799615/rpds_py-2026.9.1-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:eba5d173f7d5708b22a93815017a4611873ed54db9f268077c0dd1ed99cfc858", size = 340514, upload-time = "2026-10-04T16:29:40.405Z" }, + { url = "https://files.pythonhosted.org/packages/bd/b7/497e85768bf4e0d8ddbaa096a4cac31d1509251dee2728a8490aa367e0b5/rpds_py-2026.9.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:457866b85daf5034296666168b84a69e0b2e89dc4f1af102b46f6448a60b9063", size = 372611, upload-time = "2026-10-04T16:29:41.778Z" }, + { url = "https://files.pythonhosted.org/packages/52/4b/74ab4108916250b6e198e0d3af05bc6835eb046315f22f7a0ceb49667c5a/rpds_py-2026.9.1-cp313-cp313-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:a3a52a3ba86436ab3aef510fbe21512abc2ddd1993005dfe50514bd2284ef025", size = 377712, upload-time = "2026-10-04T16:29:43.242Z" }, + { url = "https://files.pythonhosted.org/packages/0c/8e/067e77d9d7b3cc793c9d909b7e97e7aadbbb1fb094093b6876902cc96d38/rpds_py-2026.9.1-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:d7841166b7fa64c9c56404617ae4341448847482d45933b13135d26c130519e5", size = 488106, upload-time = "2026-10-04T16:29:44.692Z" }, + { url = "https://files.pythonhosted.org/packages/3c/b4/c5aae6c2dde269bf955f6b7d35065c655a57e47750d9668052ad67e74dda/rpds_py-2026.9.1-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:926bdd3e3b5998ddf70cc64bc8cf57209571f9044542913afb673799fec77dd0", size = 390795, upload-time = "2026-10-04T16:29:46.129Z" }, + { url = "https://files.pythonhosted.org/packages/a0/36/76fab39973ee11e7f9f357c55138197bb01c86f6502cb76487e3b4f42db0/rpds_py-2026.9.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7868b85224291c6cb6759f9b5adb9745f486d226f62b16a614dd5a2a5ab2b35b", size = 370794, upload-time = "2026-10-04T16:29:47.603Z" }, + { url = "https://files.pythonhosted.org/packages/3d/fe/cd2a80e6d7b871937a60e935c5d507aa390d143f4ff3636f640b9733d5df/rpds_py-2026.9.1-cp313-cp313-manylinux_2_31_riscv64.whl", hash = "sha256:3cd182d7291d29b92c521a0069d9c01ba6193628a9a105531d11b40a6d731a33", size = 375673, upload-time = "2026-10-04T16:29:49.223Z" }, + { url = "https://files.pythonhosted.org/packages/6c/18/7464a9953724e55a3b3206062fa0ffdeaa519584c6aabf65d3956d94f131/rpds_py-2026.9.1-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:e6ea1cda8d8c688278430e4268a42f5e5da3bdd74578dfadc0820c3f1766ce83", size = 398758, upload-time = "2026-10-04T16:29:50.601Z" }, + { url = "https://files.pythonhosted.org/packages/c0/86/1534b436700fd49ff411063b7c4d7e938adfabf90895b6cf1622d5a7d1f6/rpds_py-2026.9.1-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:5943980471829f6de242a20b109de3111ba6b77e3af0ffc587028ac854b05e6c", size = 550370, upload-time = "2026-10-04T16:29:52.002Z" }, + { url = "https://files.pythonhosted.org/packages/57/1c/e1fa82a8a01e3c5820f3ba98a8b2673f642128eb368fa88871b01dd2c909/rpds_py-2026.9.1-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:76d3af9732d2dab69f28179b40ba2d87e2f1d5824b4a694780aa787d685e8f36", size = 613106, upload-time = "2026-10-04T16:29:53.655Z" }, + { url = "https://files.pythonhosted.org/packages/29/55/b20b8c4c3dde8755bfcd5b08492a02d0cd2e26929aedf6199ca2a377d42a/rpds_py-2026.9.1-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:78326f4cb4427a56ba4996c0762b63be45f06b85f086526420d2b3a66e40f84d", size = 578235, upload-time = "2026-10-04T16:29:55.157Z" }, + { url = "https://files.pythonhosted.org/packages/55/42/df3f7bbc3f7ab37a8a9db8d6c2ff2c985422899f1f7926afbf7ec3c0b8b4/rpds_py-2026.9.1-cp313-cp313-win32.whl", hash = "sha256:172e47169583f46ce118cbec68e6795d0da0f4606b488b6434f8276bca0a058c", size = 205293, upload-time = "2026-10-04T16:29:56.669Z" }, + { url = "https://files.pythonhosted.org/packages/31/9c/ba5a9569d719bfdd6ce863df4133ac6a1658cf1b07cc3534c31db729fbbc/rpds_py-2026.9.1-cp313-cp313-win_amd64.whl", hash = "sha256:3e93b2cd69a9830be33e03945cd7cda940a0a8bfcfbff41d6144f0cb0d3d8bd9", size = 222409, upload-time = "2026-10-04T16:29:58.049Z" }, + { url = "https://files.pythonhosted.org/packages/35/72/f28ca566f6c23c35bbf7445f65eb0364577b25a026305995e24f78b83d94/rpds_py-2026.9.1-cp313-cp313-win_arm64.whl", hash = "sha256:d151e148117294133bf8af7eeace085e7e87432db15ab6adf640330298a47f6f", size = 217681, upload-time = "2026-10-04T16:29:59.449Z" }, + { url = "https://files.pythonhosted.org/packages/8a/f2/67b94be1532767803415c1c5a1fd88ea487643d74a673cec1ba140af77bb/rpds_py-2026.9.1-cp314-cp314-macosx_10_12_x86_64.whl", hash = "sha256:c9d1aca01f49170fdcf5c92761b1fafe97f554b721ca4570c5949fff778f0d4b", size = 347178, upload-time = "2026-10-04T16:30:00.865Z" }, + { url = "https://files.pythonhosted.org/packages/04/37/b751de2b59b0197a1d92a5dd491de88e8a5e928c2e6562581974f1e85263/rpds_py-2026.9.1-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:3f0e9ac28fc067d4d34b88ae43c48e9489455c97fee9633d851f7eeed5a05d35", size = 341878, upload-time = "2026-10-04T16:30:02.564Z" }, + { url = "https://files.pythonhosted.org/packages/72/e2/5873bc4643c250db9e05d48dc0c93763d4aa68bc3b81164cb1af3b45b284/rpds_py-2026.9.1-cp314-cp314-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:07deecbfce94c78473018bc7d10b337cc651d12df87a1eb2cb3e4024bc9c33d0", size = 373963, upload-time = "2026-10-04T16:30:04.026Z" }, + { url = "https://files.pythonhosted.org/packages/51/03/5acf7632158247f3f6386ff0af3a1ee48167d575037e8d0920594b76d92b/rpds_py-2026.9.1-cp314-cp314-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:821b2755db9194409254012f429c56643416fb96ef9be090be82ec8826b7f477", size = 377975, upload-time = "2026-10-04T16:30:05.555Z" }, + { url = "https://files.pythonhosted.org/packages/e6/00/63fda451b8bffa5808fc8bb311ee7c073b340974b09f273c7b2a145d3d62/rpds_py-2026.9.1-cp314-cp314-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:3c91c210ae7645626c608400e3519b4a642f837cce09ca830db3beb2e9f274d4", size = 490347, upload-time = "2026-10-04T16:30:07.156Z" }, + { url = "https://files.pythonhosted.org/packages/a1/ae/c093ffd070ba0fb02f76c565d06fecc65ad6e4afdbae78f7031076d3cdac/rpds_py-2026.9.1-cp314-cp314-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:54ac2158a6f96cfbabff0b2eedaf94b90c5ec7ca8317fcadc61e1c2b2e0ff6ef", size = 392962, upload-time = "2026-10-04T16:30:08.77Z" }, + { url = "https://files.pythonhosted.org/packages/22/9d/d08a1128ab199b2f0cf25bfeb0639bd05119fff4b7c47bec24ef9a8ec23f/rpds_py-2026.9.1-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:eac2f5dbafd585dfe31f86a23ebf0d3ba480a9d49ebc87947267b5608d4ea0cd", size = 371623, upload-time = "2026-10-04T16:30:10.501Z" }, + { url = "https://files.pythonhosted.org/packages/53/c7/4758ddcbb75609414bbccfcb11d612436f9b3ee821bd2f33f0f1604ee648/rpds_py-2026.9.1-cp314-cp314-manylinux_2_31_riscv64.whl", hash = "sha256:8aa5dda18d39b6143eb24809d158f9252c88f402749b6f1b62a506cc7d96cc35", size = 376997, upload-time = "2026-10-04T16:30:12.124Z" }, + { url = "https://files.pythonhosted.org/packages/87/e4/947bd7f608ff60faf46dc9d389c3dffd0e3d767d78a0be19978448ef0ce7/rpds_py-2026.9.1-cp314-cp314-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:5c90e7fa02e8f5de0d10c17595c568ada48c5302e749462c0ea1a4c362111a86", size = 400169, upload-time = "2026-10-04T16:30:13.804Z" }, + { url = "https://files.pythonhosted.org/packages/4b/35/fe93e020a0543b5670472c18d7e6af3197c08da571240ce1965c84f85c0f/rpds_py-2026.9.1-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:e6d198bad4e49dd6732fbd636e2fc5c082f45c8cad0b4acb756b00c82c76072e", size = 551615, upload-time = "2026-10-04T16:30:15.332Z" }, + { url = "https://files.pythonhosted.org/packages/0d/4f/5d2a0136bb03b2a56a39dc6ff92d58a6e3e53a2e17079238b86228882f16/rpds_py-2026.9.1-cp314-cp314-musllinux_1_2_i686.whl", hash = "sha256:96beca19ec79de272e8668585380ff9092c47077c1d7a1e098e00bbd921f4785", size = 614655, upload-time = "2026-10-04T16:30:16.92Z" }, + { url = "https://files.pythonhosted.org/packages/09/1c/3f1025aaf70d9bf7272cc41f8b64ee76b48bf01726248138430e16f23b38/rpds_py-2026.9.1-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:a5cf77eb04f20b720be95265a3e00eb2a14814074255cc27069c551b2db53118", size = 579602, upload-time = "2026-10-04T16:30:18.555Z" }, + { url = "https://files.pythonhosted.org/packages/53/0d/5c72e6204f76610608706da32b6b7e11ef7e10317558a7bb15a122e008dc/rpds_py-2026.9.1-cp314-cp314-win32.whl", hash = "sha256:a03d57b86d2a51d0a66c92177e2be154ad015f357791d306e714569999cdb4cc", size = 206315, upload-time = "2026-10-04T16:30:20.05Z" }, + { url = "https://files.pythonhosted.org/packages/a4/0b/489d48abbcc7d70cf3fbf662d9d22abf1f4650761c0a9ae05260800800d3/rpds_py-2026.9.1-cp314-cp314-win_amd64.whl", hash = "sha256:837c6b305e26fe0f75b15c92cf3b2ba29e0ae19dc40b1c557b026cb426347d0c", size = 222852, upload-time = "2026-10-04T16:30:21.604Z" }, + { url = "https://files.pythonhosted.org/packages/91/16/bbb05a7e6a10cf79ba639be7f799d770ee15f64175cc61d081b218dd402a/rpds_py-2026.9.1-cp314-cp314-win_arm64.whl", hash = "sha256:fce4b85234a0cbad67bf8e6e1201ee815d172c9aebad75f25645bc4d834f8e31", size = 218709, upload-time = "2026-10-04T16:30:23.036Z" }, + { url = "https://files.pythonhosted.org/packages/22/ac/ac507a0a4ec478ca470440a09583db4be5259ba7670aeba0620822f1e57a/rpds_py-2026.9.1-cp314-cp314t-macosx_10_12_x86_64.whl", hash = "sha256:3a72c11530d71abfb66c8d7696a2f86c43e63fca8b948f1a784ac490f4ec688e", size = 349596, upload-time = "2026-10-04T16:30:24.558Z" }, + { url = "https://files.pythonhosted.org/packages/e9/f2/817a46b658d5070f477f722c298ee9a24525b0e4017347964146ef5fdd0e/rpds_py-2026.9.1-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:068c37bba854ec2fe42f7365c640af11dd9895890ccbf2df5070d0c059bd7f96", size = 343114, upload-time = "2026-10-04T16:30:26.048Z" }, + { url = "https://files.pythonhosted.org/packages/6c/42/6ade976b13ac1b4cb3bf2eb603f1be2fe74df19a29988d4c2b386be59d6f/rpds_py-2026.9.1-cp314-cp314t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d7fca4eb6df565e2a928f1c7dad92d27db8f9df0f449e76423ed5d7e713ed445", size = 374197, upload-time = "2026-10-04T16:30:27.699Z" }, + { url = "https://files.pythonhosted.org/packages/d9/70/77cdf1d3f1a07faabe936016ae623aec7981f73108a8fe7a203ed2e21998/rpds_py-2026.9.1-cp314-cp314t-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:c933c6678c6f116ff8af47a4c6db0868b8ace74af0343016c0ef00f00272ea69", size = 378025, upload-time = "2026-10-04T16:30:29.451Z" }, + { url = "https://files.pythonhosted.org/packages/3f/6b/18a44a3beaa9b7931acb04af7bd9539836477c630a794452d4826d6185d4/rpds_py-2026.9.1-cp314-cp314t-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:028ad274ea951dac64491b5d1e65712a4aeabfdbdb9fccf797b57bd899b0c495", size = 491969, upload-time = "2026-10-04T16:30:30.995Z" }, + { url = "https://files.pythonhosted.org/packages/73/27/fb39cfd6bddaf741b024f813890374578ff8ac1f1adc473659c048b03b05/rpds_py-2026.9.1-cp314-cp314t-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:740d0a99cf9de0b17a3943388e9294a59becf75e7c43421f387bd3c7a9901f7c", size = 393905, upload-time = "2026-10-04T16:30:32.628Z" }, + { url = "https://files.pythonhosted.org/packages/ed/71/0fa7bb77b57af0d710273964180d11b503f62b8a5c358eb2d8c3f62feff6/rpds_py-2026.9.1-cp314-cp314t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0da298fb372dc192610a4b9ecbc68a0cd8b675bbbd1fc519d01b41cfd658333e", size = 374569, upload-time = "2026-10-04T16:30:34.257Z" }, + { url = "https://files.pythonhosted.org/packages/54/22/f41cfac269af3b449513ef1bc3d7f32fde52abbbd2d01c7e76b47743acd9/rpds_py-2026.9.1-cp314-cp314t-manylinux_2_31_riscv64.whl", hash = "sha256:eb61be926bb81567c1f48bdc8aa22b9855048dc2efd53871f9f7e6e9a5632346", size = 377482, upload-time = "2026-10-04T16:30:35.997Z" }, + { url = "https://files.pythonhosted.org/packages/b4/fc/312b49006e7f8f9ca5f96647577b8aa6f3df30519c46bd448f5c425af0b2/rpds_py-2026.9.1-cp314-cp314t-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:42e75466f83cd43f6026c81eab74246efb2bdadafb307b85700632d06c68f299", size = 400040, upload-time = "2026-10-04T16:30:37.76Z" }, + { url = "https://files.pythonhosted.org/packages/cf/a6/18cca7a878dc7fa95165a83343fd4d7b65643fd22e54e47340a451121d5c/rpds_py-2026.9.1-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:617f59cde379b4f648a09797b7f683d04b90a46344cddab85639da5aff0f5531", size = 551849, upload-time = "2026-10-04T16:30:39.443Z" }, + { url = "https://files.pythonhosted.org/packages/e4/6d/1f5685e20f39604691bdc3c05aaa6b8bd2f954e9e996477adf2376768e33/rpds_py-2026.9.1-cp314-cp314t-musllinux_1_2_i686.whl", hash = "sha256:3edae8c5ddfdb6985d49ae9d150516e5076888879022f91a26c2de9276ce0bdb", size = 614842, upload-time = "2026-10-04T16:30:41.231Z" }, + { url = "https://files.pythonhosted.org/packages/c6/25/98652109fd9f7e10268dd4571aa52b81987001b806f37ef1a18260de714a/rpds_py-2026.9.1-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:0f045bb053c9057720d72c56dffe30dffdc05997b2897a827b9325f0ab6623fa", size = 582606, upload-time = "2026-10-04T16:30:43.345Z" }, + { url = "https://files.pythonhosted.org/packages/19/03/11ca09099bab5f53373a80a334c424ec917c13d050760a59499d2af5171e/rpds_py-2026.9.1-cp314-cp314t-win32.whl", hash = "sha256:bf35d0568abda97233239ce32896d3ad53fccc537832c104e30c94aa5fb93569", size = 203341, upload-time = "2026-10-04T16:30:44.954Z" }, + { url = "https://files.pythonhosted.org/packages/6f/8a/88909e3ffd9f47f5b58211473875d8c3c09079f0058c46fb72c55a702a26/rpds_py-2026.9.1-cp314-cp314t-win_amd64.whl", hash = "sha256:1e8d4d79d828299bf44a55db22a9388ab967b49d17132c88eab0f4360b48da8e", size = 222843, upload-time = "2026-10-04T16:30:46.486Z" }, + { url = "https://files.pythonhosted.org/packages/f6/b7/a662f367d4896dd0a10cef2fc91f10b7f08af1c10858e287e019563f338d/rpds_py-2026.9.1-cp315-cp315-macosx_10_12_x86_64.whl", hash = "sha256:1d77b649e6f7cdf12ca5c2a98dad0ad37f9ea9b6f960408a92f0cb12bb3d04d9", size = 347463, upload-time = "2026-10-04T16:30:48.203Z" }, + { url = "https://files.pythonhosted.org/packages/ae/3f/ad45d03df4f84ebae5439577ee81f3999d182711e82235c8037b6528890e/rpds_py-2026.9.1-cp315-cp315-macosx_11_0_arm64.whl", hash = "sha256:00ba2d8c7dd4ee537978ddf4b3fbd712bef2d8751603f7f3146b3f4287768e25", size = 342051, upload-time = "2026-10-04T16:30:49.872Z" }, + { url = "https://files.pythonhosted.org/packages/7e/31/3dcd68c13d4bcc59c1f7eb33ac8e80698f06f3eb0d8a1e06419836071c20/rpds_py-2026.9.1-cp315-cp315-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ec450527cbf485e13c8d3602a54f428ab0432fdade0ede75efd74b735421c871", size = 374143, upload-time = "2026-10-04T16:30:51.508Z" }, + { url = "https://files.pythonhosted.org/packages/cf/0d/68c1f058a250fbd1380ebda9fc227cbf50117adf8ffe8161ef383ea79f68/rpds_py-2026.9.1-cp315-cp315-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:306ee1850d8105b5baf977e78d45fcadd12c1a54678d614c9baf217708446e91", size = 378604, upload-time = "2026-10-04T16:30:53.206Z" }, + { url = "https://files.pythonhosted.org/packages/d7/d6/2d4c59b85397cb4800594fadf692688ccf5ce556adc930e7a5bf21061a5e/rpds_py-2026.9.1-cp315-cp315-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:ef6b65b03247c54692ad4fd9ee97cb772781927db72e3cb05e70b3db6d1ff14f", size = 490790, upload-time = "2026-10-04T16:30:54.925Z" }, + { url = "https://files.pythonhosted.org/packages/da/04/7e05dc3aebaf52f4e026766bd668fdd09a9d0e23f64a14686b36b3501892/rpds_py-2026.9.1-cp315-cp315-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:a575404ebc9cf2e91edd32eaf570ec1430eb900d4f56724ba7dd4bc1fc9c176d", size = 393146, upload-time = "2026-10-04T16:30:56.625Z" }, + { url = "https://files.pythonhosted.org/packages/57/ca/e2e9a0a46a74ed51a0498ba1fe10f4ea6b2d9a155f372a2f91e51f18cf10/rpds_py-2026.9.1-cp315-cp315-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2c16ab111bc27c646ba8aa005d0527754edc538ebb636f0b1bf8e244b48d1945", size = 372022, upload-time = "2026-10-04T16:30:58.295Z" }, + { url = "https://files.pythonhosted.org/packages/ba/cb/8f8774df5134e23424372838bcc5c7ed4127d723e1ff52f7bebd4dcb2563/rpds_py-2026.9.1-cp315-cp315-manylinux_2_31_riscv64.whl", hash = "sha256:7664419f27db41d4f1c43a78dccda7dd6e8ef2428df3ee01d0c2a07a6b071297", size = 377092, upload-time = "2026-10-04T16:30:59.984Z" }, + { url = "https://files.pythonhosted.org/packages/90/02/8d7095d73bf9114219be40230baa5df00611e0a82ed9517779ff9c19f82b/rpds_py-2026.9.1-cp315-cp315-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:4b26b03d9d2658ee2fa234f8f4f19f38a09773fe5261028025032e26d4d35af0", size = 400830, upload-time = "2026-10-04T16:31:01.721Z" }, + { url = "https://files.pythonhosted.org/packages/ec/02/8206856f8f363cd042a8315dc86b3912f5dcb6d3c66bbb24b69c2bfb0775/rpds_py-2026.9.1-cp315-cp315-musllinux_1_2_aarch64.whl", hash = "sha256:be3e47e2d91aa3942ff9bf4077a505226005abfc39b6f7554a91c1b9393986b9", size = 551478, upload-time = "2026-10-04T16:31:03.472Z" }, + { url = "https://files.pythonhosted.org/packages/41/6b/36211f1bb1f0b0313f496d92f5905b74ea107f27cb16fa3355a82f04575e/rpds_py-2026.9.1-cp315-cp315-musllinux_1_2_i686.whl", hash = "sha256:6307a0da524939decb8ca4a3933b8ab62525794411d6984fca6726e732804af6", size = 615173, upload-time = "2026-10-04T16:31:05.281Z" }, + { url = "https://files.pythonhosted.org/packages/35/77/cda0c4a6f055446b692f0ed5692f73707cafd3dff82672ede31b1a9b59de/rpds_py-2026.9.1-cp315-cp315-musllinux_1_2_x86_64.whl", hash = "sha256:159a7aab5c5e8b112c8830f54717ce56da1252ebdbb526f5be2df2309280b9e7", size = 579653, upload-time = "2026-10-04T16:31:07.065Z" }, + { url = "https://files.pythonhosted.org/packages/74/ec/d8385f446240aed643b9e92a5055cff3015cc04a13c61f73b2883c478ed5/rpds_py-2026.9.1-cp315-cp315-win32.whl", hash = "sha256:dbc2673f9223d420c91145599b3ba45a8a50c207d1976908e5fb5ddb0c9b9429", size = 206498, upload-time = "2026-10-04T16:31:08.989Z" }, + { url = "https://files.pythonhosted.org/packages/6d/a5/71b5cd00e0521e3b6b81828baea368c62b6b700ebdd9554cd7d41ddf12fa/rpds_py-2026.9.1-cp315-cp315-win_amd64.whl", hash = "sha256:75c38c50ab9aca840225d9a9a3810bf11d04bd5c1f186cabbb8aee56db3e9b15", size = 223121, upload-time = "2026-10-04T16:31:10.84Z" }, + { url = "https://files.pythonhosted.org/packages/33/58/dba857c3bc8221b31b62eb170a3080f4f191de79f047200389b7ed1b06a7/rpds_py-2026.9.1-cp315-cp315-win_arm64.whl", hash = "sha256:a431156bb41865fc14cd5d79bb9d7bbed83110b0159e34e62ae30951f96c0009", size = 218741, upload-time = "2026-10-04T16:31:12.592Z" }, + { url = "https://files.pythonhosted.org/packages/5b/d0/320ab28ccc1415eeb509d68682b0014fb74690cd49f1c2d29a232475af50/rpds_py-2026.9.1-cp315-cp315t-macosx_10_12_x86_64.whl", hash = "sha256:ef0d8c843e2827d6c120ab4687e9423fb1d893db1df27b7c1506615bcb9734a0", size = 349719, upload-time = "2026-10-04T16:31:14.48Z" }, + { url = "https://files.pythonhosted.org/packages/56/88/f5b12f1358f443c08b7ce3cc8391d82d335f4872580e2e097847fd36087a/rpds_py-2026.9.1-cp315-cp315t-macosx_11_0_arm64.whl", hash = "sha256:45bc6bccf78b20fd834237d18db64965d7ee68ba7f60440a26c7ab71e7b8d51a", size = 343267, upload-time = "2026-10-04T16:31:16.827Z" }, + { url = "https://files.pythonhosted.org/packages/f7/0c/c765b0059d532acb3b9c45d781ccc22f15a96dbe443d00903f643ba9df10/rpds_py-2026.9.1-cp315-cp315t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1d55198263bb51f557550c6ed2e6d1cb6a6fed6eb5c9120b741c5926bef8a45d", size = 374555, upload-time = "2026-10-04T16:31:18.931Z" }, + { url = "https://files.pythonhosted.org/packages/6b/8a/cafddfda77564a10cd21184640c3bffda6a2b8d20972fb5dedd5e0166328/rpds_py-2026.9.1-cp315-cp315t-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:a8763f20692da7df39b0afdd1ba3042b004c50a45994f76c2d9a25641f7673db", size = 378346, upload-time = "2026-10-04T16:31:20.75Z" }, + { url = "https://files.pythonhosted.org/packages/b9/01/5e626016eff72c183bf6c96539240cace15d402468647a453ec08415b2fc/rpds_py-2026.9.1-cp315-cp315t-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:e43d4a1f673e8a1cbd8533e809e02b4bf9d4f2280269bb640436556312121250", size = 492373, upload-time = "2026-10-04T16:31:22.614Z" }, + { url = "https://files.pythonhosted.org/packages/3b/9c/15a2469e9389242f46896b3f0a01d68caea8a5a35c011fcb05ef333aae73/rpds_py-2026.9.1-cp315-cp315t-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:ea394a937f17a54c51239348bdbe2e3518124c8d4a8951ba04a311d3095bd18f", size = 394371, upload-time = "2026-10-04T16:31:24.768Z" }, + { url = "https://files.pythonhosted.org/packages/63/f5/c100ff77e1e6366e947c75969c258fdfc4b7bc5bbfe7351e62ffbf2a1228/rpds_py-2026.9.1-cp315-cp315t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:cdeaa99ce822dca76cfb1b993e9120c5ea212f2eb66d48950ad63c349668a018", size = 375132, upload-time = "2026-10-04T16:31:26.588Z" }, + { url = "https://files.pythonhosted.org/packages/dd/f4/fe0269c9de253e99c81cabc12b8971a5feaa083debdaff1221e06264d9e3/rpds_py-2026.9.1-cp315-cp315t-manylinux_2_31_riscv64.whl", hash = "sha256:b4f062343e7ad3fa94f2c66e5ae667dee47ee74dd41a9057c4fbe163236a123d", size = 377642, upload-time = "2026-10-04T16:31:28.677Z" }, + { url = "https://files.pythonhosted.org/packages/05/65/b34a7b257baccff8f4a24a722933166d4941d5ebdc9c3f4bc4ffcd5ce4f4/rpds_py-2026.9.1-cp315-cp315t-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:22ffd29a63d71fb1b81552c21f2c2b734949b7ac751a9be70675a939a900839b", size = 400855, upload-time = "2026-10-04T16:31:30.802Z" }, + { url = "https://files.pythonhosted.org/packages/98/32/844e54176b6071b90b38a564e6940bc6eb8f97b2890dc709c19db9dec0f4/rpds_py-2026.9.1-cp315-cp315t-musllinux_1_2_aarch64.whl", hash = "sha256:08dae4a4095150a7c4545a1fb40b98e1ab1744fbc2770d92c977b9dadaa49ab6", size = 552573, upload-time = "2026-10-04T16:31:32.709Z" }, + { url = "https://files.pythonhosted.org/packages/17/73/6041d20729dffbfdf155c02d65be58bc225a1c1fb548fd87c23ef306138f/rpds_py-2026.9.1-cp315-cp315t-musllinux_1_2_i686.whl", hash = "sha256:9a0460d43603d1fd9ef59c30278531e15d78581721ddb538fa560aa7817ea4ad", size = 615840, upload-time = "2026-10-04T16:31:34.565Z" }, + { url = "https://files.pythonhosted.org/packages/af/9e/418094adaee6b056ce199051b255448ed872829051e341b2294c80da0977/rpds_py-2026.9.1-cp315-cp315t-musllinux_1_2_x86_64.whl", hash = "sha256:1c2d1f6da5128eabf34e963d7163a818846075a52568250d006c4c953b40f903", size = 582764, upload-time = "2026-10-04T16:31:36.665Z" }, + { url = "https://files.pythonhosted.org/packages/3d/9b/1698ebf6b840ddfe8b472198abbed6ace35c6e398faeecd6c47dae742a4e/rpds_py-2026.9.1-cp315-cp315t-win32.whl", hash = "sha256:5c6ee90dee3e85e055ddfd502d611643d9b0fd94c818220bda84ec3dacd9b27b", size = 203795, upload-time = "2026-10-04T16:31:38.53Z" }, + { url = "https://files.pythonhosted.org/packages/8a/e2/91f70d804c61f8eac39a417e82aa1024f655ab9e8bdd7393b196242bc41b/rpds_py-2026.9.1-cp315-cp315t-win_amd64.whl", hash = "sha256:fe5ad0664ec772b02c45859041aa17655709cced7a31005817fbbbd988c25567", size = 223037, upload-time = "2026-10-04T16:31:40.468Z" }, + { url = "https://files.pythonhosted.org/packages/a3/90/a9ba81408369d34c1aca73319c15adc91ed45c1d21e9e8ee4832ffb7fe0b/rpds_py-2026.9.1-pp312-pypy312_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6cdc537c8633d7fd92a82e2e0d2ab74320a3f63d5e59fb9cf08711e08fe151c4", size = 381109, upload-time = "2026-10-04T16:32:08.994Z" }, + { url = "https://files.pythonhosted.org/packages/b3/44/5192a0bed94cec86bd2a5e1cc5a1bb8f7eec3aec907eacd2deb13e87e326/rpds_py-2026.9.1-pp312-pypy312_pp73-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:10e208f2425d973938afcd56e28a7c4be32e27b6a60b5d381f49fb9d8acf9759", size = 388222, upload-time = "2026-10-04T16:32:11.321Z" }, + { url = "https://files.pythonhosted.org/packages/92/cd/5356549711448f18b52f7a11ffbe90f1228774996fbf3c6cd1b18d22abaf/rpds_py-2026.9.1-pp312-pypy312_pp73-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:6c0dbbcc19735fe5f8b0a54c07659d154a9e69f47e15d0a6ab7299215daf62cb", size = 500384, upload-time = "2026-10-04T16:32:13.478Z" }, + { url = "https://files.pythonhosted.org/packages/7a/88/ddda9d28adfe33119c75b2e733d4ba7e326f41d7e1b1093951771768ca48/rpds_py-2026.9.1-pp312-pypy312_pp73-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:684fd492fff4fead00587544e059be2bbcb6f93454f21fa2a91b66fc7508be82", size = 401661, upload-time = "2026-10-04T16:32:15.653Z" }, + { url = "https://files.pythonhosted.org/packages/32/c3/bb59ba16a6b4a57995d15b8c04c00f28df3b938c4dcdde48fbe0f73edb0c/rpds_py-2026.9.1-pp312-pypy312_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d1028417bb44037eb3069c1009bd7b7277212876cda22fbe565b0bca9fab6d2c", size = 380748, upload-time = "2026-10-04T16:32:17.727Z" }, + { url = "https://files.pythonhosted.org/packages/f5/b8/0580faa1c5a32ddc160130dd7ae54d2d007272a89a40a6b5db3e50f9f585/rpds_py-2026.9.1-pp312-pypy312_pp73-manylinux_2_31_riscv64.whl", hash = "sha256:492e5e428cbe126221611f47e068f01660352feec4ad18bc0f5ea9b2ae88fb14", size = 385731, upload-time = "2026-10-04T16:32:19.855Z" }, + { url = "https://files.pythonhosted.org/packages/bf/70/f73564642bbe3322c7eeef2c2f258cf040b71c41a430b532e59d04a1b838/rpds_py-2026.9.1-pp312-pypy312_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:88b5268892fde430d5531f95bc560b6efbbd67c929662c586afd729a96e7461c", size = 412131, upload-time = "2026-10-04T16:32:22.285Z" }, + { url = "https://files.pythonhosted.org/packages/8c/5d/17fff2e1f8f68721a2afb5cb48f7e442c751bb6b4883157c5abaf618cd08/rpds_py-2026.9.1-pp312-pypy312_pp73-musllinux_1_2_aarch64.whl", hash = "sha256:01445c8d194aa032a08e944f16567672da1c62dbdbefd8b6d0693032e290cf68", size = 558193, upload-time = "2026-10-04T16:32:24.4Z" }, + { url = "https://files.pythonhosted.org/packages/2a/d0/869ab6fb08531f97aae4a780b4d61b4190d8aef48fe054ee28bcf7114466/rpds_py-2026.9.1-pp312-pypy312_pp73-musllinux_1_2_i686.whl", hash = "sha256:eef6a03b0b6d08d0835ccfa8ec8d1bc70525e3801387567137b50c557695e6da", size = 622448, upload-time = "2026-10-04T16:32:26.844Z" }, + { url = "https://files.pythonhosted.org/packages/ba/a5/9672e532fe02cd3b92c78cfd8743abca939d96853006c63835009a1ecb6f/rpds_py-2026.9.1-pp312-pypy312_pp73-musllinux_1_2_x86_64.whl", hash = "sha256:6b9bf3135b4ad5981df9a73d71a35272d650a2985ae9c2746357b24d59de2448", size = 591126, upload-time = "2026-10-04T16:32:29.274Z" }, + { url = "https://files.pythonhosted.org/packages/80/ef/3a9f8e4279c7920af561deed4cb7ebebed2794a8f608cf404d5eef14a105/rpds_py-2026.9.1-pp312-pypy312_pp80-macosx_10_12_x86_64.whl", hash = "sha256:56c6952a9b15047466d0c2347c446a761d4527f89976156341e68f0ce5cc08b0", size = 357108, upload-time = "2026-10-04T16:32:31.641Z" }, + { url = "https://files.pythonhosted.org/packages/b7/55/4b2fa381a583760aea5c92841e4e928a358e1c6511b129219e9c2826a226/rpds_py-2026.9.1-pp312-pypy312_pp80-macosx_11_0_arm64.whl", hash = "sha256:b242c27c8f836305a4a72df9cdd564386ac57b807bd252a063223331c9316b37", size = 346877, upload-time = "2026-10-04T16:32:34.061Z" }, +] + +[[package]] +name = "secretstorage" +version = "3.5.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "cryptography" }, + { name = "jeepney" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/1c/03/e834bcd866f2f8a49a85eaff47340affa3bfa391ee9912a952a1faa68c7b/secretstorage-3.5.0.tar.gz", hash = "sha256:f04b8e4689cbce351744d5537bf6b1329c6fc68f91fa666f60a380edddcd11be", size = 19884, upload-time = "2025-11-23T19:02:53.191Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/b7/46/f5af3402b579fd5e11573ce652019a67074317e18c1935cc0b4ba9b35552/secretstorage-3.5.0-py3-none-any.whl", hash = "sha256:0ce65888c0725fcb2c5bc0fdb8e5438eece02c523557ea40ce0703c266248137", size = 15554, upload-time = "2025-11-23T19:02:51.545Z" }, +] + +[[package]] +name = "sse-starlette" +version = "3.5.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "anyio" }, + { name = "starlette" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/e4/be/0123026f719d1a7936f214a88b553bb5701e04ff2511147c1dab0c5035eb/sse_starlette-3.5.0.tar.gz", hash = "sha256:75de713aa8a9441513cc283220826da079d982770965b951e9437720e8bafdb2", size = 36794, upload-time = "2026-09-28T17:48:14.7Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/be/e4/cdda14023c316d71493bc54fdffc3dd006631b88866145c9d3cc33e0f1df/sse_starlette-3.5.0-py3-none-any.whl", hash = "sha256:3e6e1070df3f0f5d9cea81496de92dbb72f6721871d99748ece67441dd8b7997", size = 17407, upload-time = "2026-09-28T17:48:13.228Z" }, +] + +[[package]] +name = "starlette" +version = "1.7.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "anyio" }, + { name = "typing-extensions", marker = "python_full_version < '3.13'" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/7b/2b/3850dc6bf7ef71b088962eba31dafc6cffd2f96e577ebb0bb316df96da3e/starlette-1.7.0.tar.gz", hash = "sha256:c79f74ea63cff761804fbbfb182f1e0b440c2d07b164d24700c5a1bab5d6ff5d", size = 2736246, upload-time = "2026-09-23T07:30:26.35Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/4e/d6/1ec1b290f9e0fb067899b61e1d37a30c923068bad260b216dbe37a7d2967/starlette-1.7.0-py3-none-any.whl", hash = "sha256:67f8e99895493dd2911a03f11314af6ceebeae4e704bb9f43dfc6a9db151c93e", size = 78980, upload-time = "2026-09-23T07:30:24.567Z" }, +] + +[[package]] +name = "truststore" +version = "0.10.4" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/53/a3/1585216310e344e8102c22482f6060c7a6ea0322b63e026372e6dcefcfd6/truststore-0.10.4.tar.gz", hash = "sha256:9d91bd436463ad5e4ee4aba766628dd6cd7010cf3e2461756b3303710eebc301", size = 26169, upload-time = "2025-08-12T18:49:02.73Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/19/97/56608b2249fe206a67cd573bc93cd9896e1efb9e98bce9c163bcdc704b88/truststore-0.10.4-py3-none-any.whl", hash = "sha256:adaeaecf1cbb5f4de3b1959b42d41f6fab57b2b1666adb59e89cb0b53361d981", size = 18660, upload-time = "2025-08-12T18:49:01.46Z" }, +] + +[[package]] +name = "typing-extensions" +version = "4.16.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/f6/cc/6253133b5bb138fc3306cebfbda2c520f545d36b5be2c7255cc528bb45d6/typing_extensions-4.16.0.tar.gz", hash = "sha256:dc983d19a509c94dba722ee6abd33940f7c05a89e243c47e907eb4db6f1a43e5", size = 113555, upload-time = "2026-07-02T08:40:05.92Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/49/d3/b8441a820a491ddfc024b0b0cf0393375b75ea13866d9c66727e54c2fc80/typing_extensions-4.16.0-py3-none-any.whl", hash = "sha256:481caa481374e813c1b176ada14e97f1f67a4539ce9cfeb3f350d78d6370c2e8", size = 45571, upload-time = "2026-07-02T08:40:04.659Z" }, +] + +[[package]] +name = "typing-inspection" +version = "0.4.4" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "typing-extensions" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/a3/26/b09b8010994eccc3c09092e6b34058f36a460eea2d4c3e8b910c695975a0/typing_inspection-0.4.4.tar.gz", hash = "sha256:547274fa6b0a561ccf549cc9524b999a578e737d015d8709d021f9d0d13bea47", size = 76928, upload-time = "2026-08-12T12:37:25.997Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/67/81/4add07e5172b7ac40d8ed5ff580409a7801a4fe26d529bdd915401dabfbe/typing_inspection-0.4.4-py3-none-any.whl", hash = "sha256:65b8397ba37ccbce054456aaccddfc91e6e3083c92824df348d96ca832f3f147", size = 14750, upload-time = "2026-08-12T12:37:24.648Z" }, +] + +[[package]] +name = "uncalled-for" +version = "0.4.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/6b/5a/92ce0b3ea5481915f55da994c2c2c5f7a3c09949afde196ee89f8ab961aa/uncalled_for-0.4.0.tar.gz", hash = "sha256:335b95bd2422332ec210d518f314a16e4c640921c39fc8bf2ad095bd3538f4af", size = 56979, upload-time = "2026-08-10T14:51:46.247Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/a2/40/97cec87c077eb3291fc7905e6633e08b7ca593c57d30238444bcb6bb3d53/uncalled_for-0.4.0-py3-none-any.whl", hash = "sha256:16c4bb3337532e4bd5569adc192285976f3ad5305402256d34c67a12b5c968bd", size = 15502, upload-time = "2026-08-10T14:51:45.068Z" }, +] + +[[package]] +name = "uvicorn" +version = "0.54.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "click" }, + { name = "h11" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/da/34/30e9280707135d2cfc589dfff3cb796bd07a3aeb1a3e415ba09dd89d7bb4/uvicorn-0.54.0.tar.gz", hash = "sha256:a2e33cbfaa0306f8e6b0c13e0cb89d7d7a2da3e62b90c66e18c33d9807b28620", size = 112283, upload-time = "2026-09-25T06:52:37.601Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/38/0c/b54a4fdd7f90a3af8b02ebc9ce6712c2c208b7926a2f7bad95c33ebbe943/uvicorn-0.54.0-py3-none-any.whl", hash = "sha256:505bdb0f318731d45f1f712071fc781a8981f6847a31c902c9f5e652d4f67faf", size = 87427, upload-time = "2026-09-25T06:52:35.829Z" }, +] + +[[package]] +name = "watchfiles" +version = "1.3.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "anyio" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/b3/68/e6aa0b77d217b31f8f486ec0cdfe5e00e6e38dc0be657e7d85819b9faf0a/watchfiles-1.3.0.tar.gz", hash = "sha256:99aee4a07847c06820765fd7b1b49ceac4f3f711ccb7d104655a33231de1c207", size = 108119, upload-time = "2026-09-21T09:08:55.664Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/68/fa/c0b840d5d8bafe640925408ce11095948c8945bb61be1e67d0ab629b872a/watchfiles-1.3.0-cp310-abi3-macosx_10_12_x86_64.whl", hash = "sha256:000b9688fc8133037a8b075c8ebf98f32844ff8964dda61e85c1db547dafc441", size = 399703, upload-time = "2026-09-21T09:08:13.518Z" }, + { url = "https://files.pythonhosted.org/packages/c7/8a/894799b485fe9473ad10422a0d9668e53fb78e3a2b5cc6061159572844ad/watchfiles-1.3.0-cp310-abi3-macosx_11_0_arm64.whl", hash = "sha256:bbc1198edfdc90fda0600f825aa94150f428dfcbf8138746f55998e0e660d64c", size = 397647, upload-time = "2026-09-21T09:08:15.16Z" }, + { url = "https://files.pythonhosted.org/packages/5a/61/f277cd5ead05f5d37b98b41fbdd0c943ee0c04d49738f62e902cb291cf43/watchfiles-1.3.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4af9c464d410e8c44b58ddf1cbec7c3a02c1cb2c6c80df9c74659ba2fbda0ab5", size = 454994, upload-time = "2026-09-21T09:08:16.587Z" }, + { url = "https://files.pythonhosted.org/packages/46/66/ea4c01382975e53b1ac1b0a0ea1b353416b8127fb6e04f5c1c313119aab6/watchfiles-1.3.0-cp310-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:eb94e40b9a0db19636b5e3fed0a9803452ecc7381df13b385272abb779ee83ca", size = 460105, upload-time = "2026-09-21T09:08:17.961Z" }, + { url = "https://files.pythonhosted.org/packages/31/c3/1a501b597817096c9831c255f6270c124ce0e2faeb74124be24dcc93b86d/watchfiles-1.3.0-cp310-abi3-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:7398930a2b76b9dc67a4e6b8bfc7baf30946892a86f417a3920c07bdd6febc30", size = 493761, upload-time = "2026-09-21T09:08:19.327Z" }, + { url = "https://files.pythonhosted.org/packages/5a/16/77352d05e152c7786a016e9f1decdb4507e8aa5bcf3343c72142a0413d14/watchfiles-1.3.0-cp310-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:025b108f2d5cc2799cb941f79380df3e8b22bfb589c218e801767fe78d598c95", size = 577500, upload-time = "2026-09-21T09:08:20.723Z" }, + { url = "https://files.pythonhosted.org/packages/95/fe/81001c55b24466fe9911135e50269fd3a29f43e446627a92adfab54553b6/watchfiles-1.3.0-cp310-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:be9ef3cd403d756a304a0a08a112163c63da7ec72c8c9d083c98818291ff8f29", size = 469209, upload-time = "2026-09-21T09:08:22.346Z" }, + { url = "https://files.pythonhosted.org/packages/8a/cf/e3ad894ed5909a7c44b0707e89bc25d19a3d78b3a7aec846119443b6ae56/watchfiles-1.3.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b5768b49e426fd5b550b012c866db347cdf15c398ef98dc557b6e6b72fa74cd1", size = 458353, upload-time = "2026-09-21T09:08:23.7Z" }, + { url = "https://files.pythonhosted.org/packages/7f/f5/2f106829e6e2bc91ad74614730f6df484202b9a4d20d927dbf2f08d37d44/watchfiles-1.3.0-cp310-abi3-manylinux_2_31_riscv64.whl", hash = "sha256:d36c72fcdc08f143d87316a4c4c3b064e340da2c7383d39803950740ed418935", size = 468707, upload-time = "2026-09-21T09:08:25.167Z" }, + { url = "https://files.pythonhosted.org/packages/15/37/2741ab776b978669c1f3bba1e573f1a184f727ab8b4d3a6d9c61090800ed/watchfiles-1.3.0-cp310-abi3-musllinux_1_1_aarch64.whl", hash = "sha256:f0c9865240e065a2247f4b5248528ae3d01e0e8ae071462c250c884dc16e3ee3", size = 632510, upload-time = "2026-09-21T09:08:26.532Z" }, + { url = "https://files.pythonhosted.org/packages/48/64/db4a4684275fe9b696ee5118c194705c1423b3d42181c3f8ee70194d5c73/watchfiles-1.3.0-cp310-abi3-musllinux_1_1_x86_64.whl", hash = "sha256:380f513d26cc2e598266b88d66456e07d67ef4be8f0f435a1154d9c44b43d509", size = 661723, upload-time = "2026-09-21T09:08:28.004Z" }, + { url = "https://files.pythonhosted.org/packages/52/80/95ddb24f6a2f595c031c24432ab7b8aa7d6d1ada0c6d63a552166e06e8d1/watchfiles-1.3.0-cp310-abi3-win32.whl", hash = "sha256:509d9f74d2bec5c1f4cd868ddcfe0c9601f7ea53066dfcb19d8ede742c4de661", size = 277761, upload-time = "2026-09-21T09:08:29.335Z" }, + { url = "https://files.pythonhosted.org/packages/48/a1/1c4a1b3c8030cd03206232612be8a6e8799093490c220b0fcb935d02b75a/watchfiles-1.3.0-cp310-abi3-win_amd64.whl", hash = "sha256:1acabde19b67e673274e89a04d613b7fb1f122e2c4b8ec9a581e59c149264b61", size = 290643, upload-time = "2026-09-21T09:08:30.45Z" }, + { url = "https://files.pythonhosted.org/packages/82/e0/d2db577c632d26d08078c4390dd870b8555c4e558df25d22270f0166c71f/watchfiles-1.3.0-cp310-abi3-win_arm64.whl", hash = "sha256:d978cc1dd7ba44f5590d7de74f7a9c8be7262d9e469c2c0efb8bbfc2574321dc", size = 285510, upload-time = "2026-09-21T09:08:31.561Z" }, + { url = "https://files.pythonhosted.org/packages/4f/55/a122743607939429ab6a7272672f49303aa02bbd34c3f06676765a3861de/watchfiles-1.3.0-cp314-cp314t-macosx_10_12_x86_64.whl", hash = "sha256:e0204f90677b7fb8d3a824279a71a01166bea9f6e53923b8056592d87b33b0b6", size = 395978, upload-time = "2026-09-21T09:08:32.747Z" }, + { url = "https://files.pythonhosted.org/packages/3e/9d/0ee1b0ea42acfe72afa2484f0222e2386dd09992e9034a81e63cc3cdab0a/watchfiles-1.3.0-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:7c1125e99f84934a92996ae343501285617373acd66f16b59fd5654b27ad8d80", size = 387997, upload-time = "2026-09-21T09:08:33.953Z" }, + { url = "https://files.pythonhosted.org/packages/b7/f2/4319c6b683e8bd28465dfc53c750617a2a07f072eb2e3ab0182ccf812229/watchfiles-1.3.0-cp314-cp314t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a85e243c87109d9f48a2e0d10d6abdee8768cc114848b32281ec83d7f81d86ef", size = 448067, upload-time = "2026-09-21T09:08:35.104Z" }, + { url = "https://files.pythonhosted.org/packages/b7/71/9f37ac192a51a24de3a2d7fe9aac1e99b2b2668300674ff7a9f85d95beb1/watchfiles-1.3.0-cp314-cp314t-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:dd538c71766c59c732e2c5cedc39323c99c11897b99f93eac773438e54af206a", size = 452881, upload-time = "2026-09-21T09:08:36.238Z" }, + { url = "https://files.pythonhosted.org/packages/34/07/1224667c32a4a96876ddd642da69733cbfe6a15897db0865aec5a882cebc/watchfiles-1.3.0-cp314-cp314t-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:da213822ec9082b62cadf3008e07a8c690ec7a3c89f6dc5e55a8cf07b56a1b26", size = 484802, upload-time = "2026-09-21T09:08:37.717Z" }, + { url = "https://files.pythonhosted.org/packages/bd/4d/7f29cd87e1f826df86fc0418d0b8f370ca0311c29c618406dc492aad9951/watchfiles-1.3.0-cp314-cp314t-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:d4593392e87669836670f87d62fc754059eaeb0e6157af44060a46558cebe5a3", size = 567522, upload-time = "2026-09-21T09:08:38.94Z" }, + { url = "https://files.pythonhosted.org/packages/e3/ac/3aa1f84abd4dbbfbae99a817dd931f77b439261c911189cad4c30fdfd470/watchfiles-1.3.0-cp314-cp314t-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:26b81bc515a0f03f66a69a6fea86eea54c8eca4173c46dd7222569f79dd2f977", size = 461997, upload-time = "2026-09-21T09:08:40.142Z" }, + { url = "https://files.pythonhosted.org/packages/82/1c/27c66764d5b0dbb70a36770a32eca217eba739c28b24e8583a035087a3d7/watchfiles-1.3.0-cp314-cp314t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ca39661934749df580d89f3dde266f2af7c6968f4c21c72ce2dc387d299e6aa7", size = 451856, upload-time = "2026-09-21T09:08:41.305Z" }, + { url = "https://files.pythonhosted.org/packages/1e/b3/a45827084d953c1d0dd3d75abf85dcac26a0f5d115ad2fe0b7e9e931573b/watchfiles-1.3.0-cp314-cp314t-manylinux_2_31_riscv64.whl", hash = "sha256:04c5500faa725d69a99b0f63750e80795e455bb951849e9c98a811b4324997c4", size = 459889, upload-time = "2026-09-21T09:08:42.58Z" }, + { url = "https://files.pythonhosted.org/packages/7a/3d/07740d23ce2bb23419bb24055c435a9abe5fe03efdaea1ba0720b831aab6/watchfiles-1.3.0-cp314-cp314t-musllinux_1_1_aarch64.whl", hash = "sha256:ec3cd4bb181a7b6329134204c2277c7144ab5f62cce9c5335d6f901ee7ce8d6a", size = 624482, upload-time = "2026-09-21T09:08:44.064Z" }, + { url = "https://files.pythonhosted.org/packages/91/46/9540f8123eaec86df989f26d7704cad0448d9fb7271763a4f8f9fe23617d/watchfiles-1.3.0-cp314-cp314t-musllinux_1_1_x86_64.whl", hash = "sha256:e5871d4a7f788a9f64fb06f5793389d29d171e5c32d37c3ebfd520b017cc7694", size = 653724, upload-time = "2026-09-21T09:08:45.257Z" }, + { url = "https://files.pythonhosted.org/packages/25/9d/b9deb52f1e4528ffe44338c5ebab95c32ed79203082da661de50288e130a/watchfiles-1.3.0-cp314-cp314t-win32.whl", hash = "sha256:81c989d7267bfb7b676cd32c83bec97914e396870983cbf493e29415037bff5e", size = 270863, upload-time = "2026-09-21T09:08:46.518Z" }, + { url = "https://files.pythonhosted.org/packages/59/59/8b1881afccbafda06248be4185e28034dd73c80c85e4da24f2cb0c1321eb/watchfiles-1.3.0-cp314-cp314t-win_amd64.whl", hash = "sha256:d754e049006e81a9be49dc78ba7802081cee426e968cbc63ee19e164fa2d0e39", size = 286879, upload-time = "2026-09-21T09:08:47.874Z" }, + { url = "https://files.pythonhosted.org/packages/46/dd/41c12ae9745d5d72f709333287679d71cbba68ad7678fed872207bba94f4/watchfiles-1.3.0-cp314-cp314t-win_arm64.whl", hash = "sha256:a5b631db08fd3032db57ec6a92d1777cd60f88803287e4e941a4858c53aab1e0", size = 276924, upload-time = "2026-09-21T09:08:48.976Z" }, +] + +[[package]] +name = "websockets" +version = "17.2" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/01/89/3f825ab71c242fffb62ea8fe638741c290f62f8d7aadf8125ff897747af3/websockets-17.2.tar.gz", hash = "sha256:36c2fb94c990cc2545143b12690e2de6c16300f9dbe5b4f33fa300cf57dc8792", size = 188355, upload-time = "2026-10-03T14:56:53.5Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/bc/de/87854af9b38fe4738fd85f7f21c5b49558ae20aec898880894e435f33375/websockets-17.2-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:916ebdfd82e7fc68041d36b2b5f60361b9abce1e087454da15f8bd004839e090", size = 217757, upload-time = "2026-10-03T14:53:23.029Z" }, + { url = "https://files.pythonhosted.org/packages/3a/2e/1e80b5efa41544f626d56bd15ccb53dbfc56bf28bf80ab9cd6f82c4b1d20/websockets-17.2-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:3621f3686397708b8eeabfd0a9d75267c1f29a7537d2fe31e65d099e71587fa4", size = 215439, upload-time = "2026-10-03T14:53:24.531Z" }, + { url = "https://files.pythonhosted.org/packages/3b/6e/82c78b595aee05be76a7ee78539323da1593c1848e4fef51c704c696568f/websockets-17.2-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:a81e19710d48da88653473b6b9c366d47e99fe4f58e37ce415be47966748f31f", size = 215703, upload-time = "2026-10-03T14:53:26.226Z" }, + { url = "https://files.pythonhosted.org/packages/f8/c4/905ef6aa80423c03dba99e1e26fc0acf63a2a9a6a2d9e8c0e6a63caaf952/websockets-17.2-cp312-cp312-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:f2731f9067976c8c4127212c0d2f2ada42d497d935e470419e029802365b12bb", size = 225023, upload-time = "2026-10-03T14:53:27.744Z" }, + { url = "https://files.pythonhosted.org/packages/03/c0/a6d8be9c43e4456fb9597fdf8b5e0ce1f0a5df41503acce6d869536e4e23/websockets-17.2-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:6627b913b8586b1c06db9516b31dd0dfbc621de3bb9312616d92a7e44f268a5b", size = 225299, upload-time = "2026-10-03T14:53:29.171Z" }, + { url = "https://files.pythonhosted.org/packages/2f/d4/976d34b5491258b0a86c2ce9b9aabb9fdd68919ffd7fe65999c14a502a98/websockets-17.2-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:0198c4ec6a3406a2f7557c032967de426474c2c995c81076585e09d29a9f407b", size = 226540, upload-time = "2026-10-03T14:53:31.635Z" }, + { url = "https://files.pythonhosted.org/packages/83/2f/c4cfd42f53c697a8ed123fd82b8f85fcd13b6360d47f9f1d1d45d6ec6627/websockets-17.2-cp312-cp312-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:88c6a42c2632ff469e84155e44f6ed92cb15ccb047bf5fcb59225ae5a12fd33d", size = 229371, upload-time = "2026-10-03T14:53:33.061Z" }, + { url = "https://files.pythonhosted.org/packages/e7/55/9a221b29c6232ff9282eecb2fc102402cb9e42a3479264db0e5fc4fe6835/websockets-17.2-cp312-cp312-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:eb0023e6cdb4b8ece0b33875188dd16104ad8c335361d396a98394f99e30ff7a", size = 227173, upload-time = "2026-10-03T14:53:34.502Z" }, + { url = "https://files.pythonhosted.org/packages/8f/07/125e6d010c56c253d3d2b93cabaea0f96d33898151a16b49066a594acecf/websockets-17.2-cp312-cp312-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:c1c09d5d4646eb96bda2cfb97493bcea21a0956a981de116e6b1f4a9de07f3fd", size = 225929, upload-time = "2026-10-03T14:53:36.071Z" }, + { url = "https://files.pythonhosted.org/packages/23/a8/aad3bd902aee84e1b261ad6ab83b405e4a564af43101b8ad1dc0293ff4f4/websockets-17.2-cp312-cp312-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:0360c4dc13ac569cc245e0efa2f4d4b1e4733d24c47b8ab3f3747227b1356348", size = 223167, upload-time = "2026-10-03T14:53:37.528Z" }, + { url = "https://files.pythonhosted.org/packages/1f/f4/ec8ab9be1a5310b4fea829f088c7aa2b7a58b61d34bce1b2a9338635ff12/websockets-17.2-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:76693a16dead737946b651375ee3109d7db7ad9569a1c55c60aaed3ef85cfcc6", size = 225974, upload-time = "2026-10-03T14:53:38.959Z" }, + { url = "https://files.pythonhosted.org/packages/65/45/ba6503f8257d3f98b0f07ebaad0fd099c9023eae744fd5b775416743597e/websockets-17.2-cp312-cp312-musllinux_1_2_armv7l.whl", hash = "sha256:77a42cc507993ec5471b5283f7eef869239173b6000031543e3938a86d1af0fd", size = 224581, upload-time = "2026-10-03T14:53:40.496Z" }, + { url = "https://files.pythonhosted.org/packages/d0/45/05cca59a876c6776727d96fc7ba59e0b6f9aa496afbf13e7e04ad0b63678/websockets-17.2-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:3bbc5543e39ee025d524077c5c15c2d67bc11c9f6676afe5b531839e24d701f6", size = 225347, upload-time = "2026-10-03T14:53:42.061Z" }, + { url = "https://files.pythonhosted.org/packages/1c/00/cf0e43292ae949b13f67535be84317102891d69fd1986ec2bf2ead42747b/websockets-17.2-cp312-cp312-musllinux_1_2_ppc64le.whl", hash = "sha256:8da58558bfb0ca6ccac2419773521f1111e40654038b1afabdfc69c02cb82614", size = 226457, upload-time = "2026-10-03T14:53:43.575Z" }, + { url = "https://files.pythonhosted.org/packages/79/0d/9a5c61a18f0cc9876d94c70ccb3daf7614a9fee56abbb37c0e64e757fb96/websockets-17.2-cp312-cp312-musllinux_1_2_riscv64.whl", hash = "sha256:01420cb1cb47433e8e7075d32cb8017ad3ffed0654bd1e48c0251b865920dec3", size = 224011, upload-time = "2026-10-03T14:53:45.077Z" }, + { url = "https://files.pythonhosted.org/packages/34/ed/991c1ab80ab2ce40e1c939fef6fa8f971c3ef3b21caf988a7a107e0ad27d/websockets-17.2-cp312-cp312-musllinux_1_2_s390x.whl", hash = "sha256:c49c9edd47d0e44d360299e2d8865e2950d2fcf1b4098782c9d7dcd070919e5a", size = 224990, upload-time = "2026-10-03T14:53:46.8Z" }, + { url = "https://files.pythonhosted.org/packages/e7/7a/363c835d17923e967fb66376188e67b9a261c85d826a0cd5e4dd3471221d/websockets-17.2-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:96f6c8d0fe21930d1f982bfce2382789d2e8d005d2ab63d21280660f95ef8fe1", size = 225265, upload-time = "2026-10-03T14:53:48.382Z" }, + { url = "https://files.pythonhosted.org/packages/c8/90/6c51f6d78636bd1cd6781fae8ea5ea7bf1d5b4059354f3c1f5f8de793338/websockets-17.2-cp312-cp312-win32.whl", hash = "sha256:b25659ab2d655d742701487d5591e3f98e8f8b329fc999e05e3d59691ab344a1", size = 218228, upload-time = "2026-10-03T14:53:49.867Z" }, + { url = "https://files.pythonhosted.org/packages/c6/2a/90008411c652dcfae34345a2169f4becd066a4ba71eebfa8dd801e0445e1/websockets-17.2-cp312-cp312-win_amd64.whl", hash = "sha256:faa763b677e96f1beccc6b4d7e8c079dfeed2f249f57a19debc321b519ee64ec", size = 218528, upload-time = "2026-10-03T14:53:51.486Z" }, + { url = "https://files.pythonhosted.org/packages/1f/a1/b8ad6c17f8e75ba2215422fffe0d7f0c4b690dcff1c47c0473db0d253d51/websockets-17.2-cp312-cp312-win_arm64.whl", hash = "sha256:63499fc49efe48bccc2fca40723bc7adb198866cbe159093dd979905316994b6", size = 218457, upload-time = "2026-10-03T14:53:52.938Z" }, + { url = "https://files.pythonhosted.org/packages/54/54/a935a32dbc2e7365b1b59eb74b5ab7515456f02370fdca4c4efc3574e96f/websockets-17.2-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:b24b83fbb34b2d8de06cf0f0d4bd7737344ef854482a614826d4356c0c3f0c12", size = 217752, upload-time = "2026-10-03T14:53:54.59Z" }, + { url = "https://files.pythonhosted.org/packages/cd/95/cb8881851abe2662730e6c61cc521b4c96513fdf9103a44f169afce2eba8/websockets-17.2-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:8a829db795e3f87053904493d184b185c8eb1f497c852f434168ec856aa6f997", size = 215436, upload-time = "2026-10-03T14:53:56.034Z" }, + { url = "https://files.pythonhosted.org/packages/ca/1e/621bb93f35ab7d337be98f1958294437527e2a1797089b5e734ddc5eec5f/websockets-17.2-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:cf8811d285acc91216368df7fb55cc8c9bf6fcd90eea42429c7186c7385a12b9", size = 215690, upload-time = "2026-10-03T14:53:57.587Z" }, + { url = "https://files.pythonhosted.org/packages/62/4a/49d0c983c082676d5d413b28e6ba5ae1d174c00268467bf78d9fe986a2d2/websockets-17.2-cp313-cp313-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:89c4898da776193577279173dcf9860487590611d7320d379435a145881b048d", size = 225080, upload-time = "2026-10-03T14:53:59.081Z" }, + { url = "https://files.pythonhosted.org/packages/04/13/95a45eb410019772002d8f53d81396dad4120f7df39ca9962f86f5d7cd01/websockets-17.2-cp313-cp313-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:d87091c4347daadbcc0833b65812ff38d7350c67339625d4e4a512cf38e3e8ef", size = 225361, upload-time = "2026-10-03T14:54:00.61Z" }, + { url = "https://files.pythonhosted.org/packages/f8/fe/0f0eda80bb441f54becdaf793eb20ee080926f8d2356388377cf262187e5/websockets-17.2-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:1110fbfd530c447380e6e6db88b7e43ffe33d54178f5b0ff0aaa5a280301e668", size = 226602, upload-time = "2026-10-03T14:54:02.098Z" }, + { url = "https://files.pythonhosted.org/packages/5c/36/067fc09d8e6f154abde7c2f747c52cc442a02c5eb14816f5c39cb9f8bcc6/websockets-17.2-cp313-cp313-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:83abd8beab056aa77a116364811f8fc262dffbcc7abea48de0c85ccbfc6f1428", size = 228035, upload-time = "2026-10-03T14:54:03.545Z" }, + { url = "https://files.pythonhosted.org/packages/4f/a2/939bade7a396b4c381aebbf3941969f124d0f98d56753f81cd256f3fc4d6/websockets-17.2-cp313-cp313-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:876da8ca5520d65b5d0f2ca6b4e7a00d35bb90ccda35cb2ce3cda4b6c711e84a", size = 227227, upload-time = "2026-10-03T14:54:05.045Z" }, + { url = "https://files.pythonhosted.org/packages/e5/8a/37b1033e21709dd7fa39239ea4d9cd7f348ad5bcba94eb47253878576f8a/websockets-17.2-cp313-cp313-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:8462395df8f224d2daa3d80db3ae4450d9d4b7243c8483ac79a82862f1599dd6", size = 225985, upload-time = "2026-10-03T14:54:06.81Z" }, + { url = "https://files.pythonhosted.org/packages/a0/3a/0d89539900b06d86366facb7558198046de125ab8c371d9248d6262da70d/websockets-17.2-cp313-cp313-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:6e9a04e69456015e6ae5e0d486d995137fd435794442122b00ce5f9526ea3ba8", size = 223226, upload-time = "2026-10-03T14:54:08.583Z" }, + { url = "https://files.pythonhosted.org/packages/31/9a/bfc5633e3d538d0a71cfbe7a5fee56c712e16c2dbd0ce17c83196a2a96a9/websockets-17.2-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:8a2321bcb73758c44c8076509024d02c15ee484fe77ce04edea4bf4d257492cc", size = 226042, upload-time = "2026-10-03T14:54:10.254Z" }, + { url = "https://files.pythonhosted.org/packages/bb/1f/cbaf1786d8e3aeafe9d76951fc01139ec353b92555580336f23669382a55/websockets-17.2-cp313-cp313-musllinux_1_2_armv7l.whl", hash = "sha256:8be4a87b3baca380ec3c7b1643b2dd268ac9d42c5097c0e8dc9a49342faf4774", size = 224639, upload-time = "2026-10-03T14:54:11.911Z" }, + { url = "https://files.pythonhosted.org/packages/80/49/175faa5bd169486f835602ac0ae6303318aa65693b79cdc72c5ee53b148d/websockets-17.2-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:eb7b737ce8d18c8a08beb68f751572b7bf6a18093ecd1406ca1256b50592552e", size = 225407, upload-time = "2026-10-03T14:54:13.489Z" }, + { url = "https://files.pythonhosted.org/packages/ac/d1/3662f612456cfb2dcc128c8e596f0a55fb7b695025e2ebe8ba2abb355c3b/websockets-17.2-cp313-cp313-musllinux_1_2_ppc64le.whl", hash = "sha256:d6605630c2808b33f362d6d08582e79821f77ed2bd3f49f9d467ea70defea06d", size = 226513, upload-time = "2026-10-03T14:54:15.046Z" }, + { url = "https://files.pythonhosted.org/packages/73/6b/07af5177a49e30156b0922556fa93624a920a2b17d3e63bf4ad94668112c/websockets-17.2-cp313-cp313-musllinux_1_2_riscv64.whl", hash = "sha256:dd9252828073fd0d69e7667af4275a1b17c18d0833b1ab7f59db272f194a6b9a", size = 224072, upload-time = "2026-10-03T14:54:16.574Z" }, + { url = "https://files.pythonhosted.org/packages/eb/34/d18054ff4d8314524164f8b8efec2cb17627287e099f122c28ed6fa598e0/websockets-17.2-cp313-cp313-musllinux_1_2_s390x.whl", hash = "sha256:06c7386128a9d85de4e1960114604f3031c084d2f4eee8db382637f1634cbab1", size = 225022, upload-time = "2026-10-03T14:54:18.143Z" }, + { url = "https://files.pythonhosted.org/packages/e9/12/75433caa3e9fa3e51d7751dc6bad24a86addf76cbfb51e52b11d037ba7fd/websockets-17.2-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:98f2d03df74977fd252831c997c388cd6c3f691a8a9d022b266d3cbd9849838f", size = 225303, upload-time = "2026-10-03T14:54:19.679Z" }, + { url = "https://files.pythonhosted.org/packages/6f/de/23e21c002aa2786ac9807c0876faa3b2576493b29ca3386287b0db46f021/websockets-17.2-cp313-cp313-win32.whl", hash = "sha256:5b43a1f7e4853ce08c3f6d3bf69799ee5b46548bfb71792a8158f7e45d66b547", size = 218219, upload-time = "2026-10-03T14:54:21.232Z" }, + { url = "https://files.pythonhosted.org/packages/13/eb/960411c0c574535d629c16e96a2b4e5353dbe4109df8ecea859e1b5245ee/websockets-17.2-cp313-cp313-win_amd64.whl", hash = "sha256:27c7a59b5352a8f741b422820adfe89dfe47c8f2d84fb32111e76111edaa0e83", size = 218531, upload-time = "2026-10-03T14:54:23.025Z" }, + { url = "https://files.pythonhosted.org/packages/a0/1a/3ac07bb52378952eff1d52d04a7ee6e82ce84e3da319a52a4739cd9c78f5/websockets-17.2-cp313-cp313-win_arm64.whl", hash = "sha256:533b7c82bb1eafbeb921dfe131c9f88e55451ddc328d84bde1c9340ba72d2808", size = 218466, upload-time = "2026-10-03T14:54:24.857Z" }, + { url = "https://files.pythonhosted.org/packages/8b/74/6bc991a28ac983600e65de408ebd1b1413d554ed0468ae5c831bc52dded6/websockets-17.2-cp314-cp314-macosx_10_15_universal2.whl", hash = "sha256:ecb748910e9ba4624ebe2057791df51dcbffb48c37108ab94a3c593472023c9e", size = 217791, upload-time = "2026-10-03T14:54:26.381Z" }, + { url = "https://files.pythonhosted.org/packages/cb/2f/158e99426be6e71d09520bae53f29294fbb614b2fc5fbf8867b1d08395a7/websockets-17.2-cp314-cp314-macosx_10_15_x86_64.whl", hash = "sha256:2ab9af5cb7265899e659f079eb71691375a1025b6d5fbd3caa495dd08f70833a", size = 215486, upload-time = "2026-10-03T14:54:27.962Z" }, + { url = "https://files.pythonhosted.org/packages/5c/09/1abf942723c0001d9c2fca1551907dade6304517b982b0bf10bba107fa81/websockets-17.2-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:06e46da092bca3a52e98f0458c66b247993ce501a07cd09c858be3296511ab7d", size = 215699, upload-time = "2026-10-03T14:54:29.523Z" }, + { url = "https://files.pythonhosted.org/packages/a7/1d/1ade03963ef497c47e6bad79e24370827b2fe6145fa8f58070ff2b7dcbac/websockets-17.2-cp314-cp314-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:fcce735ffd72ac4056db05325d9f0232382b74826f0196eb6a15ca903abdaa0f", size = 225081, upload-time = "2026-10-03T14:54:31.278Z" }, + { url = "https://files.pythonhosted.org/packages/9f/fd/47b8a0361c49da939b976a07b27a72a9f893d01dfcf4d2a28b53419ce1ef/websockets-17.2-cp314-cp314-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:42cbca10f82a8b2fb1536e8a0830ca6ceeb6bb3d8d64b766e0795369135654a8", size = 225430, upload-time = "2026-10-03T14:54:32.917Z" }, + { url = "https://files.pythonhosted.org/packages/f0/26/f4d4c76264ee037c5556ab5f50fcba302746dabf7528955534e4dda9965e/websockets-17.2-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:c63ff5a21f26bd0e6a8464b53fadbe174825c8718ac14180df45665eaacdb6af", size = 226676, upload-time = "2026-10-03T14:54:34.833Z" }, + { url = "https://files.pythonhosted.org/packages/37/b3/c8b1c981322a050c4babfd327ffc9880f9c3834f5b15d2574e37eeb8768c/websockets-17.2-cp314-cp314-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:63f543463601c1558b755f8dd7618b6ec3dd0934dda051d3b7030d8c76e54de2", size = 228048, upload-time = "2026-10-03T14:54:36.424Z" }, + { url = "https://files.pythonhosted.org/packages/f0/5a/1cb29ddb23e6bc27ffd1c5316cd3616360d1ba0c3854eaa134ee3207bd28/websockets-17.2-cp314-cp314-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:4c32eb565ad9ce8a6444248e5b7a19dbb86a81c811fe5fcc2fba7a735aed5163", size = 227281, upload-time = "2026-10-03T14:54:38.01Z" }, + { url = "https://files.pythonhosted.org/packages/ba/64/135274572dc0c845fc1111e2b932c807c395daac75d6eae6cfa148d8a208/websockets-17.2-cp314-cp314-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:5d459bbb6c22f26dcebea56924a362aba50d453b9867912862c970434fcf0d94", size = 226025, upload-time = "2026-10-03T14:54:39.613Z" }, + { url = "https://files.pythonhosted.org/packages/58/75/f1e386aec3124489411caf5138cdd5a2bc43d3fd4a681c69adcf5f6272a5/websockets-17.2-cp314-cp314-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:f19ca1a21871f024e38faf4107b433047df27558dff1b72a1dac31481e2c1fe5", size = 223277, upload-time = "2026-10-03T14:54:41.165Z" }, + { url = "https://files.pythonhosted.org/packages/60/eb/24733a0f568c2eb99e60f9faa620a98fb228c06a01e7e2f348b33290ed9c/websockets-17.2-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:c76b4bcbf0f713194591673fc86a42820e14da6bbd1bb445d3d002cc4d1e4521", size = 226148, upload-time = "2026-10-03T14:54:42.779Z" }, + { url = "https://files.pythonhosted.org/packages/55/6d/ea66a30af74f5983cae31ebb9ef78b178b366a12856a414e1472225c4a34/websockets-17.2-cp314-cp314-musllinux_1_2_armv7l.whl", hash = "sha256:30201a7f69833b015556c72feb69ea501b645986fd0b90dab13f589e995ff428", size = 224615, upload-time = "2026-10-03T14:54:44.41Z" }, + { url = "https://files.pythonhosted.org/packages/87/80/c6f2228ad89774429d270179375ebddb657119215f52d1df7c680d65cad7/websockets-17.2-cp314-cp314-musllinux_1_2_i686.whl", hash = "sha256:0c8600aec354cc259f1691b0b42816f04a9886a953f82cb227246df76057f97a", size = 225398, upload-time = "2026-10-03T14:54:46.063Z" }, + { url = "https://files.pythonhosted.org/packages/f7/4a/3d8da19732ad468d4be7f1e3ac298078b60bdda55edde6589bef84a5eb7e/websockets-17.2-cp314-cp314-musllinux_1_2_ppc64le.whl", hash = "sha256:307fc22ea496be8542d67b82ae8c867a978dfd19ac35573d4f15943fd9277dfe", size = 226571, upload-time = "2026-10-03T14:54:47.672Z" }, + { url = "https://files.pythonhosted.org/packages/58/22/1231657122d9cc24791bb90af13cc2f4e84cf0d3a454cb37e3abfdcb2fd9/websockets-17.2-cp314-cp314-musllinux_1_2_riscv64.whl", hash = "sha256:9c88697fa943bd4ef67cc919a17d81de6581846f52bfa8c6f64a916098986556", size = 224125, upload-time = "2026-10-03T14:54:49.537Z" }, + { url = "https://files.pythonhosted.org/packages/1a/04/350ca2445da758bc42cdb4218b44d4ce0d5a9c1d5e4cc4a58d64348ad9da/websockets-17.2-cp314-cp314-musllinux_1_2_s390x.whl", hash = "sha256:f7eac84d4969da82166d5e90d9c38d2f416fe24f9708a7013569b193745b9a31", size = 225081, upload-time = "2026-10-03T14:54:51.075Z" }, + { url = "https://files.pythonhosted.org/packages/da/c4/dec952b0df3a5d918ed2a545abb0c25ae519c3bc2d9aba3b7c46abae8f05/websockets-17.2-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:313f6703023d53baabab6d6c5c37cf637b2c4fee255acf2ed5e92ad69e28f1b7", size = 225376, upload-time = "2026-10-03T14:54:52.675Z" }, + { url = "https://files.pythonhosted.org/packages/f2/b4/198a260afbcc086ff4979774e51834ed7fb5b95f9ef305e0c4924630b857/websockets-17.2-cp314-cp314-win32.whl", hash = "sha256:08d90cf344bdb971ba3a826b78d4da9bfd56cc6a97a604d9b88cbd40bfa6c735", size = 217760, upload-time = "2026-10-03T14:54:54.247Z" }, + { url = "https://files.pythonhosted.org/packages/e5/9e/0523f8bc2f7aaddf39562d4fa01b4d38fa61b23d980917a16d2dd19c8dac/websockets-17.2-cp314-cp314-win_amd64.whl", hash = "sha256:dac93bf7a9beb215be3282b8441173cd50806c41c007b8be9bb24e03c60ad563", size = 218104, upload-time = "2026-10-03T14:54:55.845Z" }, + { url = "https://files.pythonhosted.org/packages/55/17/7b8bb4cb64a199e7082f1f9be784d657842fefc327ac777d6c1493504804/websockets-17.2-cp314-cp314-win_arm64.whl", hash = "sha256:2ab742249f953d148a9ba696c8b9944361e8cb92e8bc61ba2dd53a178403afd3", size = 217989, upload-time = "2026-10-03T14:54:57.376Z" }, + { url = "https://files.pythonhosted.org/packages/ee/76/f54ed054b6e860f1e0bbc7019542a048352d41231fdff6d904b379f881c7/websockets-17.2-cp314-cp314t-macosx_10_15_universal2.whl", hash = "sha256:a69ce25be5f1330ee1c74eb6fabbbceaa96b384beedd2627cecded7546490c40", size = 218125, upload-time = "2026-10-03T14:54:58.943Z" }, + { url = "https://files.pythonhosted.org/packages/e6/4c/0f3375cea66a125ae01d21fb9c537aae955ef499bfe7e2b2376a34362f2a/websockets-17.2-cp314-cp314t-macosx_10_15_x86_64.whl", hash = "sha256:8e24b878cf54843a63985d90480f163ca7f692689fbcbe9cdbd8165521083a8b", size = 215658, upload-time = "2026-10-03T14:55:00.674Z" }, + { url = "https://files.pythonhosted.org/packages/0c/05/7c871a67bfb4b61adc1fe13583db97803f87dfeca644fe6ef51df7bb276d/websockets-17.2-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:f33c7908a6885dcae9f462a4a8347b637053b4ff2b96beb4c23fba1cf7818e5f", size = 215858, upload-time = "2026-10-03T14:55:02.379Z" }, + { url = "https://files.pythonhosted.org/packages/41/8e/59df4d9cd357e902d1c74b13c3c0c3841c8df6e4b1b3d131bf26a23fdcb1/websockets-17.2-cp314-cp314t-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:c796a1bb3e4015249639849f30e8e680df8a431b45d417ba8acf843d2451d95f", size = 225443, upload-time = "2026-10-03T14:55:03.966Z" }, + { url = "https://files.pythonhosted.org/packages/5c/64/5e486a3a44e041203c62eccf1fc89c7f8824e21104a7b82b182e5b21c228/websockets-17.2-cp314-cp314t-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:983bcdc898662f6ba9d6a025c30d29946ff0986d9ad60d400af0da3671f7cbf3", size = 225726, upload-time = "2026-10-03T14:55:05.797Z" }, + { url = "https://files.pythonhosted.org/packages/f0/98/b6eb53121c91fbe8b6897aba06861ce60f9ab58faffc6bca5750cbc21681/websockets-17.2-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:35e0f088ddfd9d9bc5019e27ff3767411779e92b59db5bb1507f2731a5b61158", size = 226895, upload-time = "2026-10-03T14:55:07.626Z" }, + { url = "https://files.pythonhosted.org/packages/8a/18/8c091321b99c91eb3eaec9acbd940e69308b4e465b5605c430af0cf7d3a5/websockets-17.2-cp314-cp314t-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:19e2511412ad3393191de652513bc7a0ca3c93af143b32d96d46e59fbbddf1d4", size = 229040, upload-time = "2026-10-03T14:55:09.321Z" }, + { url = "https://files.pythonhosted.org/packages/1a/96/3a92f944305b7de42fcb7530b9fa69607b4b4ce993c36a9f2330dbc318ba/websockets-17.2-cp314-cp314t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:cb5e2bf969ac99a6ae3c71208a5eb05cfde973192540ffa6e1068b57fb78c4f8", size = 227469, upload-time = "2026-10-03T14:55:10.935Z" }, + { url = "https://files.pythonhosted.org/packages/ea/a9/624f6d75ba326c22d03698b34c0ada984f1d76196322a62f6c22903b831d/websockets-17.2-cp314-cp314t-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:691780fca2be3dec512cb603cb91060271968cb4af86b51d07c57445c5754a37", size = 226202, upload-time = "2026-10-03T14:55:12.536Z" }, + { url = "https://files.pythonhosted.org/packages/47/af/1e6e8c625aeb268830af2c4227fe05e8db59f4f4debe1dadfd0ada214895/websockets-17.2-cp314-cp314t-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:2d39c19b1ba6a6791050383fd69efdd3b63533e2254693d0263879cd5f5921ba", size = 223743, upload-time = "2026-10-03T14:55:14.164Z" }, + { url = "https://files.pythonhosted.org/packages/dd/81/33c5280f4f6f81637c93ae065c6a594dfe35935622af135a5f7c3768bf22/websockets-17.2-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:e48ac2b302986c6f55cf61e8e36b4dd97d0132c5078a713a697a940934ba422e", size = 226492, upload-time = "2026-10-03T14:55:15.796Z" }, + { url = "https://files.pythonhosted.org/packages/1d/f3/7aa9fc36e67caccbcfee2c48f4ada41e9da512d41523c024d039f0f22ba3/websockets-17.2-cp314-cp314t-musllinux_1_2_armv7l.whl", hash = "sha256:e136197f1262620ef2e507afc3ea759c1ae7d221886da20eec5f4c9f2618c2aa", size = 224940, upload-time = "2026-10-03T14:55:17.661Z" }, + { url = "https://files.pythonhosted.org/packages/3f/8c/457aff7081a63d1261608bb4d7b0b0f9dfe780697a2a334671745742850b/websockets-17.2-cp314-cp314t-musllinux_1_2_i686.whl", hash = "sha256:3eb44019a2b0b3b91bac95998f1e4e5589730421170e060fe654a2b7be727dc7", size = 225835, upload-time = "2026-10-03T14:55:19.607Z" }, + { url = "https://files.pythonhosted.org/packages/3e/c3/7a13a3b3050db2c36772ded49f8d48f99eb080948e9f6f762e7529925ab5/websockets-17.2-cp314-cp314t-musllinux_1_2_ppc64le.whl", hash = "sha256:e5855e574804398859c5fbaf4fc7882b96278b7f6572a3d889627e6eb6cfca59", size = 226848, upload-time = "2026-10-03T14:55:21.274Z" }, + { url = "https://files.pythonhosted.org/packages/c4/3e/d5b2c1e473b1031a4a0ec0e10de69df5b981ab4a10aa482bb45c18dd43f5/websockets-17.2-cp314-cp314t-musllinux_1_2_riscv64.whl", hash = "sha256:5dc29815520c329f5662f6eb3ebadecf0d4f8c82dfa416d4d6efbf8f39245559", size = 224541, upload-time = "2026-10-03T14:55:22.874Z" }, + { url = "https://files.pythonhosted.org/packages/79/5d/bb81976cc1aa546afb51395ce42913521e9dea062bb34a61308cfff30726/websockets-17.2-cp314-cp314t-musllinux_1_2_s390x.whl", hash = "sha256:d1a4f9462da6496b6cb79bbb09c60d17f7e63e8a1df136797b3afabec9560e4d", size = 225315, upload-time = "2026-10-03T14:55:24.443Z" }, + { url = "https://files.pythonhosted.org/packages/f4/6b/314962d5440c61b4c107914599c13ceeecc6bdb6e2e73a5f7e566a7d1f26/websockets-17.2-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:9496bff5541086478264678bac73c0a75b2fde94fdf6568893bca1f7c6d50d18", size = 225747, upload-time = "2026-10-03T14:55:26.033Z" }, + { url = "https://files.pythonhosted.org/packages/98/fc/9eb64b34a3a4458eb08f3f24bde01508f72a00790330723c158ebb965048/websockets-17.2-cp314-cp314t-win32.whl", hash = "sha256:e1e3bc8090a7eae79fdf634b63bdbfa3c93999991023c37c6fd3b469fc8ff5dc", size = 217891, upload-time = "2026-10-03T14:55:27.681Z" }, + { url = "https://files.pythonhosted.org/packages/ba/ed/3a4e2a09b0822d6e525cbc6e44a4885669bad5b22ab9c64fa2444bc15325/websockets-17.2-cp314-cp314t-win_amd64.whl", hash = "sha256:65a89a5bde227bfe908016f35b5bd347970cd1e5b0360f389502eba1c7fde6e0", size = 218229, upload-time = "2026-10-03T14:55:29.314Z" }, + { url = "https://files.pythonhosted.org/packages/b5/66/cffb75ee746dd060984c3c3e2eac7f875a866225a30dfa53e2cd18232565/websockets-17.2-cp314-cp314t-win_arm64.whl", hash = "sha256:1c27339934109dfaca83f18ab2c23db06714e9d5deca2c8e37e8f492ab90d20b", size = 218146, upload-time = "2026-10-03T14:55:31.001Z" }, + { url = "https://files.pythonhosted.org/packages/12/e9/10a9b1633b63594054c87b97af048628cea2b21b5089a52a9fc1e0af60a3/websockets-17.2-cp315-cp315-macosx_10_15_universal2.whl", hash = "sha256:a7c4bb26de6ef496d24822aee4f6a305d97cd33d21a2b85f290292d69ba1c25e", size = 217719, upload-time = "2026-10-03T14:55:32.674Z" }, + { url = "https://files.pythonhosted.org/packages/0c/00/ff4020fe0886dac7199a16ce2805c7afd7b981bd2e81d3fa18dff5d9863a/websockets-17.2-cp315-cp315-macosx_10_15_x86_64.whl", hash = "sha256:c08da1f15040bd1e1a6074bd4518a6ef20e67b1594ecfb0aa75e5b45f87e6d6d", size = 215448, upload-time = "2026-10-03T14:55:34.338Z" }, + { url = "https://files.pythonhosted.org/packages/66/06/bc7b944f81514378b2c2ab96c17df19e871cd33b9be0f1f6dfc975457e5e/websockets-17.2-cp315-cp315-macosx_11_0_arm64.whl", hash = "sha256:3117abfd32b183bdb6194df9317766d32c6517f3d1c0aa8c62d5c6ccfda0b4a8", size = 215674, upload-time = "2026-10-03T14:55:35.918Z" }, + { url = "https://files.pythonhosted.org/packages/a8/da/2b2b76faa2f10c4813e3872c9577fd13a798f5918b1785b86ff7d635eb2a/websockets-17.2-cp315-cp315-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:a046227daa7f191e843d26b911c1146233e9a33d249e0c954dcb3ac7c398710e", size = 225119, upload-time = "2026-10-03T14:55:37.777Z" }, + { url = "https://files.pythonhosted.org/packages/ae/d4/22cbe288c0d5cef7620503be92c0098d82220353fc7e188034a19c517240/websockets-17.2-cp315-cp315-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:2901bdf24f20bc884124b3e88c61f7ece260c20c81e610f2196007395264a4aa", size = 225549, upload-time = "2026-10-03T14:55:39.364Z" }, + { url = "https://files.pythonhosted.org/packages/4c/0a/504b0d3063679f2c60430c3539482d42a4cb8bd1a76646baf742030a93cc/websockets-17.2-cp315-cp315-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:f60e39adfecf998488166aca8ff24ab1ac406c9ecbecbcf9b3bcfc43cb1ec9a1", size = 226717, upload-time = "2026-10-03T14:55:40.942Z" }, + { url = "https://files.pythonhosted.org/packages/4e/ea/5da9309cc55c2665a6eebc22c369d9918c0d77258c61e92058e6b08d5ff1/websockets-17.2-cp315-cp315-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:d4df62fd8448a85c752bbea1803cb3a2785e6fc8352009ab64ad7447af079b3c", size = 228413, upload-time = "2026-10-03T14:55:42.54Z" }, + { url = "https://files.pythonhosted.org/packages/a6/74/5a24df72aa5500f311105687af864c27f1f9da910e968e97818c6149e6b0/websockets-17.2-cp315-cp315-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:c8eea55fdfa9ba65c6981eea38bd20c800bce2f092a2803d82de764ecf0f071a", size = 227196, upload-time = "2026-10-03T14:55:44.251Z" }, + { url = "https://files.pythonhosted.org/packages/5e/ee/ca32cc1ed892dc4ac30a922e8f648048233fbdb8b0bce7048860ec4c60ec/websockets-17.2-cp315-cp315-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:3f0def1279644acaa9bc861d4234af3f82ea9cee7e460dffac5cb63e691501e9", size = 226092, upload-time = "2026-10-03T14:55:45.842Z" }, + { url = "https://files.pythonhosted.org/packages/7d/0c/12d4a73324aa9798d5165d20c088f9dba66c75c871960e5d921ec66694e4/websockets-17.2-cp315-cp315-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:fb78fb4158c12f77a934a003006784108a27a6553cfc0c6f10483c9c02e94f48", size = 223486, upload-time = "2026-10-03T14:55:47.45Z" }, + { url = "https://files.pythonhosted.org/packages/bc/a4/7fe15da5abb8f0f61e6a357593f7f2ed55724825b7db0ffe72b5c5fad68d/websockets-17.2-cp315-cp315-musllinux_1_2_aarch64.whl", hash = "sha256:f8969ad228115ad8869b5fed801f899e52ab8ad376fdb165ba4760a277c8258a", size = 226200, upload-time = "2026-10-03T14:55:49.126Z" }, + { url = "https://files.pythonhosted.org/packages/08/b9/4cd3a311f96a2eea0ed458bc01fe2cce42f9cd50aa9e64315dfc855d63a9/websockets-17.2-cp315-cp315-musllinux_1_2_armv7l.whl", hash = "sha256:4a49ca342efc0800e6ae94ed5c9cbdcb319308f75e73c21181e4c24d6710e8dd", size = 224862, upload-time = "2026-10-03T14:55:50.674Z" }, + { url = "https://files.pythonhosted.org/packages/41/b5/22caa3460f75e42bfcc74028870b556d22847ea9a9034aa03986f07f16a9/websockets-17.2-cp315-cp315-musllinux_1_2_i686.whl", hash = "sha256:06fa3ce9c3154826c33d4395b225b2994aa64f1f3bcd8be8ed932019175d9268", size = 225391, upload-time = "2026-10-03T14:55:52.393Z" }, + { url = "https://files.pythonhosted.org/packages/95/be/8d28f92092076abf1ddfb3206b0ce956120a22e7c3105f6a3029d727deae/websockets-17.2-cp315-cp315-musllinux_1_2_ppc64le.whl", hash = "sha256:50644d8715be7e0ec0682f9d7744b63008e199c5e1618a48fa153756a332235f", size = 226545, upload-time = "2026-10-03T14:55:54.127Z" }, + { url = "https://files.pythonhosted.org/packages/cb/7b/ff943fa383e540fe17f066cc10a3eeedef26e50fd45aae2bdc6746d6f95a/websockets-17.2-cp315-cp315-musllinux_1_2_riscv64.whl", hash = "sha256:60deca33e584c09e91f70f8b55a0b1de7d671d6a63f051d154920f48bed717c7", size = 224352, upload-time = "2026-10-03T14:55:55.856Z" }, + { url = "https://files.pythonhosted.org/packages/e9/df/1e6c3e06c473c9fd833a5c1620b15e2c3b37647b91b7d41871d20bc098de/websockets-17.2-cp315-cp315-musllinux_1_2_s390x.whl", hash = "sha256:b5f79366a8d8dbb981d53ba800bb54a95454595ab8a4548c2b95501b32a08326", size = 225255, upload-time = "2026-10-03T14:55:57.497Z" }, + { url = "https://files.pythonhosted.org/packages/db/f8/d8a4f988f7cbb568d8bd69da4632c5b6010aa9cd9366f285e23b73b678d9/websockets-17.2-cp315-cp315-musllinux_1_2_x86_64.whl", hash = "sha256:f2bbf3f28d0b63157577c8b774b9136f076afa6797e1a52a2ecd477f23cad3a8", size = 225513, upload-time = "2026-10-03T14:55:59.338Z" }, + { url = "https://files.pythonhosted.org/packages/75/e0/920357165b2797a2530fc9e271d79a9b5fee2b750b154c990c740f767af3/websockets-17.2-cp315-cp315-win32.whl", hash = "sha256:74836317b7010b579522bb52426f1e225608b042c9e78cbe2493522bebb8a318", size = 217722, upload-time = "2026-10-03T14:56:01.307Z" }, + { url = "https://files.pythonhosted.org/packages/5f/eb/25bdca25bbc329ffb330ef33993397d6556a871e40a0d196e757699ea3f7/websockets-17.2-cp315-cp315-win_amd64.whl", hash = "sha256:aaead3d926e9ab4124ada727d20cd62d396649917822df4f771d1f07f1079b40", size = 218017, upload-time = "2026-10-03T14:56:02.914Z" }, + { url = "https://files.pythonhosted.org/packages/fa/cb/ea30a552bbcd1c75f0d14bfce6c884ee36187030b85b74a242aacc02406e/websockets-17.2-cp315-cp315-win_arm64.whl", hash = "sha256:40960554e60eb60c3eec4ff9e42a80f84f8cd3ca9bc80a5481a61f1e64d807c9", size = 217929, upload-time = "2026-10-03T14:56:04.604Z" }, + { url = "https://files.pythonhosted.org/packages/4a/01/477664c619af8aa3c908d482e2a95e13ceed9d78f21d15902013c3bc6c28/websockets-17.2-cp315-cp315t-macosx_10_15_universal2.whl", hash = "sha256:9a2a60a7f0ea5f239efb6391d2b28630a640d82dad63e3bee47cf2c623c4495d", size = 218029, upload-time = "2026-10-03T14:56:06.336Z" }, + { url = "https://files.pythonhosted.org/packages/2a/a9/b0be62ff1c0e2bc966da56b36d3d820c7e2ad3c0c4a4ac414fc7335b214f/websockets-17.2-cp315-cp315t-macosx_10_15_x86_64.whl", hash = "sha256:cca2fcb72c007103740fa4fc3df19fdb1a318c641c69f3b0cc47ed63a889336e", size = 215607, upload-time = "2026-10-03T14:56:08.035Z" }, + { url = "https://files.pythonhosted.org/packages/fc/2b/a6738530de0437a31c1b168e4096ecf790aafaf561f33a009886c7d8042e/websockets-17.2-cp315-cp315t-macosx_11_0_arm64.whl", hash = "sha256:b789356bc4e2e6c20ba52817f92c3fed74e24657654237ecd536c54843b80c6c", size = 215817, upload-time = "2026-10-03T14:56:09.852Z" }, + { url = "https://files.pythonhosted.org/packages/c3/c2/2fc44ddc419cbb09ee1708af3e78d8a4b018db01fc7e4f91bd730e2f8d9e/websockets-17.2-cp315-cp315t-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:222fb626fa15701a850eccc778be17312142b2f6a0e16aea80770b7459adb784", size = 225979, upload-time = "2026-10-03T14:56:11.85Z" }, + { url = "https://files.pythonhosted.org/packages/2e/91/a215b14caa7ea65bc36db81609108899c259503300d1560dae9c70a135e7/websockets-17.2-cp315-cp315t-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:4497e87c34a2d21cbec1227858fec3af8e514dd70c47625557a122fcebc081dc", size = 226250, upload-time = "2026-10-03T14:56:13.548Z" }, + { url = "https://files.pythonhosted.org/packages/65/b9/9406a18e9edf558ed504d2a7679371d0f8107e4ef526c80b154ea4ec9752/websockets-17.2-cp315-cp315t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:6281c171557ce0e408e19d9a223f22d915117ac38a5a7f32ed83809e7492316c", size = 227579, upload-time = "2026-10-03T14:56:15.143Z" }, + { url = "https://files.pythonhosted.org/packages/fe/45/a73af119244f46f5130005d7ab63f1c75890c890141a0ca2adc9d97d4671/websockets-17.2-cp315-cp315t-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:08d97098644728bd1895caa7ecf3090b8e563d70809870d2adb33a107bd061d0", size = 229205, upload-time = "2026-10-03T14:56:17.086Z" }, + { url = "https://files.pythonhosted.org/packages/c1/92/ccd8e2e921d134a56f1ed4642d276500d9e33b3dc4d6deb63d614b3e53a6/websockets-17.2-cp315-cp315t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:1fdb8d5a1660307dc6d36d0b7fc725213cbd7f80800904dc4896aa3208b89121", size = 228011, upload-time = "2026-10-03T14:56:18.716Z" }, + { url = "https://files.pythonhosted.org/packages/e0/ef/7d71105d19a7aaab5ff87b9c712f6c1dda44e72ea56aa0e7b777f2fc274b/websockets-17.2-cp315-cp315t-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:18b0a46e5e9b315e2b54ce8c3bafdeef0e1388ca363114fa868e6aab2dc58512", size = 226892, upload-time = "2026-10-03T14:56:20.412Z" }, + { url = "https://files.pythonhosted.org/packages/56/f7/87012d628b21e66e699440f39bfa7cc55fae7f52b2c532ab62184a589624/websockets-17.2-cp315-cp315t-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:7f115d5d804a2163dd89245710049078b0e726a58c1f44a1f86c2c6e79055d76", size = 224241, upload-time = "2026-10-03T14:56:22.257Z" }, + { url = "https://files.pythonhosted.org/packages/55/f5/495371068b27ee5f7c435187f9dafd62402f195e2c76063bdd4653da1565/websockets-17.2-cp315-cp315t-musllinux_1_2_aarch64.whl", hash = "sha256:1d829946a2e7630f92f9d7b45b62f3abe9f393cc2dea6a35edb3988f865e75f2", size = 227076, upload-time = "2026-10-03T14:56:23.909Z" }, + { url = "https://files.pythonhosted.org/packages/18/18/3dce3cc6099be5e044e0fd5d0e0c9931c8e3387511cdec8014a345f619e5/websockets-17.2-cp315-cp315t-musllinux_1_2_armv7l.whl", hash = "sha256:6c274fc1572edf7c197094a0eb1887d45fdc95254bc80597dc7599550486c06a", size = 225727, upload-time = "2026-10-03T14:56:25.689Z" }, + { url = "https://files.pythonhosted.org/packages/47/30/57d0c7aaf8d4473926fa8829b8136483f561388d1e747ae71c9f2a83d5fd/websockets-17.2-cp315-cp315t-musllinux_1_2_i686.whl", hash = "sha256:4173a4b8a025ae44313d9d9b4ecf31e886c7b7faf45386d51a8ca4ff2dcf3f2a", size = 226225, upload-time = "2026-10-03T14:56:27.246Z" }, + { url = "https://files.pythonhosted.org/packages/0c/9f/9dce1203756756c00b407b9a6b13a7500fcd38f2634d4daa3f65575814ec/websockets-17.2-cp315-cp315t-musllinux_1_2_ppc64le.whl", hash = "sha256:d8cfe9522ad69b6abb26b413ed1deca43cb915cefc588433d557cb3ae1c783e2", size = 227333, upload-time = "2026-10-03T14:56:28.811Z" }, + { url = "https://files.pythonhosted.org/packages/9a/2f/d3b6b876678ebb03017b7afd7111fe44d54b93f036a80ebb4b481dd1ab74/websockets-17.2-cp315-cp315t-musllinux_1_2_riscv64.whl", hash = "sha256:908d81d88bb16141613a6275059b5114656d5c2f0b5400b421d54fe6f1943507", size = 225082, upload-time = "2026-10-03T14:56:30.578Z" }, + { url = "https://files.pythonhosted.org/packages/32/b0/a69b573a5e56d2e7a5dcbb447466f442380cf81515e1cb1220cd626c8042/websockets-17.2-cp315-cp315t-musllinux_1_2_s390x.whl", hash = "sha256:c6590e1eb624ff6b15b872421bc9a10bc6d2057635d69c6cd244ac3f928f85c6", size = 225945, upload-time = "2026-10-03T14:56:32.32Z" }, + { url = "https://files.pythonhosted.org/packages/70/be/a72911dc8e33f74c196012366ce4d99b1a803894a377a1ed0c8e66df9caa/websockets-17.2-cp315-cp315t-musllinux_1_2_x86_64.whl", hash = "sha256:61040f6f7da5a279d2f77496c69d51132aba75f701c52bded400d4c639277b18", size = 226241, upload-time = "2026-10-03T14:56:34.142Z" }, + { url = "https://files.pythonhosted.org/packages/7d/a9/02a68c1d8e5572918e0962d3aad881078f73ede43abd9b1336e4efaa8909/websockets-17.2-cp315-cp315t-win32.whl", hash = "sha256:f90bad2839c185a1edf8ee22a257cfc8a39e0e337a0490ab185dfa76ef04d1bd", size = 217847, upload-time = "2026-10-03T14:56:36.204Z" }, + { url = "https://files.pythonhosted.org/packages/2b/bf/3d7c33b8d5e7712a60e0149c017ed50394ec5e8cf72e5cb6a1ffaf11a42d/websockets-17.2-cp315-cp315t-win_amd64.whl", hash = "sha256:315551f4ccedbbf9fd4f7e8bf037a5948c976ade0e919ba5d8f581d465f6f725", size = 218169, upload-time = "2026-10-03T14:56:37.79Z" }, + { url = "https://files.pythonhosted.org/packages/27/57/ab34cc6460c5322e6932750fa5c6c64be89e6ee4e2707d13c4e9d3312b25/websockets-17.2-cp315-cp315t-win_arm64.whl", hash = "sha256:0a6220bdf8d5f11af71251a599092d89ac1d6bfac691c7f5951c5b07953947a0", size = 218089, upload-time = "2026-10-03T14:56:39.427Z" }, + { url = "https://files.pythonhosted.org/packages/8a/58/835cd51934d6780fa586f275b5d9901eead6d81569b4343b3767cdbaae4c/websockets-17.2-py3-none-any.whl", hash = "sha256:6aa59f0ef92e796b2db6f5f26550c4713c0e4036899fadf02f55e2ed4db0b7ae", size = 211883, upload-time = "2026-10-03T14:56:51.898Z" }, +] diff --git a/nginx.conf b/nginx.conf index c2809ed..d0b34af 100644 --- a/nginx.conf +++ b/nginx.conf @@ -31,7 +31,7 @@ http { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; - + # Timeout settings proxy_connect_timeout 60s; proxy_send_timeout 60s; @@ -60,15 +60,15 @@ http { # server { # listen 443 ssl http2; # server_name localhost; - # + # # ssl_certificate /etc/nginx/ssl/cert.pem; # ssl_certificate_key /etc/nginx/ssl/key.pem; - # + # # # SSL configuration # ssl_protocols TLSv1.2 TLSv1.3; # ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384; # ssl_prefer_server_ciphers off; - # + # # # Same proxy configuration as HTTP # location / { # proxy_pass http://epr-mcp-server; @@ -78,4 +78,4 @@ http { # proxy_set_header X-Forwarded-Proto $scheme; # } # } -} \ No newline at end of file +} diff --git a/prometheus.yaml b/prometheus.yaml index 52c0a17..3154867 100644 --- a/prometheus.yaml +++ b/prometheus.yaml @@ -1,3 +1,4 @@ +--- global: scrape_interval: 15s evaluation_interval: 15s @@ -7,13 +8,13 @@ rule_files: # - "second_rules.yml" scrape_configs: - - job_name: 'epr-mcp-server' + - job_name: "epr-mcp-server" static_configs: - - targets: ['epr-mcp-server:8000'] + - targets: ["epr-mcp-server:8000"] scrape_interval: 30s metrics_path: /metrics scheme: http - - - job_name: 'prometheus' + + - job_name: "prometheus" static_configs: - - targets: ['localhost:9090'] \ No newline at end of file + - targets: ["localhost:9090"] diff --git a/pyproject.toml b/pyproject.toml index 008d3fd..8398ed0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,14 +1,15 @@ [build-system] -requires = ["setuptools>=40.8.0", "wheel"] -build-backend = "setuptools.build_meta:__legacy__" +requires = ["setuptools>=77", "wheel"] +build-backend = "setuptools.build_meta" [project] name = "epr-mcp" -version = "0.1.0" +version = "2.0.0" description = "A Python MCP Server for Event Provenance Registry (EPR)" readme = "README.md" requires-python = ">= 3.12" -license.file = "LICENSE" +license = "Apache-2.0" +license-files = ["LICENSE"] authors = [ { name = "Brett Smith", email = "xbcsmith@gmail.com" }, ] @@ -16,17 +17,16 @@ classifiers = [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "Intended Audience :: Information Technology", - "License :: OSI Approved :: Apache Software License", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] dependencies = [ - "fastmcp", - "httpx", - "pydantic", - "starlette", + "fastmcp>=4.0,<5", + "httpx2>=2.13", + "pydantic>=2.12", + "starlette>=1.0", "PyYAML", ] @@ -39,6 +39,8 @@ lint = [ test = [ "coverage", "pytest", + "pytest-asyncio", + "pytest-cov", "mock", ] @@ -55,8 +57,11 @@ eprmcp = "epr_mcp.main:main" [project.urls] "Homepage" = "https://github.com/xbcsmith/epr-mcp-python" -[tool.distutils.bdist_wheel] -universal = true +[tool.setuptools.package-data] +epr_mcp = ["openapi.yaml"] + +[tool.pytest.ini_options] +testpaths = ["tests"] [tool.ruff] line-length = 120 @@ -90,8 +95,9 @@ usedevelop = false deps = coverage pytest + pytest-asyncio mock -extras = testing +extras = test commands = coverage run -p -m pytest -vv {posargs:tests/} @@ -114,7 +120,7 @@ deps = ruff skip_install = true commands = - ruff check src/epr_mcp/ tests/ + ruff check src/epr_mcp/ tests/ demos/ [testenv:report] deps = coverage @@ -148,6 +154,6 @@ deps = ruff skip_install = true commands = - ruff check --fix src/epr_mcp/ tests/ + ruff check --fix src/epr_mcp/ tests/ demos/ """ diff --git a/src/epr_mcp/common.py b/src/epr_mcp/common.py index d9cc2c3..b278057 100644 --- a/src/epr_mcp/common.py +++ b/src/epr_mcp/common.py @@ -7,6 +7,9 @@ import sys from typing import Optional +import httpx2 + +from .config import Config from .errors import debug_except_hook from .models import GraphQLQuery @@ -19,7 +22,46 @@ logger.setLevel(logging.DEBUG) +def create_client(cfg: Config) -> httpx2.AsyncClient: + """Create an HTTP client for the EPR API. + + The client sends a JSON content type and, when the configuration has a + token, an ``Authorization: Bearer`` header on every request. + + Args: + cfg: Server configuration providing the optional API token. + + Returns: + A new ``httpx2.AsyncClient``; use it as an async context manager. + + Examples: + >>> client = create_client(Config(url="http://epr", token="abc")) + >>> client.headers["Authorization"] + 'Bearer abc' + """ + headers = {"Content-Type": "application/json"} + if cfg.token: + headers["Authorization"] = f"Bearer {cfg.token}" + return httpx2.AsyncClient(headers=headers) + + def get_operation(name: str, operation: str) -> str: + """Look up a GraphQL type or field name. + + Args: + name: Kind of lookup: "search", "mutation", "operation", or "create". + operation: The operation inside that kind, for example "events" or "create_event". + + Returns: + The GraphQL input type or field name. + + Raises: + KeyError: If the name or operation is not known. + + Examples: + >>> get_operation("operation", "events") + 'event' + """ operation_map = { "search": { "events": "FindEventInput!", @@ -46,7 +88,26 @@ def get_operation(name: str, operation: str) -> str: def get_search_query(operation: str, params: Optional[dict] = None, fields: Optional[list] = None) -> GraphQLQuery: - """Convert a query dictionary to a GraphQL query string.""" + """Build the GraphQL query for an EPR search. + + Args: + operation: The search to run: "events", "event_receivers", or "event_receiver_groups". + params: The search criteria, or None for none. + fields: The fields to return for each record; defaults to just "id". + + Returns: + A GraphQLQuery holding the query text and its variables. + + Raises: + KeyError: If the operation is not known. + + Examples: + >>> q = get_search_query("events", {"name": "foo"}, ["id", "name"]) + >>> q.variables + {'obj': {'name': 'foo'}} + >>> q.query + 'query ($obj: FindEventInput!){events(event: $obj) { id,name }}' + """ variables = dict(obj=params) method = get_operation("search", operation) op = get_operation("operation", operation) @@ -56,7 +117,23 @@ def get_search_query(operation: str, params: Optional[dict] = None, fields: Opti def get_mutation_query(operation: str, params: Optional[dict] = None) -> GraphQLQuery: - """Convert a mutation dictionary to a GraphQL mutation string.""" + """Build the GraphQL mutation for an EPR create. + + Args: + operation: The mutation: "create_event", "create_event_receiver", or + "create_event_receiver_group". + params: The fields of the record to create, or None for none. + + Returns: + A GraphQLQuery holding the mutation text and its variables. + + Raises: + KeyError: If the operation is not known. + + Examples: + >>> get_mutation_query("create_event", {"name": "foo"}).query + 'mutation ($obj: CreateEventInput!){create_event(event: $obj)}' + """ variables = dict(obj=params) method = get_operation("mutation", operation) op = get_operation("create", operation) diff --git a/src/epr_mcp/config.py b/src/epr_mcp/config.py index 88a674f..d27699f 100644 --- a/src/epr_mcp/config.py +++ b/src/epr_mcp/config.py @@ -4,15 +4,28 @@ from dataclasses import asdict, dataclass +TRANSPORTS = ("http", "stdio") + @dataclass class Config: """Data class for Config""" url: str - token: str + token: str | None = None debug: bool = False + transport: str = "http" + host: str = "0.0.0.0" + port: int = 8000 def as_dict(self): - """Get a dictionary containing object properties""" + """Get a dictionary containing the configuration values. + + Returns: + A dictionary with url, token, debug, transport, host, and port. + + Examples: + >>> Config(url="http://epr").as_dict()["port"] + 8000 + """ return asdict(self) diff --git a/src/epr_mcp/constants.py b/src/epr_mcp/constants.py index ceb76ff..bdf326c 100644 --- a/src/epr_mcp/constants.py +++ b/src/epr_mcp/constants.py @@ -13,4 +13,10 @@ def info(): + """Return the package name and version as two lines of text. + + Examples: + >>> info().splitlines()[0] + 'epr-mcp' + """ return f"{__title__}\n{__version__}" diff --git a/src/epr_mcp/errors.py b/src/epr_mcp/errors.py index 85cb607..1e690c3 100644 --- a/src/epr_mcp/errors.py +++ b/src/epr_mcp/errors.py @@ -53,6 +53,19 @@ class GraphQLError(EPRError): def debug_except_hook(type, value, tb): + """Print an uncaught exception and open a post-mortem debugger. + + Installed as ``sys.excepthook`` when debugging is on. Do not use it with the stdio + transport: the debugger reads from stdin, which carries the MCP protocol. + + Args: + type: The exception class. + value: The exception instance. + tb: The traceback. + + Examples: + ``sys.excepthook = debug_except_hook`` makes an uncaught error open ``pdb``. + """ print(f"epr python hates {type.__name__}") print(str(type)) diff --git a/src/epr_mcp/main.py b/src/epr_mcp/main.py index 7d3a05c..0dedbfa 100644 --- a/src/epr_mcp/main.py +++ b/src/epr_mcp/main.py @@ -20,6 +20,8 @@ class CmdLine(object): + """Command line dispatcher: the first argument names the method to run.""" + def __init__(self): parser = argparse.ArgumentParser( description="EPR MCP Server", @@ -43,15 +45,23 @@ def __init__(self): getattr(self, args.command)() def start(self): - """ - start the EPR MCP server + """Start the EPR MCP server. + + Reads --url, --token, --transport, --host, --port, and --debug from + ``sys.argv`` (environment variables supply the defaults) and runs the server. + + Returns: + The status message from ``server.run`` after the server stops. + + Examples: + From a shell: ``eprmcp start --transport http --host 127.0.0.1 --port 8000`` """ parser = argparse.ArgumentParser(description="start the EPR MCP Server\n") parser.add_argument( "--token", dest="epr_api_token", action="store", - default=os.environ.get("EPR_API_TOKEN"), + default=os.environ.get("EPR_API_TOKEN") or os.environ.get("EPR_TOKEN"), help="EPR Access Token", ) parser.add_argument( @@ -61,6 +71,29 @@ def start(self): default=os.environ.get("EPR_URL", "http://localhost:8042"), help="EPR Server URL", ) + parser.add_argument( + "--transport", + dest="transport", + action="store", + choices=config.TRANSPORTS, + default=os.environ.get("MCP_TRANSPORT", "http"), + help="MCP transport: http (default) or stdio", + ) + parser.add_argument( + "--host", + dest="host", + action="store", + default=os.environ.get("MCP_HOST", "0.0.0.0"), + help="Host to bind for the http transport", + ) + parser.add_argument( + "--port", + dest="port", + action="store", + type=int, + default=int(os.environ.get("MCP_PORT", "8000")), + help="Port to bind for the http transport", + ) parser.add_argument( "--debug", dest="debug", @@ -72,20 +105,35 @@ def start(self): args = vars(parser.parse_args(sys.argv[2:])) url = args["epr_url"] token = args["epr_api_token"] - cfg = config.Config(url=url, token=token) - - cfg.debug = args["debug"] + cfg = config.Config( + url=url, + token=token, + debug=args["debug"], + transport=args["transport"], + host=args["host"], + port=args["port"], + ) return server.run(cfg) def version(self): - """ - Prints version of epr-mcp + """Print the name and version of epr-mcp. + + Examples: + From a shell: ``eprmcp version`` prints the package name, then the version. """ print(constants.info()) def main(): + """Entry point for the ``eprmcp`` command. + + Reads the command from ``sys.argv`` and runs it; exits with status 1 on an + unknown command. + + Examples: + From a shell: ``eprmcp start --transport stdio --url http://localhost:8042`` + """ CmdLine() diff --git a/src/epr_mcp/models.py b/src/epr_mcp/models.py index b4bc85b..5d45456 100644 --- a/src/epr_mcp/models.py +++ b/src/epr_mcp/models.py @@ -8,14 +8,34 @@ class ModelType(Enum): + """The kinds of EPR records.""" + EVENT = "Event" RECEIVER = "EventReceiver" GROUP = "EventReceiverGroup" def lower(self): + """Return the record name in lower case. + + Returns: + The lower-case name. + + Examples: + >>> ModelType.RECEIVER.lower() + 'eventreceiver' + """ return self.value.lower() def lower_plural(self): + """Return the record name in lower case and plural. + + Returns: + The lower-case plural name. + + Examples: + >>> ModelType.GROUP.lower_plural() + 'eventreceivergroups' + """ return self.lower() + "s" @@ -24,11 +44,29 @@ class Model: """Base class for data objects. Provides as_dict""" def as_dict(self): - """Get a dictionary contain object properties""" + """Get a dictionary containing the object's fields. + + Returns: + All fields, including empty ones. + + Examples: + >>> Event(name="foo").as_dict()["name"] + 'foo' + >>> Event(name="foo").as_dict()["release"] + '' + """ return asdict(self) def as_dict_query(self): - """Get a dictionary contain object properties""" + """Get a dictionary of the object's fields that have a value. + + Returns: + The fields that are not empty, suitable as a request body. + + Examples: + >>> Event(name="foo").as_dict_query() + {'name': 'foo'} + """ return {k: v for k, v in self.as_dict().items() if v} @@ -109,5 +147,7 @@ class Message(Model): @dataclass class GraphQLQuery(Model): + """A GraphQL query and its variables, ready to post to EPR.""" + query: str variables: Dict[str, Any] = field(default_factory=dict) diff --git a/src/epr_mcp/openapi.yaml b/src/epr_mcp/openapi.yaml index 093364b..a45585b 100644 --- a/src/epr_mcp/openapi.yaml +++ b/src/epr_mcp/openapi.yaml @@ -1,3 +1,4 @@ +--- openapi: 3.1.0 info: title: EPR (Event Processing Registry) API @@ -200,18 +201,18 @@ paths: type: string description: Event ID responses: - '200': + "200": description: Event found content: application/json: schema: - $ref: '#/components/schemas/Event' - '404': + $ref: "#/components/schemas/Event" + "404": description: Event not found content: application/json: schema: - $ref: '#/components/schemas/Error' + $ref: "#/components/schemas/Error" /api/v1/events: post: @@ -223,9 +224,9 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/Event' + $ref: "#/components/schemas/Event" responses: - '201': + "201": description: Event created successfully content: application/json: @@ -235,13 +236,13 @@ paths: message: type: string event: - $ref: '#/components/schemas/Event' - '400': + $ref: "#/components/schemas/Event" + "400": description: Invalid input content: application/json: schema: - $ref: '#/components/schemas/Error' + $ref: "#/components/schemas/Error" /api/v1/events/search: post: @@ -253,16 +254,16 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/SearchCriteria' + $ref: "#/components/schemas/SearchCriteria" responses: - '200': + "200": description: Search results content: application/json: schema: type: array items: - $ref: '#/components/schemas/Event' + $ref: "#/components/schemas/Event" /api/v1/receivers/{id}: get: @@ -277,18 +278,18 @@ paths: type: string description: Event receiver ID responses: - '200': + "200": description: Event receiver found content: application/json: schema: - $ref: '#/components/schemas/EventReceiver' - '404': + $ref: "#/components/schemas/EventReceiver" + "404": description: Event receiver not found content: application/json: schema: - $ref: '#/components/schemas/Error' + $ref: "#/components/schemas/Error" /api/v1/receivers: post: @@ -300,9 +301,9 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/EventReceiver' + $ref: "#/components/schemas/EventReceiver" responses: - '201': + "201": description: Event receiver created successfully content: application/json: @@ -312,13 +313,13 @@ paths: message: type: string receiver: - $ref: '#/components/schemas/EventReceiver' - '400': + $ref: "#/components/schemas/EventReceiver" + "400": description: Invalid input content: application/json: schema: - $ref: '#/components/schemas/Error' + $ref: "#/components/schemas/Error" /api/v1/receivers/search: post: @@ -330,16 +331,16 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/SearchCriteria' + $ref: "#/components/schemas/SearchCriteria" responses: - '200': + "200": description: Search results content: application/json: schema: type: array items: - $ref: '#/components/schemas/EventReceiver' + $ref: "#/components/schemas/EventReceiver" /api/v1/groups/{id}: get: @@ -354,18 +355,18 @@ paths: type: string description: Event receiver group ID responses: - '200': + "200": description: Event receiver group found content: application/json: schema: - $ref: '#/components/schemas/EventReceiverGroup' - '404': + $ref: "#/components/schemas/EventReceiverGroup" + "404": description: Event receiver group not found content: application/json: schema: - $ref: '#/components/schemas/Error' + $ref: "#/components/schemas/Error" /api/v1/groups: post: @@ -377,9 +378,9 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/EventReceiverGroup' + $ref: "#/components/schemas/EventReceiverGroup" responses: - '201': + "201": description: Event receiver group created successfully content: application/json: @@ -389,13 +390,13 @@ paths: message: type: string group: - $ref: '#/components/schemas/EventReceiverGroup' - '400': + $ref: "#/components/schemas/EventReceiverGroup" + "400": description: Invalid input content: application/json: schema: - $ref: '#/components/schemas/Error' + $ref: "#/components/schemas/Error" /api/v1/groups/search: post: @@ -407,16 +408,16 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/SearchCriteria' + $ref: "#/components/schemas/SearchCriteria" responses: - '200': + "200": description: Search results content: application/json: schema: type: array items: - $ref: '#/components/schemas/EventReceiverGroup' + $ref: "#/components/schemas/EventReceiverGroup" /health: get: @@ -424,10 +425,10 @@ paths: summary: Health check endpoint description: Check if the service is running responses: - '200': + "200": description: Service is healthy content: text/plain: schema: type: string - example: OK \ No newline at end of file + example: OK diff --git a/src/epr_mcp/openapi_server.py b/src/epr_mcp/openapi_server.py deleted file mode 100644 index 1e728fe..0000000 --- a/src/epr_mcp/openapi_server.py +++ /dev/null @@ -1,180 +0,0 @@ -# -*- coding: utf-8 -*- -# SPDX-FileCopyrightText: © 2025 Brett Smith -# SPDX-License-Identifier: Apache-2.0 - -import logging -import os -import sys -from pathlib import Path - -import httpx -from fastmcp.server.openapi import FastMCPOpenAPI, MCPType, RouteMap - -from .errors import debug_except_hook -from .models import Event, EventReceiver, EventReceiverGroup -from .schemas import validate_input - -logger = logging.getLogger(__name__) - - -class EPROpenAPIHandler: - """Handler class for EPR API operations.""" - - def __init__(self, epr_url: str, token: str | None = None): - self.epr_url = epr_url - self.token = token - self.headers = {"Content-Type": "application/json"} - if token: - self.headers["Authorization"] = f"Bearer {token}" - - async def handle_fetch_event(self, id: str) -> dict: - """Handle fetching a single event.""" - async with httpx.AsyncClient() as client: - response = await client.get(f"{self.epr_url}/api/v1/events/{id}", headers=self.headers) - if response.status_code == 200: - event_data = response.json() - event = Event(**event_data) - return event.as_dict() - else: - raise Exception(f"Failed to fetch event: {response.status_code} - {response.text}") - - async def handle_fetch_receiver(self, id: str) -> dict: - """Handle fetching a single event receiver.""" - async with httpx.AsyncClient() as client: - response = await client.get(f"{self.epr_url}/api/v1/receivers/{id}", headers=self.headers) - if response.status_code == 200: - receiver_data = response.json() - receiver = EventReceiver(**receiver_data) - return receiver.as_dict() - else: - raise Exception(f"Failed to fetch event receiver: {response.status_code} - {response.text}") - - async def handle_fetch_group(self, id: str) -> dict: - """Handle fetching a single event receiver group.""" - async with httpx.AsyncClient() as client: - response = await client.get(f"{self.epr_url}/api/v1/groups/{id}", headers=self.headers) - if response.status_code == 200: - group_data = response.json() - group = EventReceiverGroup(**group_data) - return group.as_dict() - else: - raise Exception(f"Failed to fetch event receiver group: {response.status_code} - {response.text}") - - async def handle_create_event(self, event_data: dict) -> dict: - """Handle creating a new event.""" - # Validate using schemas - validated_data = validate_input("create_event", {"data": event_data}) - create_params = validated_data["data"] - - # Create Event model from validated data - event = Event(**create_params) - - async with httpx.AsyncClient() as client: - response = await client.post( - f"{self.epr_url}/api/v1/events", json=event.as_dict_query(), headers=self.headers - ) - if response.status_code == 201: - created_event_data = response.json() - created_event = Event(**created_event_data) - return {"message": "Event created successfully", "event": created_event.as_dict()} - else: - raise Exception(f"Failed to create event: {response.status_code} - {response.text}") - - async def handle_create_receiver(self, receiver_data: dict) -> dict: - """Handle creating a new event receiver.""" - # Validate using schemas - validated_data = validate_input("create_receiver", {"data": receiver_data}) - create_params = validated_data["data"] - - # Create EventReceiver model from validated data - receiver = EventReceiver(**create_params) - - async with httpx.AsyncClient() as client: - response = await client.post( - f"{self.epr_url}/api/v1/receivers", json=receiver.as_dict_query(), headers=self.headers - ) - if response.status_code == 201: - created_receiver_data = response.json() - created_receiver = EventReceiver(**created_receiver_data) - return {"message": "Event receiver created successfully", "receiver": created_receiver.as_dict()} - else: - raise Exception(f"Failed to create event receiver: {response.status_code} - {response.text}") - - async def handle_create_group(self, group_data: dict) -> dict: - """Handle creating a new event receiver group.""" - # Validate using schemas - validated_data = validate_input("create_group", {"data": group_data}) - create_params = validated_data["data"] - - # Create EventReceiverGroup model from validated data - group = EventReceiverGroup(**create_params) - - async with httpx.AsyncClient() as client: - response = await client.post( - f"{self.epr_url}/api/v1/groups", json=group.as_dict_query(), headers=self.headers - ) - if response.status_code == 201: - created_group_data = response.json() - created_group = EventReceiverGroup(**created_group_data) - return {"message": "Event receiver group created successfully", "group": created_group.as_dict()} - else: - raise Exception(f"Failed to create event receiver group: {response.status_code} - {response.text}") - - -def create_openapi_server(cfg): - """Create FastMCP server using OpenAPI integration.""" - debug = cfg.debug or os.environ.get("EPR_DEBUG", False) - if debug: - sys.excepthook = debug_except_hook - logger.setLevel(logging.DEBUG) - - # Get the path to the OpenAPI specification - openapi_path = Path(__file__).parent / "openapi.yaml" - - # Create the EPR handler - handler = EPROpenAPIHandler(cfg.url, cfg.token) - - # Define route mappings - map OpenAPI paths to MCP component types - route_map = RouteMap( - { - # Fetch operations as Tools - "/api/v1/events/{id}": MCPType.TOOL, - "/api/v1/receivers/{id}": MCPType.TOOL, - "/api/v1/groups/{id}": MCPType.TOOL, - # Create operations as Tools - "/api/v1/events": MCPType.TOOL, - "/api/v1/receivers": MCPType.TOOL, - "/api/v1/groups": MCPType.TOOL, - # Search operations as Tools - "/api/v1/events/search": MCPType.TOOL, - "/api/v1/receivers/search": MCPType.TOOL, - "/api/v1/groups/search": MCPType.TOOL, - # Health check - "/health": MCPType.TOOL, - } - ) - - # Create FastMCP OpenAPI server - mcp = FastMCPOpenAPI( - name="EPR MCP Server", version="1.0.0", openapi_spec=openapi_path, route_map=route_map, base_url=cfg.url - ) - - # Register custom handlers for the operations - # Note: In a full implementation, you would need to handle the routing - # and parameter extraction from the OpenAPI operations - - return mcp - - -def run_openapi(cfg): - """Run the MCP server with OpenAPI integration.""" - mcp = create_openapi_server(cfg) - - logger.info("EPR MCP Server (OpenAPI) is running with the following configuration:") - logger.info(f"Debug mode: {cfg.debug}") - logger.info(f"EPR URL: {cfg.url}") - logger.info(f"EPR Token: {cfg.token}") - logger.info("MCP Server is running on http://localhost:8000/mcp") - - mcp.run_async(transport="http", host="127.0.0.1", port=8000) - return "MCP is running" diff --git a/src/epr_mcp/schemas.py b/src/epr_mcp/schemas.py index 94d79fa..5fbda78 100644 --- a/src/epr_mcp/schemas.py +++ b/src/epr_mcp/schemas.py @@ -11,6 +11,8 @@ class EventSearchInput(BaseModel): """Schema for event search input""" + model_config = {"extra": "forbid"} + name: Optional[str] = Field( None, pattern=r"^[A-Za-z0-9]+([._-]?[A-Za-z0-9]+)*(/[A-Za-z0-9]+([._-]?[A-Za-z0-9]+)*)*$", @@ -35,7 +37,20 @@ class EventSearchInput(BaseModel): ) @classmethod def strip_whitespace(cls, v): - """Strip whitespace from string fields""" + """Strip whitespace from string fields; a blank value becomes None. + + Args: + v: The raw field value. + + Returns: + The stripped string, None if it was blank, or the value unchanged if it is not a string. + + Examples: + >>> EventSearchInput(name=" foo ").name + 'foo' + >>> EventSearchInput(name=" ").name is None + True + """ if isinstance(v, str): stripped = v.strip() return stripped if stripped else None @@ -45,6 +60,8 @@ def strip_whitespace(cls, v): class EventReceiverSearchInput(BaseModel): """Schema for event receiver search input""" + model_config = {"extra": "forbid"} + name: Optional[str] = Field( None, pattern=r"^[A-Za-z0-9]+([._-]?[A-Za-z0-9]+)*(/[A-Za-z0-9]+([._-]?[A-Za-z0-9]+)*)*$", @@ -61,7 +78,20 @@ class EventReceiverSearchInput(BaseModel): @field_validator("name", "type", "version", "description", mode="before") @classmethod def strip_whitespace(cls, v): - """Strip whitespace from string fields""" + """Strip whitespace from string fields; a blank value becomes None. + + Args: + v: The raw field value. + + Returns: + The stripped string, None if it was blank, or the value unchanged if it is not a string. + + Examples: + >>> EventReceiverSearchInput(name=" foo ").name + 'foo' + >>> EventReceiverSearchInput(name=" ").name is None + True + """ if isinstance(v, str): stripped = v.strip() return stripped if stripped else None @@ -71,6 +101,8 @@ def strip_whitespace(cls, v): class EventReceiverGroupSearchInput(BaseModel): """Schema for event receiver group search input""" + model_config = {"extra": "forbid"} + name: Optional[str] = Field( None, pattern=r"^[A-Za-z0-9]+([._-]?[A-Za-z0-9]+)*(/[A-Za-z0-9]+([._-]?[A-Za-z0-9]+)*)*$", @@ -87,7 +119,20 @@ class EventReceiverGroupSearchInput(BaseModel): @field_validator("name", "type", "version", "description", mode="before") @classmethod def strip_whitespace(cls, v): - """Strip whitespace from string fields""" + """Strip whitespace from string fields; a blank value becomes None. + + Args: + v: The raw field value. + + Returns: + The stripped string, None if it was blank, or the value unchanged if it is not a string. + + Examples: + >>> EventReceiverGroupSearchInput(name=" foo ").name + 'foo' + >>> EventReceiverGroupSearchInput(name=" ").name is None + True + """ if isinstance(v, str): stripped = v.strip() return stripped if stripped else None @@ -105,6 +150,8 @@ class SearchDataWrapper(BaseModel): class EventCreateInput(BaseModel): """Schema for event creation input""" + model_config = {"extra": "forbid"} + name: str = Field( ..., pattern=r"^[A-Za-z0-9]+([._-]?[A-Za-z0-9]+)*(/[A-Za-z0-9]+([._-]?[A-Za-z0-9]+)*)*$", @@ -135,7 +182,30 @@ class EventCreateInput(BaseModel): ) @classmethod def strip_whitespace(cls, v): - """Strip whitespace from string fields""" + """Strip whitespace from string fields; a blank value is kept so it fails validation. + + Args: + v: The raw field value. + + Returns: + The stripped string, or the value unchanged if it is not a string. + + Examples: + >>> EventCreateInput.model_validate( + ... { + ... "name": " foo ", + ... "version": "1.0.0", + ... "release": "r1", + ... "platform_id": "linux", + ... "package": "oci", + ... "description": "d", + ... "success": True, + ... "payload": {}, + ... "event_receiver_id": "01JYRZ96R690ZTQ15Q53GEY6E6", + ... } + ... ).name + 'foo' + """ if isinstance(v, str): stripped = v.strip() return stripped if stripped else v # Don't convert to None for required fields @@ -144,6 +214,30 @@ def strip_whitespace(cls, v): @field_validator("payload", mode="before") @classmethod def validate_payload(cls, v): + """Require the payload to be a dictionary. + + Args: + v: The value to check. + + Returns: + The value, unchanged. + + Examples: + >>> EventCreateInput.model_validate( + ... { + ... "name": "foo", + ... "version": "1.0.0", + ... "release": "r1", + ... "platform_id": "linux", + ... "package": "oci", + ... "description": "d", + ... "success": True, + ... "payload": {"a": 1}, + ... "event_receiver_id": "01JYRZ96R690ZTQ15Q53GEY6E6", + ... } + ... ).payload + {'a': 1} + """ if not isinstance(v, dict): raise ValidationError("Payload must be a dictionary") return _sanitize_dict(v) @@ -152,6 +246,8 @@ def validate_payload(cls, v): class EventReceiverCreateInput(BaseModel): """Schema for event receiver creation input""" + model_config = {"extra": "forbid", "populate_by_name": True} + name: str = Field( ..., pattern=r"^[A-Za-z0-9]+([._-]?[A-Za-z0-9]+)*(/[A-Za-z0-9]+([._-]?[A-Za-z0-9]+)*)*$", @@ -166,11 +262,27 @@ class EventReceiverCreateInput(BaseModel): min_length=1, ) description: str = Field(..., pattern=r"^(.|\s)*$", description="Event receiver description", min_length=1) + schema_data: Dict[str, Any] = Field( + ..., alias="schema", description="JSON schema that event payloads sent to this receiver must match" + ) @field_validator("name", "type", "version", "description", mode="before") @classmethod def strip_whitespace(cls, v): - """Strip whitespace from string fields""" + """Strip whitespace from string fields; a blank value is kept so it fails validation. + + Args: + v: The raw field value. + + Returns: + The stripped string, or the value unchanged if it is not a string. + + Examples: + >>> EventReceiverCreateInput.model_validate( + ... {"name": " foo ", "type": "t", "version": "1.0.0", "description": "d", "schema": {}} + ... ).name + 'foo' + """ if isinstance(v, str): stripped = v.strip() return stripped if stripped else v # Don't convert to None for required fields @@ -180,6 +292,8 @@ def strip_whitespace(cls, v): class EventReceiverGroupCreateInput(BaseModel): """Schema for event receiver group creation input""" + model_config = {"extra": "forbid"} + name: str = Field( ..., pattern=r"^[A-Za-z0-9]+([._-]?[A-Za-z0-9]+)*(/[A-Za-z0-9]+([._-]?[A-Za-z0-9]+)*)*$", @@ -199,7 +313,26 @@ class EventReceiverGroupCreateInput(BaseModel): @field_validator("name", "type", "version", "description", mode="before") @classmethod def strip_whitespace(cls, v): - """Strip whitespace from string fields""" + """Strip whitespace from string fields; a blank value is kept so it fails validation. + + Args: + v: The raw field value. + + Returns: + The stripped string, or the value unchanged if it is not a string. + + Examples: + >>> EventReceiverGroupCreateInput.model_validate( + ... { + ... "name": " foo ", + ... "type": "t", + ... "version": "1.0.0", + ... "description": "d", + ... "event_receiver_ids": ["01JYRZ96R690ZTQ15Q53GEY6E6"], + ... } + ... ).name + 'foo' + """ if isinstance(v, str): stripped = v.strip() return stripped if stripped else v # Don't convert to None for required fields @@ -208,6 +341,29 @@ def strip_whitespace(cls, v): @field_validator("event_receiver_ids") @classmethod def validate_event_receiver_ids(cls, v): + """Strip each receiver ID and require it to be a 26 character ULID. + + Args: + v: The list of receiver IDs. + + Returns: + The cleaned list of IDs. + + Raises: + ValueError: If the list is empty or an ID is not a valid ULID. + + Examples: + >>> EventReceiverGroupCreateInput.model_validate( + ... { + ... "name": "foo", + ... "type": "t", + ... "version": "1.0.0", + ... "description": "d", + ... "event_receiver_ids": [" 01JYRZ96R690ZTQ15Q53GEY6E6 "], + ... } + ... ).event_receiver_ids + ['01JYRZ96R690ZTQ15Q53GEY6E6'] + """ if not v: # Check if list is empty raise ValidationError("Event receiver IDs list cannot be empty") @@ -258,6 +414,18 @@ class FetchInput(BaseModel): @field_validator("id") @classmethod def validate_id(cls, v): + """Strip the ID and reject an empty one. + + Args: + v: The ID to check. + + Returns: + The ID without surrounding whitespace. + + Examples: + >>> FetchInput(id="01JYRZ96R690ZTQ15Q53GEY6E6").id + '01JYRZ96R690ZTQ15Q53GEY6E6' + """ if not v or not v.strip(): raise ValidationError("ID cannot be empty") return v.strip() @@ -295,6 +463,30 @@ class EventResponse(BaseModel): @field_validator("payload", "event_receiver") @classmethod def validate_dict_fields(cls, v): + """Turn a missing value into an empty dictionary and reject other non-dictionaries. + + Args: + v: The value to check. + + Returns: + A dictionary. + + Examples: + >>> EventResponse.model_validate( + ... { + ... "id": "01JYRZ96R690ZTQ15Q53GEY6E6", + ... "name": "foo", + ... "version": "1.0.0", + ... "release": "r1", + ... "platform_id": "linux", + ... "package": "oci", + ... "description": "d", + ... "success": True, + ... "event_receiver_id": "01JYRZ96R690ZTQ15Q53GEY6E6", + ... } + ... ).payload + {} + """ if v is None: return {} if not isinstance(v, dict): @@ -327,6 +519,26 @@ class EventReceiverResponse(BaseModel): @field_validator("schema_data") @classmethod def validate_schema_field(cls, v): + """Turn a missing schema into an empty dictionary and reject other non-dictionaries. + + Args: + v: The value to check. + + Returns: + A dictionary. + + Examples: + >>> EventReceiverResponse.model_validate( + ... { + ... "id": "01JYRZ96R690ZTQ15Q53GEY6E6", + ... "name": "foo", + ... "type": "foo.type", + ... "version": "1.0.0", + ... "description": "d", + ... } + ... ).schema_data + {} + """ if v is None: return {} if not isinstance(v, dict): @@ -361,6 +573,29 @@ class EventReceiverGroupResponse(BaseModel): @field_validator("event_receiver_ids") @classmethod def validate_event_receiver_ids(cls, v): + """Strip each receiver ID and require it to be a 26 character ULID. + + Args: + v: The list of receiver IDs. + + Returns: + The cleaned list of IDs. + + Raises: + ValueError: If the list is empty or an ID is not a valid ULID. + + Examples: + >>> EventReceiverGroupCreateInput.model_validate( + ... { + ... "name": "foo", + ... "type": "t", + ... "version": "1.0.0", + ... "description": "d", + ... "event_receiver_ids": [" 01JYRZ96R690ZTQ15Q53GEY6E6 "], + ... } + ... ).event_receiver_ids + ['01JYRZ96R690ZTQ15Q53GEY6E6'] + """ if v is None: return [] if not isinstance(v, list): @@ -443,18 +678,24 @@ def _sanitize_dict(data: Dict[str, Any]) -> Dict[str, Any]: def validate_input(operation: str, input_data: Union[str, Dict[str, Any]]) -> Dict[str, Any]: - """ - Validate input data for a given operation. + """Validate the arguments of a tool call. Args: - operation: The operation name (e.g., 'search_events', 'create_event') - input_data: The input data to validate + operation: The tool: a ``fetch_*``, ``search_*``, or ``create_*`` name. + input_data: An ID string for a fetch; for the others, a dictionary with a + ``data`` key that holds the criteria or fields. Returns: - Validated data as a dictionary + The validated data as a dictionary, with field aliases applied. Raises: - ValidationError: If the operation is not supported or input data doesn't match the schema + ValidationError: If the operation is not supported or the data does not match the schema. + + Examples: + >>> validate_input("fetch_event", " 01JYRZ96R690ZTQ15Q53GEY6E6 ") + {'id': '01JYRZ96R690ZTQ15Q53GEY6E6'} + >>> validate_input("search_events", {"data": {"name": "foo"}})["data"]["name"] + 'foo' """ if operation not in SCHEMA_MAP: raise ValidationError(f"Unsupported operation: {operation}") @@ -475,21 +716,24 @@ def validate_input(operation: str, input_data: Union[str, Dict[str, Any]]) -> Di # Sanitize dictionary inputs before validation sanitized_data = _sanitize_dict(input_data) validated = schema_class(**sanitized_data) - return validated.model_dump() + return validated.model_dump(by_alias=True) def get_validation_schema(operation: str) -> BaseModel: - """ - Get the validation schema class for a given operation. + """Get the validation schema class for a given operation. Args: - operation: The operation name + operation: The operation name, for example "search_events". Returns: - The Pydantic model class for validation + The Pydantic model class used to validate that operation. Raises: - ValidationError: If the operation is not supported + ValidationError: If the operation is not supported. + + Examples: + >>> get_validation_schema("fetch_group").__name__ + 'FetchInput' """ if operation not in SCHEMA_MAP: raise ValidationError(f"Unsupported operation: {operation}") @@ -498,17 +742,32 @@ def get_validation_schema(operation: str) -> BaseModel: def validate_event_response(data: Dict[str, Any]) -> Dict[str, Any]: - """ - Validate event response data from EPR API. + """Validate an event from the EPR API. Args: - data: Raw response data from API + data: The raw record as returned by EPR. Returns: - Validated event data as dictionary + The validated record as a dictionary. Raises: - ValidationError: If data doesn't match expected schema + ValueError: If the record does not match the expected schema. + + Examples: + >>> validate_event_response( + ... { + ... "id": "01JYRZ96R690ZTQ15Q53GEY6E6", + ... "name": "foo", + ... "version": "1.0.0", + ... "release": "r1", + ... "platform_id": "linux", + ... "package": "oci", + ... "description": "d", + ... "success": True, + ... "event_receiver_id": "01JYRZ96R690ZTQ15Q53GEY6E6", + ... } + ... )["name"] + 'foo' """ try: validated = EventResponse(**data) @@ -518,17 +777,28 @@ def validate_event_response(data: Dict[str, Any]) -> Dict[str, Any]: def validate_event_receiver_response(data: Dict[str, Any]) -> Dict[str, Any]: - """ - Validate event receiver response data from EPR API. + """Validate an event receiver from the EPR API. Args: - data: Raw response data from API + data: The raw record as returned by EPR. Returns: - Validated event receiver data as dictionary + The validated record as a dictionary. Raises: - ValidationError: If data doesn't match expected schema + ValueError: If the record does not match the expected schema. + + Examples: + >>> validate_event_receiver_response( + ... { + ... "id": "01JYRZ96R690ZTQ15Q53GEY6E6", + ... "name": "foo", + ... "type": "foo.type", + ... "version": "1.0.0", + ... "description": "d", + ... } + ... )["name"] + 'foo' """ try: validated = EventReceiverResponse(**data) @@ -538,17 +808,28 @@ def validate_event_receiver_response(data: Dict[str, Any]) -> Dict[str, Any]: def validate_event_receiver_group_response(data: Dict[str, Any]) -> Dict[str, Any]: - """ - Validate event receiver group response data from EPR API. + """Validate an event receiver group from the EPR API. Args: - data: Raw response data from API + data: The raw record as returned by EPR. Returns: - Validated event receiver group data as dictionary + The validated record as a dictionary. Raises: - ValidationError: If data doesn't match expected schema + ValueError: If the record does not match the expected schema. + + Examples: + >>> validate_event_receiver_group_response( + ... { + ... "id": "01JYRZ96R690ZTQ15Q53GEY6E6", + ... "name": "foo", + ... "type": "foo.type", + ... "version": "1.0.0", + ... "description": "d", + ... } + ... )["name"] + 'foo' """ try: validated = EventReceiverGroupResponse(**data) @@ -558,17 +839,37 @@ def validate_event_receiver_group_response(data: Dict[str, Any]) -> Dict[str, An def validate_event_list_response(data: List[Dict[str, Any]]) -> List[Dict[str, Any]]: - """ - Validate list of events response data from EPR API. + """Validate a list of events from the EPR API. Args: - data: Raw list of event data from API + data: The list of raw records as returned by EPR. Returns: - Validated list of event data + The validated records as a list of dictionaries. Raises: - ValidationError: If any event doesn't match expected schema + ValueError: If any record does not match the expected schema. + + Examples: + >>> [ + ... r["name"] + ... for r in validate_event_list_response( + ... [ + ... { + ... "id": "01JYRZ96R690ZTQ15Q53GEY6E6", + ... "name": "foo", + ... "version": "1.0.0", + ... "release": "r1", + ... "platform_id": "linux", + ... "package": "oci", + ... "description": "d", + ... "success": True, + ... "event_receiver_id": "01JYRZ96R690ZTQ15Q53GEY6E6", + ... } + ... ] + ... ) + ... ] + ['foo'] """ try: return [validate_event_response(event) for event in data] @@ -577,17 +878,33 @@ def validate_event_list_response(data: List[Dict[str, Any]]) -> List[Dict[str, A def validate_event_receiver_list_response(data: List[Dict[str, Any]]) -> List[Dict[str, Any]]: - """ - Validate list of event receivers response data from EPR API. + """Validate a list of event receivers from the EPR API. Args: - data: Raw list of event receiver data from API + data: The list of raw records as returned by EPR. Returns: - Validated list of event receiver data + The validated records as a list of dictionaries. Raises: - ValidationError: If any receiver doesn't match expected schema + ValueError: If any record does not match the expected schema. + + Examples: + >>> [ + ... r["name"] + ... for r in validate_event_receiver_list_response( + ... [ + ... { + ... "id": "01JYRZ96R690ZTQ15Q53GEY6E6", + ... "name": "foo", + ... "type": "foo.type", + ... "version": "1.0.0", + ... "description": "d", + ... } + ... ] + ... ) + ... ] + ['foo'] """ try: return [validate_event_receiver_response(receiver) for receiver in data] @@ -596,17 +913,33 @@ def validate_event_receiver_list_response(data: List[Dict[str, Any]]) -> List[Di def validate_event_receiver_group_list_response(data: List[Dict[str, Any]]) -> List[Dict[str, Any]]: - """ - Validate list of event receiver groups response data from EPR API. + """Validate a list of event receiver groups from the EPR API. Args: - data: Raw list of event receiver group data from API + data: The list of raw records as returned by EPR. Returns: - Validated list of event receiver group data + The validated records as a list of dictionaries. Raises: - ValidationError: If any group doesn't match expected schema + ValueError: If any record does not match the expected schema. + + Examples: + >>> [ + ... r["name"] + ... for r in validate_event_receiver_group_list_response( + ... [ + ... { + ... "id": "01JYRZ96R690ZTQ15Q53GEY6E6", + ... "name": "foo", + ... "type": "foo.type", + ... "version": "1.0.0", + ... "description": "d", + ... } + ... ] + ... ) + ... ] + ['foo'] """ try: return [validate_event_receiver_group_response(group) for group in data] diff --git a/src/epr_mcp/server.py b/src/epr_mcp/server.py index ab175bb..f585dd2 100644 --- a/src/epr_mcp/server.py +++ b/src/epr_mcp/server.py @@ -2,7 +2,6 @@ # SPDX-FileCopyrightText: © 2025 Brett Smith # SPDX-License-Identifier: Apache-2.0 -import asyncio import json import logging import os @@ -10,15 +9,15 @@ from pathlib import Path from typing import Annotated +import httpx2 import yaml - -import httpx -from fastmcp import Context, FastMCP +from fastmcp import FastMCP from pydantic import Field, ValidationError from starlette.requests import Request from starlette.responses import PlainTextResponse -from .common import get_search_query +from .common import create_client, get_search_query +from .config import TRANSPORTS, Config from .errors import debug_except_hook from .models import Event, EventReceiver, EventReceiverGroup from .schemas import ( @@ -36,58 +35,104 @@ logger = logging.getLogger(__name__) +# EPR answers a successful create with 200; some versions answer 201. +CREATED_STATUS_CODES = (200, 201) + def filter_none_values(data: dict) -> dict: - """Filter out None values from a dictionary to avoid sending null values to GraphQL""" + """Remove None values from a dictionary so they are not sent as null to GraphQL. + + Args: + data: The dictionary to filter. + + Returns: + A new dictionary without the keys whose value is None; other falsy values are kept. + + Examples: + >>> filter_none_values({"name": "foo", "success": False, "release": None}) + {'name': 'foo', 'success': False} + """ return {key: value for key, value in data.items() if value is not None} -async def handle_http_errors(ctx: Context, e: Exception, operation: str, cfg) -> str: - """Handle common HTTP errors and return user-friendly error messages""" - if isinstance(e, httpx.ConnectError): - await ctx.error(f"Connection failed to {cfg.url}: {e!s}") +def handle_http_errors(e: Exception, operation: str, cfg: Config) -> str: + """Log an exception from an EPR call and return a user-friendly message. + + Args: + e: The exception raised while calling the EPR API. + operation: Name of the tool that failed, used in generic messages. + cfg: Server configuration providing the EPR URL. + + Returns: + A message describing the failure, suitable to return to the MCP client. + + Examples: + >>> handle_http_errors(RuntimeError("boom"), "fetch_event", Config(url="http://epr")) + 'Error in fetch_event: boom' + """ + if isinstance(e, httpx2.ConnectError): + logger.error(f"Connection failed to {cfg.url}: {e!s}") return f"Connection failed to EPR server at {cfg.url}. Please check if the EPR server is running and accessible. Error: {e!s}" - elif isinstance(e, httpx.TimeoutException): - await ctx.error(f"Request timeout to {cfg.url}: {e!s}") + elif isinstance(e, httpx2.TimeoutException): + logger.error(f"Request timeout to {cfg.url}: {e!s}") return f"Request timeout to EPR server at {cfg.url}. Error: {e!s}" - elif isinstance(e, httpx.HTTPStatusError): - await ctx.error(f"HTTP error from {cfg.url}: {e!s}") + elif isinstance(e, httpx2.HTTPStatusError): + logger.error(f"HTTP error from {cfg.url}: {e!s}") return f"HTTP error from EPR server: {e.response.status_code} - {e.response.text}" else: - await ctx.error(f"Error in {operation}: {e!s}") + logger.error(f"Error in {operation}: {e!s}") return f"Error in {operation}: {e!s}" -def run(cfg): - debug = cfg.debug or os.environ.get("EPR_DEBUG", False) - if debug: - sys.excepthook = debug_except_hook - logger.setLevel(logging.DEBUG) +def create_server(cfg: Config) -> FastMCP: + """Build the EPR MCP server with all tools and HTTP routes registered. - mcp = FastMCP("EPR MCP Server", "1.0.0") + The server is not started, so tests and embedding code can attach a client + or an ASGI test client without binding a network port. + + Args: + cfg: Server configuration (EPR URL, optional token, debug flag). + + Returns: + A configured ``FastMCP`` instance. + + Examples: + >>> mcp = create_server(Config(url="http://localhost:8042")) + >>> mcp.name + 'EPR MCP Server' + """ + mcp = FastMCP(name="EPR MCP Server", version="1.0.0") @mcp.tool(title="Fetch Event", description="Fetch an event from EPR") - async def fetch_event( - ctx: Context, id: Annotated[str, Field(description="Unique identifier of the event to fetch")] - ) -> str: - """Fetch an event from the EPR""" + async def fetch_event(id: Annotated[str, Field(description="Unique identifier of the event to fetch")]) -> str: + """Fetch an event from the EPR. + + Args: + id: The 26 character ULID of the record. + + Returns: + The record as JSON text, or a message describing the failure. + + Examples: + ``call_tool("fetch_event", {"id": "01JYRZ96R690ZTQ15Q53GEY6E6"})`` + """ try: - await ctx.debug(f"Starting fetch_event for ID: {id}") + logger.debug(f"Starting fetch_event for ID: {id}") # Validate input using schema validated_data = validate_input("fetch_event", id) event_id = validated_data["id"] - await ctx.debug(f"Input validation successful, validated ID: {event_id}") + logger.debug(f"Input validation successful, validated ID: {event_id}") url = f"{cfg.url}/api/v1/events/{event_id}" - await ctx.debug(f"Making GET request to: {url}") + logger.debug(f"Making GET request to: {url}") - async with httpx.AsyncClient() as client: + async with create_client(cfg) as client: response = await client.get(url) - await ctx.debug(f"GET response status: {response.status_code}") + logger.debug(f"GET response status: {response.status_code}") if response.status_code == 200: response_data = response.json() - await ctx.debug(f"Raw response data type: {type(response_data)}") + logger.debug(f"Raw response data type: {type(response_data)}") # Handle case where API wraps data in a 'data' field event_data = ( response_data.get("data", response_data) if isinstance(response_data, dict) else response_data @@ -102,46 +147,56 @@ async def fetch_event( # Validate response data with Pydantic schema validated_event = EventResponse.model_validate(event_data) - await ctx.debug("Response validation successful") + logger.debug("Response validation successful") return json.dumps(validated_event.model_dump(), indent=2) else: return f"Failed to fetch event: {response.status_code} - {response.text}" except ValidationError as e: # Handle both input validation and response validation errors if "response validation failed" in str(e): - await ctx.error(f"Response validation error in fetch_event: {e!s}") + logger.error(f"Response validation error in fetch_event: {e!s}") return f"Response validation error: {e!s}" else: - await ctx.error(f"Input validation error in fetch_event: {e!s}") + logger.error(f"Input validation error in fetch_event: {e!s}") return f"Input validation error: {e!s}" except ValueError as e: - await ctx.error(f"Input validation error in fetch_event: {e!s}") + logger.error(f"Input validation error in fetch_event: {e!s}") return f"Input validation error: {e!s}" except Exception as e: - return await handle_http_errors(ctx, e, "fetch_event", cfg) + return handle_http_errors(e, "fetch_event", cfg) @mcp.tool(title="Fetch Event Receiver", description="Fetch an event receiver from EPR") async def fetch_receiver( - ctx: Context, id: Annotated[str, Field(description="Unique identifier of the event receiver to fetch")] + id: Annotated[str, Field(description="Unique identifier of the event receiver to fetch")], ) -> str: - """Fetch an event receiver from the EPR""" + """Fetch an event receiver from the EPR. + + Args: + id: The 26 character ULID of the record. + + Returns: + The record as JSON text, or a message describing the failure. + + Examples: + ``call_tool("fetch_receiver", {"id": "01JYRZ96R690ZTQ15Q53GEY6E6"})`` + """ try: - await ctx.debug(f"Starting fetch_receiver for ID: {id}") + logger.debug(f"Starting fetch_receiver for ID: {id}") # Validate input using schema validated_data = validate_input("fetch_receiver", id) receiver_id = validated_data["id"] - await ctx.debug(f"Input validation successful, validated ID: {receiver_id}") + logger.debug(f"Input validation successful, validated ID: {receiver_id}") url = f"{cfg.url}/api/v1/receivers/{receiver_id}" - await ctx.debug(f"Making GET request to: {url}") + logger.debug(f"Making GET request to: {url}") - async with httpx.AsyncClient() as client: + async with create_client(cfg) as client: response = await client.get(url) - await ctx.debug(f"GET response status: {response.status_code}") + logger.debug(f"GET response status: {response.status_code}") if response.status_code == 200: response_data = response.json() - await ctx.debug(f"Raw response data type: {type(response_data)}") + logger.debug(f"Raw response data type: {type(response_data)}") # Handle case where API wraps data in a 'data' field receiver_data = ( response_data.get("data", response_data) if isinstance(response_data, dict) else response_data @@ -156,46 +211,56 @@ async def fetch_receiver( # Validate response data with Pydantic schema validated_receiver = EventReceiverResponse.model_validate(receiver_data) - await ctx.debug("Response validation successful") + logger.debug("Response validation successful") return json.dumps(validated_receiver.model_dump(), indent=2) else: return f"Failed to fetch event receiver: {response.status_code} - {response.text}" except ValidationError as e: # Handle both input validation and response validation errors if "response validation failed" in str(e): - await ctx.error(f"Response validation error in fetch_receiver: {e!s}") + logger.error(f"Response validation error in fetch_receiver: {e!s}") return f"Response validation error: {e!s}" else: - await ctx.error(f"Input validation error in fetch_receiver: {e!s}") + logger.error(f"Input validation error in fetch_receiver: {e!s}") return f"Input validation error: {e!s}" except ValueError as e: - await ctx.error(f"Input validation error in fetch_receiver: {e!s}") + logger.error(f"Input validation error in fetch_receiver: {e!s}") return f"Input validation error: {e!s}" except Exception as e: - return await handle_http_errors(ctx, e, "fetch_receiver", cfg) + return handle_http_errors(e, "fetch_receiver", cfg) @mcp.tool(title="Fetch Event Receiver Group", description="Fetch an event receiver group from EPR") async def fetch_group( - ctx: Context, id: Annotated[str, Field(description="Unique identifier of the event receiver group to fetch")] + id: Annotated[str, Field(description="Unique identifier of the event receiver group to fetch")], ) -> str: - """Fetch an event receiver group from the EPR""" + """Fetch an event receiver group from the EPR. + + Args: + id: The 26 character ULID of the record. + + Returns: + The record as JSON text, or a message describing the failure. + + Examples: + ``call_tool("fetch_group", {"id": "01JYRZ96R690ZTQ15Q53GEY6E6"})`` + """ try: - await ctx.debug(f"Starting fetch_group for ID: {id}") + logger.debug(f"Starting fetch_group for ID: {id}") # Validate input using schema validated_data = validate_input("fetch_group", id) group_id = validated_data["id"] - await ctx.debug(f"Input validation successful, validated ID: {group_id}") + logger.debug(f"Input validation successful, validated ID: {group_id}") url = f"{cfg.url}/api/v1/groups/{group_id}" - await ctx.debug(f"Making GET request to: {url}") + logger.debug(f"Making GET request to: {url}") - async with httpx.AsyncClient() as client: + async with create_client(cfg) as client: response = await client.get(url) - await ctx.debug(f"GET response status: {response.status_code}") + logger.debug(f"GET response status: {response.status_code}") if response.status_code == 200: response_data = response.json() - await ctx.debug(f"Raw response data type: {type(response_data)}") + logger.debug(f"Raw response data type: {type(response_data)}") # Handle case where API wraps data in a 'data' field group_data = ( response_data.get("data", response_data) if isinstance(response_data, dict) else response_data @@ -212,44 +277,53 @@ async def fetch_group( # Validate response data with Pydantic schema validated_group = EventReceiverGroupResponse.model_validate(group_data) - await ctx.debug("Response validation successful") + logger.debug("Response validation successful") return json.dumps(validated_group.model_dump(), indent=2) else: return f"Failed to fetch event receiver group: {response.status_code} - {response.text}" except ValidationError as e: # Handle both input validation and response validation errors if "response validation failed" in str(e): - await ctx.error(f"Response validation error in fetch_group: {e!s}") + logger.error(f"Response validation error in fetch_group: {e!s}") return f"Response validation error: {e!s}" else: - await ctx.error(f"Input validation error in fetch_group: {e!s}") + logger.error(f"Input validation error in fetch_group: {e!s}") return f"Input validation error: {e!s}" except ValueError as e: - await ctx.error(f"Input validation error in fetch_group: {e!s}") + logger.error(f"Input validation error in fetch_group: {e!s}") return f"Input validation error: {e!s}" except Exception as e: - return await handle_http_errors(ctx, e, "fetch_group", cfg) + return handle_http_errors(e, "fetch_group", cfg) @mcp.tool(title="Search Events", description="Search for events in EPR") async def search_events( - ctx: Context, data: Annotated[ dict, Field(description="Search criteria including name, version, package, platform_id, success status, etc."), ], ) -> str: - """Search for events in the EPR""" + """Search for events in the EPR. + + Args: + data: Search criteria; any of name, version, release, platform_id, package, description, success, event_receiver_id. Unknown fields are rejected. + + Returns: + The matching records as a JSON list, or a message describing the failure. + + Examples: + ``call_tool("search_events", {"data": {"name": "foo"}})`` + """ try: - await ctx.debug(f"Starting search_events with data: {data}") + logger.debug(f"Starting search_events with data: {data}") # Validate input using schema - validated_data = validate_input("search_events", data) + validated_data = validate_input("search_events", {"data": data}) search_params = validated_data["data"] - await ctx.debug(f"Input validation successful, search params: {search_params}") + logger.debug(f"Input validation successful, search params: {search_params}") # Filter out None values to avoid sending null parameters to GraphQL filtered_params = filter_none_values(search_params) - await ctx.debug(f"Filtered search params (None values removed): {filtered_params}") + logger.debug(f"Filtered search params (None values removed): {filtered_params}") fields = [ "id", @@ -265,115 +339,133 @@ async def search_events( "payload", ] query = get_search_query(operation="events", params=filtered_params, fields=fields) - await ctx.debug(f"Generated GraphQL query: {query.as_dict_query()}") + logger.debug(f"Generated GraphQL query: {query.as_dict_query()}") url = f"{cfg.url}/api/v1/graphql/query" - await ctx.debug(f"Making POST request to: {url}") + logger.debug(f"Making POST request to: {url}") - async with httpx.AsyncClient() as client: - headers = {"Content-Type": "application/json"} - response = await client.post(url, json=query.as_dict_query(), headers=headers) - await ctx.debug(f"POST response status: {response.status_code}") + async with create_client(cfg) as client: + response = await client.post(url, json=query.as_dict_query()) + logger.debug(f"POST response status: {response.status_code}") if response.status_code == 200: result = response.json() - await ctx.debug(f"Raw GraphQL response structure: {type(result)}") + if result.get("errors"): + return f"Failed to search events: {result['errors']}" + logger.debug(f"Raw GraphQL response structure: {type(result)}") events_data = result.get("data", {}).get("events", []) - await ctx.debug(f"Extracted events data: {len(events_data)} events found") + logger.debug(f"Extracted events data: {len(events_data)} events found") # Validate response data with Pydantic schema validated_events = validate_event_list_response(events_data) - await ctx.debug("Response validation successful") + logger.debug("Response validation successful") return json.dumps(validated_events, indent=2) else: return f"Failed to search events: {response.status_code} - {response.text}" except ValidationError as e: # Handle input validation errors (from validate_input) - await ctx.error(f"Input validation error in search_events: {e!s}") + logger.error(f"Input validation error in search_events: {e!s}") return f"Input validation error: {e!s}" except ValueError as e: # Handle response validation errors (from validate_event_list_response) if "validation failed" in str(e): - await ctx.error(f"Response validation error in search_events: {e!s}") + logger.error(f"Response validation error in search_events: {e!s}") return f"Response validation error: {e!s}" else: - await ctx.error(f"Input validation error in search_events: {e!s}") + logger.error(f"Input validation error in search_events: {e!s}") return f"Input validation error: {e!s}" except Exception as e: - return await handle_http_errors(ctx, e, "search_events", cfg) + return handle_http_errors(e, "search_events", cfg) @mcp.tool(title="Search Event Receivers", description="Search for event receivers in EPR") async def search_receivers( - ctx: Context, data: Annotated[dict, Field(description="Search criteria including name, type, version, description, etc.")], ) -> str: - """Search for event receivers in the EPR""" + """Search for event receivers in the EPR. + + Args: + data: Search criteria; any of name, type, version, description. Unknown fields are rejected. + + Returns: + The matching records as a JSON list, or a message describing the failure. + + Examples: + ``call_tool("search_receivers", {"data": {"name": "foo"}})`` + """ try: - await ctx.debug(f"Starting search_receivers with data: {data}") + logger.debug(f"Starting search_receivers with data: {data}") # Validate input using schema - validated_data = validate_input("search_receivers", data) + validated_data = validate_input("search_receivers", {"data": data}) search_params = validated_data["data"] - await ctx.debug(f"Input validation successful, search params: {search_params}") + logger.debug(f"Input validation successful, search params: {search_params}") # Filter out None values to avoid sending null parameters to GraphQL filtered_params = filter_none_values(search_params) - await ctx.debug(f"Filtered search params (None values removed): {filtered_params}") + logger.debug(f"Filtered search params (None values removed): {filtered_params}") fields = ["id", "name", "type", "version", "description", "schema", "fingerprint", "created_at"] query = get_search_query(operation="event_receivers", params=filtered_params, fields=fields) - await ctx.debug(f"Generated GraphQL query: {query.as_dict_query()}") + logger.debug(f"Generated GraphQL query: {query.as_dict_query()}") url = f"{cfg.url}/api/v1/graphql/query" - await ctx.debug(f"Making POST request to: {url}") + logger.debug(f"Making POST request to: {url}") - async with httpx.AsyncClient() as client: - headers = {"Content-Type": "application/json"} - response = await client.post(url, json=query.as_dict_query(), headers=headers) - await ctx.debug(f"POST response status: {response.status_code}") + async with create_client(cfg) as client: + response = await client.post(url, json=query.as_dict_query()) + logger.debug(f"POST response status: {response.status_code}") if response.status_code == 200: result = response.json() - await ctx.debug(f"Raw GraphQL response structure: {type(result)}") + if result.get("errors"): + return f"Failed to search event receivers: {result['errors']}" + logger.debug(f"Raw GraphQL response structure: {type(result)}") receivers_data = result.get("data", {}).get("event_receivers", []) - await ctx.debug(f"Extracted receivers data: {len(receivers_data)} receivers found") + logger.debug(f"Extracted receivers data: {len(receivers_data)} receivers found") # Validate response data with Pydantic schema validated_receivers = validate_event_receiver_list_response(receivers_data) - await ctx.debug("Response validation successful") + logger.debug("Response validation successful") return json.dumps(validated_receivers, indent=2) else: return f"Failed to search event receivers: {response.status_code} - {response.text}" except ValidationError as e: # Handle input validation errors (from validate_input) - await ctx.error(f"Input validation error in search_receivers: {e!s}") + logger.error(f"Input validation error in search_receivers: {e!s}") return f"Input validation error: {e!s}" except ValueError as e: # Handle response validation errors (from validate_event_receiver_list_response) if "validation failed" in str(e): - await ctx.error(f"Response validation error in search_receivers: {e!s}") + logger.error(f"Response validation error in search_receivers: {e!s}") return f"Response validation error: {e!s}" else: - await ctx.error(f"Input validation error in search_receivers: {e!s}") + logger.error(f"Input validation error in search_receivers: {e!s}") return f"Input validation error: {e!s}" except Exception as e: - return await handle_http_errors(ctx, e, "search_receivers", cfg) + return handle_http_errors(e, "search_receivers", cfg) @mcp.tool(title="Search Event Receiver Groups", description="Search for event receiver groups in EPR") async def search_groups( - ctx: Context, - data: Annotated[ - dict, Field(description="Search criteria including name, type, version, description, enabled status, etc.") - ], + data: Annotated[dict, Field(description="Search criteria: any of name, type, version, description")], ) -> str: - """Search for event receiver groups in the EPR""" + """Search for event receiver groups in the EPR. + + Args: + data: Search criteria; any of name, type, version, description. Unknown fields are rejected. + + Returns: + The matching records as a JSON list, or a message describing the failure. + + Examples: + ``call_tool("search_groups", {"data": {"name": "foo"}})`` + """ try: - await ctx.debug(f"Starting search_groups with data: {data}") + logger.debug(f"Starting search_groups with data: {data}") # Validate input using schema - validated_data = validate_input("search_groups", data) + validated_data = validate_input("search_groups", {"data": data}) search_params = validated_data["data"] - await ctx.debug(f"Input validation successful, search params: {search_params}") + logger.debug(f"Input validation successful, search params: {search_params}") # Filter out None values to avoid sending null parameters to GraphQL filtered_params = filter_none_values(search_params) - await ctx.debug(f"Filtered search params (None values removed): {filtered_params}") + logger.debug(f"Filtered search params (None values removed): {filtered_params}") fields = [ "id", @@ -383,49 +475,48 @@ async def search_groups( "description", "enabled", "event_receiver_ids", - "fingerprint", "created_at", "updated_at", ] query = get_search_query(operation="event_receiver_groups", params=filtered_params, fields=fields) - await ctx.debug(f"Generated GraphQL query: {query.as_dict_query()}") + logger.debug(f"Generated GraphQL query: {query.as_dict_query()}") url = f"{cfg.url}/api/v1/graphql/query" - await ctx.debug(f"Making POST request to: {url}") + logger.debug(f"Making POST request to: {url}") - async with httpx.AsyncClient() as client: - headers = {"Content-Type": "application/json"} - response = await client.post(url, json=query.as_dict_query(), headers=headers) - await ctx.debug(f"POST response status: {response.status_code}") + async with create_client(cfg) as client: + response = await client.post(url, json=query.as_dict_query()) + logger.debug(f"POST response status: {response.status_code}") if response.status_code == 200: result = response.json() - await ctx.debug(f"Raw GraphQL response structure: {type(result)}") + if result.get("errors"): + return f"Failed to search event receiver groups: {result['errors']}" + logger.debug(f"Raw GraphQL response structure: {type(result)}") groups_data = result.get("data", {}).get("event_receiver_groups", []) - await ctx.debug(f"Extracted groups data: {len(groups_data)} groups found") + logger.debug(f"Extracted groups data: {len(groups_data)} groups found") # Validate response data with Pydantic schema validated_groups = validate_event_receiver_group_list_response(groups_data) - await ctx.debug("Response validation successful") + logger.debug("Response validation successful") return json.dumps(validated_groups, indent=2) else: return f"Failed to search event receiver groups: {response.status_code} - {response.text}" except ValidationError as e: # Handle input validation errors (from validate_input) - await ctx.error(f"Input validation error in search_groups: {e!s}") + logger.error(f"Input validation error in search_groups: {e!s}") return f"Input validation error: {e!s}" except ValueError as e: # Handle response validation errors (from validate_event_receiver_group_list_response) if "validation failed" in str(e): - await ctx.error(f"Response validation error in search_groups: {e!s}") + logger.error(f"Response validation error in search_groups: {e!s}") return f"Response validation error: {e!s}" else: - await ctx.error(f"Input validation error in search_groups: {e!s}") + logger.error(f"Input validation error in search_groups: {e!s}") return f"Input validation error: {e!s}" except Exception as e: - return await handle_http_errors(ctx, e, "search_groups", cfg) + return handle_http_errors(e, "search_groups", cfg) @mcp.tool(title="Create Event", description="Create a new event in EPR") async def create_event( - ctx: Context, event_data: Annotated[ dict, Field( @@ -433,28 +524,38 @@ async def create_event( ), ], ) -> str: - """Create a new event in the EPR""" + """Create a new event in the EPR. + + Args: + event_data: The fields of the new record: name, version, release, platform_id, package, description, payload, success, event_receiver_id. + + Returns: + A JSON message with the ID of the new record, or a message describing the failure. + + Examples: + ``call_tool("create_event", {"event_data": {...}})`` + """ try: - await ctx.debug(f"Starting create_event with data: {event_data}") + logger.debug(f"Starting create_event with data: {event_data}") # Validate input using schema - validated_data = validate_input("create_event", event_data) + validated_data = validate_input("create_event", {"data": event_data}) create_params = validated_data["data"] - await ctx.debug(f"Input validation successful, create params: {create_params}") + logger.debug(f"Input validation successful, create params: {create_params}") # Create Event model from validated data for better structure event = Event(**create_params) - await ctx.debug(f"Created Event model: {event.as_dict_query()}") + logger.debug(f"Created Event model: {event.as_dict_query()}") url = f"{cfg.url}/api/v1/events" - await ctx.debug(f"Making POST request to: {url}") + logger.debug(f"Making POST request to: {url}") - async with httpx.AsyncClient() as client: + async with create_client(cfg) as client: response = await client.post(url, json=event.as_dict_query()) - await ctx.debug(f"POST response status: {response.status_code}") - if response.status_code == 201: + logger.debug(f"POST response status: {response.status_code}") + if response.status_code in CREATED_STATUS_CODES: response_data = response.json() - await ctx.debug(f"Raw response data type: {type(response_data)}") + logger.debug(f"Raw response data type: {type(response_data)}") # Handle case where API wraps data in a 'data' field created_event_data = ( response_data.get("data", response_data) if isinstance(response_data, dict) else response_data @@ -467,9 +568,13 @@ async def create_event( # Take the first event from the array created_event_data = created_event_data[0] + # EPR normally answers a create with just the new ID: {"data": ""} + if isinstance(created_event_data, str): + return json.dumps({"message": "Event created successfully", "id": created_event_data}, indent=2) + # Validate response data with Pydantic schema validated_event_data = validate_event_response(created_event_data) - await ctx.debug("Event created and response validation successful") + logger.debug("Event created and response validation successful") return json.dumps( {"message": "Event created successfully", "event": validated_event_data}, indent=2 ) @@ -478,46 +583,58 @@ async def create_event( except ValidationError as e: # Handle both input validation and response validation errors if "response validation failed" in str(e): - await ctx.error(f"Response validation error in create_event: {e!s}") + logger.error(f"Response validation error in create_event: {e!s}") return f"Response validation error: {e!s}" else: - await ctx.error(f"Input validation error in create_event: {e!s}") + logger.error(f"Input validation error in create_event: {e!s}") return f"Input validation error: {e!s}" except ValueError as e: - await ctx.error(f"Input validation error in create_event: {e!s}") + logger.error(f"Input validation error in create_event: {e!s}") return f"Input validation error: {e!s}" except Exception as e: - return await handle_http_errors(ctx, e, "create_event", cfg) + return handle_http_errors(e, "create_event", cfg) @mcp.tool(title="Create Event Receiver", description="Create a new event receiver in EPR") async def create_receiver( - ctx: Context, receiver_data: Annotated[ - dict, Field(description="Event receiver creation data containing name, type, version, and description") + dict, + Field( + description="Event receiver creation data containing name, type, version, description, and schema (a JSON schema that event payloads must match)" + ), ], ) -> str: - """Create a new event receiver in the EPR""" + """Create a new event receiver in the EPR. + + Args: + receiver_data: The fields of the new record: name, type, version, description, schema. + + Returns: + A JSON message with the ID of the new record, or a message describing the failure. + + Examples: + ``call_tool("create_receiver", {"receiver_data": {...}})`` + """ try: - await ctx.debug(f"Starting create_receiver with data: {receiver_data}") + logger.debug(f"Starting create_receiver with data: {receiver_data}") # Validate input using schema - validated_data = validate_input("create_receiver", receiver_data) + validated_data = validate_input("create_receiver", {"data": receiver_data}) create_params = validated_data["data"] - await ctx.debug(f"Input validation successful, create params: {create_params}") + logger.debug(f"Input validation successful, create params: {create_params}") # Create EventReceiver model from validated data for better structure receiver = EventReceiver(**create_params) - await ctx.debug(f"Created EventReceiver model: {receiver.as_dict_query()}") + logger.debug(f"Created EventReceiver model: {receiver.as_dict_query()}") url = f"{cfg.url}/api/v1/receivers" - await ctx.debug(f"Making POST request to: {url}") + logger.debug(f"Making POST request to: {url}") - async with httpx.AsyncClient() as client: + async with create_client(cfg) as client: response = await client.post(url, json=receiver.as_dict_query()) - await ctx.debug(f"POST response status: {response.status_code}") - if response.status_code == 201: + logger.debug(f"POST response status: {response.status_code}") + if response.status_code in CREATED_STATUS_CODES: response_data = response.json() - await ctx.debug(f"Raw response data type: {type(response_data)}") + logger.debug(f"Raw response data type: {type(response_data)}") # Handle case where API wraps data in a 'data' field created_receiver_data = ( response_data.get("data", response_data) if isinstance(response_data, dict) else response_data @@ -530,9 +647,15 @@ async def create_receiver( # Take the first receiver from the array created_receiver_data = created_receiver_data[0] + # EPR normally answers a create with just the new ID: {"data": ""} + if isinstance(created_receiver_data, str): + return json.dumps( + {"message": "Event receiver created successfully", "id": created_receiver_data}, indent=2 + ) + # Validate response data with Pydantic schema validated_receiver_data = validate_event_receiver_response(created_receiver_data) - await ctx.debug("Event receiver created and response validation successful") + logger.debug("Event receiver created and response validation successful") return json.dumps( {"message": "Event receiver created successfully", "receiver": validated_receiver_data}, indent=2, @@ -542,20 +665,19 @@ async def create_receiver( except ValidationError as e: # Handle both input validation and response validation errors if "response validation failed" in str(e): - await ctx.error(f"Response validation error in create_receiver: {e!s}") + logger.error(f"Response validation error in create_receiver: {e!s}") return f"Response validation error: {e!s}" else: - await ctx.error(f"Input validation error in create_receiver: {e!s}") + logger.error(f"Input validation error in create_receiver: {e!s}") return f"Input validation error: {e!s}" except ValueError as e: - await ctx.error(f"Input validation error in create_receiver: {e!s}") + logger.error(f"Input validation error in create_receiver: {e!s}") return f"Input validation error: {e!s}" except Exception as e: - return await handle_http_errors(ctx, e, "create_receiver", cfg) + return handle_http_errors(e, "create_receiver", cfg) @mcp.tool(title="Create Event Receiver Group", description="Create a new event receiver group in EPR") async def create_group( - ctx: Context, group_data: Annotated[ dict, Field( @@ -563,28 +685,38 @@ async def create_group( ), ], ) -> str: - """Create a new event receiver group in the EPR""" + """Create a new event receiver group in the EPR. + + Args: + group_data: The fields of the new record: name, type, version, description, event_receiver_ids. + + Returns: + A JSON message with the ID of the new record, or a message describing the failure. + + Examples: + ``call_tool("create_group", {"group_data": {...}})`` + """ try: - await ctx.debug(f"Starting create_group with data: {group_data}") + logger.debug(f"Starting create_group with data: {group_data}") # Validate input using schema - validated_data = validate_input("create_group", group_data) + validated_data = validate_input("create_group", {"data": group_data}) create_params = validated_data["data"] - await ctx.debug(f"Input validation successful, create params: {create_params}") + logger.debug(f"Input validation successful, create params: {create_params}") # Create EventReceiverGroup model from validated data for better structure group = EventReceiverGroup(**create_params) - await ctx.debug(f"Created EventReceiverGroup model: {group.as_dict_query()}") + logger.debug(f"Created EventReceiverGroup model: {group.as_dict_query()}") url = f"{cfg.url}/api/v1/groups" - await ctx.debug(f"Making POST request to: {url}") + logger.debug(f"Making POST request to: {url}") - async with httpx.AsyncClient() as client: + async with create_client(cfg) as client: response = await client.post(url, json=group.as_dict_query()) - await ctx.debug(f"POST response status: {response.status_code}") - if response.status_code == 201: + logger.debug(f"POST response status: {response.status_code}") + if response.status_code in CREATED_STATUS_CODES: response_data = response.json() - await ctx.debug(f"Raw response data type: {type(response_data)}") + logger.debug(f"Raw response data type: {type(response_data)}") # Handle case where API wraps data in a 'data' field created_group_data = ( response_data.get("data", response_data) if isinstance(response_data, dict) else response_data @@ -599,9 +731,15 @@ async def create_group( # Take the first group from the array created_group_data = created_group_data[0] + # EPR normally answers a create with just the new ID: {"data": ""} + if isinstance(created_group_data, str): + return json.dumps( + {"message": "Event receiver group created successfully", "id": created_group_data}, indent=2 + ) + # Validate response data with Pydantic schema validated_group_data = validate_event_receiver_group_response(created_group_data) - await ctx.debug("Event receiver group created and response validation successful") + logger.debug("Event receiver group created and response validation successful") return json.dumps( {"message": "Event receiver group created successfully", "group": validated_group_data}, indent=2, @@ -611,24 +749,45 @@ async def create_group( except ValidationError as e: # Handle both input validation and response validation errors if "response validation failed" in str(e): - await ctx.error(f"Response validation error in create_group: {e!s}") + logger.error(f"Response validation error in create_group: {e!s}") return f"Response validation error: {e!s}" else: - await ctx.error(f"Input validation error in create_group: {e!s}") + logger.error(f"Input validation error in create_group: {e!s}") return f"Input validation error: {e!s}" except ValueError as e: - await ctx.error(f"Input validation error in create_group: {e!s}") + logger.error(f"Input validation error in create_group: {e!s}") return f"Input validation error: {e!s}" except Exception as e: - return await handle_http_errors(ctx, e, "create_group", cfg) + return handle_http_errors(e, "create_group", cfg) @mcp.custom_route("/health", methods=["GET"]) async def health_check(request: Request) -> PlainTextResponse: + """Answer the health check used by Docker and load balancers. + + Args: + request: The incoming HTTP request. + + Returns: + A plain text response with the body ``OK``. + + Examples: + ``curl http://127.0.0.1:8000/health`` prints ``OK``. + """ return PlainTextResponse("OK") @mcp.custom_route("/openapi.yaml", methods=["GET"]) async def openapi_spec_yaml(request: Request): - """Serve the OpenAPI specification as YAML""" + """Serve the OpenAPI specification as YAML. + + Args: + request: The incoming HTTP request. + + Returns: + The file, or a 404 JSON error if it is missing. + + Examples: + ``curl http://127.0.0.1:8000/openapi.yaml`` + """ from starlette.responses import FileResponse openapi_path = Path(__file__).parent / "openapi.yaml" @@ -641,7 +800,17 @@ async def openapi_spec_yaml(request: Request): @mcp.custom_route("/openapi.json", methods=["GET"]) async def openapi_spec_json(request: Request): - """Serve the OpenAPI specification as JSON""" + """Serve the OpenAPI specification as JSON. + + Args: + request: The incoming HTTP request. + + Returns: + The document as JSON, or a 404 JSON error if it is missing. + + Examples: + ``curl http://127.0.0.1:8000/openapi.json`` + """ from starlette.responses import JSONResponse openapi_path = Path(__file__).parent / "openapi.yaml" @@ -657,7 +826,17 @@ async def openapi_spec_json(request: Request): @mcp.custom_route("/docs", methods=["GET"]) async def swagger_ui(request: Request): - """Serve Swagger UI for API documentation""" + """Serve Swagger UI for the API documentation. + + Args: + request: The incoming HTTP request. + + Returns: + An HTML page that loads ``/openapi.json``. + + Examples: + Open ``http://127.0.0.1:8000/docs`` in a browser. + """ from starlette.responses import HTMLResponse html = f""" @@ -707,11 +886,44 @@ async def swagger_ui(request: Request): """ return HTMLResponse(html) - """Run the MCP""" + return mcp + + +def run(cfg: Config) -> str: + """Create the server and run it with the transport in the configuration. + + Args: + cfg: Server configuration; ``transport`` is ``"http"`` or ``"stdio"``, + and ``host`` and ``port`` apply to the HTTP transport. + + Returns: + A short status message after the server stops. + + Raises: + ValueError: If ``cfg.transport`` is not ``"http"`` or ``"stdio"``. + + Examples: + ``run(Config(url="http://localhost:8042", transport="stdio"))`` serves MCP over + stdin and stdout until the client disconnects. + """ + if cfg.transport not in TRANSPORTS: + raise ValueError(f"Unsupported transport {cfg.transport!r}; expected one of {', '.join(TRANSPORTS)}") + + debug = cfg.debug or os.environ.get("EPR_DEBUG", False) + if debug: + sys.excepthook = debug_except_hook + logger.setLevel(logging.DEBUG) + + mcp = create_server(cfg) + logger.info("MCP is running with the following configuration:") logger.info(f"Debug mode: {debug}") - logger.info("MCP Server is running on http://localhost:8000/mcp") + logger.info(f"Transport: {cfg.transport}") logger.info(f"EPR URL: {cfg.url}") - logger.info(f"EPR Token: {cfg.token}") - asyncio.run(mcp.run_async(transport="http", host="0.0.0.0", port=8000)) - return "MCP is running" + logger.info(f"EPR Token configured: {bool(cfg.token)}") + if cfg.transport == "stdio": + mcp.run(transport="stdio", show_banner=False) + else: + logger.info(f"MCP Server is running on http://{cfg.host}:{cfg.port}/mcp") + mcp.run(transport="http", host=cfg.host, port=cfg.port) + return "MCP stopped" diff --git a/tests/demos/__init__.py b/tests/demos/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/demos/test_demo_helpers.py b/tests/demos/test_demo_helpers.py new file mode 100644 index 0000000..87043bb --- /dev/null +++ b/tests/demos/test_demo_helpers.py @@ -0,0 +1,95 @@ +# SPDX-FileCopyrightText: © 2025 Brett Smith +# SPDX-License-Identifier: Apache-2.0 + +"""Tests for the helper functions in the OpenAPI and MCP client demos.""" + +import argparse +import importlib.util +import subprocess +import sys +from pathlib import Path + +import pytest # type: ignore + +DEMOS = Path(__file__).resolve().parents[2] / "demos" + + +def load(name: str): + """Import a demo script as a module.""" + spec = importlib.util.spec_from_file_location(f"demo_helpers_{name}", DEMOS / f"{name}.py") + module = importlib.util.module_from_spec(spec) + spec.loader.exec_module(module) + return module + + +class TestOpenapiDemoHelpers: + """Tests for the helpers in openapi_demo.py.""" + + def test_free_port_is_usable(self): + """Test free port is usable.""" + demo = load("openapi_demo") + assert 1024 <= demo.free_port() <= 65535 + + def test_wait_until_healthy_fails_if_the_server_process_exits(self): + """Test wait until healthy fails if the server process exits.""" + demo = load("openapi_demo") + with subprocess.Popen([sys.executable, "-c", "pass"]) as process: + process.wait() + with pytest.raises(RuntimeError, match="exited before"): + demo.wait_until_healthy("http://127.0.0.1:9", process, timeout=5) + + def test_wait_until_healthy_times_out_without_a_process(self): + """Test wait until healthy times out without a process.""" + demo = load("openapi_demo") + with pytest.raises(RuntimeError, match="no healthy server"): + demo.wait_until_healthy("http://127.0.0.1:9", None, timeout=0.5) + + def test_running_server_terminates_the_child_when_the_block_ends(self): + """Test running server terminates the child when the block ends.""" + demo = load("openapi_demo") + with demo.running_server(demo.free_port(), "http://127.0.0.1:9") as process: + assert process.poll() is None + assert process.poll() is not None + + def test_main_returns_one_for_an_unreachable_server_url(self, monkeypatch, capsys): + """Test main returns one for an unreachable server url.""" + demo = load("openapi_demo") + monkeypatch.setattr(sys, "argv", ["openapi_demo.py", "--url", "http://127.0.0.1:9"]) + monkeypatch.setattr(demo.time, "sleep", lambda seconds: None) + monkeypatch.setattr(demo, "wait_until_healthy", lambda *a, **k: (_ for _ in ()).throw(RuntimeError("down"))) + assert demo.main() == 1 + assert "Demo failed" in capsys.readouterr().err + + +class TestClientDemoHelpers: + """Tests for the helpers in mcp_client_demo.py.""" + + def test_make_client_uses_http_for_a_server_url(self): + """Test make client uses http for a server url.""" + demo = load("mcp_client_demo") + args = argparse.Namespace(server_url="http://127.0.0.1:8000/mcp", epr_url="http://epr", show_server_logs=False) + assert type(demo.make_client(args).transport).__name__ == "StreamableHttpTransport" + + def test_make_client_uses_stdio_without_a_server_url(self): + """Test make client uses stdio without a server url.""" + demo = load("mcp_client_demo") + args = argparse.Namespace(server_url=None, epr_url="http://epr", show_server_logs=False) + assert type(demo.make_client(args).transport).__name__ == "StdioTransport" + + def test_step_prints_a_numbered_heading(self, capsys): + """Test step prints a numbered heading.""" + demo = load("mcp_client_demo") + demo.step(2, "Create a receiver") + assert "[2/6] Create a receiver" in capsys.readouterr().out + + def test_main_returns_one_when_the_demo_fails(self, monkeypatch, capsys): + """Test main returns one when the demo fails.""" + demo = load("mcp_client_demo") + + async def fail(args): + raise demo.DemoError("boom") + + monkeypatch.setattr(sys, "argv", ["mcp_client_demo.py"]) + monkeypatch.setattr(demo, "run", fail) + assert demo.main() == 1 + assert "boom" in capsys.readouterr().err diff --git a/tests/demos/test_demos.py b/tests/demos/test_demos.py new file mode 100644 index 0000000..1e38d38 --- /dev/null +++ b/tests/demos/test_demos.py @@ -0,0 +1,182 @@ +# SPDX-FileCopyrightText: © 2025 Brett Smith +# SPDX-License-Identifier: Apache-2.0 + +"""Smoke tests for the demo scripts. None of them need EPR or the network.""" + +import importlib.util +import re +import subprocess +import sys +from pathlib import Path + +import pytest # type: ignore + +DEMOS = Path(__file__).resolve().parents[2] / "demos" + + +def load(name: str): + """Import a demo script from the demos directory as a module.""" + spec = importlib.util.spec_from_file_location(f"demo_{name}", DEMOS / f"{name}.py") + module = importlib.util.module_from_spec(spec) + spec.loader.exec_module(module) + return module + + +@pytest.fixture(scope="module") +def generator(): + """Provide the generate_epr_events module.""" + return load("generate_epr_events") + + +class TestGenerateEprEvents: + """Tests for demos/generate_epr_events.py.""" + + def test_ulids_are_valid_and_sortable(self, generator): + """Test ulids are valid and sortable.""" + ids = [generator.generate_ulid() for _ in range(50)] + assert all(re.fullmatch(r"[0-9A-HJKMNP-TV-Z]{26}", value) for value in ids) + assert len(set(ids)) == 50 + + def test_ulid_timestamp_prefix_orders_by_time(self, generator, monkeypatch): + """Test ulid timestamp prefix orders by time.""" + monkeypatch.setattr(generator.time, "time_ns", lambda: 1_000_000_000_000) + earlier = generator.generate_ulid() + monkeypatch.setattr(generator.time, "time_ns", lambda: 2_000_000_000_000) + later = generator.generate_ulid() + assert earlier[:10] < later[:10] + + def test_receivers_cover_eleven_cdevent_types_with_a_schema(self, generator): + """Test receivers cover eleven cdevent types with a schema.""" + receivers = generator.generate_event_receivers() + assert len(receivers) == 11 + assert all("schema" in receiver for receiver in receivers) + assert len({receiver["type"] for receiver in receivers}) == 11 + + def test_events_are_four_services_times_eleven_types(self, generator): + """Test events are four services times eleven types.""" + events = generator.generate_events({}) + assert len(events) == 44 + assert {event["name"] for event in events} == {"foo", "bar", "baz", "qux"} + assert all(re.fullmatch(r"\d{4}\.\d{2}\.\d{2}", event["release"]) for event in events) + + def test_events_use_the_receiver_ids_they_are_given(self, generator): + """Test events use the receiver ids they are given.""" + receivers = {r["type"]: {"data": "01ARZ3NDEKTSV4RRFFQ69G5FAV"} for r in generator.generate_event_receivers()} + events = generator.generate_events(receivers) + assert {event["event_receiver_id"] for event in events} == {"01ARZ3NDEKTSV4RRFFQ69G5FAV"} + + def test_curl_command_quotes_the_payload(self, generator): + """Test curl command quotes the payload.""" + command = generator.make_curl_command({"name": "it's"}, "http://epr/api/v1/events") + assert command.startswith("curl -sS -X POST") + assert "http://epr/api/v1/events" in command + + def test_dry_run_prints_55_curl_commands_and_exits_zero(self): + """Test dry run prints 55 curl commands and exits zero.""" + result = subprocess.run( + [sys.executable, str(DEMOS / "generate_epr_events.py"), "--dry-run"], + capture_output=True, + text=True, + timeout=60, + ) + assert result.returncode == 0, result.stderr + assert sum(1 for line in result.stdout.splitlines() if line.startswith("curl ")) == 55 + + def test_unreachable_epr_exits_nonzero(self, tmp_path): + """Test unreachable epr exits nonzero.""" + result = subprocess.run( + [sys.executable, str(DEMOS / "generate_epr_events.py"), "--url", "http://127.0.0.1:9", "--timeout", "1"], + capture_output=True, + text=True, + timeout=120, + cwd=tmp_path, + ) + assert result.returncode == 1 + assert "Posted 0/44 events successfully" in result.stdout + + def test_write_to_disk_writes_files_and_posts_nothing(self, tmp_path): + """Test write to disk writes files and posts nothing.""" + result = subprocess.run( + [sys.executable, str(DEMOS / "generate_epr_events.py"), "--write-to-disk", "--dry-run"], + capture_output=True, + text=True, + timeout=60, + cwd=tmp_path, + ) + assert result.returncode == 0, result.stderr + assert len(list((tmp_path / "epr_reports" / "events").glob("*.json"))) == 44 + assert len(list((tmp_path / "epr_reports" / "event_receivers").glob("*.json"))) == 11 + + +class TestClientDemos: + """Tests for the OpenAPI and MCP client demos.""" + + @pytest.mark.parametrize("name", ["openapi_demo", "mcp_client_demo"]) + def test_demo_imports_and_documents_its_usage(self, name): + """Test demo imports and documents its usage.""" + module = load(name) + assert "Usage:" in module.__doc__ + assert callable(module.main) + + def test_shorten_truncates_long_text(self): + """Test shorten truncates long text.""" + module = load("mcp_client_demo") + assert module.shorten("a b\nc") == "a b c" + assert module.shorten("x" * 200, 20) == "x" * 17 + "..." + + @pytest.mark.asyncio + async def test_call_treats_non_json_text_as_a_failure(self): + """Test call treats non json text as a failure.""" + module = load("mcp_client_demo") + + class Result: + def __init__(self): + self.is_error = False + self.content = [type("Text", (), {"text": "Connection failed to EPR server"})()] + + class Client: + async def call_tool(self, *args, **kwargs): + return Result() + + with pytest.raises(module.DemoError, match="returned an error"): + await module.call(Client(), "fetch_event", {"id": "x"}) + assert await module.call(Client(), "fetch_event", {"id": "x"}, expect_error=True) + + +def test_openapi_demo_runs_end_to_end(): + """Starts the real server on a free port; EPR is not contacted.""" + result = subprocess.run( + [sys.executable, str(DEMOS / "openapi_demo.py")], + capture_output=True, + text=True, + timeout=120, + ) + assert result.returncode == 0, result.stdout + result.stderr + assert "found 9 tools" in result.stdout + assert "JSON matches the YAML document: True" in result.stdout + + +def test_demos_do_not_use_the_legacy_httpx_package(): + """Test demos do not use the legacy httpx package.""" + pattern = re.compile(r"^\s*(import httpx|from httpx)\b(?!2)", re.MULTILINE) + offenders = [str(path) for path in DEMOS.glob("*.py") if pattern.search(path.read_text())] + assert offenders == [] + + +def test_run_all_script_is_executable_and_valid_bash(): + """Test run all script is executable and valid bash.""" + script = DEMOS / "scripts" / "run_all.sh" + assert script.stat().st_mode & 0o111 + assert subprocess.run(["bash", "-n", str(script)]).returncode == 0 + refused = subprocess.run([str(script), "--bogus"], capture_output=True, text=True) + assert refused.returncode == 2 + + +def test_every_demo_has_a_presenter_script(): + """Test every demo has a presenter script.""" + scripts = DEMOS / "scripts" + for name in ("generate_events_script.md", "openapi_demo_script.md", "mcp_client_demo_script.md"): + assert (scripts / name).is_file() + readme = (DEMOS / "README.md").read_text() + for demo in ("generate_epr_events.py", "openapi_demo.py", "mcp_client_demo.py"): + assert demo in readme diff --git a/tests/functional/test_transports.py b/tests/functional/test_transports.py new file mode 100644 index 0000000..ff7482a --- /dev/null +++ b/tests/functional/test_transports.py @@ -0,0 +1,76 @@ +# SPDX-FileCopyrightText: © 2025 Brett Smith +# SPDX-License-Identifier: Apache-2.0 + +"""Functional tests that start the real server process. + +Skipped unless ``EPR_MCP_FUNCTIONAL=1`` is set, since they spawn subprocesses +and bind a local port. EPR itself is not needed: the tests only list tools. +""" + +import asyncio +import os +import socket +import subprocess +import sys +import time + +import httpx2 +import pytest # type: ignore +from fastmcp import Client +from fastmcp.client.transports import StdioTransport + +pytestmark = pytest.mark.skipif(os.environ.get("EPR_MCP_FUNCTIONAL") != "1", reason="set EPR_MCP_FUNCTIONAL=1 to run") + +EXPECTED_TOOL_COUNT = 9 + + +def free_port() -> int: + """Return a free local TCP port.""" + with socket.socket() as sock: + sock.bind(("127.0.0.1", 0)) + return sock.getsockname()[1] + + +def test_stdio_transport_lists_tools(): + """Test stdio transport lists tools.""" + transport = StdioTransport( + command=sys.executable, + args=["-m", "epr_mcp.main", "start", "--transport", "stdio", "--url", "http://127.0.0.1:9"], + ) + + async def go(): + async with Client(transport) as client: + return await client.list_tools() + + assert len(asyncio.run(go())) == EXPECTED_TOOL_COUNT + + +def test_http_transport_serves_health_and_tools(): + """Test http transport serves health and tools.""" + port = free_port() + command = [ + sys.executable, '-m', 'epr_mcp.main', 'start', + '--transport', 'http', '--host', '127.0.0.1', '--port', str(port), + '--url', 'http://127.0.0.1:9', + ] # fmt: skip + + async def list_tools(): + async with Client(f"http://127.0.0.1:{port}/mcp") as client: + return await client.list_tools() + + with subprocess.Popen(command, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) as proc: + try: + deadline = time.time() + 30 + while True: + try: + if httpx2.get(f"http://127.0.0.1:{port}/health").status_code == 200: + break + except httpx2.TransportError: + pass + assert proc.poll() is None, "server exited early" + assert time.time() < deadline, "server did not become healthy" + time.sleep(0.2) + assert len(asyncio.run(list_tools())) == EXPECTED_TOOL_COUNT + finally: + proc.terminate() + proc.wait(timeout=10) diff --git a/tests/tutorials/__init__.py b/tests/tutorials/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/tutorials/test_tutorial_code.py b/tests/tutorials/test_tutorial_code.py new file mode 100644 index 0000000..80e2091 --- /dev/null +++ b/tests/tutorials/test_tutorial_code.py @@ -0,0 +1,173 @@ +# SPDX-FileCopyrightText: © 2025 Brett Smith +# SPDX-License-Identifier: Apache-2.0 + +"""Checks that the workshop code and configs under docs/tutorials stay working. + +Every checkpoint server must import and expose the right tools, the final +checkpoint's own tests must pass, and the editor configs must point at files +that exist. +""" + +import importlib.util +import json +import re +import subprocess +import sys +from pathlib import Path + +import pytest # type: ignore +import yaml +from fastmcp import Client + +TUTORIALS = Path(__file__).resolve().parents[2] / "docs" / "tutorials" +CODE = TUTORIALS / "code" +CHECKPOINTS = { + "checkpoint_01_first_tool": 1, + "checkpoint_03_tool_set": 9, + "checkpoint_04_validation": 9, + "checkpoint_05_tests": 9, +} +# Starters are the beginning-of-module state. starter_01 has no tools yet; +# starter_03 is the checkpoint_01 state (one tool); starter_04 and +# starter_05 are copies of the previous checkpoint so the tool counts match. +STARTERS = { + "starter_01_first_tool": 0, + "starter_03_tool_set": 1, + "starter_04_validation": 9, + "starter_05_tests": 9, +} +SHIPPED_TOOLS = { + "fetch_event", + "fetch_receiver", + "fetch_group", + "search_events", + "search_receivers", + "search_groups", + "create_event", + "create_receiver", + "create_group", +} + + +def load_server(checkpoint: str): + """Import a checkpoint's server.py as a module.""" + path = CODE / checkpoint / "server.py" + spec = importlib.util.spec_from_file_location(f"workshop_{checkpoint}", path) + module = importlib.util.module_from_spec(spec) + spec.loader.exec_module(module) + return module + + +@pytest.mark.parametrize(("checkpoint", "expected"), CHECKPOINTS.items()) +@pytest.mark.asyncio +async def test_checkpoint_server_lists_expected_tools(checkpoint, expected): + """Test checkpoint server lists expected tools.""" + module = load_server(checkpoint) + async with Client(module.mcp) as client: + tools = {tool.name for tool in await client.list_tools()} + assert len(tools) == expected + if expected == 9: + assert tools == SHIPPED_TOOLS + + +@pytest.mark.parametrize(("starter", "expected"), STARTERS.items()) +@pytest.mark.asyncio +async def test_starter_server_imports_and_has_expected_tools(starter, expected): + """Test starter server imports cleanly and has the expected number of tools.""" + module = load_server(starter) + async with Client(module.mcp) as client: + tools = {tool.name for tool in await client.list_tools()} + assert len(tools) == expected + if expected == 9: + assert tools == SHIPPED_TOOLS + + +def test_starter_03_matches_checkpoint_01(): + """starter_03 is the beginning-of-module-03 state; it must equal checkpoint_01.""" + assert (CODE / "starter_03_tool_set" / "server.py").read_text() == ( + CODE / "checkpoint_01_first_tool" / "server.py" + ).read_text() + + +def test_starter_04_matches_checkpoint_03(): + """starter_04 is the beginning-of-module-04 state; it must equal checkpoint_03.""" + assert (CODE / "starter_04_validation" / "server.py").read_text() == ( + CODE / "checkpoint_03_tool_set" / "server.py" + ).read_text() + + +def test_starter_05_server_matches_checkpoint_04(): + """starter_05 is the beginning-of-module-05 state; server must equal checkpoint_04.""" + assert (CODE / "starter_05_tests" / "server.py").read_text() == ( + CODE / "checkpoint_04_validation" / "server.py" + ).read_text() + + +def test_checkpoint_05_server_matches_checkpoint_04(): + """Module 05 only adds tests, so the server must not drift from module 04.""" + assert (CODE / "checkpoint_05_tests" / "server.py").read_text() == ( + CODE / "checkpoint_04_validation" / "server.py" + ).read_text() + + +def test_checkpoint_05_own_tests_pass(): + """Test checkpoint 05 own tests pass.""" + result = subprocess.run( + [sys.executable, "-m", "pytest", "checkpoint_05_tests", "-q", "-p", "no:cacheprovider"], + cwd=CODE, + capture_output=True, + text=True, + ) + assert result.returncode == 0, result.stdout + result.stderr + + +def test_vscode_config_references_existing_paths(): + """Test vscode config references existing paths.""" + config = json.loads((CODE / ".vscode" / "mcp.json").read_text()) + workshop = config["servers"]["epr-workshop"]["args"] + assert (CODE / workshop[-1]).is_file() + shipped = config["servers"]["epr-mcp"]["args"] + assert ( + CODE / shipped[shipped.index("--directory") + 1].replace("${workspaceFolder}", ".") / "pyproject.toml" + ).is_file() + assert config["servers"]["epr-mcp"]["args"][-2:] == ["--transport", "stdio"] + + +def test_claude_desktop_config_matches_vscode_servers(): + """Test claude desktop config matches vscode servers.""" + desktop = json.loads((CODE / "claude_desktop_config.json").read_text())["mcpServers"] + vscode = json.loads((CODE / ".vscode" / "mcp.json").read_text())["servers"] + assert desktop.keys() == vscode.keys() + for name in desktop: + assert desktop[name]["args"][0] == "run" + assert desktop[name]["args"][-1] == vscode[name]["args"][-1] + + +def test_workshop_compose_runs_only_epr_services(): + """Test workshop compose runs only epr services.""" + compose = yaml.safe_load((CODE / "docker-compose.yaml").read_text()) + assert set(compose["services"]) == {"postgres", "redpanda", "epr-server"} + + +def test_tutorial_files_are_named_per_agents_rules(): + """Test tutorial files are named per agents rules.""" + for path in TUTORIALS.glob("*.md"): + assert path.name == "README.md" or re.fullmatch(r"[0-9a-z_]+\.md", path.name), path.name + + +def test_tutorials_use_fastmcp_4_and_httpx2_only(): + """Test tutorials use fastmcp 4 and httpx2 only.""" + stale = re.compile( + r"mcp\.server\.fastmcp|^\s*import httpx\s*$|^\s*from httpx import|FastMCP 2|FastMCP 1|mcp\[cli\]", re.M + ) + # Module 07 documents the migration, so it names the old APIs on purpose. + migration_notes = TUTORIALS / "07_misc_and_troubleshooting.md" + offenders = [ + str(p) + for p in TUTORIALS.rglob("*") + if p.suffix in {".md", ".py", ".toml"} + and p != migration_notes + and ".venv" not in p.parts + and stale.search(p.read_text()) + ] + assert offenders == [] diff --git a/tests/tutorials/test_tutorial_scripts.py b/tests/tutorials/test_tutorial_scripts.py new file mode 100644 index 0000000..d96db35 --- /dev/null +++ b/tests/tutorials/test_tutorial_scripts.py @@ -0,0 +1,136 @@ +# SPDX-FileCopyrightText: © 2025 Brett Smith +# SPDX-License-Identifier: Apache-2.0 + +"""Tests for the workshop's helper scripts: seed_epr.py, check_setup.py, and client.py.""" + +import importlib.util +import json +import sys +from pathlib import Path + +import httpx2 +import pytest # type: ignore + +CODE = Path(__file__).resolve().parents[2] / "docs" / "tutorials" / "code" + + +def load(name: str): + """Import a script from the workshop code directory as a module.""" + spec = importlib.util.spec_from_file_location(f"workshop_{name}", CODE / f"{name}.py") + module = importlib.util.module_from_spec(spec) + spec.loader.exec_module(module) + return module + + +class TestSeedEpr: + """Tests for seed_epr.py.""" + + def test_create_returns_the_new_id(self): + """Test create returns the new id.""" + seed = load("seed_epr") + transport = httpx2.MockTransport(lambda request: httpx2.Response(200, json={"data": "01ABC"})) + with httpx2.Client(base_url="http://epr.test", transport=transport) as client: + assert seed.create(client, "/api/v1/receivers", {"name": "x"}) == "01ABC" + + def test_create_raises_on_an_error_status(self): + """Test create raises on an error status.""" + seed = load("seed_epr") + transport = httpx2.MockTransport(lambda request: httpx2.Response(400, text="bad")) + with httpx2.Client(base_url="http://epr.test", transport=transport) as client: + with pytest.raises(httpx2.HTTPStatusError): + seed.create(client, "/api/v1/receivers", {}) + + def test_main_saves_ids_and_exits_zero(self, tmp_path, monkeypatch, capsys): + """Test main saves ids and exits zero.""" + seed = load("seed_epr") + counter = iter(range(100)) + transport = httpx2.MockTransport(lambda request: httpx2.Response(200, json={"data": f"ID{next(counter)}"})) + real_client = httpx2.Client + monkeypatch.setattr(seed.httpx2, "Client", lambda **kw: real_client(transport=transport, **kw)) + monkeypatch.setattr(seed, "IDS_FILE", tmp_path / "ids.json") + assert seed.main() == 0 + ids = json.loads((tmp_path / "ids.json").read_text()) + assert ids["receiver_id"] == "ID0" and len(ids["event_ids"]) == 3 + assert "Saved to" in capsys.readouterr().out + + def test_main_reports_an_unreachable_epr(self, monkeypatch, capsys): + """Test main reports an unreachable epr.""" + seed = load("seed_epr") + + def refuse(**kwargs): + raise httpx2.ConnectError("refused") + + monkeypatch.setattr(seed.httpx2, "Client", refuse) + assert seed.main() == 1 + assert "Cannot reach EPR" in capsys.readouterr().err + + +class TestCheckSetup: + """Tests for check_setup.py.""" + + def test_report_counts_only_failures(self, capsys): + """Test report counts only failures.""" + check = load("check_setup") + check.report("PASS", "a") + check.report("SKIP", "b", "later") + assert check.failures == 0 + check.report("FAIL", "c", "broken") + assert check.failures == 1 + out = capsys.readouterr().out + assert "PASS" in out and "FAIL" in out and "broken" in out + + def test_check_epr_passes_when_ready_and_fails_when_down(self, monkeypatch, capsys): + """Test check epr passes when ready and fails when down.""" + check = load("check_setup") + monkeypatch.setattr(check.httpx2, "get", lambda url, timeout: httpx2.Response(200)) + check.check_epr() + assert check.failures == 0 + + def down(url, timeout): + raise httpx2.ConnectError("refused") + + monkeypatch.setattr(check.httpx2, "get", down) + check.check_epr() + assert check.failures == 1 + assert "docker compose up" in capsys.readouterr().out + + def test_check_python_passes_on_this_interpreter(self): + """Test check python passes on this interpreter.""" + check = load("check_setup") + check.check_python() + assert check.failures == 0 + + def test_check_uv_reports_a_missing_uv(self, monkeypatch): + """Test check uv reports a missing uv.""" + check = load("check_setup") + monkeypatch.setattr(check.shutil, "which", lambda name: None) + assert check.check_uv() is None + assert check.failures == 1 + + def test_main_returns_one_when_a_check_fails(self, monkeypatch): + """Test main returns one when a check fails.""" + check = load("check_setup") + monkeypatch.setattr(sys, "argv", ["check_setup.py", "--skip-stdio"]) + monkeypatch.setattr(check, "check_uv", lambda: None) + monkeypatch.setattr(check, "check_epr", lambda: check.report("FAIL", "EPR")) + monkeypatch.setattr(check, "check_in_process", lambda: None) + assert check.main() == 1 + + +class TestClient: + """Tests for client.py.""" + + @pytest.mark.asyncio + async def test_list_prints_the_tools(self, capfd): + """Test list prints the tools.""" + client = load("client") + status = await client.run(CODE / "checkpoint_01_first_tool" / "server.py", None, {}) + assert status == 0 + assert "fetch_event" in capfd.readouterr().out + + @pytest.mark.asyncio + async def test_call_with_invalid_arguments_returns_one(self, capfd): + """Test call with invalid arguments returns one.""" + client = load("client") + status = await client.run(CODE / "checkpoint_04_validation" / "server.py", "fetch_event", {"id": "bad"}) + assert status == 1 diff --git a/tests/unit/test_common.py b/tests/unit/test_common.py index cc58b9d..09fe799 100644 --- a/tests/unit/test_common.py +++ b/tests/unit/test_common.py @@ -1,8 +1,12 @@ +# SPDX-FileCopyrightText: © 2025 Brett Smith +# SPDX-License-Identifier: Apache-2.0 + """Unit tests for epr_mcp.common module.""" import pytest # type: ignore -from epr_mcp.common import get_mutation_query, get_operation, get_search_query +from epr_mcp.common import create_client, get_mutation_query, get_operation, get_search_query +from epr_mcp.config import Config from epr_mcp.models import GraphQLQuery @@ -162,3 +166,25 @@ def test_mutation_query_structure(self): assert result.query.startswith("mutation") assert "$obj: CreateEventInput!" in result.query assert "{create_event(event: $obj)}" in result.query + + +class TestCreateClient: + """Test create_client function.""" + + def test_sends_bearer_token_when_configured(self): + """Token is sent as a bearer Authorization header.""" + client = create_client(Config(url="http://epr", token="abc")) + assert client.headers["Authorization"] == "Bearer abc" + assert client.headers["Content-Type"] == "application/json" + + def test_omits_authorization_without_token(self): + """No Authorization header when the token is unset or empty.""" + for token in (None, ""): + client = create_client(Config(url="http://epr", token=token)) + assert "Authorization" not in client.headers + + def test_returns_httpx2_client(self): + """The client is an httpx2.AsyncClient.""" + import httpx2 + + assert isinstance(create_client(Config(url="http://epr")), httpx2.AsyncClient) diff --git a/tests/unit/test_config.py b/tests/unit/test_config.py new file mode 100644 index 0000000..5b0c43d --- /dev/null +++ b/tests/unit/test_config.py @@ -0,0 +1,38 @@ +# SPDX-FileCopyrightText: © 2025 Brett Smith +# SPDX-License-Identifier: Apache-2.0 + +"""Unit tests for epr_mcp.config.""" + +import pytest # type: ignore + +from epr_mcp.config import TRANSPORTS, Config + + +class TestConfig: + """Tests for the Config data class.""" + + def test_defaults_match_the_documented_values(self): + """Test defaults match the documented values.""" + cfg = Config(url="http://epr") + assert (cfg.token, cfg.debug, cfg.transport, cfg.host, cfg.port) == (None, False, "http", "0.0.0.0", 8000) + + def test_as_dict_contains_every_field(self): + """Test as dict contains every field.""" + data = Config(url="http://epr", token="t", port=9000).as_dict() + assert data == { + "url": "http://epr", + "token": "t", + "debug": False, + "transport": "http", + "host": "0.0.0.0", + "port": 9000, + } + + @pytest.mark.parametrize("transport", TRANSPORTS) + def test_every_listed_transport_is_accepted_by_the_data_class(self, transport): + """Test every listed transport is accepted by the data class.""" + assert Config(url="http://epr", transport=transport).transport == transport + + def test_transports_are_http_and_stdio(self): + """Test transports are http and stdio.""" + assert set(TRANSPORTS) == {"http", "stdio"} diff --git a/tests/unit/test_http_errors.py b/tests/unit/test_http_errors.py new file mode 100644 index 0000000..939bfc1 --- /dev/null +++ b/tests/unit/test_http_errors.py @@ -0,0 +1,67 @@ +# SPDX-FileCopyrightText: © 2025 Brett Smith +# SPDX-License-Identifier: Apache-2.0 + +"""Unit tests for HTTP error handling and the httpx2 migration.""" + +import logging +import re +from pathlib import Path + +import httpx2 +import pytest # type: ignore + +from epr_mcp.config import Config +from epr_mcp.server import handle_http_errors + + +@pytest.fixture +def cfg(): + """Provide a configuration pointing at a fake EPR.""" + return Config(url="http://epr.test:8042", token=None) + + +class TestHandleHttpErrors: + """Test handle_http_errors with httpx2 exception types.""" + + def test_connect_error(self, cfg, caplog): + """Test connect error.""" + with caplog.at_level(logging.ERROR, logger="epr_mcp.server"): + message = handle_http_errors(httpx2.ConnectError("refused"), "fetch_event", cfg) + assert "Connection failed to EPR server at http://epr.test:8042" in message + assert "refused" in message + assert "Connection failed to http://epr.test:8042" in caplog.text + + def test_timeout_error(self, cfg, caplog): + """Test timeout error.""" + with caplog.at_level(logging.ERROR, logger="epr_mcp.server"): + message = handle_http_errors(httpx2.ReadTimeout("too slow"), "fetch_event", cfg) + assert message.startswith("Request timeout to EPR server at http://epr.test:8042") + assert "Request timeout" in caplog.text + + def test_http_status_error(self, cfg, caplog): + """Test http status error.""" + request = httpx2.Request("GET", "http://epr.test:8042/api/v1/events/1") + response = httpx2.Response(500, text="boom", request=request) + error = httpx2.HTTPStatusError("server error", request=request, response=response) + with caplog.at_level(logging.ERROR, logger="epr_mcp.server"): + message = handle_http_errors(error, "fetch_event", cfg) + assert message == "HTTP error from EPR server: 500 - boom" + assert "HTTP error from" in caplog.text + + def test_generic_error(self, cfg, caplog): + """Test generic error.""" + with caplog.at_level(logging.ERROR, logger="epr_mcp.server"): + message = handle_http_errors(RuntimeError("unexpected"), "create_event", cfg) + assert message == "Error in create_event: unexpected" + assert "Error in create_event" in caplog.text + + +class TestNoLegacyHttpx: + """Guard against reintroducing the legacy httpx package.""" + + def test_src_does_not_import_httpx(self): + """Test src does not import httpx.""" + src = Path(__file__).resolve().parents[2] / "src" / "epr_mcp" + pattern = re.compile(r"^\s*(import httpx|from httpx)\b(?!2)", re.MULTILINE) + offenders = [str(p) for p in src.rglob("*.py") if pattern.search(p.read_text())] + assert offenders == [] diff --git a/tests/unit/test_main.py b/tests/unit/test_main.py new file mode 100644 index 0000000..7247f50 --- /dev/null +++ b/tests/unit/test_main.py @@ -0,0 +1,89 @@ +# SPDX-FileCopyrightText: © 2025 Brett Smith +# SPDX-License-Identifier: Apache-2.0 + +"""Tests for the eprmcp command line.""" + +from unittest import mock + +import pytest # type: ignore + +from epr_mcp import main + + +def start(monkeypatch, *args, env=None): + """Run ``eprmcp start`` with the arguments and environment, and return the Config it built.""" + for key in ("EPR_URL", "EPR_API_TOKEN", "EPR_TOKEN", "MCP_TRANSPORT", "MCP_HOST", "MCP_PORT"): + monkeypatch.delenv(key, raising=False) + for key, value in (env or {}).items(): + monkeypatch.setenv(key, value) + monkeypatch.setattr("sys.argv", ["eprmcp", "start", *args]) + with mock.patch.object(main.server, "run") as run: + main.main() + return run.call_args.args[0] + + +class TestStart: + """Tests for the start command's options and environment variables.""" + + def test_defaults(self, monkeypatch): + """Test defaults.""" + cfg = start(monkeypatch) + assert (cfg.url, cfg.token, cfg.transport, cfg.host, cfg.port) == ( + "http://localhost:8042", + None, + "http", + "0.0.0.0", + 8000, + ) + + def test_flags(self, monkeypatch): + """Test flags.""" + cfg = start( + monkeypatch, + '--url', 'http://epr:1', + '--token', 't', + '--transport', 'stdio', + '--host', '127.0.0.1', + '--port', '9001', + '--debug', + ) # fmt: skip + assert (cfg.url, cfg.token, cfg.transport, cfg.host, cfg.port, cfg.debug) == ( + "http://epr:1", + "t", + "stdio", + "127.0.0.1", + 9001, + True, + ) + + def test_environment_defaults(self, monkeypatch): + """Test environment defaults.""" + cfg = start( + monkeypatch, + env={"EPR_URL": "http://e:2", "MCP_TRANSPORT": "stdio", "MCP_HOST": "1.2.3.4", "MCP_PORT": "7"}, + ) + assert (cfg.url, cfg.transport, cfg.host, cfg.port) == ("http://e:2", "stdio", "1.2.3.4", 7) + + @pytest.mark.parametrize("variable", ["EPR_API_TOKEN", "EPR_TOKEN"]) + def test_token_from_either_environment_variable(self, monkeypatch, variable): + """Test token from either environment variable.""" + assert start(monkeypatch, env={variable: "abc"}).token == "abc" + + def test_invalid_transport_exits(self, monkeypatch): + """Test invalid transport exits.""" + with pytest.raises(SystemExit): + start(monkeypatch, "--transport", "sse") + + +def test_unknown_command_exits(monkeypatch): + """Test unknown command exits.""" + monkeypatch.setattr("sys.argv", ["eprmcp", "bogus"]) + with pytest.raises(SystemExit): + main.main() + + +def test_version_prints(monkeypatch, capsys): + """Test version prints.""" + monkeypatch.setattr("sys.argv", ["eprmcp", "version"]) + main.main() + assert "epr-mcp" in capsys.readouterr().out diff --git a/tests/unit/test_schemas.py b/tests/unit/test_schemas.py index c4a17f8..17fbb8e 100644 --- a/tests/unit/test_schemas.py +++ b/tests/unit/test_schemas.py @@ -1,3 +1,6 @@ +# SPDX-FileCopyrightText: © 2025 Brett Smith +# SPDX-License-Identifier: Apache-2.0 + """Unit tests for epr_mcp.schemas module.""" import pytest # type: ignore @@ -10,6 +13,7 @@ _sanitize_string, validate_event_list_response, validate_event_response, + validate_input, ) @@ -354,3 +358,26 @@ def test_validate_event_list_response_with_invalid_data_raises_value_error(self) with pytest.raises(ValueError, match="Event list response validation failed"): validate_event_list_response(invalid_data) + + +class TestInputModelsForbidExtraKeys: + """Input models reject unknown keys instead of silently dropping them.""" + + @pytest.mark.parametrize( + ("operation", "payload"), + [ + ("search_events", {"data": {"name": "foo", "bogus": 1}}), + ("search_receivers", {"data": {"name": "foo", "bogus": 1}}), + ("search_groups", {"data": {"name": "foo", "bogus": 1}}), + ], + ) + def test_search_inputs_reject_unknown_keys(self, operation, payload): + """Test search inputs reject unknown keys.""" + with pytest.raises(ValidationError): + validate_input(operation, payload) + + def test_create_receiver_rejects_unknown_keys(self): + """Test create receiver rejects unknown keys.""" + payload = {"data": {"name": "foo", "type": "t", "version": "1.0.0", "description": "d", "bogus": 1}} + with pytest.raises(ValidationError): + validate_input("create_receiver", payload) diff --git a/tests/unit/test_server_routes.py b/tests/unit/test_server_routes.py new file mode 100644 index 0000000..05a8c38 --- /dev/null +++ b/tests/unit/test_server_routes.py @@ -0,0 +1,70 @@ +# SPDX-FileCopyrightText: © 2025 Brett Smith +# SPDX-License-Identifier: Apache-2.0 + +"""Tests for the HTTP routes served next to the MCP endpoint.""" + +from pathlib import Path + +import pytest # type: ignore +import yaml +from starlette.testclient import TestClient + +from epr_mcp import server +from epr_mcp.config import Config + + +@pytest.fixture +def client(): + """Provide a Starlette test client for the server's HTTP app.""" + mcp = server.create_server(Config(url="http://epr.test")) + with TestClient(mcp.http_app()) as test_client: + yield test_client + + +class TestRoutes: + """Tests for the HTTP routes next to the MCP endpoint.""" + + def test_health(self, client): + """Test health.""" + response = client.get("/health") + assert response.status_code == 200 + assert response.text == "OK" + + def test_openapi_yaml(self, client): + """Test openapi yaml.""" + response = client.get("/openapi.yaml") + assert response.status_code == 200 + assert yaml.safe_load(response.text)["openapi"].startswith("3.") + + def test_openapi_json_matches_yaml(self, client): + """Test openapi json matches yaml.""" + spec = client.get("/openapi.json").json() + assert spec == yaml.safe_load(client.get("/openapi.yaml").text) + + def test_docs_points_at_openapi_json(self, client): + """Test docs points at openapi json.""" + response = client.get("/docs") + assert response.status_code == 200 + assert "swagger-ui" in response.text + assert "/openapi.json" in response.text + + def test_missing_spec_returns_404(self, client, monkeypatch): + """Test missing spec returns 404.""" + monkeypatch.setattr(Path, "exists", lambda self: False) + assert client.get("/openapi.yaml").status_code == 404 + assert client.get("/openapi.json").status_code == 404 + + +def test_openapi_spec_is_package_data(): + """The spec must sit inside the package so the wheel can ship it.""" + spec = Path(server.__file__).parent / "openapi.yaml" + assert spec.is_file() + + +def test_pyproject_ships_openapi_spec(): + """The build configuration must include the spec in the wheel.""" + import tomllib + + pyproject = Path(__file__).resolve().parents[2] / "pyproject.toml" + config = tomllib.loads(pyproject.read_text()) + assert "openapi.yaml" in config["tool"]["setuptools"]["package-data"]["epr_mcp"] diff --git a/tests/unit/test_server_run.py b/tests/unit/test_server_run.py new file mode 100644 index 0000000..d323681 --- /dev/null +++ b/tests/unit/test_server_run.py @@ -0,0 +1,57 @@ +# SPDX-FileCopyrightText: © 2025 Brett Smith +# SPDX-License-Identifier: Apache-2.0 + +"""Tests for server.run transport selection.""" + +import logging +from unittest import mock + +import pytest # type: ignore +from fastmcp import FastMCP + +from epr_mcp import server +from epr_mcp.config import Config + + +@pytest.fixture +def fake_run(): + """Replace FastMCP.run so no server starts.""" + with mock.patch.object(FastMCP, "run") as run: + yield run + + +class TestRun: + """Tests for transport selection in server.run.""" + + def test_http_transport_uses_configured_host_and_port(self, fake_run): + """Test http transport uses configured host and port.""" + server.run(Config(url="http://epr", host="127.0.0.1", port=9000)) + fake_run.assert_called_once_with(transport="http", host="127.0.0.1", port=9000) + + def test_stdio_transport_hides_banner(self, fake_run): + """Test stdio transport hides banner.""" + server.run(Config(url="http://epr", transport="stdio")) + fake_run.assert_called_once_with(transport="stdio", show_banner=False) + + def test_unknown_transport_is_rejected(self, fake_run): + """Test unknown transport is rejected.""" + with pytest.raises(ValueError, match="Unsupported transport"): + server.run(Config(url="http://epr", transport="sse")) + fake_run.assert_not_called() + + def test_token_is_never_logged(self, fake_run, caplog): + """Test token is never logged.""" + with caplog.at_level(logging.DEBUG, logger="epr_mcp.server"): + server.run(Config(url="http://epr", token="super-secret")) + assert "super-secret" not in caplog.text + assert "EPR Token configured: True" in caplog.text + + def test_debug_flag_sets_debug_logging(self, fake_run): + """Test debug flag sets debug logging.""" + previous = server.logger.level + try: + with mock.patch.object(server.sys, "excepthook"): + server.run(Config(url="http://epr", debug=True)) + assert server.logger.level == logging.DEBUG + finally: + server.logger.setLevel(previous) diff --git a/tests/unit/test_server_tools.py b/tests/unit/test_server_tools.py new file mode 100644 index 0000000..6d3fc63 --- /dev/null +++ b/tests/unit/test_server_tools.py @@ -0,0 +1,578 @@ +# SPDX-FileCopyrightText: © 2025 Brett Smith +# SPDX-License-Identifier: Apache-2.0 + +"""Tests for the EPR MCP tools, using an in-memory FastMCP client. + +EPR calls are intercepted with ``httpx2.MockTransport`` so no network is used. +""" + +import json + +import httpx2 +import pytest # type: ignore +from fastmcp import Client +from fastmcp.exceptions import ToolError + +from epr_mcp import common, server +from epr_mcp.config import Config + +EVENT_ID = "01JYRZ96R690ZTQ15Q53GEY6E6" +EXPECTED_TOOLS = { + "fetch_event", + "fetch_receiver", + "fetch_group", + "search_events", + "search_receivers", + "search_groups", + "create_event", + "create_receiver", + "create_group", +} + +EVENT = { + "id": EVENT_ID, + "name": "foo", + "version": "1.0.0", + "release": "2025.1", + "platform_id": "linux", + "package": "oci", + "description": "an event", + "success": True, + "event_receiver_id": "01JYRZ96R690ZTQ15Q53GEY6E7", + "created_at": "2025-01-01T00:00:00Z", + "payload": {"a": 1}, +} + + +@pytest.fixture +def cfg(): + """Provide a configuration with a token, pointing at a fake EPR.""" + return Config(url="http://epr.test", token="secret") + + +@pytest.fixture +def mock_epr(monkeypatch): + """Route every EPR request through a handler the test installs.""" + state = {"handler": lambda request: httpx2.Response(404), "requests": []} + + def create_client(cfg): + def handler(request): + state["requests"].append(request) + return state["handler"](request) + + client = common.create_client(cfg) + return httpx2.AsyncClient(headers=client.headers, transport=httpx2.MockTransport(handler)) + + monkeypatch.setattr(server, "create_client", create_client) + return state + + +async def call(mcp, tool, args): + """Call a tool through an in-memory client and return the reply text.""" + async with Client(mcp) as client: + result = await client.call_tool(tool, args) + return result.content[0].text + + +class TestServerRegistration: + """The server exposes the expected tools and metadata.""" + + @pytest.mark.asyncio + async def test_lists_all_tools(self, cfg): + """Test lists all tools.""" + async with Client(server.create_server(cfg)) as client: + tools = await client.list_tools() + assert {t.name for t in tools} == EXPECTED_TOOLS + + @pytest.mark.asyncio + async def test_tool_schemas_have_required_inputs(self, cfg): + """Test tool schemas have required inputs.""" + async with Client(server.create_server(cfg)) as client: + tools = {t.name: t for t in await client.list_tools()} + assert tools["fetch_event"].input_schema["required"] == ["id"] + assert "ctx" not in tools["fetch_event"].input_schema["properties"] + assert tools["search_events"].input_schema["required"] == ["data"] + assert tools["create_event"].input_schema["required"] == ["event_data"] + + def test_version_is_not_instructions(self, cfg): + """Test version is not instructions.""" + mcp = server.create_server(cfg) + assert mcp.name == "EPR MCP Server" + assert mcp.version == "1.0.0" + assert mcp.instructions != "1.0.0" + + +class TestFetchTools: + """Tests for the fetch tools.""" + + @pytest.mark.asyncio + async def test_fetch_event_success_sends_bearer_token(self, cfg, mock_epr): + """Test fetch event success sends bearer token.""" + mock_epr["handler"] = lambda request: httpx2.Response(200, json={"data": [EVENT]}) + text = await call(server.create_server(cfg), "fetch_event", {"id": EVENT_ID}) + assert json.loads(text)["id"] == EVENT_ID + request = mock_epr["requests"][0] + assert request.url.path == f"/api/v1/events/{EVENT_ID}" + assert request.headers["Authorization"] == "Bearer secret" + + @pytest.mark.asyncio + async def test_fetch_event_empty_result(self, cfg, mock_epr): + """Test fetch event empty result.""" + mock_epr["handler"] = lambda request: httpx2.Response(200, json={"data": []}) + text = await call(server.create_server(cfg), "fetch_event", {"id": EVENT_ID}) + assert "No event found" in text + + @pytest.mark.asyncio + async def test_fetch_event_not_found(self, cfg, mock_epr): + """Test fetch event not found.""" + mock_epr["handler"] = lambda request: httpx2.Response(404, text="missing") + text = await call(server.create_server(cfg), "fetch_event", {"id": EVENT_ID}) + assert text == "Failed to fetch event: 404 - missing" + + @pytest.mark.asyncio + async def test_fetch_event_invalid_id(self, cfg, mock_epr): + """Test fetch event invalid id.""" + text = await call(server.create_server(cfg), "fetch_event", {"id": " "}) + assert "validation" in text.lower() + assert mock_epr["requests"] == [] + + @pytest.mark.asyncio + async def test_fetch_event_response_validation_failure(self, cfg, mock_epr): + """Test fetch event response validation failure.""" + mock_epr["handler"] = lambda request: httpx2.Response(200, json={"data": {"unexpected": True}}) + text = await call(server.create_server(cfg), "fetch_event", {"id": EVENT_ID}) + assert "validation" in text.lower() + + @pytest.mark.asyncio + @pytest.mark.parametrize( + ("tool", "path"), + [("fetch_receiver", "/api/v1/receivers/"), ("fetch_group", "/api/v1/groups/")], + ) + async def test_fetch_other_tools_call_expected_path(self, cfg, mock_epr, tool, path): + """Test fetch other tools call expected path.""" + mock_epr["handler"] = lambda request: httpx2.Response(200, json={"data": []}) + await call(server.create_server(cfg), tool, {"id": EVENT_ID}) + assert mock_epr["requests"][0].url.path == f"{path}{EVENT_ID}" + + +class TestSearchTools: + """Tests for the search tools.""" + + @pytest.mark.asyncio + async def test_search_events_success(self, cfg, mock_epr): + """Test search events success.""" + mock_epr["handler"] = lambda request: httpx2.Response(200, json={"data": {"events": [EVENT]}}) + text = await call(server.create_server(cfg), "search_events", {"data": {"name": "foo"}}) + assert json.loads(text)[0]["name"] == "foo" + request = mock_epr["requests"][0] + assert request.url.path == "/api/v1/graphql/query" + assert json.loads(request.content)["variables"]["obj"] == {"name": "foo"} + + @pytest.mark.asyncio + @pytest.mark.parametrize("tool", ["search_events", "search_receivers", "search_groups"]) + async def test_search_non_200(self, cfg, mock_epr, tool): + """Test search non 200.""" + mock_epr["handler"] = lambda request: httpx2.Response(500, text="bad") + text = await call(server.create_server(cfg), tool, {"data": {"name": "foo"}}) + assert text.startswith("Failed to search") + assert "500 - bad" in text + + @pytest.mark.asyncio + @pytest.mark.parametrize("tool", ["search_receivers", "search_groups"]) + async def test_search_empty_results(self, cfg, mock_epr, tool): + """Test search empty results.""" + mock_epr["handler"] = lambda request: httpx2.Response(200, json={"data": {}}) + text = await call(server.create_server(cfg), tool, {"data": {"name": "foo"}}) + assert json.loads(text) == [] + + +class TestCreateTools: + """Tests for the create tools.""" + + @pytest.mark.asyncio + async def test_create_event_non_201(self, cfg, mock_epr): + """Test create event non 201.""" + mock_epr["handler"] = lambda request: httpx2.Response(400, text="nope") + data = { + "name": "foo", + "version": "1.0.0", + "release": "2025.1", + "platform_id": "linux", + "package": "oci", + "description": "an event", + "payload": {"a": 1}, + "event_receiver_id": EVENT_ID, + "success": True, + } + text = await call(server.create_server(cfg), "create_event", {"event_data": data}) + assert text == "Failed to create event: 400 - nope" + + @pytest.mark.asyncio + @pytest.mark.parametrize( + ("tool", "arg"), + [("create_event", "event_data"), ("create_receiver", "receiver_data"), ("create_group", "group_data")], + ) + async def test_create_rejects_invalid_input(self, cfg, mock_epr, tool, arg): + """Test create rejects invalid input.""" + text = await call(server.create_server(cfg), tool, {arg: {}}) + assert "validation" in text.lower() + assert mock_epr["requests"] == [] + + +class TestTransportErrors: + """Tests for connection errors and timeouts.""" + + @pytest.mark.asyncio + async def test_connect_error_is_reported(self, cfg, mock_epr): + """Test connect error is reported.""" + + def handler(request): + raise httpx2.ConnectError("refused", request=request) + + mock_epr["handler"] = handler + text = await call(server.create_server(cfg), "fetch_event", {"id": EVENT_ID}) + assert "Connection failed to EPR server at http://epr.test" in text + + @pytest.mark.asyncio + async def test_timeout_is_reported(self, cfg, mock_epr): + """Test timeout is reported.""" + + def handler(request): + raise httpx2.ReadTimeout("slow", request=request) + + mock_epr["handler"] = handler + text = await call(server.create_server(cfg), "fetch_event", {"id": EVENT_ID}) + assert text.startswith("Request timeout to EPR server") + + +def test_unknown_tool_raises(cfg): + """Test unknown tool raises.""" + import asyncio + + async def go(): + async with Client(server.create_server(cfg)) as client: + await client.call_tool("nope", {}) + + with pytest.raises(ToolError): + asyncio.run(go()) + + +RECEIVER = { + "id": EVENT_ID, + "name": "foobar", + "type": "foo.bar", + "version": "1.1.3", + "description": "a receiver", + "schema": {"type": "object"}, + "fingerprint": "a" * 64, + "created_at": "2025-01-01T00:00:00Z", +} + +GROUP = { + "id": EVENT_ID, + "name": "agroup", + "type": "foo.group", + "version": "1.0.0", + "description": "a group", + "enabled": True, + "event_receiver_ids": [EVENT_ID], + "created_at": "2025-01-01T00:00:00Z", + "updated_at": "2025-01-01T00:00:00Z", +} + +EVENT_INPUT = { + "name": "foo", + "version": "1.0.0", + "release": "2025.1", + "platform_id": "linux", + "package": "oci", + "description": "an event", + "payload": {"a": 1}, + "event_receiver_id": EVENT_ID, + "success": True, +} +RECEIVER_INPUT = { + "name": "foobar", + "type": "foo.bar", + "version": "1.1.3", + "description": "a receiver", + "schema": {"type": "object", "properties": {"name": {"type": "string"}}}, +} +GROUP_INPUT = { + "name": "agroup", + "type": "foo.group", + "version": "1.0.0", + "description": "a group", + "event_receiver_ids": [EVENT_ID], +} + + +class TestSuccessPaths: + """Every tool returns validated EPR data on success.""" + + @pytest.mark.asyncio + @pytest.mark.parametrize( + ("tool", "record"), + [("fetch_event", EVENT), ("fetch_receiver", RECEIVER), ("fetch_group", GROUP)], + ) + @pytest.mark.parametrize("wrap", [lambda r: {"data": r}, lambda r: {"data": [r]}, lambda r: r]) + async def test_fetch_success_handles_epr_response_shapes(self, cfg, mock_epr, tool, record, wrap): + """Test fetch success handles epr response shapes.""" + mock_epr["handler"] = lambda request: httpx2.Response(200, json=wrap(record)) + text = await call(server.create_server(cfg), tool, {"id": EVENT_ID}) + assert json.loads(text)["id"] == EVENT_ID + + @pytest.mark.asyncio + @pytest.mark.parametrize( + ("tool", "key", "record"), + [ + ("search_events", "events", EVENT), + ("search_receivers", "event_receivers", RECEIVER), + ("search_groups", "event_receiver_groups", GROUP), + ], + ) + async def test_search_success(self, cfg, mock_epr, tool, key, record): + """Test search success.""" + mock_epr["handler"] = lambda request: httpx2.Response(200, json={"data": {key: [record]}}) + text = await call(server.create_server(cfg), tool, {"data": {"name": record["name"]}}) + assert json.loads(text)[0]["id"] == EVENT_ID + + @pytest.mark.asyncio + @pytest.mark.parametrize( + ("tool", "arg", "payload", "record", "path", "key"), + [ + ("create_event", "event_data", EVENT_INPUT, EVENT, "/api/v1/events", "event"), + ("create_receiver", "receiver_data", RECEIVER_INPUT, RECEIVER, "/api/v1/receivers", "receiver"), + ("create_group", "group_data", GROUP_INPUT, GROUP, "/api/v1/groups", "group"), + ], + ) + @pytest.mark.parametrize("status", [200, 201]) + async def test_create_success(self, cfg, mock_epr, tool, arg, payload, record, path, key, status): + """EPR answers a create with 200; some versions answer 201.""" + mock_epr["handler"] = lambda request: httpx2.Response(status, json={"data": [record]}) + text = await call(server.create_server(cfg), tool, {arg: payload}) + result = json.loads(text) + assert "created successfully" in result["message"] + assert result[key]["id"] == EVENT_ID + request = mock_epr["requests"][0] + assert request.method == "POST" + assert request.url.path == path + + @pytest.mark.asyncio + @pytest.mark.parametrize( + ("tool", "arg", "payload"), + [ + ("create_receiver", "receiver_data", RECEIVER_INPUT), + ("create_group", "group_data", GROUP_INPUT), + ], + ) + async def test_create_non_success(self, cfg, mock_epr, tool, arg, payload): + """Test create non success.""" + mock_epr["handler"] = lambda request: httpx2.Response(409, text="conflict") + text = await call(server.create_server(cfg), tool, {arg: payload}) + assert text.startswith("Failed to create") + assert "409 - conflict" in text + + @pytest.mark.asyncio + @pytest.mark.parametrize( + ("tool", "arg", "payload"), + [ + ("create_event", "event_data", EVENT_INPUT), + ("create_receiver", "receiver_data", RECEIVER_INPUT), + ("create_group", "group_data", GROUP_INPUT), + ], + ) + async def test_create_empty_result(self, cfg, mock_epr, tool, arg, payload): + """Test create empty result.""" + mock_epr["handler"] = lambda request: httpx2.Response(201, json={"data": []}) + text = await call(server.create_server(cfg), tool, {arg: payload}) + assert "empty result" in text + + @pytest.mark.asyncio + @pytest.mark.parametrize("tool", ["fetch_receiver", "fetch_group"]) + async def test_fetch_empty_result(self, cfg, mock_epr, tool): + """Test fetch empty result.""" + mock_epr["handler"] = lambda request: httpx2.Response(200, json={"data": []}) + text = await call(server.create_server(cfg), tool, {"id": EVENT_ID}) + assert "No event" in text + + @pytest.mark.asyncio + @pytest.mark.parametrize("tool", ["fetch_receiver", "fetch_group"]) + async def test_fetch_non_200_and_invalid_id(self, cfg, mock_epr, tool): + """Test fetch non 200 and invalid id.""" + mock_epr["handler"] = lambda request: httpx2.Response(500, text="bad") + assert (await call(server.create_server(cfg), tool, {"id": EVENT_ID})).startswith("Failed to fetch") + assert "validation" in (await call(server.create_server(cfg), tool, {"id": "short"})).lower() + + @pytest.mark.asyncio + @pytest.mark.parametrize("tool", ["fetch_receiver", "fetch_group"]) + async def test_fetch_response_validation_failure(self, cfg, mock_epr, tool): + """Test fetch response validation failure.""" + mock_epr["handler"] = lambda request: httpx2.Response(200, json={"data": {"unexpected": True}}) + assert "validation" in (await call(server.create_server(cfg), tool, {"id": EVENT_ID})).lower() + + +class TestAgainstRealEprBehavior: + """Behavior observed against a running EPR rather than assumed from its docs.""" + + @pytest.mark.asyncio + async def test_create_receiver_requires_a_schema(self, cfg, mock_epr): + """Test create receiver requires a schema.""" + without_schema = {k: v for k, v in RECEIVER_INPUT.items() if k != "schema"} + text = await call(server.create_server(cfg), "create_receiver", {"receiver_data": without_schema}) + assert text.startswith("Input validation error") + assert mock_epr["requests"] == [] + + @pytest.mark.asyncio + async def test_create_receiver_sends_schema_to_epr(self, cfg, mock_epr): + """Test create receiver sends schema to epr.""" + mock_epr["handler"] = lambda request: httpx2.Response(200, json={"data": [RECEIVER]}) + await call(server.create_server(cfg), "create_receiver", {"receiver_data": RECEIVER_INPUT}) + assert json.loads(mock_epr["requests"][0].content)["schema"] == RECEIVER_INPUT["schema"] + + @pytest.mark.asyncio + async def test_group_search_does_not_request_unknown_fingerprint_field(self, cfg, mock_epr): + """The EPR GraphQL type EventReceiverGroup has no fingerprint; asking for it fails the query.""" + mock_epr["handler"] = lambda request: httpx2.Response(200, json={"data": {"event_receiver_groups": []}}) + await call(server.create_server(cfg), "search_groups", {"data": {"name": "agroup"}}) + assert "fingerprint" not in json.loads(mock_epr["requests"][0].content)["query"] + + @pytest.mark.asyncio + @pytest.mark.parametrize("tool", ["search_events", "search_receivers", "search_groups"]) + async def test_graphql_errors_are_reported_not_hidden(self, cfg, mock_epr, tool): + """Test graphql errors are reported not hidden.""" + mock_epr["handler"] = lambda request: httpx2.Response(200, json={"errors": [{"message": "Cannot query field"}]}) + text = await call(server.create_server(cfg), tool, {"data": {}}) + assert text.startswith("Failed to search") + assert "Cannot query field" in text + + +class TestCreateReturnsIdOnly: + """A running EPR answers a create with only the new ID: {"data": ""}.""" + + @pytest.mark.asyncio + @pytest.mark.parametrize( + ("tool", "arg", "payload", "label"), + [ + ("create_event", "event_data", EVENT_INPUT, "Event created"), + ("create_receiver", "receiver_data", RECEIVER_INPUT, "Event receiver created"), + ("create_group", "group_data", GROUP_INPUT, "Event receiver group created"), + ], + ) + async def test_create_reports_the_new_id(self, cfg, mock_epr, tool, arg, payload, label): + """Test create reports the new id.""" + mock_epr["handler"] = lambda request: httpx2.Response(200, json={"data": EVENT_ID}) + result = json.loads(await call(server.create_server(cfg), tool, {arg: payload})) + assert result == {"message": f"{label} successfully", "id": EVENT_ID} + + +class TestFlatArguments: + """Tools take their criteria or fields directly, not wrapped in a data key.""" + + @pytest.mark.asyncio + @pytest.mark.parametrize("tool", ["search_events", "search_receivers", "search_groups"]) + async def test_search_rejects_legacy_wrapped_argument(self, cfg, mock_epr, tool): + """A wrapped argument must fail loudly, not run an unfiltered search.""" + text = await call(server.create_server(cfg), tool, {"data": {"data": {"name": "foo"}}}) + assert text.startswith("Input validation error") + assert mock_epr["requests"] == [] + + @pytest.mark.asyncio + async def test_search_rejects_unknown_criteria(self, cfg, mock_epr): + """Test search rejects unknown criteria.""" + text = await call(server.create_server(cfg), "search_events", {"data": {"nme": "foo"}}) + assert text.startswith("Input validation error") + assert mock_epr["requests"] == [] + + @pytest.mark.asyncio + async def test_search_without_criteria_is_allowed(self, cfg, mock_epr): + """Test search without criteria is allowed.""" + mock_epr["handler"] = lambda request: httpx2.Response(200, json={"data": {"events": []}}) + text = await call(server.create_server(cfg), "search_events", {"data": {}}) + assert json.loads(text) == [] + assert json.loads(mock_epr["requests"][0].content)["variables"]["obj"] == {} + + @pytest.mark.asyncio + @pytest.mark.parametrize( + ("tool", "arg", "payload"), + [ + ("create_event", "event_data", EVENT_INPUT), + ("create_receiver", "receiver_data", RECEIVER_INPUT), + ("create_group", "group_data", GROUP_INPUT), + ], + ) + async def test_create_rejects_legacy_wrapped_argument(self, cfg, mock_epr, tool, arg, payload): + """Test create rejects legacy wrapped argument.""" + text = await call(server.create_server(cfg), tool, {arg: {"data": payload}}) + assert text.startswith("Input validation error") + assert mock_epr["requests"] == [] + + +ALL_TOOL_CALLS = [ + ("fetch_event", {"id": EVENT_ID}), + ("fetch_receiver", {"id": EVENT_ID}), + ("fetch_group", {"id": EVENT_ID}), + ("search_events", {"data": {"name": "foo"}}), + ("search_receivers", {"data": {"name": "foo"}}), + ("search_groups", {"data": {"name": "foo"}}), + ("create_event", {"event_data": EVENT_INPUT}), + ("create_receiver", {"receiver_data": RECEIVER_INPUT}), + ("create_group", {"group_data": GROUP_INPUT}), +] + + +class TestEveryToolHandlesEprFailures: + """Every one of the nine tools reports connection errors, timeouts, and bad responses.""" + + @pytest.mark.asyncio + @pytest.mark.parametrize(("tool", "arguments"), ALL_TOOL_CALLS) + async def test_connect_error_is_reported(self, cfg, mock_epr, tool, arguments): + """Test connect error is reported.""" + + def refuse(request): + raise httpx2.ConnectError("refused", request=request) + + mock_epr["handler"] = refuse + text = await call(server.create_server(cfg), tool, arguments) + assert text.startswith("Connection failed to EPR server at http://epr.test") + + @pytest.mark.asyncio + @pytest.mark.parametrize(("tool", "arguments"), ALL_TOOL_CALLS) + async def test_timeout_is_reported(self, cfg, mock_epr, tool, arguments): + """Test timeout is reported.""" + + def slow(request): + raise httpx2.ReadTimeout("slow", request=request) + + mock_epr["handler"] = slow + text = await call(server.create_server(cfg), tool, arguments) + assert text.startswith("Request timeout to EPR server") + + @pytest.mark.asyncio + @pytest.mark.parametrize(("tool", "arguments"), ALL_TOOL_CALLS) + async def test_error_status_is_reported(self, cfg, mock_epr, tool, arguments): + """Test error status is reported.""" + mock_epr["handler"] = lambda request: httpx2.Response(500, text="boom") + text = await call(server.create_server(cfg), tool, arguments) + assert text.startswith("Failed to") and "500" in text and "boom" in text + + @pytest.mark.asyncio + @pytest.mark.parametrize( + ("tool", "arguments", "body"), + [ + ("fetch_event", {"id": EVENT_ID}, {"data": {"unexpected": True}}), + ("fetch_receiver", {"id": EVENT_ID}, {"data": {"unexpected": True}}), + ("fetch_group", {"id": EVENT_ID}, {"data": {"unexpected": True}}), + ("search_events", {"data": {}}, {"data": {"events": [{"unexpected": True}]}}), + ("search_receivers", {"data": {}}, {"data": {"event_receivers": [{"unexpected": True}]}}), + ("search_groups", {"data": {}}, {"data": {"event_receiver_groups": [{"unexpected": True}]}}), + ("create_event", {"event_data": EVENT_INPUT}, {"data": {"unexpected": True}}), + ("create_receiver", {"receiver_data": RECEIVER_INPUT}, {"data": {"unexpected": True}}), + ("create_group", {"group_data": GROUP_INPUT}, {"data": {"unexpected": True}}), + ], + ) + async def test_response_that_fails_validation_is_reported(self, cfg, mock_epr, tool, arguments, body): + """Test response that fails validation is reported.""" + mock_epr["handler"] = lambda request: httpx2.Response(200, json=body) + text = await call(server.create_server(cfg), tool, arguments) + assert "validation" in text.lower()