Skip to content

Commit 0be749b

Browse files
author
Lasim
committed
feat(backend): add API endpoint for retrieving team usage statistics
1 parent 0eb2ae6 commit 0be749b

File tree

5 files changed

+619
-0
lines changed

5 files changed

+619
-0
lines changed

services/backend/api-spec.json

Lines changed: 218 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10518,6 +10518,224 @@
1051810518
}
1051910519
}
1052010520
},
10521+
"/api/teams/{id}/usage": {
10522+
"get": {
10523+
"summary": "Get team usage statistics",
10524+
"tags": [
10525+
"Teams"
10526+
],
10527+
"description": "Retrieves MCP server installation counts and limits for a specific team. Only team members can view their team's usage.",
10528+
"parameters": [
10529+
{
10530+
"schema": {
10531+
"type": "string",
10532+
"minLength": 1
10533+
},
10534+
"in": "path",
10535+
"name": "id",
10536+
"required": true,
10537+
"description": "Team ID"
10538+
}
10539+
],
10540+
"security": [
10541+
{
10542+
"cookieAuth": []
10543+
}
10544+
],
10545+
"responses": {
10546+
"200": {
10547+
"description": "Team usage retrieved successfully",
10548+
"content": {
10549+
"application/json": {
10550+
"schema": {
10551+
"type": "object",
10552+
"properties": {
10553+
"success": {
10554+
"type": "boolean",
10555+
"description": "Indicates if the operation was successful"
10556+
},
10557+
"data": {
10558+
"type": "object",
10559+
"properties": {
10560+
"is_default_team": {
10561+
"type": "boolean",
10562+
"description": "Whether this team is the calling user's default team"
10563+
},
10564+
"total_installed_mcp_servers": {
10565+
"type": "number",
10566+
"description": "Total number of MCP servers installed for the team"
10567+
},
10568+
"non_http_mcp_servers": {
10569+
"type": "number",
10570+
"description": "Number of non-HTTP MCP servers (stdio transport)"
10571+
},
10572+
"http_mcp_servers": {
10573+
"type": "number",
10574+
"description": "Number of HTTP MCP servers (http/sse transport)"
10575+
},
10576+
"limits": {
10577+
"type": "object",
10578+
"properties": {
10579+
"mcp_server_limit": {
10580+
"type": "number",
10581+
"description": "Maximum total MCP servers allowed for the team"
10582+
},
10583+
"non_http_mcp_limit": {
10584+
"type": "number",
10585+
"description": "Maximum non-HTTP MCP servers allowed for the team"
10586+
}
10587+
},
10588+
"required": [
10589+
"mcp_server_limit",
10590+
"non_http_mcp_limit"
10591+
]
10592+
}
10593+
},
10594+
"required": [
10595+
"is_default_team",
10596+
"total_installed_mcp_servers",
10597+
"non_http_mcp_servers",
10598+
"http_mcp_servers",
10599+
"limits"
10600+
]
10601+
}
10602+
},
10603+
"required": [
10604+
"success",
10605+
"data"
10606+
],
10607+
"description": "Team usage retrieved successfully"
10608+
}
10609+
}
10610+
}
10611+
},
10612+
"401": {
10613+
"description": "Unauthorized - Authentication required",
10614+
"content": {
10615+
"application/json": {
10616+
"schema": {
10617+
"type": "object",
10618+
"properties": {
10619+
"success": {
10620+
"type": "boolean",
10621+
"default": false,
10622+
"description": "Indicates if the operation was successful (false for errors)"
10623+
},
10624+
"error": {
10625+
"type": "string",
10626+
"description": "Error message"
10627+
},
10628+
"details": {
10629+
"type": "array",
10630+
"items": {},
10631+
"description": "Additional error details (validation errors)"
10632+
}
10633+
},
10634+
"required": [
10635+
"success",
10636+
"error"
10637+
],
10638+
"description": "Unauthorized - Authentication required"
10639+
}
10640+
}
10641+
}
10642+
},
10643+
"403": {
10644+
"description": "Forbidden - Insufficient permissions",
10645+
"content": {
10646+
"application/json": {
10647+
"schema": {
10648+
"type": "object",
10649+
"properties": {
10650+
"success": {
10651+
"type": "boolean",
10652+
"default": false,
10653+
"description": "Indicates if the operation was successful (false for errors)"
10654+
},
10655+
"error": {
10656+
"type": "string",
10657+
"description": "Error message"
10658+
},
10659+
"details": {
10660+
"type": "array",
10661+
"items": {},
10662+
"description": "Additional error details (validation errors)"
10663+
}
10664+
},
10665+
"required": [
10666+
"success",
10667+
"error"
10668+
],
10669+
"description": "Forbidden - Insufficient permissions"
10670+
}
10671+
}
10672+
}
10673+
},
10674+
"404": {
10675+
"description": "Not Found - Team not found",
10676+
"content": {
10677+
"application/json": {
10678+
"schema": {
10679+
"type": "object",
10680+
"properties": {
10681+
"success": {
10682+
"type": "boolean",
10683+
"default": false,
10684+
"description": "Indicates if the operation was successful (false for errors)"
10685+
},
10686+
"error": {
10687+
"type": "string",
10688+
"description": "Error message"
10689+
},
10690+
"details": {
10691+
"type": "array",
10692+
"items": {},
10693+
"description": "Additional error details (validation errors)"
10694+
}
10695+
},
10696+
"required": [
10697+
"success",
10698+
"error"
10699+
],
10700+
"description": "Not Found - Team not found"
10701+
}
10702+
}
10703+
}
10704+
},
10705+
"500": {
10706+
"description": "Internal Server Error",
10707+
"content": {
10708+
"application/json": {
10709+
"schema": {
10710+
"type": "object",
10711+
"properties": {
10712+
"success": {
10713+
"type": "boolean",
10714+
"default": false,
10715+
"description": "Indicates if the operation was successful (false for errors)"
10716+
},
10717+
"error": {
10718+
"type": "string",
10719+
"description": "Error message"
10720+
},
10721+
"details": {
10722+
"type": "array",
10723+
"items": {},
10724+
"description": "Additional error details (validation errors)"
10725+
}
10726+
},
10727+
"required": [
10728+
"success",
10729+
"error"
10730+
],
10731+
"description": "Internal Server Error"
10732+
}
10733+
}
10734+
}
10735+
}
10736+
}
10737+
}
10738+
},
1052110739
"/api/teams/{id}/members": {
1052210740
"get": {
1052310741
"summary": "Get team members",

services/backend/api-spec.yaml

Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7285,6 +7285,159 @@ paths:
72857285
- success
72867286
- error
72877287
description: Internal Server Error
7288+
/api/teams/{id}/usage:
7289+
get:
7290+
summary: Get team usage statistics
7291+
tags:
7292+
- Teams
7293+
description: Retrieves MCP server installation counts and limits for a specific
7294+
team. Only team members can view their team's usage.
7295+
parameters:
7296+
- schema:
7297+
type: string
7298+
minLength: 1
7299+
in: path
7300+
name: id
7301+
required: true
7302+
description: Team ID
7303+
security:
7304+
- cookieAuth: []
7305+
responses:
7306+
"200":
7307+
description: Team usage retrieved successfully
7308+
content:
7309+
application/json:
7310+
schema:
7311+
type: object
7312+
properties:
7313+
success:
7314+
type: boolean
7315+
description: Indicates if the operation was successful
7316+
data:
7317+
type: object
7318+
properties:
7319+
is_default_team:
7320+
type: boolean
7321+
description: Whether this team is the calling user's default team
7322+
total_installed_mcp_servers:
7323+
type: number
7324+
description: Total number of MCP servers installed for the team
7325+
non_http_mcp_servers:
7326+
type: number
7327+
description: Number of non-HTTP MCP servers (stdio transport)
7328+
http_mcp_servers:
7329+
type: number
7330+
description: Number of HTTP MCP servers (http/sse transport)
7331+
limits:
7332+
type: object
7333+
properties:
7334+
mcp_server_limit:
7335+
type: number
7336+
description: Maximum total MCP servers allowed for the team
7337+
non_http_mcp_limit:
7338+
type: number
7339+
description: Maximum non-HTTP MCP servers allowed for the team
7340+
required:
7341+
- mcp_server_limit
7342+
- non_http_mcp_limit
7343+
required:
7344+
- is_default_team
7345+
- total_installed_mcp_servers
7346+
- non_http_mcp_servers
7347+
- http_mcp_servers
7348+
- limits
7349+
required:
7350+
- success
7351+
- data
7352+
description: Team usage retrieved successfully
7353+
"401":
7354+
description: Unauthorized - Authentication required
7355+
content:
7356+
application/json:
7357+
schema:
7358+
type: object
7359+
properties:
7360+
success:
7361+
type: boolean
7362+
default: false
7363+
description: Indicates if the operation was successful (false for errors)
7364+
error:
7365+
type: string
7366+
description: Error message
7367+
details:
7368+
type: array
7369+
items: {}
7370+
description: Additional error details (validation errors)
7371+
required:
7372+
- success
7373+
- error
7374+
description: Unauthorized - Authentication required
7375+
"403":
7376+
description: Forbidden - Insufficient permissions
7377+
content:
7378+
application/json:
7379+
schema:
7380+
type: object
7381+
properties:
7382+
success:
7383+
type: boolean
7384+
default: false
7385+
description: Indicates if the operation was successful (false for errors)
7386+
error:
7387+
type: string
7388+
description: Error message
7389+
details:
7390+
type: array
7391+
items: {}
7392+
description: Additional error details (validation errors)
7393+
required:
7394+
- success
7395+
- error
7396+
description: Forbidden - Insufficient permissions
7397+
"404":
7398+
description: Not Found - Team not found
7399+
content:
7400+
application/json:
7401+
schema:
7402+
type: object
7403+
properties:
7404+
success:
7405+
type: boolean
7406+
default: false
7407+
description: Indicates if the operation was successful (false for errors)
7408+
error:
7409+
type: string
7410+
description: Error message
7411+
details:
7412+
type: array
7413+
items: {}
7414+
description: Additional error details (validation errors)
7415+
required:
7416+
- success
7417+
- error
7418+
description: Not Found - Team not found
7419+
"500":
7420+
description: Internal Server Error
7421+
content:
7422+
application/json:
7423+
schema:
7424+
type: object
7425+
properties:
7426+
success:
7427+
type: boolean
7428+
default: false
7429+
description: Indicates if the operation was successful (false for errors)
7430+
error:
7431+
type: string
7432+
description: Error message
7433+
details:
7434+
type: array
7435+
items: {}
7436+
description: Additional error details (validation errors)
7437+
required:
7438+
- success
7439+
- error
7440+
description: Internal Server Error
72887441
/api/teams/{id}/members:
72897442
get:
72907443
summary: Get team members

0 commit comments

Comments
 (0)