Skip to content

Commit b1750ac

Browse files
committed
feat(backend): add reset token endpoint for MCP installations
1 parent ed756ea commit b1750ac

File tree

9 files changed

+614
-0
lines changed

9 files changed

+614
-0
lines changed

services/backend/api-spec.json

Lines changed: 204 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30723,6 +30723,210 @@
3072330723
}
3072430724
}
3072530725
},
30726+
"/api/teams/{teamId}/mcp/installations/{installationId}/reset-token": {
30727+
"post": {
30728+
"summary": "Reset instance connection token",
30729+
"tags": [
30730+
"MCP Installations"
30731+
],
30732+
"description": "Regenerates the connection token for the current user's instance. The old token is immediately invalidated.",
30733+
"parameters": [
30734+
{
30735+
"schema": {
30736+
"type": "string",
30737+
"minLength": 1
30738+
},
30739+
"in": "path",
30740+
"name": "teamId",
30741+
"required": true,
30742+
"description": "Team ID that owns the installation"
30743+
},
30744+
{
30745+
"schema": {
30746+
"type": "string",
30747+
"minLength": 1
30748+
},
30749+
"in": "path",
30750+
"name": "installationId",
30751+
"required": true,
30752+
"description": "Installation ID"
30753+
}
30754+
],
30755+
"security": [
30756+
{
30757+
"cookieAuth": []
30758+
},
30759+
{
30760+
"bearerAuth": []
30761+
}
30762+
],
30763+
"responses": {
30764+
"200": {
30765+
"description": "Token reset successfully",
30766+
"content": {
30767+
"application/json": {
30768+
"schema": {
30769+
"type": "object",
30770+
"properties": {
30771+
"success": {
30772+
"type": "boolean",
30773+
"description": "Indicates if the token was reset successfully"
30774+
},
30775+
"data": {
30776+
"type": "object",
30777+
"properties": {
30778+
"instance_token": {
30779+
"type": "string",
30780+
"description": "New plaintext instance token"
30781+
}
30782+
},
30783+
"required": [
30784+
"instance_token"
30785+
]
30786+
}
30787+
},
30788+
"required": [
30789+
"success",
30790+
"data"
30791+
],
30792+
"description": "Token reset successfully"
30793+
}
30794+
}
30795+
}
30796+
},
30797+
"400": {
30798+
"description": "Bad Request - Invalid input or validation error",
30799+
"content": {
30800+
"application/json": {
30801+
"schema": {
30802+
"type": "object",
30803+
"properties": {
30804+
"success": {
30805+
"type": "boolean",
30806+
"default": false,
30807+
"description": "Indicates the operation failed"
30808+
},
30809+
"error": {
30810+
"type": "string",
30811+
"description": "Error message describing what went wrong"
30812+
}
30813+
},
30814+
"required": [
30815+
"success",
30816+
"error"
30817+
],
30818+
"description": "Bad Request - Invalid input or validation error"
30819+
}
30820+
}
30821+
}
30822+
},
30823+
"401": {
30824+
"description": "Unauthorized - Authentication required or invalid token",
30825+
"content": {
30826+
"application/json": {
30827+
"schema": {
30828+
"type": "object",
30829+
"properties": {
30830+
"success": {
30831+
"type": "boolean",
30832+
"default": false,
30833+
"description": "Indicates the operation failed"
30834+
},
30835+
"error": {
30836+
"type": "string",
30837+
"description": "Error message describing what went wrong"
30838+
}
30839+
},
30840+
"required": [
30841+
"success",
30842+
"error"
30843+
],
30844+
"description": "Unauthorized - Authentication required or invalid token"
30845+
}
30846+
}
30847+
}
30848+
},
30849+
"403": {
30850+
"description": "Forbidden - Insufficient permissions or scope",
30851+
"content": {
30852+
"application/json": {
30853+
"schema": {
30854+
"type": "object",
30855+
"properties": {
30856+
"success": {
30857+
"type": "boolean",
30858+
"default": false,
30859+
"description": "Indicates the operation failed"
30860+
},
30861+
"error": {
30862+
"type": "string",
30863+
"description": "Error message describing what went wrong"
30864+
}
30865+
},
30866+
"required": [
30867+
"success",
30868+
"error"
30869+
],
30870+
"description": "Forbidden - Insufficient permissions or scope"
30871+
}
30872+
}
30873+
}
30874+
},
30875+
"404": {
30876+
"description": "No instance found for this user and installation",
30877+
"content": {
30878+
"application/json": {
30879+
"schema": {
30880+
"type": "object",
30881+
"properties": {
30882+
"success": {
30883+
"type": "boolean",
30884+
"default": false,
30885+
"description": "Indicates the operation failed"
30886+
},
30887+
"error": {
30888+
"type": "string",
30889+
"description": "Error message describing what went wrong"
30890+
}
30891+
},
30892+
"required": [
30893+
"success",
30894+
"error"
30895+
],
30896+
"description": "No instance found for this user and installation"
30897+
}
30898+
}
30899+
}
30900+
},
30901+
"500": {
30902+
"description": "Internal Server Error",
30903+
"content": {
30904+
"application/json": {
30905+
"schema": {
30906+
"type": "object",
30907+
"properties": {
30908+
"success": {
30909+
"type": "boolean",
30910+
"default": false,
30911+
"description": "Indicates the operation failed"
30912+
},
30913+
"error": {
30914+
"type": "string",
30915+
"description": "Error message describing what went wrong"
30916+
}
30917+
},
30918+
"required": [
30919+
"success",
30920+
"error"
30921+
],
30922+
"description": "Internal Server Error"
30923+
}
30924+
}
30925+
}
30926+
}
30927+
}
30928+
}
30929+
},
3072630930
"/api/teams/{teamId}/mcp/oauth/callback/{flowId}": {
3072730931
"get": {
3072830932
"tags": [

services/backend/api-spec.yaml

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21834,6 +21834,144 @@ paths:
2183421834
- success
2183521835
- error
2183621836
description: Internal Server Error
21837+
/api/teams/{teamId}/mcp/installations/{installationId}/reset-token:
21838+
post:
21839+
summary: Reset instance connection token
21840+
tags:
21841+
- MCP Installations
21842+
description: Regenerates the connection token for the current user's instance.
21843+
The old token is immediately invalidated.
21844+
parameters:
21845+
- schema:
21846+
type: string
21847+
minLength: 1
21848+
in: path
21849+
name: teamId
21850+
required: true
21851+
description: Team ID that owns the installation
21852+
- schema:
21853+
type: string
21854+
minLength: 1
21855+
in: path
21856+
name: installationId
21857+
required: true
21858+
description: Installation ID
21859+
security:
21860+
- cookieAuth: []
21861+
- bearerAuth: []
21862+
responses:
21863+
"200":
21864+
description: Token reset successfully
21865+
content:
21866+
application/json:
21867+
schema:
21868+
type: object
21869+
properties:
21870+
success:
21871+
type: boolean
21872+
description: Indicates if the token was reset successfully
21873+
data:
21874+
type: object
21875+
properties:
21876+
instance_token:
21877+
type: string
21878+
description: New plaintext instance token
21879+
required:
21880+
- instance_token
21881+
required:
21882+
- success
21883+
- data
21884+
description: Token reset successfully
21885+
"400":
21886+
description: Bad Request - Invalid input or validation error
21887+
content:
21888+
application/json:
21889+
schema:
21890+
type: object
21891+
properties:
21892+
success:
21893+
type: boolean
21894+
default: false
21895+
description: Indicates the operation failed
21896+
error:
21897+
type: string
21898+
description: Error message describing what went wrong
21899+
required:
21900+
- success
21901+
- error
21902+
description: Bad Request - Invalid input or validation error
21903+
"401":
21904+
description: Unauthorized - Authentication required or invalid token
21905+
content:
21906+
application/json:
21907+
schema:
21908+
type: object
21909+
properties:
21910+
success:
21911+
type: boolean
21912+
default: false
21913+
description: Indicates the operation failed
21914+
error:
21915+
type: string
21916+
description: Error message describing what went wrong
21917+
required:
21918+
- success
21919+
- error
21920+
description: Unauthorized - Authentication required or invalid token
21921+
"403":
21922+
description: Forbidden - Insufficient permissions or scope
21923+
content:
21924+
application/json:
21925+
schema:
21926+
type: object
21927+
properties:
21928+
success:
21929+
type: boolean
21930+
default: false
21931+
description: Indicates the operation failed
21932+
error:
21933+
type: string
21934+
description: Error message describing what went wrong
21935+
required:
21936+
- success
21937+
- error
21938+
description: Forbidden - Insufficient permissions or scope
21939+
"404":
21940+
description: No instance found for this user and installation
21941+
content:
21942+
application/json:
21943+
schema:
21944+
type: object
21945+
properties:
21946+
success:
21947+
type: boolean
21948+
default: false
21949+
description: Indicates the operation failed
21950+
error:
21951+
type: string
21952+
description: Error message describing what went wrong
21953+
required:
21954+
- success
21955+
- error
21956+
description: No instance found for this user and installation
21957+
"500":
21958+
description: Internal Server Error
21959+
content:
21960+
application/json:
21961+
schema:
21962+
type: object
21963+
properties:
21964+
success:
21965+
type: boolean
21966+
default: false
21967+
description: Indicates the operation failed
21968+
error:
21969+
type: string
21970+
description: Error message describing what went wrong
21971+
required:
21972+
- success
21973+
- error
21974+
description: Internal Server Error
2183721975
/api/teams/{teamId}/mcp/oauth/callback/{flowId}:
2183821976
get:
2183921977
tags:

services/backend/src/routes/mcp/installations/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import getClientConfigRoute from './config';
1212
import deleteInstallationRoute from './delete';
1313
import authorizeRoute from './authorize';
1414
import reauthRoute from './reauth';
15+
import resetTokenRoute from './resetToken';
1516
import callbackRoute from './callback';
1617

1718
export default async function installationsRoutes(fastify: FastifyInstance) {
@@ -28,5 +29,6 @@ export default async function installationsRoutes(fastify: FastifyInstance) {
2829
await fastify.register(deleteInstallationRoute);
2930
await fastify.register(authorizeRoute);
3031
await fastify.register(reauthRoute);
32+
await fastify.register(resetTokenRoute);
3133
await fastify.register(callbackRoute);
3234
}

0 commit comments

Comments
 (0)