@@ -231,29 +231,37 @@ export class Server {
231231 // This will fail on unsupported platforms
232232 const { Client : AtlasLocalClient } = await import ( "@mongodb-js-preview/atlas-local" ) ;
233233
234- // Connect to Atlas Local client
235- // This will fail if docker is not running
236- const client = AtlasLocalClient . connect ( ) ;
237-
238- // Set Atlas Local client
239- this . session . atlasLocalClient = client ;
240-
241- // Register Atlas Local tools
242- for ( const toolConstructor of AtlasLocalTools ) {
243- const tool = new toolConstructor ( {
244- session : this . session ,
245- config : this . userConfig ,
246- telemetry : this . telemetry ,
247- elicitation : this . elicitation ,
248- } ) ;
249- if ( tool . register ( this ) ) {
250- this . tools . push ( tool ) ;
234+ try {
235+ // Connect to Atlas Local client
236+ // This will fail if docker is not running
237+ const client = AtlasLocalClient . connect ( ) ;
238+
239+ // Set Atlas Local client
240+ this . session . atlasLocalClient = client ;
241+
242+ // Register Atlas Local tools
243+ for ( const toolConstructor of AtlasLocalTools ) {
244+ const tool = new toolConstructor ( {
245+ session : this . session ,
246+ config : this . userConfig ,
247+ telemetry : this . telemetry ,
248+ elicitation : this . elicitation ,
249+ } ) ;
250+ if ( tool . register ( this ) ) {
251+ this . tools . push ( tool ) ;
252+ }
251253 }
254+ } catch ( dockerError ) {
255+ console . warn (
256+ "Failed to connect to Atlas Local client (Docker not available or not running), atlas-local tools will be disabled (error: " ,
257+ dockerError ,
258+ ")"
259+ ) ;
252260 }
253- } catch ( error ) {
261+ } catch ( importError ) {
254262 console . warn (
255- "Failed to initialize Atlas Local client, atlas-local tools will be disabled (error: " ,
256- error ,
263+ "Failed to import Atlas Local client (platform not supported) , atlas-local tools will be disabled (error: " ,
264+ importError ,
257265 ")"
258266 ) ;
259267 }
0 commit comments