Skip to content

Commit 32582c9

Browse files
author
christopherholland-workday
committed
Use secureFetch and secureAxiosRequest for more URLs
1 parent e63f6bd commit 32582c9

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

  • packages/components/nodes/tools/MCP

packages/components/nodes/tools/MCP/core.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { BaseToolkit, tool, Tool } from '@langchain/core/tools'
55
import { z } from 'zod'
66
import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js'
77
import { SSEClientTransport } from '@modelcontextprotocol/sdk/client/sse.js'
8-
import { checkDenyList } from '../../../src/httpSecurity'
8+
import { checkDenyList, secureFetch } from '../../../src/httpSecurity'
99

1010
export class MCPToolkit extends BaseToolkit {
1111
tools: Tool[] = []
@@ -73,17 +73,18 @@ export class MCPToolkit extends BaseToolkit {
7373
},
7474
eventSourceInit: {
7575
fetch: async (url, init) => {
76-
await checkDenyList(url.toString())
77-
return fetch(url, { ...init, headers: this.serverParams.headers })
76+
return secureFetch(url.toString(), {
77+
...(init as any),
78+
headers: this.serverParams.headers
79+
}) as any
7880
}
7981
}
8082
})
8183
} else {
8284
transport = new SSEClientTransport(baseUrl, {
8385
eventSourceInit: {
8486
fetch: async (url, init) => {
85-
await checkDenyList(url.toString())
86-
return fetch(url, init)
87+
return secureFetch(url.toString(), init as any) as any
8788
}
8889
}
8990
})

0 commit comments

Comments
 (0)