fix: mirror params.taskId into Mcp-Name for tasks requests (SEP-2663) (#2613)
Co-authored-by: Felix Weinberger <fweinberger@anthropic.com> Co-authored-by: Konstantin Konstantinov <KKonstantinov@users.noreply.github.com>
This commit is contained in:
parent
7b781ed4e2
commit
70de0c8b56
1 changed files with 184 additions and 45 deletions
|
|
@ -7,8 +7,10 @@
|
|||
* body-primary classifier returns a modern route. A missing
|
||||
* `MCP-Protocol-Version` header, a missing `Mcp-Method`
|
||||
* header, a missing `Mcp-Name` header on a `tools/call` / `prompts/get` /
|
||||
* `resources/read` request, an `Mcp-Name` value disagreeing with
|
||||
* `params.name` / `params.uri`, and an invalid `Mcp-Name` Base64 sentinel are
|
||||
* `resources/read` request or (SEP-2663) a `tasks/get` / `tasks/update` /
|
||||
* `tasks/cancel` request, an `Mcp-Name` value disagreeing with
|
||||
* `params.name` / `params.uri` / `params.taskId`, and an invalid `Mcp-Name`
|
||||
* Base64 sentinel are
|
||||
* all rejected `400` / `-32020` (`HeaderMismatch`) on the
|
||||
* `standard-header-validation` rung — the same shape the classifier already
|
||||
* emits for the `MCP-Protocol-Version` and `Mcp-Method` mismatch cells on the
|
||||
|
|
@ -234,6 +236,15 @@ describe('SEP-2243 standard-header validation (createMcpHandler, modern era)', (
|
|||
const response = await handler.fetch(modernRequest('tools/list', {}, { 'mcp-method': 'tools/list' }));
|
||||
expect(response.status).toBe(200);
|
||||
});
|
||||
|
||||
it('a missing Mcp-Name header on tasks/get is rejected 400/-32020 at the entry (SEP-2663)', async () => {
|
||||
const handler = createMcpHandler(makeFactory());
|
||||
const error = await expectHeaderMismatch(
|
||||
await handler.fetch(modernRequest('tasks/get', { taskId: 'task-123' }, { 'mcp-method': 'tasks/get' }))
|
||||
);
|
||||
expect(error.message).toContain('params.taskId="task-123"');
|
||||
expect(error.message).toContain('Mcp-Name header is absent');
|
||||
});
|
||||
});
|
||||
|
||||
describe('SEP-2243 standard-header validation is era-gated', () => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue