Skip to content

Commit deb57b7

Browse files
committed
Merge origin/v2/main into v2/chore/5540-memory-scale-round-trip-test
Catch up before merge: v2/main moved under this PR.
2 parents 7d0c78a + 1372568 commit deb57b7

43 files changed

Lines changed: 3191 additions & 154 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@modelcontextprotocol/server-everything": minor
3+
---
4+
5+
The Streamable HTTP transport now evicts a 2025-era session that has been idle for 30 minutes: one with no request in flight and no stream open. Until now a session whose client never sent a DELETE stayed in memory, with its server instance, for the life of the process. An evicted session's next request is answered `404 Session not found`, the spec's signal for the client to initialize again. Set the new `SESSION_IDLE_TIMEOUT_MILLIS` environment variable to change the timeout, or to `0` to keep sessions until their client ends them. 2026-07-28 clients have no sessions and are unaffected. Thanks to [Pierpaolo1223](https://github.com/Pierpaolo1223) for the report and the measurements in [#5558](https://github.com/modelcontextprotocol/servers/issues/5558).
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@modelcontextprotocol/server-filesystem": patch
3+
---
4+
5+
`move_file` now refuses to move a directory into itself with `Cannot move a directory into itself: <destination> is inside <source>`, instead of reporting `Parent directory does not exist` for a destination directory that does exist.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@modelcontextprotocol/server-filesystem": patch
3+
---
4+
5+
On Windows, `list_directory`, `list_directory_with_sizes`, `directory_tree` and `search_files` now check the directory they list before and after reading it: its path must have no junction or symlink on it and must name the same directory both times, or the call is refused with "Access denied - a directory on the path changed during the operation". A directory swapped for a junction after the path was validated is no longer listed. A swap made and undone while the directory is being read is still not detected; the README's "Limit on Windows" entry says what holds. macOS and Linux are unchanged.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@modelcontextprotocol/server-memory": patch
3+
---
4+
5+
Close three narrow gaps in how the memory file lock changes hands between server processes: a writer could start while a live lock was momentarily moved aside by a server checking a stale one, a lock could be put back after its holder had finished (delaying later writes by up to 30 seconds), and a server releasing a lock it had held past the stale timeout could remove the lock of the server that took over. The momentary `<memory file>.lock.break` file now orders every release and stale-lock break, and a server that has just created the lock waits for it to go before writing. Servers on this version and on 2.2.1 or earlier can still share a memory file; the older server's own releases and acquisitions keep those gaps.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@modelcontextprotocol/server-filesystem": patch
3+
---
4+
5+
`search_files` no longer answers a search that matched nothing with a bare `No matches found`. The result still begins with those words, and now names the pattern and the directory searched, says the pattern is a case-sensitive glob over names relative to that directory (never file contents), and, for a pattern with no `**`, suggests the `**/` form that reaches subdirectories.

‎.claude/skills/local-dev/SKILL.md‎

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,18 @@ node src/filesystem/dist/index.js --transport streamable-http /tmp/scratch # d
8888
(cd src/time && uv run mcp-server-time --transport streamable-http)
8989
```
9090

91-
Each one's endpoint is stateless for 2025-era clients (a fresh server per
92-
request; GET and DELETE answer 405), so nothing the server asks of the client
93-
mid-session (filesystem's Roots) reaches it over HTTP.
91+
What a 2025-era client gets from that endpoint differs by language (#5593):
92+
93+
- **`memory`, `filesystem`, `sequentialthinking` (TypeScript) are stateless**: a
94+
fresh server per request, no `Mcp-Session-Id` on the `initialize` response,
95+
and GET and DELETE answer 405. So nothing the server asks of the client
96+
mid-session (filesystem's Roots) reaches it over HTTP.
97+
- **`fetch`, `git`, `time` (Python) keep a session**, through the SDK's
98+
Streamable HTTP app. `initialize` returns an `Mcp-Session-Id` header and
99+
every later request must carry it: without it a POST, GET or DELETE answers
100+
400 "Missing session ID". With it, GET opens the session's stream and DELETE
101+
ends the session, after which its id answers 404. A hand-written `curl`
102+
probe therefore sends `initialize` first and passes the header on.
94103

95104
## Run the local package the way a user would
96105

‎.claude/skills/pr-flow/SKILL.md‎

Lines changed: 103 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ gh pr view "$PR" --repo modelcontextprotocol/servers \
252252
```
253253

254254
The link does **not** make the issue close on merge into `v2/main`; that is
255-
still done by hand in step 9.
255+
still done by hand in step 10.
256256

257257
Then move the card to **In Review** (`/board-ops`). The PR itself never goes on
258258
the board.
@@ -407,6 +407,108 @@ the PR shows why the loop ended.
407407

408408
Merging is a maintainer's decision. Do not merge on your own initiative.
409409

410+
### Before the merge: catch up if `v2/main` moved
411+
412+
The rule is in `AGENTS.md` **Issue-driven work style**: a PR is caught up and
413+
re-tested before it merges when `v2/main` moved in a way that can interact
414+
with it. CI here runs on **push**, on the branch's head commit, and the gate
415+
ran in your worktree, so neither has seen anything that landed on `v2/main`
416+
after the branch last took it in. GitHub's "no conflicts with the base branch"
417+
compares text and tests nothing: #5564 and #5567 were each green and cleanly
418+
mergeable, merged ten minutes apart, and left `v2/main` failing `ruff check`
419+
(#5569).
420+
421+
**1. List what the PR's head lacks.** From any checkout of this repo:
422+
423+
```sh
424+
PR=<PR>
425+
git fetch origin v2/main "refs/pull/$PR/head"
426+
HEAD_SHA=$(gh pr view "$PR" --repo modelcontextprotocol/servers \
427+
--json headRefOid --jq .headRefOid)
428+
429+
# Commits on v2/main that the head does not hold. Nothing printed: the PR was
430+
# tested on the current tip, so there is nothing to catch up.
431+
git log --oneline "$HEAD_SHA..origin/v2/main"
432+
433+
# The files each side changed since the two diverged.
434+
LANDED=$(git diff --name-only "$HEAD_SHA...origin/v2/main")
435+
MINE=$(git diff --name-only "origin/v2/main...$HEAD_SHA")
436+
437+
# Check A: servers that both sides touched.
438+
comm -12 <(grep -oE '^src/[^/]+/' <<<"$LANDED" | sort -u) \
439+
<(grep -oE '^src/[^/]+/' <<<"$MINE" | sort -u)
440+
441+
# Check B: repository-wide configuration, on either side: a root manifest,
442+
# lockfile, config file or dotfile, scripts/, or a workflow.
443+
WIDE='^([^/]+\.(json|js|mjs|cjs|ts|toml|ya?ml)|\.[^/]+|scripts/.*|\.github/workflows/.*)$'
444+
grep -E "$WIDE" <<<"$LANDED" | sed 's/^/landed: /'
445+
grep -E "$WIDE" <<<"$MINE" | sed 's/^/mine: /'
446+
```
447+
448+
**2. Decide.**
449+
450+
| The listing shows | Then |
451+
| --- | --- |
452+
| No commits | Nothing to do. Merge on green CI |
453+
| Commits, and checks A and B both print nothing | What landed cannot interact with the PR. No catch-up needed |
454+
| Check A prints a server, or check B prints any path | **Catch up** (below) |
455+
| Anything you are unsure of | **Catch up**. The checks are deliberately coarse, and a gate run is cheaper than a red `v2/main` |
456+
457+
A server's own configuration (`pyproject.toml`, `uv.lock`, `tsconfig.json`,
458+
`vitest.config.ts`) is inside its directory, so check A covers it: that is the
459+
#5569 case, where a `requires-python` bump changed which lint rules applied to
460+
code another PR was adding.
461+
462+
**3. Catch up**, in the PR's worktree:
463+
464+
```sh
465+
git fetch origin v2/main
466+
git merge --no-edit origin/v2/main
467+
npm install # the merge may have moved package-lock.json
468+
npm run local:gate && git push # the push runs only on a green gate
469+
```
470+
471+
- **Merge, never rebase.** A rebase rewrites the commits that were reviewed,
472+
outdates every review thread and needs a force-push. The merge commit is
473+
exempt from the DCO check (step 3).
474+
- **The gate runs on the merged tree before the push**, as before any push
475+
(step 4), and a red gate pushes nothing. A red stage here is the interaction
476+
this step exists to find: fix it on the branch, signed off, and run that
477+
last line again.
478+
- **Then wait for CI on the new head**, with one backgrounded command, as
479+
`AGENTS.md` **Waiting on long-running work** says. The `sleep` gives the push
480+
runs time to register; `--watch` on a head with no checks yet exits at once.
481+
482+
```sh
483+
sleep 60; gh pr checks "$PR" --repo modelcontextprotocol/servers \
484+
--watch --interval 30; echo "EXIT=$?"
485+
```
486+
487+
- **A catch-up that merged without conflicts and passed the gate unchanged
488+
needs no new Copilot round.** Nothing the PR adds changed. One that needed a
489+
conflict resolved or a fix pushed changed the PR, so request a round (step 9).
490+
- **If `v2/main` moves again before the merge, run step 1 again.** It costs
491+
one fetch, and most of the time it prints nothing that interacts.
492+
493+
**Fan-outs.** When several PRs for one server are open at once, a PR that
494+
changes that server's **configuration** (a language floor, lint or compiler
495+
settings, a dependency major) interacts with every one of them. Merge it
496+
**last**, after catching it up on the others, or merge it first and catch up
497+
and re-test each of the others after it. The open PRs that touch a server:
498+
499+
```sh
500+
gh pr list --repo modelcontextprotocol/servers --base v2/main --state open \
501+
--limit 200 --json number,title,files \
502+
--jq '.[] | select(any(.files[]; .path | startswith("src/fetch/")))
503+
| "\(.number) \(.title)"'
504+
```
505+
506+
Nothing enforces this step: `v2/main`'s ruleset requires no status checks, so
507+
it is done by hand by whoever merges. Whether a merge queue or a required
508+
up-to-date check should take it over is #5588.
509+
510+
### After the merge
511+
410512
**On merge into `v2/main`, close the issue by hand and move its card to
411513
Done**, since auto-close does not fire there:
412514

