everything: add a test that requestState expires after its 600-second TTL
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 86/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- typescript
- 领域
- testing
调研方向
阅读 src/everything/tests/modern.test.ts 中现有的 requestState 用例和 minted-resource TTL 测试,以及 src/everything/tests/harness.ts 中的 raw-session 测试框架。添加一个过期用例:捕获 requestState,将 Date 前进 601 秒,然后使用有效答案继续。当过期状态因错误代码 -32602 被拒绝时,即为完成。
由索引模型根据 Issue 内容生成。
描述
Which server?
everything (@modelcontextprotocol/server-everything)
Protocol era
Modern (2026-07-28)
MCP client
No response
The problem
The multi-step tools' continuation token (requestState) is constructed with a declared TTL of 600 seconds (src/everything/server/index.ts:83-85). The existing tests in modern.test.ts pin the tamper case (a modified state is rejected with -32602, :319) and the happy-path round trip (:330) — but not expiry: that a correctly signed, untampered state is refused once its time has run out. Expiry is the security-relevant half of the TTL; if validation only ever checked the signature, an old state would work forever.
Case
Start trigger-multi-step-elicitation over a raw session and capture the requestState. Advance only the clock — vi.useFakeTimers({ toFake: ["Date"] }) plus setSystemTime +601 seconds, the same fake-Date pattern the minted-resource TTL test in the same file uses (:643) — then continue with a valid answer and assert the error is -32602, consistent with the tamper rejection. The state is untampered; only time has passed.
Solution you have in mind (optional)
Proposed test
Beside the existing requestState cases in src/everything/__tests__/modern.test.ts, using the raw-session harness:
import { afterEach, describe, expect, it, vi } from "vitest";
import { connectRaw, type RawSession } from "./harness.js";
let raw: RawSession | undefined;
afterEach(async () => {
await raw?.close();
raw = undefined;
vi.useRealTimers();
});
describe("requestState expiry", () => {
it("refuses a requestState continued after its 600-second TTL with -32602", async () => {
raw = await connectRaw({ elicitation: {} });
const first = await raw.call("trigger-multi-step-elicitation");
expect(first).toMatchObject({
resultType: "input_required",
requestState: expect.any(String),
});
const state = (first as { requestState: string }).requestState;
vi.useFakeTimers({ toFake: ["Date"] });
vi.setSystemTime(Date.now() + 601_000);
const response = await raw.request("tools/call", {
name: "trigger-multi-step-elicitation",
arguments: {},
requestState: state,
inputResponses: {
name: { action: "accept", content: { name: "Ada" } },
},
});
expect(response.error).toMatchObject({ code: -32602 });
});
});
Which MCP feature does it demonstrate? (optional)
No response
Alternatives or workarounds you have tried
The only near hit, #4852, is a spec-refactor tracking issue, not a duplicate of this test proposal. No workaround covers this — expiry of a correctly signed, untampered requestState is not pinned by any existing test.
Already built it locally?
Verification
Ran against a byte-identical copy of v2/main @ 6cfff622: 1 passed — the TTL is enforced as declared. Full everything suite with it included: 27 files, 475 passed.
Prompt used
"In src/everything's modern tests, the requestState cases pin tamper rejection (-32602) and the happy-path round trip, but not expiry. Add one: start trigger-multi-step-elicitation over a raw session, capture the requestState, advance the clock 601 seconds with vi.useFakeTimers({ toFake: ["Date"] }) + setSystemTime (the pattern the minted-resource TTL test in the same file uses), then continue with a valid answer and assert the error is -32602. The state is untampered — only time has passed."
Before you submit
- I searched existing issues and this is not a duplicate.
- This is a request for this repository or one of its servers, not a new server, the MCP specification or an SDK.
- 主要语言
- TypeScript
- 星标
- 92k
- 派生
- 12k
- 平均合并
- 3 小时 12 分钟
- 30 天内合并 PR
- 174
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
modelcontextprotocol/servers 的其他 Issue
-
bug server-time v2
难度 2/5 1-3 小时 新手友好度 76/100
modelcontextprotocol/servers#5559 ·
维护者通常 1 天内回复
-
enhancement server-filesystem v2
难度 2/5 1-3 小时 新手友好度 68/100
modelcontextprotocol/servers#5553 · 2 条评论 ·
维护者通常 1 天内回复
-
enhancement server-git v2
难度 1/5 1 小时以内 新手友好度 88/100
modelcontextprotocol/servers#5552 · 2 条评论 ·
维护者通常 1 天内回复
-
chore dependencies server-fetch v2
难度 2/5 1-3 小时 新手友好度 65/100
modelcontextprotocol/servers#5546 · 2 条评论 ·
维护者通常 1 天内回复
-
chore dependencies v2
难度 2/5 1-3 小时 新手友好度 68/100
modelcontextprotocol/servers#5545 · 1 条评论 ·
维护者通常 1 天内回复
查看 modelcontextprotocol/servers 的全部 Issue
相似的 Issue
-
难度 1/5 1 小时以内 新手友好度 95/100
marimo-team/marimo#11949 ·
维护者通常 1 天内回复
-
bug
难度 1/5 1 小时以内 新手友好度 88/100
Monsieur-Nico/textConvert#479 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
router-for-me/Home-Management-Center#232 ·
维护者通常 1 天内回复
-
clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster maturity:stable P3
难度 2/5 1-3 小时 新手友好度 72/100
openclaw/openclaw#200937 · 1 条评论 · 1 个 reaction ·
维护者通常 1 天内回复
-
bug follow-up
难度 2/5 1-3 小时 新手友好度 88/100
维护者通常 1 天内回复