Skip to content

Commit d13cd98

Browse files
author
Lasim
committed
feat(gateway): add endpoint to retrieve merged MCP configurations
1 parent fa14c5a commit d13cd98

File tree

4 files changed

+789
-0
lines changed

4 files changed

+789
-0
lines changed

services/backend/api-spec.json

Lines changed: 216 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23240,6 +23240,222 @@
2324023240
}
2324123241
}
2324223242
},
23243+
"/api/gateway/me/mcp-configurations": {
23244+
"get": {
23245+
"summary": "Get merged MCP configurations for gateway",
23246+
"tags": [
23247+
"Gateway"
23248+
],
23249+
"description": "Retrieves all MCP server configurations for the authenticated user with merged template, team, and user-specific values. Supports both cookie-based authentication (for web users) and OAuth2 Bearer token authentication (for CLI users). Requires mcp:read scope for OAuth2 access.",
23250+
"parameters": [
23251+
{
23252+
"schema": {
23253+
"type": "string"
23254+
},
23255+
"in": "query",
23256+
"name": "device_id",
23257+
"required": false,
23258+
"description": "Device ID to get device-specific user configurations"
23259+
}
23260+
],
23261+
"security": [
23262+
{
23263+
"cookieAuth": []
23264+
},
23265+
{
23266+
"bearerAuth": []
23267+
}
23268+
],
23269+
"responses": {
23270+
"200": {
23271+
"description": "MCP configurations retrieved successfully",
23272+
"content": {
23273+
"application/json": {
23274+
"schema": {
23275+
"type": "object",
23276+
"properties": {
23277+
"success": {
23278+
"type": "boolean",
23279+
"default": true
23280+
},
23281+
"data": {
23282+
"type": "object",
23283+
"properties": {
23284+
"servers": {
23285+
"type": "array",
23286+
"items": {
23287+
"type": "object",
23288+
"properties": {
23289+
"id": {
23290+
"type": "string",
23291+
"description": "Server identifier"
23292+
},
23293+
"name": {
23294+
"type": "string",
23295+
"description": "Server name"
23296+
},
23297+
"command": {
23298+
"type": "string",
23299+
"description": "Command to execute"
23300+
},
23301+
"args": {
23302+
"type": "array",
23303+
"items": {
23304+
"type": "string"
23305+
},
23306+
"description": "Command arguments with user values merged"
23307+
},
23308+
"env": {
23309+
"type": "object",
23310+
"additionalProperties": {
23311+
"type": "string"
23312+
},
23313+
"description": "Environment variables with user values merged"
23314+
},
23315+
"status": {
23316+
"type": "string",
23317+
"enum": [
23318+
"ready",
23319+
"invalid"
23320+
],
23321+
"description": "Server configuration status"
23322+
}
23323+
},
23324+
"required": [
23325+
"id",
23326+
"name",
23327+
"command",
23328+
"args",
23329+
"env",
23330+
"status"
23331+
],
23332+
"additionalProperties": false
23333+
}
23334+
}
23335+
},
23336+
"required": [
23337+
"servers"
23338+
],
23339+
"additionalProperties": false
23340+
}
23341+
},
23342+
"required": [
23343+
"success",
23344+
"data"
23345+
],
23346+
"additionalProperties": false,
23347+
"description": "MCP configurations retrieved successfully"
23348+
}
23349+
}
23350+
}
23351+
},
23352+
"400": {
23353+
"description": "Bad Request - Invalid device_id or missing parameters",
23354+
"content": {
23355+
"application/json": {
23356+
"schema": {
23357+
"type": "object",
23358+
"properties": {
23359+
"success": {
23360+
"type": "boolean",
23361+
"default": false
23362+
},
23363+
"error": {
23364+
"type": "string",
23365+
"description": "Error message"
23366+
}
23367+
},
23368+
"required": [
23369+
"success",
23370+
"error"
23371+
],
23372+
"additionalProperties": false,
23373+
"description": "Bad Request - Invalid device_id or missing parameters"
23374+
}
23375+
}
23376+
}
23377+
},
23378+
"401": {
23379+
"description": "Unauthorized",
23380+
"content": {
23381+
"application/json": {
23382+
"schema": {
23383+
"type": "object",
23384+
"properties": {
23385+
"success": {
23386+
"type": "boolean",
23387+
"default": false
23388+
},
23389+
"error": {
23390+
"type": "string",
23391+
"description": "Error message"
23392+
}
23393+
},
23394+
"required": [
23395+
"success",
23396+
"error"
23397+
],
23398+
"additionalProperties": false,
23399+
"description": "Unauthorized"
23400+
}
23401+
}
23402+
}
23403+
},
23404+
"403": {
23405+
"description": "Forbidden",
23406+
"content": {
23407+
"application/json": {
23408+
"schema": {
23409+
"type": "object",
23410+
"properties": {
23411+
"success": {
23412+
"type": "boolean",
23413+
"default": false
23414+
},
23415+
"error": {
23416+
"type": "string",
23417+
"description": "Error message"
23418+
}
23419+
},
23420+
"required": [
23421+
"success",
23422+
"error"
23423+
],
23424+
"additionalProperties": false,
23425+
"description": "Forbidden"
23426+
}
23427+
}
23428+
}
23429+
},
23430+
"500": {
23431+
"description": "Internal Server Error",
23432+
"content": {
23433+
"application/json": {
23434+
"schema": {
23435+
"type": "object",
23436+
"properties": {
23437+
"success": {
23438+
"type": "boolean",
23439+
"default": false
23440+
},
23441+
"error": {
23442+
"type": "string",
23443+
"description": "Error message"
23444+
}
23445+
},
23446+
"required": [
23447+
"success",
23448+
"error"
23449+
],
23450+
"additionalProperties": false,
23451+
"description": "Internal Server Error"
23452+
}
23453+
}
23454+
}
23455+
}
23456+
}
23457+
}
23458+
},
2324323459
"/api/auth/email/register": {
2324423460
"post": {
2324523461
"summary": "User registration via email",

services/backend/api-spec.yaml

Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16053,6 +16053,158 @@ paths:
1605316053
- success
1605416054
- error
1605516055
description: Internal Server Error
16056+
/api/gateway/me/mcp-configurations:
16057+
get:
16058+
summary: Get merged MCP configurations for gateway
16059+
tags:
16060+
- Gateway
16061+
description: Retrieves all MCP server configurations for the authenticated user
16062+
with merged template, team, and user-specific values. Supports both
16063+
cookie-based authentication (for web users) and OAuth2 Bearer token
16064+
authentication (for CLI users). Requires mcp:read scope for OAuth2
16065+
access.
16066+
parameters:
16067+
- schema:
16068+
type: string
16069+
in: query
16070+
name: device_id
16071+
required: false
16072+
description: Device ID to get device-specific user configurations
16073+
security:
16074+
- cookieAuth: []
16075+
- bearerAuth: []
16076+
responses:
16077+
"200":
16078+
description: MCP configurations retrieved successfully
16079+
content:
16080+
application/json:
16081+
schema:
16082+
type: object
16083+
properties:
16084+
success:
16085+
type: boolean
16086+
default: true
16087+
data:
16088+
type: object
16089+
properties:
16090+
servers:
16091+
type: array
16092+
items:
16093+
type: object
16094+
properties:
16095+
id:
16096+
type: string
16097+
description: Server identifier
16098+
name:
16099+
type: string
16100+
description: Server name
16101+
command:
16102+
type: string
16103+
description: Command to execute
16104+
args:
16105+
type: array
16106+
items:
16107+
type: string
16108+
description: Command arguments with user values merged
16109+
env:
16110+
type: object
16111+
additionalProperties:
16112+
type: string
16113+
description: Environment variables with user values merged
16114+
status:
16115+
type: string
16116+
enum:
16117+
- ready
16118+
- invalid
16119+
description: Server configuration status
16120+
required:
16121+
- id
16122+
- name
16123+
- command
16124+
- args
16125+
- env
16126+
- status
16127+
additionalProperties: false
16128+
required:
16129+
- servers
16130+
additionalProperties: false
16131+
required:
16132+
- success
16133+
- data
16134+
additionalProperties: false
16135+
description: MCP configurations retrieved successfully
16136+
"400":
16137+
description: Bad Request - Invalid device_id or missing parameters
16138+
content:
16139+
application/json:
16140+
schema:
16141+
type: object
16142+
properties:
16143+
success:
16144+
type: boolean
16145+
default: false
16146+
error:
16147+
type: string
16148+
description: Error message
16149+
required:
16150+
- success
16151+
- error
16152+
additionalProperties: false
16153+
description: Bad Request - Invalid device_id or missing parameters
16154+
"401":
16155+
description: Unauthorized
16156+
content:
16157+
application/json:
16158+
schema:
16159+
type: object
16160+
properties:
16161+
success:
16162+
type: boolean
16163+
default: false
16164+
error:
16165+
type: string
16166+
description: Error message
16167+
required:
16168+
- success
16169+
- error
16170+
additionalProperties: false
16171+
description: Unauthorized
16172+
"403":
16173+
description: Forbidden
16174+
content:
16175+
application/json:
16176+
schema:
16177+
type: object
16178+
properties:
16179+
success:
16180+
type: boolean
16181+
default: false
16182+
error:
16183+
type: string
16184+
description: Error message
16185+
required:
16186+
- success
16187+
- error
16188+
additionalProperties: false
16189+
description: Forbidden
16190+
"500":
16191+
description: Internal Server Error
16192+
content:
16193+
application/json:
16194+
schema:
16195+
type: object
16196+
properties:
16197+
success:
16198+
type: boolean
16199+
default: false
16200+
error:
16201+
type: string
16202+
description: Error message
16203+
required:
16204+
- success
16205+
- error
16206+
additionalProperties: false
16207+
description: Internal Server Error
1605616208
/api/auth/email/register:
1605716209
post:
1605816210
summary: User registration via email
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import { type FastifyInstance } from 'fastify';
22
import getClientConfig from './config/get-client-config';
33
import listClients from './config/list-clients';
4+
import meMcpConfigurations from './me-mcp-configurations';
45

56
export default async function gatewayRoutes(server: FastifyInstance) {
67
// Register gateway configuration routes
78
await server.register(getClientConfig);
89
await server.register(listClients);
10+
await server.register(meMcpConfigurations);
911
}

0 commit comments

Comments
 (0)