‎.claude/skills/pr-flow/evals/evals.json‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@
2323
"prompt": "My PR into v2/main just merged. What do I still need to do to close it out?",
2424
"expect": "pr-flow"
2525
},
26+
{
27+
"prompt": "My PR is green and GitHub says it has no conflicts, but another PR for the same server merged into v2/main ten minutes ago. What do I have to do before it can merge?",
28+
"expect": "pr-flow"
29+
},
2630
{
2731
"prompt": "What does this regex match? /^[a-z]+$/",
2832
"expect": null

‎AGENTS.md‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -600,6 +600,19 @@ here.
600600
declined finding that is worth doing gets its own issue, linked in the
601601
reply. The rule is under
602602
[Responding to code reviews](#responding-to-code-reviews).
603+
- **Before a PR merges, it is caught up and re-tested if `v2/main` moved in a
604+
way that can interact with it.** GitHub reporting no conflicts is not that
605+
test: it compares text, and the gate and CI ran on the PR's head, which
606+
holds nothing that landed on `v2/main` after the branch last took it in. Two
607+
fetch PRs that were each green left `v2/main` red that way (#5569). What
608+
landed **can interact** when it touches a server directory
609+
(`src/<server>/`) the PR also touches, or when either side touches
610+
repository-wide configuration: a root manifest, lockfile or configuration
611+
file, `scripts/`, or `.github/workflows/`. When in doubt, re-test. Catching
612+
up is a merge of `origin/v2/main` into the branch, never a rebase, then the
613+
gate, a push, and green CI on the new head. `v2/main`'s ruleset requires no
614+
status checks, so this is on whoever merges. The recipe is the `pr-flow`
615+
skill (step 10).
603616
- **If new tasks are discovered during development, create issues** for them
604617
and put them on the board, rather than widening the current PR.
605618

‎src/everything/README.md‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,9 @@ Both HTTP transports (Streamable HTTP and HTTP+SSE) listen on the loopback inter
133133
| --- | --- | --- |
134134
| `PORT` | `3001` | The port the HTTP transport listens on |
135135
| `HOST` | `127.0.0.1` | The address it binds; `0.0.0.0` (or `::`) for every interface |
136+
| `SESSION_IDLE_TIMEOUT_MILLIS` | `1800000` (30 minutes) | Streamable HTTP only: how long a 2025-era session may sit idle before the server ends it; `0` never ends one |
137+
138+
A 2025-era Streamable HTTP session normally ends when its client sends a `DELETE`. One whose client goes away without doing so is ended by the server once it has been idle for `SESSION_IDLE_TIMEOUT_MILLIS`: its server instance is closed and its timers and subscriptions are released. Idle means no request in flight and no stream open, so a client that keeps its `GET` stream open, or is waiting on a long tool call, is never timed out; the clock starts when the session's last response closes, and idle sessions are looked for every tenth of the timeout (no less than a second and no more than a minute apart), so one is ended that much late at most. A request for a session the server has ended is answered `404 Not Found` (`Session not found`), which is the [specification's signal](https://modelcontextprotocol.io/specification/2025-11-25/basic/transports#session-management) for the client to start a new session with a fresh `initialize`. Set a short timeout to exercise that path in a client under test, or `0` to keep every session until its client ends it. A value that is not a non-negative number is ignored in favor of the default. 2026-07-28 clients have no sessions, and an HTTP+SSE session ends when its stream's connection closes, so neither is affected.
136139

137140
Both HTTP transports (Streamable HTTP and HTTP+SSE) accept browser requests only from a localhost origin: an `Origin` header whose host is `localhost`, `127.0.0.1` or `[::1]`, on any port, such as the MCP Inspector's. A request carrying any other `Origin` is refused with `403 Forbidden`. Clients that send no `Origin` header, which is every non-browser client, are unaffected.
138141

0 commit comments

Comments
 (0)