Skip to content

Conversation

blva
Copy link
Collaborator

@blva blva commented Sep 2, 2025

Proposed changes

MCP-140

Tests

Logs for a successfull flow

{"t":{"$date":"2025-09-02T11:25:09.980Z"},"s":"I","c":"MONGODB-MCP","id":1000002,"ctx":"server","msg":"Detected a MongoDB connection string in the configuration, trying to connect..."}
{"t":{"$date":"2025-09-02T11:25:09.980Z"},"s":"I","c":"MONGODB-MCP","id":1000002,"ctx":"server","msg":"Server with version 0.3.0 started with transport StdioServerTransport and agent runner {\"name\":\"cursor-vscode\",\"version\":\"1.0.0\",\"title\":\"unknown\"}"}
{"t":{"$date":"2025-09-02T11:25:09.980Z"},"s":"I","c":"MONGODB-MCP","id":1002002,"ctx":"telemetry","msg":"Telemetry is disabled."}
{"t":{"$date":"2025-09-02T11:25:58.619Z"},"s":"D1","c":"MONGODB-MCP","id":1003001,"ctx":"tool","msg":"Executing tool list-databases"}

Logs for a failed flow

{"t":{"$date":"2025-09-02T11:26:26.942Z"},"s":"I","c":"MONGODB-MCP","id":1000002,"ctx":"server","msg":"Detected a MongoDB connection string in the configuration, trying to connect..."}
{"t":{"$date":"2025-09-02T11:26:26.943Z"},"s":"I","c":"MONGODB-MCP","id":1000002,"ctx":"server","msg":"Server with version 0.3.0 started with transport StdioServerTransport and agent runner {\"name\":\"cursor-vscode\",\"version\":\"1.0.0\",\"title\":\"unknown\"}"}
{"t":{"$date":"2025-09-02T11:26:26.943Z"},"s":"I","c":"MONGODB-MCP","id":1002002,"ctx":"telemetry","msg":"Telemetry is disabled."}
{"t":{"$date":"2025-09-02T11:26:28.497Z"},"s":"E","c":"MONGODB-MCP","id":1004001,"ctx":"server","msg":"Failed to connect to MongoDB instance using the connection string from the config: Error: bad auth : authentication failed"}

Checklist

id: LogId.serverInitialized,
context: "server",
message: `Server started with transport ${transport.constructor.name} and agent runner ${this.session.mcpClient?.name}`,
message: `Server with version ${packageInfo.version} started with transport ${transport.constructor.name} and agent runner ${JSON.stringify(this.session.mcpClient)}`,
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

adding more logs to make it easier to debug

@blva blva marked this pull request as ready for review September 2, 2025 11:34
@Copilot Copilot AI review requested due to automatic review settings September 2, 2025 11:34
@blva blva requested a review from a team as a code owner September 2, 2025 11:34
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR modifies the MCP server to allow it to start successfully even when the initial MongoDB connection fails. Previously, connection failures would prevent the server from starting.

  • Removes error throwing when MongoDB connection fails during server initialization
  • Adds informational and error logging for connection attempts
  • Enhances server startup logging with version and client information

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@coveralls
Copy link
Collaborator

coveralls commented Sep 2, 2025

Pull Request Test Coverage Report for Build 17402691381

Details

  • 8 of 13 (61.54%) changed or added relevant lines in 2 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage increased (+0.02%) to 80.962%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/server.ts 7 12 58.33%
Files with Coverage Reduction New Missed Lines %
src/server.ts 1 78.3%
Totals Coverage Status
Change from base Build 17383023562: 0.02%
Covered Lines: 4543
Relevant Lines: 5526

💛 - Coveralls

@blva blva changed the title fix: start mcp even if connection fails fix: start mcp even if connection fails - [MCP-140] Sep 2, 2025
@blva blva merged commit 47c0a09 into main Sep 2, 2025
18 of 19 checks passed
@blva blva deleted the MCP-140 branch September 2, 2025 17:57
nirinchev added a commit that referenced this pull request Sep 3, 2025
* main:
  feat: add more details about atlas connect flow - MCP-124 (#500)
  chore: extend library interfaces to allow injecting a custom connection error handler MCP-132 (#502)
  fix: start mcp even if connection fails - [MCP-140] (#503)
  fix: allow connect tool on readOnly mode (#499)
  chore: warn about the usage of deprecated cli arguments MCP-107 (#493)
  ci: add ipAccessList after creating project (#496)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants