mirror of
https://github.com/outline/outline.git
synced 2026-12-02 09:42:07 +03:00
fix: Close MCP subscriptions/listen streams at once (#14254)
The tool and resource lists never change during a request, so do not advertise listChanged. This stops 2026-07-28 clients from holding open SSE streams that the router interrupts.
This commit is contained in:
1 parent
b520be0a9e
commit
fb7b09ad6c
2 files changed
+28
-2
No files matched your search
+4
-2
@@ -49,9 +49,11 @@ export function createMcpServer(
|
||||
],
|
||||
},
|
||||
{
|
||||
// The lists never change during a request, so subscriptions/listen
|
||||
// completes at once instead of holding a stream open.
|
||||
capabilities: {
|
||||
tools: {},
|
||||
resources: {},
|
||||
tools: { listChanged: false },
|
||||
resources: { listChanged: false, subscribe: false },
|
||||
extensions: {
|
||||
[skillsExtensionId]: {},
|
||||
},
|
||||
|
||||
@@ -131,6 +131,30 @@ describe("POST /mcp/", () => {
|
||||
expect(result?.content?.[0]?.text).toContain(collection.id);
|
||||
});
|
||||
|
||||
it("should complete a subscriptions/listen request at once", async () => {
|
||||
const { accessToken } = await buildOAuthUser();
|
||||
const { body, resultId } = mcpRequest("subscriptions/listen", {
|
||||
notifications: {
|
||||
toolsListChanged: true,
|
||||
resourcesListChanged: true,
|
||||
},
|
||||
_meta: modernMeta("2026-07-28"),
|
||||
});
|
||||
const res = await server.post("/mcp/", {
|
||||
headers: {
|
||||
...mcpHeaders(accessToken),
|
||||
"MCP-Protocol-Version": "2026-07-28",
|
||||
"Mcp-Method": "subscriptions/listen",
|
||||
},
|
||||
body,
|
||||
});
|
||||
expect(res.status).toEqual(200);
|
||||
|
||||
const text = await res.text();
|
||||
expect(text).toContain('"resultType":"complete"');
|
||||
expect(text).toContain(`"id":${resultId}`);
|
||||
});
|
||||
|
||||
it("should handle initialize and return capabilities", async () => {
|
||||
const { accessToken } = await buildOAuthUser();
|
||||
const { body } = mcpRequest("initialize", {
|
||||
|
||||
Reference in new issue
Block a user