Browse Source

Add scope to update account to MCP access

pull/8177/head
Thomas Kaul 1 day ago
parent
commit
2812dfa822
  1. 8
      libs/common/src/lib/scopes.spec.ts
  2. 2
      libs/common/src/lib/scopes.ts
  3. 6
      prisma/migrations/20261014000000_added_account_update_scope_to_mcp_access/migration.sql

8
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

2
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<AccessType, readonly Scope[]> = {
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
};

6
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"));
Loading…
Cancel
Save