Skip to content

Commit 6544193

Browse files
author
Lasim
committed
feat(backend): add configurable team member limit and update error messages
1 parent 0bbf82e commit 6544193

File tree

4 files changed

+19
-4
lines changed

4 files changed

+19
-4
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ Our roadmap is designed to build the essential infrastructure for using MCP secu
112112

113113
- **[To Do]** Build out Audit Logging features in the cloud UI.
114114
- **[To Do]** Develop Analytics dashboards for tool usage and performance.
115+
- **[To Do]** Add `deploystack logs` command for real-time gateway activity monitoring.
115116
- **[To Do]** Implement advanced policy controls (e.g., rate limiting, request validation).
116117
- **[To Do]** Add support for proxying to remote, HTTP-based MCP servers.
117118

services/backend/src/global-settings/global.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,14 @@ export const globalSettings: GlobalSettingsModule = {
4848
description: 'Show backend version in the root API response. When disabled, version information is hidden from visitors.',
4949
encrypted: false,
5050
required: false
51+
},
52+
{
53+
key: 'global.team_member_limit',
54+
defaultValue: 3,
55+
type: 'number',
56+
description: 'Maximum number of members allowed in non-default teams. Default teams are always limited to 1 member (the owner).',
57+
encrypted: false,
58+
required: false
5159
}
5260
]
5361
};

services/backend/src/routes/teams/members/add.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export default async function addTeamMemberRoute(server: FastifyInstance) {
2929
schema: {
3030
tags: ['Team Members'],
3131
summary: 'Add team member',
32-
description: 'Adds a new member to a team by email address. Only team admins and owners can add members. Cannot add members to default teams. Teams are limited to 3 members maximum. Requires Content-Type: application/json header when sending request body.',
32+
description: 'Adds a new member to a team by email address. Only team admins and owners can add members. Cannot add members to default teams. Team member limit is configurable via global settings (default: 3 members maximum). Requires Content-Type: application/json header when sending request body.',
3333
security: [{ cookieAuth: [] }],
3434
params: {
3535
type: 'object',

services/backend/src/services/teamService.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import { eq, and, count } from 'drizzle-orm';
33
import { getDb, getSchema } from '../db/index';
44
import { generateId } from 'lucia';
5+
import { GlobalSettings } from '../global-settings/helpers';
56

67
export interface Team {
78
id: string;
@@ -423,9 +424,12 @@ export class TeamService {
423424
return false;
424425
}
425426

426-
// Check if team has less than 3 members
427+
// Get team member limit from global settings
428+
const memberLimit = await GlobalSettings.getNumber('global.team_member_limit', 3);
429+
430+
// Check if team has less than the configured limit
427431
const memberCount = await this.getTeamMemberCount(teamId);
428-
return memberCount < 3;
432+
return memberCount < memberLimit;
429433
}
430434

431435
/**
@@ -527,7 +531,9 @@ export class TeamService {
527531
if (await this.isTeamDefault(teamId)) {
528532
throw new Error('Cannot add members to default teams');
529533
} else {
530-
throw new Error('Team has reached maximum capacity (3 members)');
534+
// Get the actual limit for the error message
535+
const memberLimit = await GlobalSettings.getNumber('global.team_member_limit', 3);
536+
throw new Error(`Team has reached maximum capacity (${memberLimit} members)`);
531537
}
532538
}
533539

0 commit comments

Comments
 (0)