@@ -5,6 +5,7 @@ import { MCPServer, MCPServerCostInfo } from "./types";
5
5
import { updateMCPServer , testMCPToolsListRequest } from "../networking" ;
6
6
import MCPServerCostConfig from "./mcp_server_cost_config" ;
7
7
import MCPPermissionManagement from "./MCPPermissionManagement" ;
8
+ import MCPToolConfiguration from "./mcp_tool_configuration" ;
8
9
import { MinusCircleOutlined , PlusOutlined , InfoCircleOutlined } from "@ant-design/icons" ;
9
10
import { validateMCPServerUrl , validateMCPServerName } from "./utils" ;
10
11
import NotificationsManager from "../molecules/notifications_manager" ;
@@ -23,7 +24,8 @@ const MCPServerEdit: React.FC<MCPServerEditProps> = ({ mcpServer, accessToken, o
23
24
const [ tools , setTools ] = useState < any [ ] > ( [ ] ) ;
24
25
const [ isLoadingTools , setIsLoadingTools ] = useState ( false ) ;
25
26
const [ searchValue , setSearchValue ] = useState < string > ( "" ) ;
26
- const [ aliasManuallyEdited , setAliasManuallyEdited ] = useState ( false )
27
+ const [ aliasManuallyEdited , setAliasManuallyEdited ] = useState ( false ) ;
28
+ const [ allowedTools , setAllowedTools ] = useState < string [ ] > ( [ ] ) ;
27
29
28
30
// Initialize cost config from existing server data
29
31
useEffect ( ( ) => {
@@ -32,6 +34,13 @@ const MCPServerEdit: React.FC<MCPServerEditProps> = ({ mcpServer, accessToken, o
32
34
}
33
35
} , [ mcpServer ] ) ;
34
36
37
+ // Initialize allowed tools from existing server data
38
+ useEffect ( ( ) => {
39
+ if ( mcpServer . allowed_tools ) {
40
+ setAllowedTools ( mcpServer . allowed_tools ) ;
41
+ }
42
+ } , [ mcpServer ] ) ;
43
+
35
44
// Transform string array to object array for initial form values
36
45
useEffect ( ( ) => {
37
46
if ( mcpServer . mcp_access_groups ) {
@@ -128,7 +137,7 @@ const MCPServerEdit: React.FC<MCPServerEditProps> = ({ mcpServer, accessToken, o
128
137
alias : values . alias ,
129
138
// Include permission management fields
130
139
extra_headers : values . extra_headers || [ ] ,
131
- allowed_tools : values . allowed_tools || [ ] ,
140
+ allowed_tools : allowedTools . length > 0 ? allowedTools : null ,
132
141
disallowed_tools : values . disallowed_tools || [ ] ,
133
142
} ;
134
143
@@ -195,6 +204,24 @@ const MCPServerEdit: React.FC<MCPServerEditProps> = ({ mcpServer, accessToken, o
195
204
/>
196
205
</ div >
197
206
207
+ { /* Tool Configuration Section */ }
208
+ < div className = "mt-6" >
209
+ < MCPToolConfiguration
210
+ accessToken = { accessToken }
211
+ formValues = { {
212
+ server_id : mcpServer . server_id ,
213
+ server_name : mcpServer . server_name ,
214
+ url : mcpServer . url ,
215
+ transport : mcpServer . transport ,
216
+ auth_type : mcpServer . auth_type ,
217
+ mcp_info : mcpServer . mcp_info ,
218
+ } }
219
+ allowedTools = { allowedTools }
220
+ existingAllowedTools = { mcpServer . allowed_tools || null }
221
+ onAllowedToolsChange = { setAllowedTools }
222
+ />
223
+ </ div >
224
+
198
225
< div className = "flex justify-end gap-2" >
199
226
< AntdButton onClick = { onCancel } > Cancel</ AntdButton >
200
227
< Button type = "submit" > Save Changes</ Button >
0 commit comments