[PR #4299] [CLOSED] Fix MCP server reliability issues #4585

Closed
opened 2026-02-22 18:36:07 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Mintplex-Labs/anything-llm/pull/4299
Author: @jgowdy-godaddy
Created: 8/16/2025
Status: Closed

Base: masterHead: fix/mcp-code-issues


📝 Commits (10+)

📊 Changes

2 files changed (+236 additions, -31 deletions)

View changed files

📝 server/utils/MCP/hypervisor/index.js (+135 -19)
📝 server/utils/MCP/index.js (+101 -12)

📄 Description

Summary

Fix multiple reliability issues in MCP server management including process termination, memory leaks, race conditions, and transport compatibility.

  • Fix process termination to use SIGTERM instead of SIGHUP
  • Prevent singleton race conditions with instance locking
  • Fix memory leaks in Promise.race timeout patterns
  • Add shell environment loading for desktop applications
  • Add support for HTTP streaming transport type
  • Implement safe JSON stringify for circular references
  • Fix stale MCP references in plugin closures
  • Add comprehensive error handling for async operations

Test plan

  • Test MCP server startup and shutdown with various transport types
  • Verify no memory leaks during connection timeouts
  • Test concurrent MCP initialization
  • Verify proper error handling for failed connections
  • Test desktop environment PATH resolution

These changes address real issues reported in #4017 and #3854 regarding MCP server failures in desktop environments.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Mintplex-Labs/anything-llm/pull/4299 **Author:** [@jgowdy-godaddy](https://github.com/jgowdy-godaddy) **Created:** 8/16/2025 **Status:** ❌ Closed **Base:** `master` ← **Head:** `fix/mcp-code-issues` --- ### 📝 Commits (10+) - [`0990534`](https://github.com/Mintplex-Labs/anything-llm/commit/099053471bf4bb4bc8ad741bd60f89f83a575dff) Fix MCP server process termination using SIGTERM - [`77f9b3d`](https://github.com/Mintplex-Labs/anything-llm/commit/77f9b3d288ccd40c895439f2ca2446248b109c02) Add singleton pattern race condition prevention - [`6eab9f6`](https://github.com/Mintplex-Labs/anything-llm/commit/6eab9f63200bff7951e7e864900666a0db0284d4) Fix memory leaks in Promise.race timeout patterns - [`4412ae3`](https://github.com/Mintplex-Labs/anything-llm/commit/4412ae351f2ea8f2e7428b81b89dc9509449ffd2) Add shell environment loading for desktop applications #4017 #3854 - [`2be6fd2`](https://github.com/Mintplex-Labs/anything-llm/commit/2be6fd290fb3a0972619f99d69e9a6eac2c5b8a8) Add support for HTTP streaming transport type - [`4afca2c`](https://github.com/Mintplex-Labs/anything-llm/commit/4afca2cad4a7ecfef4341f53b142b6e3cdd4a1b6) Add safe JSON stringify for circular references - [`1b7f9fc`](https://github.com/Mintplex-Labs/anything-llm/commit/1b7f9fc4d668fa7371763fff354450d162a6883f) Fix stale MCP references in plugin closures - [`dd88eb7`](https://github.com/Mintplex-Labs/anything-llm/commit/dd88eb734039cc738467c728971a92dc001b8c97) Add comprehensive error handling for async operations - [`21ff01f`](https://github.com/Mintplex-Labs/anything-llm/commit/21ff01f20a09ee7083fa811d6755d31148b6f8f9) Fix ESLint errors - [`ac7b228`](https://github.com/Mintplex-Labs/anything-llm/commit/ac7b228e040766b6f3b8b29f7a3f4138664c0bf2) Apply Prettier formatting ### 📊 Changes **2 files changed** (+236 additions, -31 deletions) <details> <summary>View changed files</summary> 📝 `server/utils/MCP/hypervisor/index.js` (+135 -19) 📝 `server/utils/MCP/index.js` (+101 -12) </details> ### 📄 Description ## Summary Fix multiple reliability issues in MCP server management including process termination, memory leaks, race conditions, and transport compatibility. - Fix process termination to use SIGTERM instead of SIGHUP - Prevent singleton race conditions with instance locking - Fix memory leaks in Promise.race timeout patterns - Add shell environment loading for desktop applications - Add support for HTTP streaming transport type - Implement safe JSON stringify for circular references - Fix stale MCP references in plugin closures - Add comprehensive error handling for async operations ## Test plan - Test MCP server startup and shutdown with various transport types - Verify no memory leaks during connection timeouts - Test concurrent MCP initialization - Verify proper error handling for failed connections - Test desktop environment PATH resolution These changes address real issues reported in #4017 and #3854 regarding MCP server failures in desktop environments. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-22 18:36:07 -05:00
yindo closed this issue 2026-02-22 18:36:07 -05:00
yindo changed title from [PR #4299] Fix MCP server reliability issues to [PR #4299] [CLOSED] Fix MCP server reliability issues 2026-06-05 15:19:19 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Mintplex-Labs/anything-llm#4585