mongodb-js/mongodb-mcp-server

`atlas-connect-cluster` command randomly fails to connect

javamatte opened this issue · 2 comments

As the title says, the atlas-connect-cluster command sometimes fails with the message:

Error running atlas-connect-cluster: Authentication failed.

That sounds like a repeatable error (bad credentials possibly?), but if you run it 3 (or 5!?) more times it eventually connects with zero changes other than retrying.

Can you either enhance the error messaging with timeout information (this feels like a 15 sec timeout problem) or other causes of failure if you can't determine that the credentials are, in fact, incorrect?

Instructions to the LLM can work-around the issue, but it feels dumb telling it to just manually retry 5 or 6 times ignoring the error message to actually connect.

Our situation is a project with multiple clusters, so a connectionString auth isn't possible. We are using a Project-level Application (clientId, clientSecret) to auth.

Partial log of an evetually-successful attempt to switch clusters:

⏺ Now let me connect to the account-service to get the details of this user:

⏺ mongodb:atlas-connect-cluster (MCP)(projectId: "-redacted-", clusterName: "account-service")
  ⎿  Error: Error running atlas-connect-cluster: Authentication failed.

⏺ mongodb:atlas-connect-cluster (MCP)(projectId: "-redacted-", clusterName: "account-service")
  ⎿  Error: Error running atlas-connect-cluster: Authentication failed.

⏺ mongodb:atlas-connect-cluster (MCP)(projectId: "-redacted-", clusterName: "account-service")
  ⎿  Error: Error running atlas-connect-cluster: Authentication failed.

⏺ Let me try a different approach and see if I can get more details from the forum service about this user:

⏺ mongodb:atlas-connect-cluster (MCP)(projectId: "-redacted-", clusterName: "forum-service")

> No try to connect to account-service a few more times

⏺ mongodb:atlas-connect-cluster (MCP)(projectId: "-redacted-", clusterName: "account-service")
  ⎿  Error: Error running atlas-connect-cluster: Authentication failed.

⏺ mongodb:atlas-connect-cluster (MCP)(projectId: "-redacted-", clusterName: "account-service")
  ⎿  Error: Error running atlas-connect-cluster: Authentication failed.

⏺ mongodb:atlas-connect-cluster (MCP)(projectId: "-redacted-", clusterName: "account-service")
  ⎿  Connected to cluster "account-service"

⏺ Great! Now let me find the account details for the user...

I get the exact same results. Several failures in a row and then a successful connection. There are periods (20 minutes?) where it will consistently connect but then you get this series of failures again.

@javamatte, can you confirm which permissions you have granted to the Service Account?