Infinite Loop in MCP Section Parsing
Problem Description
The application was experiencing an infinite loop and high CPU usage when processing requests with a large system prompt. The issue was traced to the MCP section parsing logic in the parse_mcp_sections function in mcp_parser.py.
Root Cause
The infinite loop was caused by a while True loop in the parse_mcp_sections function that was searching for the "### Available Tools" section. The loop had no proper exit condition, causing it to run indefinitely when the section was not found or when there was an error in the parsing logic.
Additionally, the large system prompt (64,122 characters) exacerbated the issue, as the application was trying to parse this large text repeatedly in the loop.
Thank you for your report. We have promptly fixed the infinite loop issue.
For MCP servers containing resource templates or resources, I have identified that parsing may occur differently than expected and are taking corrective action.
For MCP servers containing resource templates or resources, I have identified that parsing may occur differently than expected and are taking corrective action.
I have also made corrections to this.