mcp-server-espn 2.3.1__tar.gz → 2.3.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {mcp_server_espn-2.3.1 → mcp_server_espn-2.3.2}/.github/workflows/ci.yml +43 -1
- {mcp_server_espn-2.3.1 → mcp_server_espn-2.3.2}/.github/workflows/dependabot-automerge.yml +30 -4
- {mcp_server_espn-2.3.1 → mcp_server_espn-2.3.2}/AGENTS.md +3 -4
- {mcp_server_espn-2.3.1 → mcp_server_espn-2.3.2}/PKG-INFO +2 -2
- {mcp_server_espn-2.3.1 → mcp_server_espn-2.3.2}/fastmcp.json +1 -1
- {mcp_server_espn-2.3.1 → mcp_server_espn-2.3.2}/pyproject.toml +9 -3
- {mcp_server_espn-2.3.1 → mcp_server_espn-2.3.2}/scripts/setup_repo_governance.sh +4 -5
- {mcp_server_espn-2.3.1 → mcp_server_espn-2.3.2}/src/espn_mcp/client.py +4 -2
- {mcp_server_espn-2.3.1 → mcp_server_espn-2.3.2}/tests/conftest.py +32 -2
- mcp_server_espn-2.3.2/tests/test_ci_workflow.py +123 -0
- mcp_server_espn-2.3.2/tests/test_conftest_live_gate.py +104 -0
- {mcp_server_espn-2.3.1 → mcp_server_espn-2.3.2}/tests/test_e2e_isolation.py +7 -7
- mcp_server_espn-2.3.2/tests/test_fastmcp_json_floor.py +151 -0
- mcp_server_espn-2.3.1/tests/test_e2e_live.py → mcp_server_espn-2.3.2/tests/test_live.py +6 -6
- {mcp_server_espn-2.3.1 → mcp_server_espn-2.3.2}/tests/test_upstream_http_errors.py +26 -0
- {mcp_server_espn-2.3.1 → mcp_server_espn-2.3.2}/uv.lock +13 -13
- mcp_server_espn-2.3.1/skills/espn-mcp/SKILL.md +0 -115
- mcp_server_espn-2.3.1/tests/test_fastmcp_json_floor.py +0 -75
- {mcp_server_espn-2.3.1 → mcp_server_espn-2.3.2}/.github/CODEOWNERS +0 -0
- {mcp_server_espn-2.3.1 → mcp_server_espn-2.3.2}/.github/dependabot.yml +0 -0
- {mcp_server_espn-2.3.1 → mcp_server_espn-2.3.2}/.github/workflows/release.yml +0 -0
- {mcp_server_espn-2.3.1 → mcp_server_espn-2.3.2}/.gitignore +0 -0
- {mcp_server_espn-2.3.1 → mcp_server_espn-2.3.2}/CHANGELOG.md +0 -0
- {mcp_server_espn-2.3.1 → mcp_server_espn-2.3.2}/CODE_OF_CONDUCT.md +0 -0
- {mcp_server_espn-2.3.1 → mcp_server_espn-2.3.2}/CONTRIBUTING.md +0 -0
- {mcp_server_espn-2.3.1 → mcp_server_espn-2.3.2}/Dockerfile +0 -0
- {mcp_server_espn-2.3.1 → mcp_server_espn-2.3.2}/LICENSE +0 -0
- {mcp_server_espn-2.3.1 → mcp_server_espn-2.3.2}/README.md +0 -0
- {mcp_server_espn-2.3.1 → mcp_server_espn-2.3.2}/SECURITY.md +0 -0
- {mcp_server_espn-2.3.1 → mcp_server_espn-2.3.2}/conformance-baseline.yml +0 -0
- {mcp_server_espn-2.3.1 → mcp_server_espn-2.3.2}/docker/build-backend.txt +0 -0
- {mcp_server_espn-2.3.1 → mcp_server_espn-2.3.2}/docker/pip-bootstrap.txt +0 -0
- {mcp_server_espn-2.3.1 → mcp_server_espn-2.3.2}/docker/uv-bootstrap.txt +0 -0
- {mcp_server_espn-2.3.1 → mcp_server_espn-2.3.2}/scripts/check_conformance.sh +0 -0
- {mcp_server_espn-2.3.1 → mcp_server_espn-2.3.2}/scripts/check_openapi_drift.py +0 -0
- {mcp_server_espn-2.3.1 → mcp_server_espn-2.3.2}/scripts/check_tool_contract.py +0 -0
- {mcp_server_espn-2.3.1 → mcp_server_espn-2.3.2}/scripts/check_version.py +0 -0
- {mcp_server_espn-2.3.1 → mcp_server_espn-2.3.2}/scripts/gen_build_backend.py +0 -0
- {mcp_server_espn-2.3.1 → mcp_server_espn-2.3.2}/scripts/release_notes.py +0 -0
- {mcp_server_espn-2.3.1 → mcp_server_espn-2.3.2}/server.json +0 -0
- {mcp_server_espn-2.3.1 → mcp_server_espn-2.3.2}/src/espn_mcp/__init__.py +0 -0
- {mcp_server_espn-2.3.1 → mcp_server_espn-2.3.2}/src/espn_mcp/auth.py +0 -0
- {mcp_server_espn-2.3.1 → mcp_server_espn-2.3.2}/src/espn_mcp/config.py +0 -0
- {mcp_server_espn-2.3.1 → mcp_server_espn-2.3.2}/src/espn_mcp/errors.py +0 -0
- {mcp_server_espn-2.3.1 → mcp_server_espn-2.3.2}/src/espn_mcp/middleware.py +0 -0
- {mcp_server_espn-2.3.1 → mcp_server_espn-2.3.2}/src/espn_mcp/server.py +0 -0
- {mcp_server_espn-2.3.1 → mcp_server_espn-2.3.2}/src/espn_mcp/tools/__init__.py +0 -0
- {mcp_server_espn-2.3.1 → mcp_server_espn-2.3.2}/src/espn_mcp/tools/games.py +0 -0
- {mcp_server_espn-2.3.1 → mcp_server_espn-2.3.2}/src/espn_mcp/tools/news.py +0 -0
- {mcp_server_espn-2.3.1 → mcp_server_espn-2.3.2}/src/espn_mcp/tools/params.py +0 -0
- {mcp_server_espn-2.3.1 → mcp_server_espn-2.3.2}/src/espn_mcp/tools/teams.py +0 -0
- {mcp_server_espn-2.3.1 → mcp_server_espn-2.3.2}/tests/fake_network.py +0 -0
- {mcp_server_espn-2.3.1 → mcp_server_espn-2.3.2}/tests/fixtures/mlb_yankees_schedule_2023.json +0 -0
- {mcp_server_espn-2.3.1 → mcp_server_espn-2.3.2}/tests/test_build_backend_lock.py +0 -0
- {mcp_server_espn-2.3.1 → mcp_server_espn-2.3.2}/tests/test_check_version.py +0 -0
- {mcp_server_espn-2.3.1 → mcp_server_espn-2.3.2}/tests/test_client.py +0 -0
- {mcp_server_espn-2.3.1 → mcp_server_espn-2.3.2}/tests/test_config.py +0 -0
- {mcp_server_espn-2.3.1 → mcp_server_espn-2.3.2}/tests/test_dockerfile.py +0 -0
- {mcp_server_espn-2.3.1 → mcp_server_espn-2.3.2}/tests/test_drift.py +0 -0
- {mcp_server_espn-2.3.1 → mcp_server_espn-2.3.2}/tests/test_errors.py +0 -0
- {mcp_server_espn-2.3.1 → mcp_server_espn-2.3.2}/tests/test_eval_search_fixes.py +0 -0
- {mcp_server_espn-2.3.1 → mcp_server_espn-2.3.2}/tests/test_http_auth.py +0 -0
- {mcp_server_espn-2.3.1 → mcp_server_espn-2.3.2}/tests/test_layered.py +0 -0
- {mcp_server_espn-2.3.1 → mcp_server_espn-2.3.2}/tests/test_league_events_dates.py +0 -0
- {mcp_server_espn-2.3.1 → mcp_server_espn-2.3.2}/tests/test_otel_spans.py +0 -0
- {mcp_server_espn-2.3.1 → mcp_server_espn-2.3.2}/tests/test_protocol.py +0 -0
- {mcp_server_espn-2.3.1 → mcp_server_espn-2.3.2}/tests/test_redaction.py +0 -0
- {mcp_server_espn-2.3.1 → mcp_server_espn-2.3.2}/tests/test_redaction_linear.py +0 -0
- {mcp_server_espn-2.3.1 → mcp_server_espn-2.3.2}/tests/test_redaction_probes.py +0 -0
- {mcp_server_espn-2.3.1 → mcp_server_espn-2.3.2}/tests/test_redaction_python_repr.py +0 -0
- {mcp_server_espn-2.3.1 → mcp_server_espn-2.3.2}/tests/test_release_notes.py +0 -0
- {mcp_server_espn-2.3.1 → mcp_server_espn-2.3.2}/tests/test_release_workflow.py +0 -0
- {mcp_server_espn-2.3.1 → mcp_server_espn-2.3.2}/tests/test_retry_after.py +0 -0
- {mcp_server_espn-2.3.1 → mcp_server_espn-2.3.2}/tests/test_scoreboard_date_ranges.py +0 -0
- {mcp_server_espn-2.3.1 → mcp_server_espn-2.3.2}/tests/test_server.py +0 -0
- {mcp_server_espn-2.3.1 → mcp_server_espn-2.3.2}/tests/test_version.py +0 -0
|
@@ -101,6 +101,23 @@ jobs:
|
|
|
101
101
|
- name: Run unit test suite
|
|
102
102
|
run: uv run pytest
|
|
103
103
|
|
|
104
|
+
# One required check for the whole matrix. The name stays "Tests" when a
|
|
105
|
+
# Python version is added or removed, so branch protection does not change
|
|
106
|
+
# with the matrix. It runs even when a leg fails and fails unless every leg
|
|
107
|
+
# succeeded.
|
|
108
|
+
tests:
|
|
109
|
+
name: Tests
|
|
110
|
+
needs: test
|
|
111
|
+
if: always()
|
|
112
|
+
runs-on: ubuntu-latest
|
|
113
|
+
steps:
|
|
114
|
+
- name: Fail unless the test matrix succeeded
|
|
115
|
+
run: |
|
|
116
|
+
if [ "${{ needs.test.result }}" != "success" ]; then
|
|
117
|
+
echo "test matrix result: ${{ needs.test.result }}"
|
|
118
|
+
exit 1
|
|
119
|
+
fi
|
|
120
|
+
|
|
104
121
|
tool-contract:
|
|
105
122
|
name: Tool contract assertions
|
|
106
123
|
runs-on: ubuntu-latest
|
|
@@ -135,11 +152,36 @@ jobs:
|
|
|
135
152
|
- name: Protocol & stdio verification
|
|
136
153
|
run: uv run pytest tests/test_protocol.py --no-cov
|
|
137
154
|
|
|
155
|
+
conformance:
|
|
156
|
+
name: Protocol conformance
|
|
157
|
+
runs-on: ubuntu-latest
|
|
158
|
+
steps:
|
|
159
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
160
|
+
with:
|
|
161
|
+
fetch-depth: 0
|
|
162
|
+
persist-credentials: false
|
|
163
|
+
|
|
164
|
+
- name: Install uv
|
|
165
|
+
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
|
166
|
+
with:
|
|
167
|
+
# Newest uv that meets pyproject.toml's [tool.uv] required-version (>=0.13.4, from
|
|
168
|
+
# FastMCP's October 2026 certificate authority incident notice).
|
|
169
|
+
version-file: "pyproject.toml"
|
|
170
|
+
enable-cache: true
|
|
171
|
+
|
|
172
|
+
- name: Set up Python
|
|
173
|
+
uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
|
|
174
|
+
with:
|
|
175
|
+
python-version: "3.11"
|
|
176
|
+
|
|
138
177
|
- name: Set up Node.js 22
|
|
139
178
|
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
|
|
140
179
|
with:
|
|
141
180
|
node-version: "22"
|
|
142
181
|
|
|
182
|
+
- name: Install dependencies
|
|
183
|
+
run: uv sync --locked --extra dev --python 3.11
|
|
184
|
+
|
|
143
185
|
- name: Protocol conformance suite
|
|
144
186
|
run: ./scripts/check_conformance.sh
|
|
145
187
|
|
|
@@ -177,7 +219,7 @@ jobs:
|
|
|
177
219
|
run: uv run twine check dist/*
|
|
178
220
|
|
|
179
221
|
docker-build:
|
|
180
|
-
name: Container
|
|
222
|
+
name: Container image build
|
|
181
223
|
runs-on: ubuntu-latest
|
|
182
224
|
steps:
|
|
183
225
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
@@ -18,9 +18,18 @@ jobs:
|
|
|
18
18
|
# The PR author, not github.actor (the last actor on the event, which can be spoofed),
|
|
19
19
|
# and only for branches in this repository.
|
|
20
20
|
if: github.event.pull_request.user.login == 'dependabot[bot]' && github.repository == github.event.pull_request.head.repo.full_name
|
|
21
|
+
# Wait for the CI run on the pull request head, then squash-merge that exact
|
|
22
|
+
# commit. This does not use `gh pr merge --auto`. With branch protection, the
|
|
23
|
+
# required checks still gate the merge; without it, the wait is what keeps an
|
|
24
|
+
# untested commit off the default branch. `--match-head-commit` refuses the
|
|
25
|
+
# merge if the head moved after CI ran.
|
|
26
|
+
# A merge made with GITHUB_TOKEN does not trigger the push CI workflow. The
|
|
27
|
+
# weekly schedule on the CI workflow still tests the default branch.
|
|
28
|
+
timeout-minutes: 30
|
|
21
29
|
permissions:
|
|
22
|
-
|
|
23
|
-
|
|
30
|
+
actions: read # find and watch the CI run for the PR head
|
|
31
|
+
contents: write # squash the PR into main after CI succeeds
|
|
32
|
+
pull-requests: write # merge the PR
|
|
24
33
|
steps:
|
|
25
34
|
- name: Dependabot metadata
|
|
26
35
|
id: metadata
|
|
@@ -42,12 +51,29 @@ jobs:
|
|
|
42
51
|
# Allowlist, not a major-version denylist: update-type is the highest change in the PR
|
|
43
52
|
# (a grouped PR with one major is skipped), and it is empty when the PR carries a
|
|
44
53
|
# non-Dependabot commit, so only minor and patch updates are auto-merged.
|
|
45
|
-
|
|
54
|
+
# A failed or cancelled CI run fails this step and nothing merges. --match-head-commit
|
|
55
|
+
# refuses the merge if the PR head moved after CI ran.
|
|
56
|
+
- name: Merge semver-minor and semver-patch updates after CI succeeds
|
|
46
57
|
if: >-
|
|
47
58
|
steps.metadata.outputs.package-ecosystem != 'docker' &&
|
|
48
59
|
(steps.metadata.outputs.update-type == 'version-update:semver-minor' ||
|
|
49
60
|
steps.metadata.outputs.update-type == 'version-update:semver-patch')
|
|
50
|
-
run:
|
|
61
|
+
run: |
|
|
62
|
+
run_id=""
|
|
63
|
+
for _ in $(seq 1 30); do
|
|
64
|
+
run_id="$(gh run list --repo "$REPO" --workflow ci.yml --event pull_request \
|
|
65
|
+
--commit "$HEAD_SHA" --limit 1 --json databaseId --jq '.[0].databaseId // empty')"
|
|
66
|
+
if [ -n "$run_id" ]; then break; fi
|
|
67
|
+
sleep 10
|
|
68
|
+
done
|
|
69
|
+
if [ -z "$run_id" ]; then
|
|
70
|
+
echo "::error::No CI run found for $HEAD_SHA"
|
|
71
|
+
exit 1
|
|
72
|
+
fi
|
|
73
|
+
gh run watch "$run_id" --repo "$REPO" --exit-status --interval 10
|
|
74
|
+
gh pr merge --squash --match-head-commit "$HEAD_SHA" "$PR_URL"
|
|
51
75
|
env:
|
|
52
76
|
PR_URL: ${{ github.event.pull_request.html_url }}
|
|
77
|
+
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
|
|
78
|
+
REPO: ${{ github.repository }}
|
|
53
79
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
@@ -49,8 +49,8 @@ Both ecosystems publish live, queryable Documentation MCP servers exposing full
|
|
|
49
49
|
- `scripts/check_tool_contract.py` — source of truth for the expected tool set and annotations. Do not hard-code tool counts elsewhere.
|
|
50
50
|
- `scripts/check_openapi_drift.py`, `scripts/check_conformance.sh` + `conformance-baseline.yml`.
|
|
51
51
|
- `scripts/release_notes.py` — release body from squash commits since the previous `v*` tag. `scripts/check_version.py` — runs after `uv build` and reads the version from the single wheel in `dist/` (the file that ships, as release.yml's tag check does); fails on `0.0.0` (no git metadata) or `0.0.1.devN` (no reachable tag, a shallow checkout).
|
|
52
|
-
- `tests/` — offline unit, layered-composition, and protocol tests; `
|
|
53
|
-
- `.github/workflows/` — `ci.yml` (
|
|
52
|
+
- `tests/` — offline unit, layered-composition, and protocol tests; `test_live.py` is opt-in (`uv run pytest -m live --no-cov`). The public ESPN API needs no credential, so `-m live` runs that sweep unskipped.
|
|
53
|
+
- `.github/workflows/` — `ci.yml` (Lint and types, Tests on py3.11–3.14 plus an aggregate Tests check, Tool contract assertions with OpenAPI drift and stdio verification, Protocol conformance, Build and package check, Container image build, and Check API Drift on `drift-check` for scheduled and manual runs only), `release.yml` (on a `v*` tag, five jobs: `build` (contents: read) builds with full history, checks the wheel version matches the tag, builds the release notes, checks the packages and the SBOM; `publish` (id-token and contents: write) uploads to PyPI and creates the GitHub Release from `scripts/release_notes.py` with the wheel, sdist and SBOM; `docker` (packages: write) pushes the GHCR image with no buildx provenance or SBOM and exposes its digest; `attest` (the only job with attestations: write) attests `dist/*` and the image digest; `registry` publishes to the MCP Registry last, with the tag version stamped into `server.json`), `dependabot-automerge.yml` (waits for CI, then squash-merges that head commit, only for Dependabot PRs whose highest update is minor or patch; major updates wait for a human review; Docker base image updates always wait for review).
|
|
54
54
|
- `server.json` (MCP Registry metadata), `Dockerfile`, `fastmcp.json`, `pyproject.toml` (console scripts `mcp-server-espn`, which must equal the `server.json` identifier, and `espn-mcp`, which the README configs and Dockerfile run).
|
|
55
55
|
|
|
56
56
|
---
|
|
@@ -94,7 +94,6 @@ Both ecosystems publish live, queryable Documentation MCP servers exposing full
|
|
|
94
94
|
- **Breaking changes:** every `feat!` / `fix!` PR (any `type!:` title) carries a `BREAKING CHANGE:` footer as the final paragraph of the PR body, and the footer text must include the migration steps. `BREAKING CHANGE:` (or its synonym `BREAKING-CHANGE:`) is the only footer token; do not add a separate migration token. `scripts/release_notes.py` stops at the CodeRabbit marker line (outside a code fence) `<!-- This is an auto-generated comment: release notes by coderabbit.ai -->` and ignores everything after it, so the footer goes before CodeRabbit's generated summary, never inside it.
|
|
95
95
|
- **Squash merges use the PR body as the commit message** (repo settings: PR title as squash title, PR body as squash message). Keep the PR body accurate up to the merge, because `scripts/release_notes.py` reads it from the squash commit.
|
|
96
96
|
- **`CHANGELOG.md` is frozen** as of 1.2.9. GitHub Releases are the changelog: `scripts/release_notes.py` builds each release body from the squash commits since the previous tag (every `BREAKING CHANGE:` footer verbatim, then the commit subjects). Do not add CHANGELOG entries.
|
|
97
|
-
- `skills/espn-mcp/SKILL.md` carries no version: the [Agent Skills specification](https://agentskills.io/specification) has no top-level `version` field. Do not add one. Update the skill only when its operator guidance changes.
|
|
98
97
|
- **README is outside the release version ceremony.** Do not add or chase `README.md` `==X.Y.Z` install pins. Update `README.md` only when project behavior, install method, config, or commands actually change. Prefer unpinned install examples (`uvx --from mcp-server-espn espn-mcp`) or point readers to GitHub Releases.
|
|
99
98
|
|
|
100
99
|
---
|
|
@@ -136,7 +135,7 @@ coderabbit review --agent --uncommitted
|
|
|
136
135
|
|
|
137
136
|
## 🔄 CI & Releases
|
|
138
137
|
|
|
139
|
-
CI is defined in `.github/workflows/ci.yml` (jobs:
|
|
138
|
+
CI is defined in `.github/workflows/ci.yml` (jobs: Lint and types, Tests on Python 3.11–3.14 at 100% coverage with an aggregate Tests check, Tool contract assertions with OpenAPI drift and stdio verification, Protocol conformance as its own job, Build and package check with `scripts/check_version.py` and `twine check`, Container image build (`docker-build` builds the full image without pushing it and checks that the runtime image has the project and none of the build-only packages (runtime dependencies such as `packaging` stay), checks that the image answers `initialize` and `tools/list` over stdio with no network, then checks that the builder stage fails at its `ca-certificates` floor check, before any pip step, when the floor is above the installed version), and Check API Drift (`drift-check`, the same OpenAPI drift check as its own job; scheduled and manual runs only)). CodeQL code scanning runs through GitHub's default setup, not a workflow job. Jobs that install or build the package check out with `fetch-depth: 0`, because a shallow checkout has no reachable tag and reports `0.0.1.devN`. The published Docker image is built only in `release.yml` (CI's `docker-build` image is never pushed), with `UV_DYNAMIC_VERSIONING_BYPASS` set to the tag version (the build context has no `.git`). CI runs on pushes and pull requests to `main`, weekly on `main` on Sunday at 15:37 America/New_York (`schedule` with `timezone`, after the Sunday 09:30 America/New_York Dependabot run in `.github/dependabot.yml`), and on manual dispatch (`workflow_dispatch`); the weekly run exists because merges by `dependabot-automerge.yml` use `GITHUB_TOKEN` and so never trigger the `push` run. Run the commands above before opening a PR.
|
|
140
139
|
|
|
141
140
|
Do not create tags or releases unless the maintainer asks. There is no release PR: merged commits accumulate on `main`, and releases go out on any weekday on the maintainer's go; no fixed release day. Before the tag:
|
|
142
141
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: mcp-server-espn
|
|
3
|
-
Version: 2.3.
|
|
3
|
+
Version: 2.3.2
|
|
4
4
|
Summary: Model Context Protocol (MCP) server for live & historical sports stats, odds, and schedules via ESPN
|
|
5
5
|
Project-URL: Homepage, https://github.com/christianclaudio/mcp-server-espn
|
|
6
6
|
Project-URL: Documentation, https://github.com/christianclaudio/mcp-server-espn#readme
|
|
@@ -23,7 +23,7 @@ Classifier: Programming Language :: Python :: 3.14
|
|
|
23
23
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
24
24
|
Requires-Python: >=3.11
|
|
25
25
|
Requires-Dist: certifi>=2026.10.23
|
|
26
|
-
Requires-Dist: fastmcp>=4.
|
|
26
|
+
Requires-Dist: fastmcp>=4.2.0
|
|
27
27
|
Requires-Dist: httpx>=0.28.1
|
|
28
28
|
Requires-Dist: mcp>=2.3.0
|
|
29
29
|
Requires-Dist: pydantic-settings>=2.15.0
|
|
@@ -27,7 +27,7 @@ classifiers = [
|
|
|
27
27
|
]
|
|
28
28
|
dependencies = [
|
|
29
29
|
"mcp>=2.3.0",
|
|
30
|
-
"fastmcp>=4.
|
|
30
|
+
"fastmcp>=4.2.0",
|
|
31
31
|
# certifi floor from FastMCP's October 2026 certificate authority incident notice,
|
|
32
32
|
# raised to the 2026.10.23 fleet floor. httpx verifies upstream TLS against this bundle.
|
|
33
33
|
# https://github.com/PrefectHQ/fastmcp/blob/main/SECURITY.md#certificate-authority-incident-october-2026
|
|
@@ -114,9 +114,15 @@ asyncio_mode = "auto"
|
|
|
114
114
|
testpaths = ["tests"]
|
|
115
115
|
pythonpath = ["src", "."]
|
|
116
116
|
markers = [
|
|
117
|
-
"
|
|
117
|
+
"live: live network tests against the public ESPN API (run with -m live)",
|
|
118
118
|
]
|
|
119
|
-
|
|
119
|
+
# Category only. A module regex is matched against the warning's stacklevel
|
|
120
|
+
# caller, so it would miss our own FastMCP calls and would fail on a
|
|
121
|
+
# third-party DeprecationWarning raised inside fastmcp.
|
|
122
|
+
filterwarnings = [
|
|
123
|
+
"error::fastmcp.exceptions.FastMCPDeprecationWarning",
|
|
124
|
+
]
|
|
125
|
+
addopts = "-m 'not live' --strict-markers --cov=src/espn_mcp --cov-report=term-missing --cov-fail-under=100"
|
|
120
126
|
|
|
121
127
|
[tool.coverage.report]
|
|
122
128
|
exclude_lines = [
|
|
@@ -31,12 +31,11 @@ gh api -X PUT "/repos/${REPO_NAME}/branches/main/protection" --input - << 'JSON_
|
|
|
31
31
|
"strict": true,
|
|
32
32
|
"contexts": [
|
|
33
33
|
"Lint and types",
|
|
34
|
-
"Tests
|
|
35
|
-
"Tests (py3.12)",
|
|
36
|
-
"Tests (py3.13)",
|
|
37
|
-
"Tests (py3.14)",
|
|
34
|
+
"Tests",
|
|
38
35
|
"Tool contract assertions",
|
|
39
|
-
"
|
|
36
|
+
"Protocol conformance",
|
|
37
|
+
"Build and package check",
|
|
38
|
+
"Container image build"
|
|
40
39
|
]
|
|
41
40
|
},
|
|
42
41
|
"enforce_admins": false,
|
|
@@ -787,7 +787,9 @@ def _scrub_recorded_in_body(text: str, response: httpx.Response, *, walk: bool)
|
|
|
787
787
|
|
|
788
788
|
When ``walk`` is set and the body parses as a JSON object or array, each
|
|
789
789
|
decoded string is scrubbed before it is serialized again. A parser or walk
|
|
790
|
-
failure uses the raw text, which is the same linear scrub.
|
|
790
|
+
failure uses the raw text, which is the same linear scrub. ``json.loads``
|
|
791
|
+
raises ``RecursionError`` (not ``ValueError``) on a deeply nested body, and
|
|
792
|
+
that falls back to the linear scrub too.
|
|
791
793
|
"""
|
|
792
794
|
pattern = _recorded_secret_pattern(response)
|
|
793
795
|
if not walk:
|
|
@@ -795,7 +797,7 @@ def _scrub_recorded_in_body(text: str, response: httpx.Response, *, walk: bool)
|
|
|
795
797
|
parsed: Any = None
|
|
796
798
|
try:
|
|
797
799
|
parsed = json.loads(text)
|
|
798
|
-
except ValueError:
|
|
800
|
+
except (ValueError, RecursionError):
|
|
799
801
|
parsed = None
|
|
800
802
|
if isinstance(parsed, (dict, list)):
|
|
801
803
|
try:
|
|
@@ -21,6 +21,36 @@ def _clear_espn_auth_env(monkeypatch: pytest.MonkeyPatch) -> None:
|
|
|
21
21
|
monkeypatch.delenv("ESPN_MCP_ALLOW_UNAUTHENTICATED_BIND", raising=False)
|
|
22
22
|
|
|
23
23
|
|
|
24
|
+
# The public ESPN API needs no credential. An empty tuple leaves ``-m live`` unskipped.
|
|
25
|
+
# A name added here is listed when it is missing or blank; the reason never includes a value.
|
|
26
|
+
LIVE_REQUIRED_ENV: tuple[str, ...] = ()
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def live_skip_reason(environ: dict[str, str] | None = None) -> str | None:
|
|
30
|
+
"""Return why a live test must skip, or None when it may run.
|
|
31
|
+
|
|
32
|
+
The reason lists missing names from ``LIVE_REQUIRED_ENV`` and never a value.
|
|
33
|
+
With the tuple empty, the public-API sweep runs whenever ``-m live`` selects it.
|
|
34
|
+
"""
|
|
35
|
+
env = os.environ if environ is None else environ
|
|
36
|
+
missing = [name for name in LIVE_REQUIRED_ENV if not env.get(name, "").strip()]
|
|
37
|
+
if missing:
|
|
38
|
+
return "missing or empty: " + ", ".join(missing)
|
|
39
|
+
return None
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def pytest_collection_modifyitems(config: pytest.Config, items: list[pytest.Item]) -> None:
|
|
43
|
+
"""Skip live items when a required name is missing or blank."""
|
|
44
|
+
del config
|
|
45
|
+
reason = live_skip_reason()
|
|
46
|
+
if reason is None:
|
|
47
|
+
return
|
|
48
|
+
skip = pytest.mark.skip(reason=reason)
|
|
49
|
+
for item in items:
|
|
50
|
+
if item.get_closest_marker("live") is not None:
|
|
51
|
+
item.add_marker(skip)
|
|
52
|
+
|
|
53
|
+
|
|
24
54
|
@pytest.fixture
|
|
25
55
|
def mock_transport():
|
|
26
56
|
"""Create a mock transport with pre-configured ESPN responses."""
|
|
@@ -747,14 +777,14 @@ def mock_transport():
|
|
|
747
777
|
def mock_server_client(request: pytest.FixtureRequest):
|
|
748
778
|
"""Ensure espn_mcp.server.client and default_client use mock_transport during tests.
|
|
749
779
|
|
|
750
|
-
Tests marked ``
|
|
780
|
+
Tests marked ``live`` are the live tests, so they get no mock: they run the normal
|
|
751
781
|
``default_client``, whose own pooled client goes through ``SSRFSafeAsyncTransport``.
|
|
752
782
|
The default run deselects them, so it stays fully mocked.
|
|
753
783
|
"""
|
|
754
784
|
from espn_mcp import client as client_module
|
|
755
785
|
from espn_mcp import server
|
|
756
786
|
|
|
757
|
-
if request.node.get_closest_marker("
|
|
787
|
+
if request.node.get_closest_marker("live") is not None:
|
|
758
788
|
# A fresh guarded pool per live test: never a custom client, never one bound to an
|
|
759
789
|
# earlier test's event loop.
|
|
760
790
|
assert client_module.default_client._custom_client is None
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"""Canonical CI job ids, check names, and required-status contexts.
|
|
2
|
+
|
|
3
|
+
Check names carry no tool counts, spec dates, or versions. The test matrix job
|
|
4
|
+
is the only exception: its name may contain a digit. Text checks only; no YAML
|
|
5
|
+
dependency.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
import re
|
|
11
|
+
from pathlib import Path
|
|
12
|
+
|
|
13
|
+
ROOT = Path(__file__).resolve().parent.parent
|
|
14
|
+
CI_PATH = ROOT / ".github/workflows/ci.yml"
|
|
15
|
+
GOVERNANCE_PATH = ROOT / "scripts/setup_repo_governance.sh"
|
|
16
|
+
CONFORMANCE_PATH = ROOT / "scripts/check_conformance.sh"
|
|
17
|
+
|
|
18
|
+
# Job id at two-space indent, then the job's own ``name:`` (four spaces, not a step).
|
|
19
|
+
_JOB_NAME = re.compile(r"^ ([a-z0-9-]+):\n(?: .+\n)*? name: (.+)$", re.MULTILINE)
|
|
20
|
+
|
|
21
|
+
EXPECTED_JOBS = {
|
|
22
|
+
"lint-and-types": "Lint and types",
|
|
23
|
+
"test": "Tests (py${{ matrix.python-version }})",
|
|
24
|
+
"tests": "Tests",
|
|
25
|
+
"tool-contract": "Tool contract assertions",
|
|
26
|
+
"conformance": "Protocol conformance",
|
|
27
|
+
"build-check": "Build and package check",
|
|
28
|
+
"docker-build": "Container image build",
|
|
29
|
+
"drift-check": "Check API Drift",
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
EXPECTED_CONTEXTS = [
|
|
33
|
+
"Lint and types",
|
|
34
|
+
"Tests",
|
|
35
|
+
"Tool contract assertions",
|
|
36
|
+
"Protocol conformance",
|
|
37
|
+
"Build and package check",
|
|
38
|
+
"Container image build",
|
|
39
|
+
]
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def _ci_text() -> str:
|
|
43
|
+
return CI_PATH.read_text(encoding="utf-8")
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def _jobs_section(text: str) -> str:
|
|
47
|
+
marker = "\njobs:\n"
|
|
48
|
+
index = text.find(marker)
|
|
49
|
+
assert index != -1, "ci.yml has no jobs: block"
|
|
50
|
+
return text[index + len(marker) :]
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def _job_names(text: str) -> dict[str, str]:
|
|
54
|
+
return {match.group(1): match.group(2).strip() for match in _JOB_NAME.finditer(text)}
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def _job_block(text: str, job_id: str) -> str:
|
|
58
|
+
match = re.search(
|
|
59
|
+
rf"^ {re.escape(job_id)}:\n(.*?)(?=^ [a-z0-9-]+:\n|\Z)",
|
|
60
|
+
text,
|
|
61
|
+
re.MULTILINE | re.DOTALL,
|
|
62
|
+
)
|
|
63
|
+
assert match is not None, job_id
|
|
64
|
+
return match.group(1)
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def test_job_ids_and_names() -> None:
|
|
68
|
+
"""The workflow's job ids and check names are the canonical set."""
|
|
69
|
+
jobs = _job_names(_jobs_section(_ci_text()))
|
|
70
|
+
assert jobs == EXPECTED_JOBS
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def test_job_names_have_no_digits_except_the_test_matrix() -> None:
|
|
74
|
+
"""A check name embeds no count, date, or version. The matrix job may."""
|
|
75
|
+
for job_id, name in _job_names(_jobs_section(_ci_text())).items():
|
|
76
|
+
if job_id == "test":
|
|
77
|
+
continue
|
|
78
|
+
assert re.search(r"\d", name) is None, f"{job_id} name {name!r} contains a digit"
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
def test_aggregate_tests_job_fails_unless_the_matrix_succeeds() -> None:
|
|
82
|
+
"""``tests`` is the required context: it needs ``test``, always runs, and
|
|
83
|
+
fails unless ``needs.test.result`` is ``success``.
|
|
84
|
+
"""
|
|
85
|
+
body = _job_block(_jobs_section(_ci_text()), "tests")
|
|
86
|
+
assert re.search(r"^ name: Tests$", body, re.MULTILINE)
|
|
87
|
+
assert re.search(r"^ needs: test$", body, re.MULTILINE)
|
|
88
|
+
assert re.search(r"^ if: always\(\)$", body, re.MULTILINE)
|
|
89
|
+
assert re.search(r'needs\.test\.result \}\}" != "success"', body)
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
def test_conformance_is_its_own_job() -> None:
|
|
93
|
+
"""Node and the conformance script live on ``conformance``, not ``tool-contract``.
|
|
94
|
+
|
|
95
|
+
OpenAPI drift and the stdio protocol tests stay on ``tool-contract``.
|
|
96
|
+
"""
|
|
97
|
+
jobs = _jobs_section(_ci_text())
|
|
98
|
+
conformance = _job_block(jobs, "conformance")
|
|
99
|
+
tool_contract = _job_block(jobs, "tool-contract")
|
|
100
|
+
assert 'node-version: "22"' in conformance
|
|
101
|
+
assert "./scripts/check_conformance.sh" in conformance
|
|
102
|
+
assert "setup-node" not in tool_contract
|
|
103
|
+
assert "check_conformance.sh" not in tool_contract
|
|
104
|
+
assert "scripts/check_openapi_drift.py" in tool_contract
|
|
105
|
+
assert "tests/test_protocol.py" in tool_contract
|
|
106
|
+
script = CONFORMANCE_PATH.read_text(encoding="utf-8")
|
|
107
|
+
assert 'CONFORMANCE_VERSION="${CONFORMANCE_VERSION:-0.1.16}"' in script
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
def test_governance_required_contexts() -> None:
|
|
111
|
+
"""Required checks use the aggregate Tests name plus image build and conformance."""
|
|
112
|
+
text = GOVERNANCE_PATH.read_text(encoding="utf-8")
|
|
113
|
+
match = re.search(
|
|
114
|
+
r'"required_status_checks": \{\s*"strict": true,\s*"contexts": \[(.*?)\]',
|
|
115
|
+
text,
|
|
116
|
+
re.DOTALL,
|
|
117
|
+
)
|
|
118
|
+
assert match is not None
|
|
119
|
+
contexts = re.findall(r'"([^"]+)"', match.group(1))
|
|
120
|
+
assert contexts == EXPECTED_CONTEXTS
|
|
121
|
+
assert "Tests (py" not in text
|
|
122
|
+
for name in contexts:
|
|
123
|
+
assert re.search(r"\d", name) is None, name
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"""The live marker runs the public ESPN sweep; it skips only for a missing name."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import tomllib
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
from typing import Any
|
|
8
|
+
|
|
9
|
+
import pytest
|
|
10
|
+
|
|
11
|
+
from tests.conftest import (
|
|
12
|
+
LIVE_REQUIRED_ENV,
|
|
13
|
+
live_skip_reason,
|
|
14
|
+
pytest_collection_modifyitems,
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
ROOT = Path(__file__).resolve().parent.parent
|
|
18
|
+
PYPROJECT = ROOT / "pyproject.toml"
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class _Item:
|
|
22
|
+
"""Minimal item: only the marker lookup and add_marker the hook uses."""
|
|
23
|
+
|
|
24
|
+
def __init__(self, live: bool) -> None:
|
|
25
|
+
self._live = live
|
|
26
|
+
self.markers: list[Any] = []
|
|
27
|
+
|
|
28
|
+
def get_closest_marker(self, name: str) -> object | None:
|
|
29
|
+
if self._live and name == "live":
|
|
30
|
+
return object()
|
|
31
|
+
return None
|
|
32
|
+
|
|
33
|
+
def add_marker(self, marker: Any) -> None:
|
|
34
|
+
self.markers.append(marker)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def _reason(marker: Any) -> str:
|
|
38
|
+
reason = marker.kwargs["reason"]
|
|
39
|
+
assert isinstance(reason, str)
|
|
40
|
+
return reason
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def test_public_api_needs_no_credential() -> None:
|
|
44
|
+
"""No credential is required, so the gate is open and ``-m live`` is unskipped."""
|
|
45
|
+
assert LIVE_REQUIRED_ENV == ()
|
|
46
|
+
assert live_skip_reason({}) is None
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def test_missing_name_is_listed_without_its_value(monkeypatch: pytest.MonkeyPatch) -> None:
|
|
50
|
+
"""A missing required name is listed, and a value that is set is not."""
|
|
51
|
+
monkeypatch.setattr(
|
|
52
|
+
"tests.conftest.LIVE_REQUIRED_ENV",
|
|
53
|
+
("ESPN_BASE_URL", "ESPN_CORE_BASE_URL"),
|
|
54
|
+
)
|
|
55
|
+
reason = live_skip_reason({"ESPN_CORE_BASE_URL": "super-secret"})
|
|
56
|
+
assert reason == "missing or empty: ESPN_BASE_URL"
|
|
57
|
+
assert "super-secret" not in reason
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def test_blank_value_counts_as_missing_and_is_not_echoed(monkeypatch: pytest.MonkeyPatch) -> None:
|
|
61
|
+
"""An empty or whitespace-only value counts as missing and is not echoed."""
|
|
62
|
+
monkeypatch.setattr("tests.conftest.LIVE_REQUIRED_ENV", ("ESPN_BASE_URL",))
|
|
63
|
+
reason = live_skip_reason({"ESPN_BASE_URL": " "})
|
|
64
|
+
assert reason == "missing or empty: ESPN_BASE_URL"
|
|
65
|
+
assert " " not in reason
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def test_present_names_do_not_skip(monkeypatch: pytest.MonkeyPatch) -> None:
|
|
69
|
+
"""Every required name set to a non-blank value lets the item run."""
|
|
70
|
+
monkeypatch.setattr("tests.conftest.LIVE_REQUIRED_ENV", ("ESPN_BASE_URL",))
|
|
71
|
+
assert live_skip_reason({"ESPN_BASE_URL": "https://site.api.espn.com"}) is None
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def test_default_addopts_deselect_live() -> None:
|
|
75
|
+
"""The default run deselects live, and the e2e marker is gone."""
|
|
76
|
+
ini = tomllib.loads(PYPROJECT.read_text(encoding="utf-8"))["tool"]["pytest"]["ini_options"]
|
|
77
|
+
assert "-m 'not live'" in ini["addopts"]
|
|
78
|
+
assert "not e2e" not in ini["addopts"]
|
|
79
|
+
markers = list(ini["markers"])
|
|
80
|
+
assert markers == ["live: live network tests against the public ESPN API (run with -m live)"]
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
def test_hook_skips_live_items_only(monkeypatch: pytest.MonkeyPatch) -> None:
|
|
84
|
+
"""The collection hook skips live items and leaves every other item alone."""
|
|
85
|
+
monkeypatch.setattr(
|
|
86
|
+
"tests.conftest.live_skip_reason",
|
|
87
|
+
lambda environ=None: "missing or empty: ESPN_BASE_URL",
|
|
88
|
+
)
|
|
89
|
+
monkeypatch.setenv("ESPN_BASE_URL", "super-secret")
|
|
90
|
+
live = _Item(True)
|
|
91
|
+
other = _Item(False)
|
|
92
|
+
pytest_collection_modifyitems(None, [live, other]) # type: ignore[arg-type]
|
|
93
|
+
assert other.markers == []
|
|
94
|
+
assert len(live.markers) == 1
|
|
95
|
+
reason = _reason(live.markers[0])
|
|
96
|
+
assert reason == "missing or empty: ESPN_BASE_URL"
|
|
97
|
+
assert "super-secret" not in reason
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
def test_hook_leaves_live_items_when_the_gate_is_open() -> None:
|
|
101
|
+
"""With no required names, the hook adds no skip."""
|
|
102
|
+
live = _Item(True)
|
|
103
|
+
pytest_collection_modifyitems(None, [live]) # type: ignore[arg-type]
|
|
104
|
+
assert live.markers == []
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
"""The autouse mock skips ``
|
|
1
|
+
"""The autouse mock skips ``live`` tests, which run the normal client and its SSRF guard.
|
|
2
2
|
|
|
3
3
|
An inner pytest session (in a subprocess, so this run's own mock is not in play) loads the
|
|
4
|
-
real conftest and runs two tests that make no request: one marked ``
|
|
4
|
+
real conftest and runs two tests that make no request: one marked ``live``, one not.
|
|
5
5
|
"""
|
|
6
6
|
|
|
7
7
|
from __future__ import annotations
|
|
@@ -21,8 +21,8 @@ from espn_mcp import server
|
|
|
21
21
|
from espn_mcp.client import SSRFSafeAsyncTransport
|
|
22
22
|
|
|
23
23
|
|
|
24
|
-
@pytest.mark.
|
|
25
|
-
def
|
|
24
|
+
@pytest.mark.live
|
|
25
|
+
def test_live_gets_the_guarded_default_client():
|
|
26
26
|
default = client_module.default_client
|
|
27
27
|
assert server.client is default
|
|
28
28
|
assert client_module.get_client() is default
|
|
@@ -40,16 +40,16 @@ def test_default_run_gets_the_mock_transport():
|
|
|
40
40
|
"""
|
|
41
41
|
|
|
42
42
|
|
|
43
|
-
def
|
|
43
|
+
def test_autouse_mock_skips_live_tests_only(pytester: pytest.Pytester) -> None:
|
|
44
44
|
conftest = Path(__file__).with_name("conftest.py").read_text(encoding="utf-8")
|
|
45
45
|
pytester.makeconftest(conftest)
|
|
46
|
-
pytester.makeini("[pytest]\nmarkers =\n
|
|
46
|
+
pytester.makeini("[pytest]\nmarkers =\n live: live tests\n")
|
|
47
47
|
pytester.makepyfile(test_inner=_INNER_TESTS)
|
|
48
48
|
result = pytester.runpytest_subprocess("-p", "no:cacheprovider", "-p", "no:cov", "-v")
|
|
49
49
|
result.assert_outcomes(passed=2)
|
|
50
50
|
result.stdout.fnmatch_lines(
|
|
51
51
|
[
|
|
52
|
-
"*
|
|
52
|
+
"*test_live_gets_the_guarded_default_client PASSED*",
|
|
53
53
|
"*test_default_run_gets_the_mock_transport PASSED*",
|
|
54
54
|
]
|
|
55
55
|
)
|