Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
422 changes: 422 additions & 0 deletions docs/docs.go

Large diffs are not rendered by default.

478 changes: 478 additions & 0 deletions docs/openapi.json

Large diffs are not rendered by default.

422 changes: 422 additions & 0 deletions docs/swagger.json

Large diffs are not rendered by default.

301 changes: 301 additions & 0 deletions docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1789,6 +1789,34 @@ definitions:
type: string
url:
type: string
user_headers:
description: |-
UserHeaders declares the upstream headers each caller fills with their
own value. Omitted on update, the stored declarations are kept; an empty
list removes them all.
items:
$ref: '#/definitions/github_com_NeuralTrust_TrustGate_pkg_api_handler_http_registry_request.MCPUserHeaderRequest'
type: array
type: object
github_com_NeuralTrust_TrustGate_pkg_api_handler_http_registry_request.MCPUserHeaderRequest:
properties:
description:
description: Description is the help shown to a person entering their value.
type: string
name:
description: Name is the HTTP header sent upstream, e.g. X-API-Key.
type: string
required:
description: Required refuses a call with a connect link until the caller
has a value.
type: boolean
scheme:
description: Scheme is written before the value, e.g. Bearer. Empty sends
it raw.
type: string
secret:
description: Secret keeps the value masked once entered.
type: boolean
type: object
github_com_NeuralTrust_TrustGate_pkg_api_handler_http_registry_request.OpenAPITargetRequest:
properties:
Expand Down Expand Up @@ -1964,6 +1992,40 @@ definitions:
additionalProperties: {}
type: object
type: object
github_com_NeuralTrust_TrustGate_pkg_api_handler_http_registry_request.UserHeaderImportRequest:
properties:
values:
items:
$ref: '#/definitions/github_com_NeuralTrust_TrustGate_pkg_api_handler_http_registry_request.UserHeaderImportValue'
type: array
type: object
github_com_NeuralTrust_TrustGate_pkg_api_handler_http_registry_request.UserHeaderImportValue:
properties:
header:
type: string
principal_sub:
type: string
value:
description: Value is the person's own value, stored encrypted and never returned.
type: string
type: object
github_com_NeuralTrust_TrustGate_pkg_api_handler_http_registry_request.UserHeaderLinkRequest:
properties:
consumer_path:
description: |-
ConsumerPath is the virtual MCP the person reaches the server through,
e.g. /dev/mcp. Required for a custom server; empty uses the MCP Store,
which serves only the servers it materialised.
type: string
principal_sub:
description: |-
PrincipalSub is the person: the subject their token carries, or
app:<consumer_id>:<end_user> for an end user an application names.
type: string
resume_url:
description: ResumeURL is where the page sends the person once they are done.
type: string
type: object
github_com_NeuralTrust_TrustGate_pkg_api_handler_http_registry_response.A2AAWSAuthResponse:
properties:
access_key_id:
Expand Down Expand Up @@ -2232,6 +2294,26 @@ definitions:
type: string
url:
type: string
user_headers:
description: |-
UserHeaders are the upstream headers each caller fills with their own
value. Only the declarations: values live per person in the vault.
items:
$ref: '#/definitions/github_com_NeuralTrust_TrustGate_pkg_api_handler_http_registry_response.MCPUserHeaderResponse'
type: array
type: object
github_com_NeuralTrust_TrustGate_pkg_api_handler_http_registry_response.MCPUserHeaderResponse:
properties:
description:
type: string
name:
type: string
required:
type: boolean
scheme:
type: string
secret:
type: boolean
type: object
github_com_NeuralTrust_TrustGate_pkg_api_handler_http_registry_response.OpenAPITargetResponse:
properties:
Expand Down Expand Up @@ -2425,6 +2507,51 @@ definitions:
type: string
type: array
type: object
github_com_NeuralTrust_TrustGate_pkg_api_handler_http_registry_response.UserHeaderCountResponse:
properties:
count:
type: integer
type: object
github_com_NeuralTrust_TrustGate_pkg_api_handler_http_registry_response.UserHeaderHolderResponse:
properties:
missing:
description: Missing lists the required headers this person has no usable
value for.
items:
type: string
type: array
principal_sub:
type: string
values:
items:
$ref: '#/definitions/github_com_NeuralTrust_TrustGate_pkg_api_handler_http_registry_response.UserHeaderValueResponse'
type: array
type: object
github_com_NeuralTrust_TrustGate_pkg_api_handler_http_registry_response.UserHeaderHoldersResponse:
properties:
holders:
items:
$ref: '#/definitions/github_com_NeuralTrust_TrustGate_pkg_api_handler_http_registry_response.UserHeaderHolderResponse'
type: array
type: object
github_com_NeuralTrust_TrustGate_pkg_api_handler_http_registry_response.UserHeaderLinkResponse:
properties:
consumer_path:
type: string
ticket:
type: string
type: object
github_com_NeuralTrust_TrustGate_pkg_api_handler_http_registry_response.UserHeaderValueResponse:
properties:
header:
type: string
rejected_at:
description: RejectedAt is set when the upstream refused the value with a
401.
type: string
updated_at:
type: string
type: object
github_com_NeuralTrust_TrustGate_pkg_api_handler_http_secretstore_request.TestSecretRequest:
properties:
field:
Expand Down Expand Up @@ -7700,6 +7827,180 @@ paths:
summary: List an MCP backend's tools
tags:
- registries
/v1/gateways/{gateway_id}/registries/{id}/user-headers:
get:
description: Lists every person holding a value for this MCP instance's per-user
headers, when each was written and whether the upstream refused it. Values
are never returned.
parameters:
- description: Gateway id
format: uuid
in: path
name: gateway_id
required: true
type: string
- description: Registry id
format: uuid
in: path
name: id
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/github_com_NeuralTrust_TrustGate_pkg_api_handler_http_registry_response.UserHeaderHoldersResponse'
"404":
description: Not Found
schema:
$ref: '#/definitions/github_com_NeuralTrust_TrustGate_pkg_api_handler_http_httpio.ErrorBody'
"409":
description: Conflict
schema:
$ref: '#/definitions/github_com_NeuralTrust_TrustGate_pkg_api_handler_http_httpio.ErrorBody'
security:
- BearerAuth: []
summary: List who holds per-user header values
tags:
- registries
/v1/gateways/{gateway_id}/registries/{id}/user-headers/links:
post:
consumes:
- application/json
description: 'Mints the connect page one person walks to enter their own values
for this instance. Hand it to that person: it acts as them. consumer_path
names the virtual MCP that binds the server and is required for a custom server.'
parameters:
- description: Gateway id
format: uuid
in: path
name: gateway_id
required: true
type: string
- description: Registry id
format: uuid
in: path
name: id
required: true
type: string
- description: Whose link
in: body
name: body
required: true
schema:
$ref: '#/definitions/github_com_NeuralTrust_TrustGate_pkg_api_handler_http_registry_request.UserHeaderLinkRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/github_com_NeuralTrust_TrustGate_pkg_api_handler_http_registry_response.UserHeaderLinkResponse'
"404":
description: Not Found
schema:
$ref: '#/definitions/github_com_NeuralTrust_TrustGate_pkg_api_handler_http_httpio.ErrorBody'
"409":
description: Conflict
schema:
$ref: '#/definitions/github_com_NeuralTrust_TrustGate_pkg_api_handler_http_httpio.ErrorBody'
"422":
description: Unprocessable Entity
schema:
$ref: '#/definitions/github_com_NeuralTrust_TrustGate_pkg_api_handler_http_httpio.ErrorBody'
security:
- BearerAuth: []
summary: Issue one person's link to enter their header values
tags:
- registries
/v1/gateways/{gateway_id}/registries/{id}/user-headers/values:
delete:
description: Removes the values one person holds for this instance (principal_sub),
or every person's when principal_sub is omitted. The next call of each affected
person answers with a connect link.
parameters:
- description: Gateway id
format: uuid
in: path
name: gateway_id
required: true
type: string
- description: Registry id
format: uuid
in: path
name: id
required: true
type: string
- description: One person; omitted resets everyone
in: query
name: principal_sub
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/github_com_NeuralTrust_TrustGate_pkg_api_handler_http_registry_response.UserHeaderCountResponse'
"404":
description: Not Found
schema:
$ref: '#/definitions/github_com_NeuralTrust_TrustGate_pkg_api_handler_http_httpio.ErrorBody'
security:
- BearerAuth: []
summary: Reset per-user header values
tags:
- registries
put:
consumes:
- application/json
description: Stores values for many people at once (up to 1000 rows). Every
row is validated before any is written; values are encrypted and never returned.
parameters:
- description: Gateway id
format: uuid
in: path
name: gateway_id
required: true
type: string
- description: Registry id
format: uuid
in: path
name: id
required: true
type: string
- description: Values to load
in: body
name: body
required: true
schema:
$ref: '#/definitions/github_com_NeuralTrust_TrustGate_pkg_api_handler_http_registry_request.UserHeaderImportRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/github_com_NeuralTrust_TrustGate_pkg_api_handler_http_registry_response.UserHeaderCountResponse'
"404":
description: Not Found
schema:
$ref: '#/definitions/github_com_NeuralTrust_TrustGate_pkg_api_handler_http_httpio.ErrorBody'
"409":
description: Conflict
schema:
$ref: '#/definitions/github_com_NeuralTrust_TrustGate_pkg_api_handler_http_httpio.ErrorBody'
"422":
description: Unprocessable Entity
schema:
$ref: '#/definitions/github_com_NeuralTrust_TrustGate_pkg_api_handler_http_httpio.ErrorBody'
security:
- BearerAuth: []
summary: Load per-user header values in bulk
tags:
- registries
/v1/gateways/{gateway_id}/registries/from-catalog:
post:
consumes:
Expand Down
10 changes: 8 additions & 2 deletions pkg/api/handler/http/oauth/connect_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ func (h *ConnectHandler) showPage(c *fiber.Ctx, ticket, flash string) error {
// before. A page the ticket does not scope to one server, or whose server is
// already here, is returned as it is.
func (h *ConnectHandler) awaitServer(ctx context.Context, ticket string, page *appoauth.ConnectPage) *appoauth.ConnectPage {
if strings.TrimSpace(page.Code) == "" || len(providerRowsForPage(page)) > 0 || h.holdFor <= 0 {
if strings.TrimSpace(page.Code) == "" || serverOnPage(page) || h.holdFor <= 0 {
return page
}
deadline := time.NewTimer(h.holdFor)
Expand All @@ -382,13 +382,19 @@ func (h *ConnectHandler) awaitServer(ctx context.Context, ticket string, page *a
return page
}
page = next
if len(providerRowsForPage(page)) > 0 {
if serverOnPage(page) {
return page
}
}
}
}

// serverOnPage reports whether the server a focused page is for has reached
// this plane: as an account to connect, or as keys to enter.
func serverOnPage(page *appoauth.ConnectPage) bool {
return len(providerRowsForPage(page)) > 0 || len(page.UserHeaders) > 0
}

func (h *ConnectHandler) pageError(c *fiber.Ctx, err error) error {
if errors.Is(err, appoauth.ErrTicketNotFound) {
return fiber.NewError(fiber.StatusUnauthorized, err.Error())
Expand Down
Loading
Loading