fix: Default collections created through MCP to private (#12644)

This commit is contained in:
Tom Moor
2026-06-09 08:38:34 -04:00
committed by GitHub
parent bd01a62fc1
commit 3c2e9a9723
3 changed files with 3 additions and 2 deletions
@@ -1241,6 +1241,7 @@ describe("#collections.create", () => {
expect(body.data.name).toBe("Test"); expect(body.data.name).toBe("Test");
expect(body.data.sort.field).toBe("index"); expect(body.data.sort.field).toBe("index");
expect(body.data.sort.direction).toBe("asc"); expect(body.data.sort.direction).toBe("asc");
expect(body.data.permission).toBe(null);
expect(body.policies.length).toBe(1); expect(body.policies.length).toBe(1);
expect(body.policies[0].abilities.read).toBeTruthy(); expect(body.policies[0].abilities.read).toBeTruthy();
}); });
+1
View File
@@ -60,6 +60,7 @@ describe("collection tools", () => {
expect(data.color).toEqual("#FF0000"); expect(data.color).toEqual("#FF0000");
expect(data.id).toBeDefined(); expect(data.id).toBeDefined();
expect(data.url).toMatch(/^https?:\/\//); expect(data.url).toMatch(/^https?:\/\//);
expect(data.permission).toEqual(null);
}); });
it("update_collection updates fields on existing collection", async () => { it("update_collection updates fields on existing collection", async () => {
+1 -2
View File
@@ -1,7 +1,6 @@
import { z } from "zod"; import { z } from "zod";
import { Sequelize, Op, type WhereOptions } from "sequelize"; import { Sequelize, Op, type WhereOptions } from "sequelize";
import { type McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; import { type McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { CollectionPermission } from "@shared/types";
import { Collection, Team } from "@server/models"; import { Collection, Team } from "@server/models";
import { sequelize } from "@server/storage/database"; import { sequelize } from "@server/storage/database";
import { authorize } from "@server/policies"; import { authorize } from "@server/policies";
@@ -179,7 +178,7 @@ export function collectionTools(server: McpServer, scopes: string[]) {
color: input.color, color: input.color,
teamId: user.teamId, teamId: user.teamId,
createdById: user.id, createdById: user.id,
permission: CollectionPermission.ReadWrite, permission: null,
}); });
await collection.saveWithCtx(ctx); await collection.saveWithCtx(ctx);