mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-20 01:09: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
|
||||
}
|
||||
|
||||
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 type {
|
||||
Collection,
|
||||
MCPServerDetail,
|
||||
Tool,
|
||||
} from '@/app/components/tools/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) => {
|
||||
return useQuery({
|
||||
queryKey: [NAME_SPACE, 'builtin-provider-info', providerName],
|
||||
|
Loading…
x
Reference in New Issue
Block a user