From 1a8c937613642d8dea0757d585cf3aada31009ff Mon Sep 17 00:00:00 2001 From: Filipe C Menezes Date: Tue, 29 Apr 2025 18:28:04 +0100 Subject: [PATCH 1/4] fix: config resource --- src/server.ts | 29 +++++++---------------------- 1 file changed, 7 insertions(+), 22 deletions(-) diff --git a/src/server.ts b/src/server.ts index effdee63..f36bf4ea 100644 --- a/src/server.ts +++ b/src/server.ts @@ -149,10 +149,14 @@ export class Server { const result = { telemetry: this.userConfig.telemetry, logPath: this.userConfig.logPath, - connectionString: this.userConfig.connectionString - ? "set; no explicit connect needed, use switch-connection tool to connect to a different connection if necessary" - : "not set; before using any mongodb tool, you need to call the connect tool with a connection string", + mode: this.userConfig.connectionString + ? "MongoDB; access to MongoDB tools is available" + : "not set; before using any MongoDB tool, you need to configure a connection string, more info at 'https://github.com/mongodb-js/mongodb-mcp-server', alternatively you man setup MongoDB Atlas access.", connectOptions: this.userConfig.connectOptions, + atlas: + this.userConfig.apiClientId && this.userConfig.apiClientSecret + ? "set; MongoDB Atlas tools are currently available to use" + : "not set; MongoDB Atlas tools are currently unavailable, to have access to MongoDB Atlas tools like creating clusters or connecting to clusters make sure to setup credentials, more info at 'https://github.com/mongodb-js/mongodb-mcp-server'.", }; return { contents: [ @@ -164,25 +168,6 @@ export class Server { }; } ); - if (this.userConfig.connectionString) { - this.mcpServer.resource( - "connection-string", - "config://connection-string", - { - description: "Preconfigured connection string that will be used as a default in the `connect` tool", - }, - (uri) => { - return { - contents: [ - { - text: `Preconfigured connection string: ${this.userConfig.connectionString}`, - uri: uri.href, - }, - ], - }; - } - ); - } } private async validateConfig(): Promise { From 13f6c9abaa96d11eb5bdc3ff7d4bc6af0cee6f35 Mon Sep 17 00:00:00 2001 From: Filipe C Menezes Date: Tue, 29 Apr 2025 18:29:38 +0100 Subject: [PATCH 2/4] fix: messages --- src/server.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/server.ts b/src/server.ts index f36bf4ea..5bf059f3 100644 --- a/src/server.ts +++ b/src/server.ts @@ -149,9 +149,9 @@ export class Server { const result = { telemetry: this.userConfig.telemetry, logPath: this.userConfig.logPath, - mode: this.userConfig.connectionString - ? "MongoDB; access to MongoDB tools is available" - : "not set; before using any MongoDB tool, you need to configure a connection string, more info at 'https://github.com/mongodb-js/mongodb-mcp-server', alternatively you man setup MongoDB Atlas access.", + connectionString: this.userConfig.connectionString + ? "set; access to MongoDB tools are currently available to use" + : "not set; before using any MongoDB tool, you need to configure a connection string, alternatively you man setup MongoDB Atlas access, more info at 'https://github.com/mongodb-js/mongodb-mcp-server'.", connectOptions: this.userConfig.connectOptions, atlas: this.userConfig.apiClientId && this.userConfig.apiClientSecret From 60ad1c7df2fa547b363e79af1b59759a90b8db49 Mon Sep 17 00:00:00 2001 From: Filipe C Menezes Date: Tue, 29 Apr 2025 18:30:13 +0100 Subject: [PATCH 3/4] fix: mime type --- src/server.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/server.ts b/src/server.ts index 5bf059f3..86aaa5eb 100644 --- a/src/server.ts +++ b/src/server.ts @@ -162,6 +162,7 @@ export class Server { contents: [ { text: JSON.stringify(result), + mimeType: "application/json", uri: uri.href, }, ], From 0c9ecfcd34dcc4f88198aca3ce6eaf28eb0ff98a Mon Sep 17 00:00:00 2001 From: Filipe Constantinov Menezes Date: Tue, 29 Apr 2025 21:47:48 +0100 Subject: [PATCH 4/4] Update server.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- src/server.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/server.ts b/src/server.ts index 86aaa5eb..38a1d82b 100644 --- a/src/server.ts +++ b/src/server.ts @@ -151,7 +151,7 @@ export class Server { logPath: this.userConfig.logPath, connectionString: this.userConfig.connectionString ? "set; access to MongoDB tools are currently available to use" - : "not set; before using any MongoDB tool, you need to configure a connection string, alternatively you man setup MongoDB Atlas access, more info at 'https://github.com/mongodb-js/mongodb-mcp-server'.", + : "not set; before using any MongoDB tool, you need to configure a connection string, alternatively you can setup MongoDB Atlas access, more info at 'https://github.com/mongodb-js/mongodb-mcp-server'.", connectOptions: this.userConfig.connectOptions, atlas: this.userConfig.apiClientId && this.userConfig.apiClientSecret