diff --git a/libs/common/src/lib/scopes.spec.ts b/libs/common/src/lib/scopes.spec.ts index 97d6ef1f8f..a49a061e53 100644 --- a/libs/common/src/lib/scopes.spec.ts +++ b/libs/common/src/lib/scopes.spec.ts @@ -258,9 +258,9 @@ describe('Scopes', () => { ).not.toContain(scopes.portfolioReadValues); }); - // The controller exposes the tool to import activities as the only tool - // which writes, hence a further write scope stays ineffective - it('Gives the write scope to create an activity only', () => { + // The controller exposes no tool for a further write scope, hence it stays + // ineffective + it('Gives the write scopes to update an account and to create an activity only', () => { expect( getScopesOfAccess({ scopes: [...SCOPES_OF_READ_ACCESS, ...SCOPES_OF_WRITE_ACCESS], @@ -268,7 +268,7 @@ describe('Scopes', () => { }).filter((scope) => { return SCOPES_OF_WRITE_ACCESS.includes(scope as Scope); }) - ).toEqual([scopes.activityCreate]); + ).toEqual([scopes.accountUpdate, scopes.activityCreate]); }); // The dialog narrows the access level to the scopes which the type diff --git a/libs/common/src/lib/scopes.ts b/libs/common/src/lib/scopes.ts index 39b1954fc2..de0b17cff5 100644 --- a/libs/common/src/lib/scopes.ts +++ b/libs/common/src/lib/scopes.ts @@ -68,7 +68,7 @@ export const SCOPES_OF_READ_RESTRICTED_ACCESS: readonly Scope[] = * monetary values. */ const SCOPES_OF_TYPE: Record = { - MCP: [...SCOPES_OF_READ_ACCESS, scopes.activityCreate], + MCP: [...SCOPES_OF_READ_ACCESS, scopes.accountUpdate, scopes.activityCreate], PRIVATE: Object.values(scopes), PUBLIC: SCOPES_OF_PUBLIC_ACCESS }; diff --git a/prisma/migrations/20261014000000_added_account_update_scope_to_mcp_access/migration.sql b/prisma/migrations/20261014000000_added_account_update_scope_to_mcp_access/migration.sql new file mode 100644 index 0000000000..fba4918516 --- /dev/null +++ b/prisma/migrations/20261014000000_added_account_update_scope_to_mcp_access/migration.sql @@ -0,0 +1,6 @@ +-- Grant the scope to update an account to the existing accesses of the model context protocol which can create an activity +UPDATE "Access" +SET "scopes" = array_append("scopes", 'account:update') +WHERE "type" = 'MCP' + AND 'activity:create' = ANY("scopes") + AND NOT ('account:update' = ANY("scopes"));