mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-20 02:29:05 +08:00
api of MCP server detail
This commit is contained in:
parent
a8bc02e39e
commit
ccea3212a2
@ -172,3 +172,11 @@ export type WorkflowToolProviderResponse = {
|
|||||||
}
|
}
|
||||||
privacy_policy: string
|
privacy_policy: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type MCPServerDetail = {
|
||||||
|
id: string
|
||||||
|
server_code: string
|
||||||
|
description: string
|
||||||
|
status: string
|
||||||
|
parameters?: Record<string, string>
|
||||||
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import { del, get, post, put } from './base'
|
import { del, get, post, put } from './base'
|
||||||
import type {
|
import type {
|
||||||
Collection,
|
Collection,
|
||||||
|
MCPServerDetail,
|
||||||
Tool,
|
Tool,
|
||||||
} from '@/app/components/tools/types'
|
} from '@/app/components/tools/types'
|
||||||
import type { ToolWithProvider } from '@/app/components/workflow/types'
|
import type { ToolWithProvider } from '@/app/components/workflow/types'
|
||||||
@ -175,6 +176,60 @@ export const useUpdateMCPTools = (providerID: string) => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const useMCPServerDetail = (appID: string) => {
|
||||||
|
return useQuery<MCPServerDetail>({
|
||||||
|
queryKey: [NAME_SPACE, 'MCPServerDetail', appID],
|
||||||
|
queryFn: () => get<MCPServerDetail>(`/apps/${appID}/server`),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const useCreateMCPServer = ({
|
||||||
|
onSuccess,
|
||||||
|
}: {
|
||||||
|
onSuccess?: () => void
|
||||||
|
}) => {
|
||||||
|
return useMutation({
|
||||||
|
mutationKey: [NAME_SPACE, 'create-mcp-server'],
|
||||||
|
mutationFn: (payload: {
|
||||||
|
appID: string
|
||||||
|
description: string
|
||||||
|
parameters?: Record<string, string>
|
||||||
|
}) => {
|
||||||
|
const { appID, ...rest } = payload
|
||||||
|
return post(`apps/${appID}/server`, {
|
||||||
|
body: {
|
||||||
|
...rest,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
},
|
||||||
|
onSuccess,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const useUpdateMCPServer = ({
|
||||||
|
onSuccess,
|
||||||
|
}: {
|
||||||
|
onSuccess?: () => void
|
||||||
|
}) => {
|
||||||
|
return useMutation({
|
||||||
|
mutationKey: [NAME_SPACE, 'update-mcp-server'],
|
||||||
|
mutationFn: (payload: {
|
||||||
|
appID: string
|
||||||
|
description?: string
|
||||||
|
status?: string
|
||||||
|
parameters?: Record<string, string>
|
||||||
|
}) => {
|
||||||
|
const { appID, ...rest } = payload
|
||||||
|
return put(`apps/${appID}/server`, {
|
||||||
|
body: {
|
||||||
|
...rest,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
},
|
||||||
|
onSuccess,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
export const useBuiltinProviderInfo = (providerName: string) => {
|
export const useBuiltinProviderInfo = (providerName: string) => {
|
||||||
return useQuery({
|
return useQuery({
|
||||||
queryKey: [NAME_SPACE, 'builtin-provider-info', providerName],
|
queryKey: [NAME_SPACE, 'builtin-provider-info', providerName],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user