Skip to content

Commit b0b4a13

Browse files
committed
fix: Apply MCP node acquisition tool
1 parent f8249cd commit b0b4a13

File tree

4 files changed

+15
-11
lines changed

4 files changed

+15
-11
lines changed

apps/application/serializers/application.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -572,8 +572,8 @@ class PlayDemoTextRequest(serializers.Serializer):
572572

573573

574574
async def get_mcp_tools(servers):
575-
async with MultiServerMCPClient(servers) as client:
576-
return client.get_tools()
575+
client = MultiServerMCPClient(servers)
576+
return await client.get_tools()
577577

578578

579579
class McpServersSerializer(serializers.Serializer):

apps/application/views/application.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ def post(self, request: Request, workspace_id: str):
7171
RoleConstants.USER.get_workspace_role(),
7272
RoleConstants.WORKSPACE_MANAGE.get_workspace_role())
7373
def get(self, request: Request, workspace_id: str):
74-
return result.success(Query(data={'workspace_id': workspace_id, 'user_id': request.user.id}).list(request.query_params))
74+
return result.success(
75+
Query(data={'workspace_id': workspace_id, 'user_id': request.user.id}).list(request.query_params))
7576

7677
class Page(APIView):
7778
authentication_classes = [TokenAuth]
@@ -266,9 +267,11 @@ class McpServers(APIView):
266267
[PermissionConstants.APPLICATION.get_workspace_application_permission()],
267268
CompareConstants.AND),
268269
RoleConstants.WORKSPACE_MANAGE.get_workspace_role())
269-
def get(self, request: Request, workspace_id, application_id: str):
270+
def post(self, request: Request, workspace_id, application_id: str):
270271
return result.success(ApplicationOperateSerializer(
271-
data={'mcp_servers': request.query_params.get('mcp_servers')}).get_mcp_servers())
272+
data={'mcp_servers': request.query_params.get('mcp_servers'), 'workspace_id': workspace_id,
273+
'user_id': request.user.id,
274+
'application_id': application_id}).get_mcp_servers(request.data))
272275

273276

274277
class SpeechToText(APIView):

ui/src/api/application/application.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -289,11 +289,12 @@ const speechToText: (
289289
/**
290290
* mcp 节点
291291
*/
292-
const getMcpTools: (application_id: String, loading?: Ref<boolean>) => Promise<Result<any>> = (
293-
application_id,
294-
loading,
295-
) => {
296-
return get(`${prefix.value}/${application_id}/mcp_tools`, undefined, loading)
292+
const getMcpTools: (
293+
application_id: String,
294+
mcp_servers: any,
295+
loading?: Ref<boolean>,
296+
) => Promise<Result<any>> = (application_id, mcp_servers, loading) => {
297+
return post(`${prefix.value}/${application_id}/mcp_tools`, { mcp_servers }, {}, loading)
297298
}
298299

299300
/**

ui/src/workflow/nodes/mcp-node/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ function getTools() {
260260
MsgError(t('views.applicationWorkflow.nodes.mcpNode.mcpServerTip'))
261261
return
262262
}
263-
applicationApi.getMcpTools(id, loading).then((res: any) => {
263+
applicationApi.getMcpTools(id, form_data.value.mcp_servers, loading).then((res: any) => {
264264
form_data.value.mcp_tools = res.data
265265
MsgSuccess(t('views.applicationWorkflow.nodes.mcpNode.getToolsSuccess'))
266266
// 修改了json,刷新mcp_server

0 commit comments

Comments
 (0)