@@ -69,11 +69,13 @@ async def current_config_callback(self, config: Config) -> Config:
6969mcp_enabled [oap ["id" ]]= server .enabled
7070
7171# remove oap mcp servers
72+ # preserve old config, might be used to construct final output
73+ old_oap :dict [str ,MCPServerConfig ]= {}
7274if mcp_servers is None or len (mcp_servers )> 0 :
7375for key in config .mcp_servers .copy ():
7476value = config .mcp_servers [key ]
7577if value .extra_data and value .extra_data .get ("oap" ):
76- config .mcp_servers .pop (key )
78+ old_oap [ key ] = config .mcp_servers .pop (key )
7779
7880if mcp_servers is None :
7981return config
@@ -82,11 +84,13 @@ async def current_config_callback(self, config: Config) -> Config:
8284headers = server .headers .copy ()
8385if server .auth_type == "header" :
8486headers .update ({"Authorization" :f"Bearer{ self .device_token } " })
87+ old_config = old_oap .get (server .name )
8588config .mcp_servers [server .name ]= MCPServerConfig (
8689enabled = mcp_enabled .get (server .id ,True ),
8790url = server .url ,
8891transport = server .transport ,
8992headers = headers ,# type: ignore
93+ exclude_tools = old_config .exclude_tools if old_config else [],
9094extraData = {
9195"oap" : {
9296"id" :server .id ,