Skip to content

Commit bc38fa0

Browse files
committed
docs: pin the landing page install command; wait on an event in the progress test
Two review nits on the previous commit: - docs/index.md's install tabs were the last unpinned `mcp[cli]` commands in the book. They now pin 2.0.0a2 like installation.md and the README, and the warning box below them explains the pin instead of asking the reader to add one. - The new test in tests/docs_src/test_progress.py waited for the gated callbacks with a sleep poll, which AGENTS.md tells contributors not to do, and used a 10s fail_after where 5 is the standard. The callback now sets an anyio.Event when the second value lands and the test waits on that, under fail_after(5).
1 parent f7887e5 commit bc38fa0

2 files changed

Lines changed: 14 additions & 12 deletions

File tree

docs/index.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,22 @@ Python 3.10+.
2020
=== "uv"
2121

2222
```bash
23-
uv add "mcp[cli]"
23+
uv add "mcp[cli]==2.0.0a2"
2424
```
2525

2626
=== "pip"
2727

2828
```bash
29-
pip install "mcp[cli]"
29+
pip install "mcp[cli]==2.0.0a2"
3030
```
3131

3232
The `[cli]` extra gives you the `mcp` command; you'll want it for development.
3333

3434
!!! warning "Pin the version while v2 is in alpha"
35-
Until v2 is stable, installers resolve `mcp` to the latest **v1.x** release, which this
36-
documentation does not describe. Pin an alpha explicitly (`uv add "mcp[cli]==2.0.0a2"`;
37-
check [PyPI](https://pypi.org/project/mcp/#history) for the newest pre-release).
38-
See [Installation](installation.md) for the details.
35+
Installers never select a pre-release unless you name one, so an unpinned `uv add "mcp[cli]"`
36+
gives you the latest **v1.x** release, which this documentation does not describe. Check
37+
[PyPI](https://pypi.org/project/mcp/#history) for the newest alpha before you copy the line
38+
above. See [Installation](installation.md) for the details.
3939

4040
## Example
4141

tests/docs_src/test_progress.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,20 +51,22 @@ async def test_over_a_wire_dispatcher_callbacks_race_the_result() -> None:
5151
you not to rule out.
5252
"""
5353
release = anyio.Event()
54+
done = anyio.Event()
5455
finished: list[float] = []
5556

56-
async def slow(progress: float, total: float | None, message: str | None) -> None:
57+
async def gated(progress: float, total: float | None, message: str | None) -> None:
5758
await release.wait()
5859
finished.append(progress)
60+
if len(finished) == 2:
61+
done.set()
5962

6063
async with Client(tutorial001.mcp, mode="legacy") as client:
61-
with anyio.fail_after(10):
62-
result = await client.call_tool("import_catalog", {"urls": URLS}, progress_callback=slow)
64+
with anyio.fail_after(5):
65+
result = await client.call_tool("import_catalog", {"urls": URLS}, progress_callback=gated)
6366
assert finished == []
6467
release.set()
65-
with anyio.fail_after(10):
66-
while len(finished) < 2:
67-
await anyio.sleep(0.01)
68+
with anyio.fail_after(5):
69+
await done.wait()
6870
assert sorted(finished) == [1, 2]
6971
assert result.structured_content == {"result": "Imported 2 records."}
7072

0 commit comments

Comments
 (0)