mirror of
https://github.com/langgenius/dify.git
synced 2026-09-24 23:22:26 +08:00
feat(api): add MCP user-identity forwarding (#36839)
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
autofix-ci[bot]
parent
db1aa683bc
commit
37e1d452b8
@@ -459,6 +459,7 @@ export type McpProviderCreatePayload = {
|
||||
icon: string
|
||||
icon_background?: string
|
||||
icon_type: string
|
||||
identity_mode?: IdentityMode
|
||||
name: string
|
||||
server_identifier: string
|
||||
server_url: string
|
||||
@@ -477,6 +478,7 @@ export type McpProviderUpdatePayload = {
|
||||
icon: string
|
||||
icon_background?: string
|
||||
icon_type: string
|
||||
identity_mode?: IdentityMode
|
||||
name: string
|
||||
provider_id: string
|
||||
server_identifier: string
|
||||
@@ -669,6 +671,8 @@ export type ApiProviderSchemaType = 'openai_actions' | 'openai_plugin' | 'openap
|
||||
|
||||
export type CredentialType = 'api-key' | 'oauth2' | 'unauthorized'
|
||||
|
||||
export type IdentityMode = 'idp_token' | 'off'
|
||||
|
||||
export type WorkflowToolParameterConfiguration = {
|
||||
description: string
|
||||
form: ToolParameterForm
|
||||
|
||||
@@ -351,37 +351,6 @@ export const zMcpProviderDeletePayload = z.object({
|
||||
provider_id: z.string(),
|
||||
})
|
||||
|
||||
/**
|
||||
* MCPProviderCreatePayload
|
||||
*/
|
||||
export const zMcpProviderCreatePayload = z.object({
|
||||
authentication: z.record(z.string(), z.unknown()).nullish(),
|
||||
configuration: z.record(z.string(), z.unknown()).nullish(),
|
||||
headers: z.record(z.string(), z.unknown()).nullish(),
|
||||
icon: z.string(),
|
||||
icon_background: z.string().optional().default(''),
|
||||
icon_type: z.string(),
|
||||
name: z.string(),
|
||||
server_identifier: z.string(),
|
||||
server_url: z.string(),
|
||||
})
|
||||
|
||||
/**
|
||||
* MCPProviderUpdatePayload
|
||||
*/
|
||||
export const zMcpProviderUpdatePayload = z.object({
|
||||
authentication: z.record(z.string(), z.unknown()).nullish(),
|
||||
configuration: z.record(z.string(), z.unknown()).nullish(),
|
||||
headers: z.record(z.string(), z.unknown()).nullish(),
|
||||
icon: z.string(),
|
||||
icon_background: z.string().optional().default(''),
|
||||
icon_type: z.string(),
|
||||
name: z.string(),
|
||||
provider_id: z.string(),
|
||||
server_identifier: z.string(),
|
||||
server_url: z.string(),
|
||||
})
|
||||
|
||||
/**
|
||||
* MCPAuthPayload
|
||||
*/
|
||||
@@ -829,6 +798,46 @@ export const zBuiltinToolAddPayload = z.object({
|
||||
visibility: z.string().nullish(),
|
||||
})
|
||||
|
||||
/**
|
||||
* IdentityMode
|
||||
*
|
||||
* How Dify forwards the end-user's identity to an MCP server.
|
||||
*/
|
||||
export const zIdentityMode = z.enum(['idp_token', 'off'])
|
||||
|
||||
/**
|
||||
* MCPProviderCreatePayload
|
||||
*/
|
||||
export const zMcpProviderCreatePayload = z.object({
|
||||
authentication: z.record(z.string(), z.unknown()).nullish(),
|
||||
configuration: z.record(z.string(), z.unknown()).nullish(),
|
||||
headers: z.record(z.string(), z.unknown()).nullish(),
|
||||
icon: z.string(),
|
||||
icon_background: z.string().optional().default(''),
|
||||
icon_type: z.string(),
|
||||
identity_mode: zIdentityMode.optional(),
|
||||
name: z.string(),
|
||||
server_identifier: z.string(),
|
||||
server_url: z.string(),
|
||||
})
|
||||
|
||||
/**
|
||||
* MCPProviderUpdatePayload
|
||||
*/
|
||||
export const zMcpProviderUpdatePayload = z.object({
|
||||
authentication: z.record(z.string(), z.unknown()).nullish(),
|
||||
configuration: z.record(z.string(), z.unknown()).nullish(),
|
||||
headers: z.record(z.string(), z.unknown()).nullish(),
|
||||
icon: z.string(),
|
||||
icon_background: z.string().optional().default(''),
|
||||
icon_type: z.string(),
|
||||
identity_mode: zIdentityMode.optional(),
|
||||
name: z.string(),
|
||||
provider_id: z.string(),
|
||||
server_identifier: z.string(),
|
||||
server_url: z.string(),
|
||||
})
|
||||
|
||||
/**
|
||||
* StrategySetting
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user