@@ -11,7 +11,7 @@ import { useTranslation } from "react-i18next"
1111import { useDebounceEffect } from "@src/utils/useDebounceEffect"
1212import { appendImages } from "@src/utils/imageUtils"
1313
14- import type { ClineAsk , ClineMessage } from "@roo-code/types"
14+ import type { ClineAsk , ClineMessage , McpServerUse } from "@roo-code/types"
1515
1616import { ClineSayBrowserAction , ClineSayTool , ExtensionMessage } from "@roo/ExtensionMessage"
1717import { McpServer , McpTool } from "@roo/mcp"
@@ -1062,9 +1062,9 @@ const ChatViewComponent: React.ForwardRefRenderFunction<ChatViewRef, ChatViewPro
10621062 return true
10631063 }
10641064
1065- const mcpServerUse = JSON . parse ( message . text ) as { type : string ; serverName : string ; toolName : string }
1065+ const mcpServerUse = JSON . parse ( message . text ) as McpServerUse
10661066
1067- if ( mcpServerUse . type === "use_mcp_tool" ) {
1067+ if ( mcpServerUse . type === "use_mcp_tool" && mcpServerUse . toolName ) {
10681068 const server = mcpServers ?. find ( ( s : McpServer ) => s . name === mcpServerUse . serverName )
10691069 const tool = server ?. tools ?. find ( ( t : McpTool ) => t . name === mcpServerUse . toolName )
10701070 return tool ?. alwaysAllow || false
@@ -1145,7 +1145,27 @@ const ChatViewComponent: React.ForwardRefRenderFunction<ChatViewRef, ChatViewPro
11451145 }
11461146
11471147 if ( message . ask === "use_mcp_server" ) {
1148- return alwaysAllowMcp && isMcpToolAlwaysAllowed ( message )
1148+ // Check if it's a tool or resource access
1149+ if ( ! message . text ) {
1150+ return false
1151+ }
1152+
1153+ try {
1154+ const mcpServerUse = JSON . parse ( message . text ) as McpServerUse
1155+
1156+ if ( mcpServerUse . type === "use_mcp_tool" ) {
1157+ // For tools, check if the specific tool is always allowed
1158+ return alwaysAllowMcp && isMcpToolAlwaysAllowed ( message )
1159+ } else if ( mcpServerUse . type === "access_mcp_resource" ) {
1160+ // For resources, auto-approve if MCP is always allowed
1161+ // Resources don't have individual alwaysAllow settings like tools do
1162+ return alwaysAllowMcp
1163+ }
1164+ } catch ( error ) {
1165+ console . error ( "Failed to parse MCP server use message:" , error )
1166+ return false
1167+ }
1168+ return false
11491169 }
11501170
11511171 if ( message . ask === "command" ) {
0 commit comments