Skip to content

fix(amazonq): Fixes mcp server registry not clearing on switching connections and reduces GetProfile calls#2580

Open
shruti0085 wants to merge 8 commits intomainfrom
shruti0085/mcpfix
Open

fix(amazonq): Fixes mcp server registry not clearing on switching connections and reduces GetProfile calls#2580
shruti0085 wants to merge 8 commits intomainfrom
shruti0085/mcpfix

Conversation

@shruti0085
Copy link
Contributor

Description

This changes addresses to issues:

  1. With JB it was observed that GetProfile calls may get invoked a large number of times when service returned 5xx errors. With this change an attempt has been made to reduce the number of time GetProfile call may get invoked by the profileStatusMonitor.IsMcpEnabeld call.
  2. A bug was found where within a single IDE session when switching between connections IDC/Builder ID, if previously signed in with a mcp registry enabled profile, signing out and logging into a builder id or IDC without registry resulted in still being able to access servers from the previous connection's registry. This change ensures, mcp servers are cleared and registry reset on signout.

Testing
Validated that less IsMcpEnabled calls are invoked and mcp servers are cleared on switching connections

License

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@shruti0085 shruti0085 requested a review from a team as a code owner January 8, 2026 22:17
@codecov-commenter
Copy link

codecov-commenter commented Jan 8, 2026

Codecov Report

❌ Patch coverage is 45.65217% with 25 lines in your changes missing coverage. Please review.
✅ Project coverage is 60.58%. Comparing base (a837cc9) to head (5712947).

Files with missing lines Patch % Lines
...rver/agenticChat/tools/mcp/profileStatusMonitor.ts 40.00% 18 Missing ⚠️
core/aws-lsp-core/src/util/retryUtils.ts 33.33% 1 Missing and 1 partial ⚠️
...anguage-server/agenticChat/tools/mcp/mcpManager.ts 77.77% 2 Missing ⚠️
...rc/language-server/agenticChat/tools/toolServer.ts 0.00% 2 Missing ⚠️
...mazonQServiceManager/AmazonQTokenServiceManager.ts 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2580      +/-   ##
==========================================
- Coverage   60.58%   60.58%   -0.01%     
==========================================
  Files         278      278              
  Lines       65062    65078      +16     
  Branches     4145     4146       +1     
==========================================
+ Hits        39420    39425       +5     
- Misses      25558    25568      +10     
- Partials       84       85       +1     
Flag Coverage Δ
unittests 60.58% <45.65%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

try {
// note: use dynamic require to satisfy webpack requirements for webworker
const McpManager = eval('require')('./mcpManager').McpManager
if (McpManager.isInitialized()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

what happens when no mcpManager initialized yet?

Copy link
Contributor Author

@shruti0085 shruti0085 Jan 13, 2026

Choose a reason for hiding this comment

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

should default to false mcp state right? As mentioned offline, there is not an accessible way to use mcp manager without initialization and since it is the source for resolving servers, it seems reasonable for it have no servers. I believe even with my change that default behavior should not change as this is surrounded by a try catch

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