Skip to content

Db tools maxTimeMS default#7823

Draft
bsradcliffe wants to merge 1 commit intomainfrom
cursor/db-tools-maxtimems-default-8ab6
Draft

Db tools maxTimeMS default#7823
bsradcliffe wants to merge 1 commit intomainfrom
cursor/db-tools-maxtimems-default-8ab6

Conversation

@bsradcliffe
Copy link
Copy Markdown
Collaborator

feat(assistant): apply maxTimeMS to database tools COMPASS-10235

Description

This PR ensures that database tools invoked by the assistant respect the maxTimeMS setting configured in Compass.

The ToolsController now retrieves the maxTimeMS from Compass preferences and passes it via the x-compass-maxtimems header during tool invocation. To enable the mongodb-mcp-server to utilize this, the package has been upgraded to 1.7.0 and patched. The patch modifies the find and aggregate tools within the MCP server to read and apply the maxTimeMS value from the requestInfo.headers. A postinstall script has been added to automatically apply this patch.

Checklist

  • New tests and/or benchmarks are included
  • Documentation is changed or added
  • If this change updates the UI, screenshots/videos are added and a design review is requested
  • If this change could impact the load on the MongoDB cluster, please describe the expected and worst case impact
  • I have signed the MongoDB Contributor License Agreement (https://www.mongodb.com/legal/contributor-agreement)

Motivation and Context

This change is required to prevent long-running operations initiated by the assistant's database tools. By applying the default or configured maxTimeMS from Compass, we align the assistant's behavior with the rest of Compass/DE, improving user experience and preventing unintended resource consumption.

  • Bugfix
  • New feature
  • Dependency update
  • Misc

Open Questions

None.

Dependents

None.

Types of changes

  • Backport Needed
  • Patch (non-breaking change which fixes an issue)
  • Minor (non-breaking change which adds functionality)
  • Major (fix or feature that would cause existing functionality to change)

Open in Web Open in Cursor 

- Modified ToolsController to accept preferences and pass maxTimeMS
- Updated provider to inject getMaxTimeMS function from preferences
- Patched mongodb-mcp-server to read maxTimeMS from requestInfo.headers
- Applied maxTimeMS to find and aggregate operations
- Upgraded mongodb-mcp-server to 1.7.0
- Added postinstall script to apply patches automatically
- All tests passing
@cursor
Copy link
Copy Markdown
Contributor

cursor bot commented Feb 25, 2026

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

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