Skip to content

Add config option for connection string #56

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

Merged
merged 4 commits into from
Apr 11, 2025
Merged

Conversation

nirinchev
Copy link
Collaborator

Adds the following connect options:

  • readPreference
  • readConcern
  • writeConcern.w
  • timeoutMS

I've tried to strike a balance between giving users control and not going overboard wtih config options that may never get used.

Additionally, refactored the env variable parsing where instead of using the defaults to look up env variables, we now construct an object from all env variables that start with MDB_MCP_.

@nirinchev nirinchev requested review from gagik and Copilot April 10, 2025 19:35
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.

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (2)

src/tools/mongodb/connect.ts:75

  • Verify that wrapping config.connectOptions.writeConcern inside an object with the key 'w' matches the expected structure for NodeDriverServiceProvider.connect. If a different structure is required, adjust accordingly.
w: config.connectOptions.writeConcern,

src/config.ts:124

  • [nitpick] The function name 'SNAKE_CASE_toCamelCase' mixes naming conventions. Consider renaming it to 'snakeToCamelCase' for consistency.
return str.toLowerCase().replace(/([-_][a-z])/g, (group) => group.toUpperCase().replace('_', ''));

@nirinchev nirinchev requested a review from gagik April 11, 2025 10:06
@nirinchev nirinchev merged commit 74a2f0f into main Apr 11, 2025
2 checks passed
@nirinchev nirinchev deleted the ni/connection-config branch April 11, 2025 10:12
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.

2 participants