dynamic mcp: add persisted loading state#771
Conversation
Co-authored-by: Cursor <cursoragent@cursor.com>
🤖 LLM Evaluation ResultsOpenAI
❌ Failed EvaluationsShow 6 failuresOPENAI1. TestReactEval/[openai]_react_cat_message
2. TestConversationMentionHandling/[openai]_conversation_from_attribution_long_thread.json
3. TestConversationMentionHandling/[openai]_conversation_from_attribution_long_thread.json
4. TestConversationMentionHandling/[openai]_conversation_from_attribution_long_thread.json
5. TestConversationMentionHandling/[openai]_conversation_from_attribution_long_thread.json
6. TestConversationMentionHandling/[openai]_conversation_from_attribution_long_thread.json
Anthropic
❌ Failed EvaluationsShow 7 failuresANTHROPIC1. TestReactEval/[anthropic]_react_cat_message
2. TestConversationMentionHandling/[anthropic]_conversation_from_attribution_long_thread.json
3. TestConversationMentionHandling/[anthropic]_conversation_from_attribution_long_thread.json
4. TestConversationMentionHandling/[anthropic]_conversation_from_attribution_long_thread.json
5. TestConversationMentionHandling/[anthropic]_conversation_from_attribution_long_thread.json
6. TestConversationMentionHandling/[anthropic]_conversation_from_attribution_long_thread.json
7. TestDirectMessageConversations/[anthropic]_bot_dm_tool_introspection
This comment was automatically generated by the eval CI pipeline. |
📝 WalkthroughWalkthroughThe PR adds infrastructure for MCP dynamic tool loading configuration with JSON-based defaulting, persists loaded MCP tools in a new database table, adds observability metrics, introduces tool description overrides, and enables LLM tracing configuration. ChangesMCP Dynamic Tool Loading & Configuration Infrastructure
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes The PR spans multiple coordinated subsystems (configuration, persistence, metrics) with moderate complexity. The loaded MCP tools persistence layer introduces new store methods and a database table with comprehensive test coverage. Agent persistence updates touch SQL query construction requiring placeholder validation. Most changes follow established patterns (migrations, store methods, metric registration) with good test coverage, but the distributed nature across config, storage, and metrics layers requires understanding the full feature scope. Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c65e350f4f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Stale comment
Security Review: No Findings
This PR adds persistence/config foundation for dynamic MCP tool loading (migrations, store methods, config fields, metrics). After tracing all changes:
- SQL injection: All queries use parameterized statements via the squirrel query builder. No raw string interpolation.
- Data isolation:
ListLoadedMCPToolscorrectly scopes by the(conversationID, botID, userID)triple, preventing cross-user data access at the store layer.- No new HTTP endpoints: This PR introduces no user-facing API routes. Authorization enforcement will need to be verified in subsequent PRs in this stack where handlers call these store methods.
- Config fields (
EnableLLMTrace,MCPDynamicToolLoading,RetrievalDescriptionOverride): All admin-only configuration. Not consumed by any code paths in this PR yet.- Metrics:
ObserveMCPDynamicToolEventlabel parameters (event,result) are clearly designed for bounded enums. No callers exist in this PR.- Secrets exposure: No credentials or sensitive data in logs, errors, or responses.
No medium, high, or critical vulnerabilities identified.
Sent by Cursor Automation: Find vulnerabilities
Co-authored-by: Cursor <cursoragent@cursor.com>
There was a problem hiding this comment.
Security Review: No Findings
This PR adds persistence and configuration scaffolding for dynamic MCP tool loading. After tracing all changes, no medium/high/critical vulnerabilities were found:
- Store layer (
store/loaded_mcp_tools.go): All SQL queries use the squirrel query builder with parameterized values. CRUD methods requireconversationID,botID, anduserIDscoping, and no HTTP handlers expose these methods directly in this PR. - Config fields (
EnableLLMTrace,MCPDynamicToolLoading,RetrievalDescriptionOverride): All are admin-only config or internal feature flags. None have consumers in this PR that could leak data or affect authorization. - Metrics (
ObserveMCPDynamicToolEvent): Labels arebot_name,event,result. No callers exist yet in this PR. The existingObserveTokenUsagefollows the same pattern, so this is consistent. - Migrations: Standard DDL with appropriate defaults. The
DEFAULT trueon the new column is intentional for backward compatibility. - No new HTTP endpoints or API surface is added by this PR — this is pure infrastructure for future PRs in the stack.
Sent by Cursor Automation: Find vulnerabilities
|
Plugin Spinwick PR #771 🎉 Test server created! Access here: https://agents-pr-771-b91jq.test.mattermost.cloud
Installation ID: Credentials: Posted securely in this Mattermost channel - Look for PR #771 |
|
Test server destroyed |


Summary
Adds the persistence/config foundation for dynamic MCP tool loading, including bot config defaults, loaded-tool state storage, migrations, and metrics plumbing.
Stack: 1/6
Ticket Link
N/A
Screenshots
N/A
Release Note
Made with Cursor
Summary by CodeRabbit
Release Notes