Skip to content

Conversation

blva
Copy link
Collaborator

@blva blva commented Sep 1, 2025

Proposed changes

  • MCP-124
  • Adds more messages about the resources created to be able to connect to an atlas cluster

Checklist

@blva blva changed the title feat: add more details about atlas connect flow feat: add more details about atlas connect flow - MCP-124 Sep 1, 2025
@blva blva marked this pull request as ready for review September 1, 2025 16:57
@Copilot Copilot AI review requested due to automatic review settings September 1, 2025 16:57
@blva blva requested a review from a team as a code owner September 1, 2025 16:57
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 adds more informative messaging to the Atlas connect flow to better inform users about resources that are automatically created during cluster connection. The changes track whether an IP access list entry or user was created and provide appropriate feedback messages.

  • Modify ensureCurrentIpInAccessList to return a boolean indicating if a new IP access list entry was created
  • Update the connect cluster flow to track user creation and provide detailed feedback about created resources
  • Add informative messages about IP access list updates and temporary user creation with a reference to documentation

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/common/atlas/accessListUtils.ts Modified to return boolean indicating if new IP access list entry was created
src/tools/atlas/connect/connectCluster.ts Enhanced to track resource creation and provide detailed user feedback messages

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 1, 2025

Pull Request Test Coverage Report for Build 17433820852

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 42 of 53 (79.25%) changed or added relevant lines in 2 files are covered.
  • 12 unchanged lines in 3 files lost coverage.
  • Overall coverage decreased (-0.3%) to 80.976%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/common/atlas/accessListUtils.ts 3 4 75.0%
src/tools/atlas/connect/connectCluster.ts 39 49 79.59%
Files with Coverage Reduction New Missed Lines %
src/common/atlas/accessListUtils.ts 1 82.69%
src/tools/atlas/connect/connectCluster.ts 5 77.14%
src/common/connectionManager.ts 6 87.94%
Totals Coverage Status
Change from base Build 17430523151: -0.3%
Covered Lines: 4594
Relevant Lines: 5585

💛 - Coveralls

Copy link
Collaborator

@nirinchev nirinchev left a comment

Choose a reason for hiding this comment

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

Minor nits/questions, otherwise lgtm.

cn.searchParams.set("authSource", "admin");

return { connectionString: cn.toString(), atlas: connectedAtlasCluster };
return { connectionString: cn.toString(), atlas: connectedAtlasCluster, userCreated: true };
Copy link
Collaborator

Choose a reason for hiding this comment

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

It seems like we're always returning true for userCreated - am I missing something?

Copy link
Collaborator Author

@blva blva Sep 1, 2025

Choose a reason for hiding this comment

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

no, if the connection state doesn't require preparation (e.g. is already connected*) then we'd not execute this

Copy link
Collaborator

Choose a reason for hiding this comment

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

Right - my point is that prepareClusterConnection always returns userCreated: true (or at least it's not obvious in which case it will return false for userCreated. In the already connected state, we wouldn't invoke this method.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ah, got it! yes, good point since we error if something goes wrong. I can remove that from now, I think we'll need to do more work in the connectCluster anyways but this is out of scope here, so let me simplify

"Note: Your current IP address has been added to the Atlas project's IP access list to enable secure connection.";

const createdUserMessage =
"Note: A temporary user has been created to enable secure connection to the cluster. For more information, see https://dochub.mongodb.org/core/mongodb-mcp-server-tools-considerations";
Copy link
Collaborator

Choose a reason for hiding this comment

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

Too lazy to test it, but during manual testing, did you experience the model correctly relaying the url to users?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I couldn't find the LLM propagating the link. But it does show up in the tool call logs if the toggle is clicked

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Screenshot 2025-09-01 at 20 56 55

Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we try tweaking the response and seeing what the output is? E.g. we could add something like: Note to LLM Agent: it is important to include the following link in your response to the user in case they want to get more information about the temporary user created

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

that did the trick!
Screenshot 2025-09-03 at 13 42 54

@blva blva enabled auto-merge (squash) September 3, 2025 12:51
@blva blva merged commit 345efa4 into main Sep 3, 2025
17 checks passed
@blva blva deleted the MCP-124 branch September 3, 2025 12:52
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.

4 participants