-
Couldn't load subscription status.
- Fork 148
chore: Support atlas connect via private and private endpoint connection strings #673
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: Support atlas connect via private and private endpoint connection strings #673
Conversation
4f8f307 to
80b353f
Compare
There was a problem hiding this 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 support for connecting to MongoDB Atlas clusters using private and private endpoint connection strings, in addition to the existing standard connection string option.
Key changes:
- Introduces a
connectionTypeparameter to theconnect-clustertool, allowing users to specify "standard", "private", or "privateEndpoint" connection types - Refactors the cluster data model to store all connection string types instead of just a single connection string
- Updates cluster listing and inspection tools to display the appropriate connection string based on availability
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/tools/atlas/connect/connectCluster.ts | Adds connectionType parameter to support private/privateEndpoint connections and updates connection preparation logic |
| src/tools/args.ts | Defines new connectionType Zod schema with enum validation for the three connection types |
| src/common/atlas/cluster.ts | Adds getConnectionString helper function and refactors Cluster interface to store all connection strings instead of a single string |
| src/tools/atlas/read/listClusters.ts | Updates cluster listing to use new connection strings structure |
| src/tools/atlas/read/inspectCluster.ts | Updates cluster inspection to use new connection strings structure |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, some questions
| } | ||
| const connectionString = getConnectionString(cluster.connectionStrings, connectionType); | ||
| if (connectionString === undefined) { | ||
| throw new Error(`Connection string for connection type "${connectionType}" not available`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there something we could instruct or recommend them / the model to do in this case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. I'll expand the error message to point to atlas docs on connecting to clusters
Proposed changes
Adds new optional input for
atlas-connect-clusterconnectionType. This allows users to connect via standard, private, or private endpoint connection strings.Manual Testing
Although I was unable to successfully set up a PE to test the connection in a timely manner, I have verified that the PE connection string obtained in this tool matches that which is provided when connection via the Atlas UI.
mongodb+srv://<user>:<password>@<cluster-name>-pl-<...>.mongodb-dev.net/?authSource=adminJIRA ticket: MCP-259
Checklist