DeepCode
DeepCode copied to clipboard
[Question]: mcp_agent.mcp.mcp_aggregator.ResearchAnalyzerAgent - Last aggregator closing, shutting down all persistent connections...
Do you need to ask a question?
- [x] I have searched the existing question and discussions and this question is not already answered.
- [ ] I believe this is a legitimate question, not just a bug or feature request.
Your Question
上传pdf或者提交url后,paper可以成功生成.md文件,但会出现[ERROR] 2025-11-04T13:51:41 mcp_agent.mcp.mcp_agent_client_session - send_request failed: Connection closed以及后续的filesystem的错误。bocha的api_key已配置。请问是什么原因?
运行时部分输出如下:
📊 Starting research analysis...
Input prompt length: 20
Input preview: /tmp/tmp70ezuc4j.pdf...
🔍 Using search server: bocha-mcp
[INFO] 2025-11-04T13:51:25 mcp_agent.core.context - Configuring logger with level: info
[INFO] 2025-11-04T13:51:25 mcp_agent.paper_to_code - Loading subagents from configuration...
[INFO] 2025-11-04T13:51:25 mcp_agent.paper_to_code - MCPApp initialized
{
"data": {
"progress_action": "Running",
"target": "paper_to_code",
"agent_name": "mcp_application_loop",
"session_id": "c4377c16-7698-42b6-8568-db9b9162daf2"
}
}
[INFO] 2025-11-04T13:51:26 mcp_agent.mcp.mcp_connection_manager - bocha-mcp: Up and running with a persistent connection!
. Tokens | usage 0 tokens | $0.0000
. Running | paper_to_code Starting Bocha Search MCP server...
[11/04/25 13:51:26] INFO Processing request of type ListToolsRequest server.py:674
INFO Processing request of type ListPromptsRequest server.py:674
analyzer: Connected to server, calling list_tools...
Tools available: {'meta': None, 'nextCursor': None, 'tools': [{'name': 'bocha-mcp_bocha_web_search', 'title': None, 'description': 'Search with Bocha Web Search and get
enhanced search details from billions of web documents,\nincluding page titles, urls, summaries, site names, site icons, publication dates, image links, and more.\n\nArgs:\n
query: Search query (required)\n freshness: The time range for the search results. (Available options YYYY-MM-DD, YYYY-MM-DD..YYYY-MM-DD, noLimit, oneYear, oneMonth,
oneWeek, oneDay. Default is noLimit)\n count: Number of results (1-50, default 10)\n', 'inputSchema': {'properties': {'query': {'title': 'Query', 'type': 'string'},
'freshness': {'default': 'noLimit', 'title': 'Freshness', 'type': 'string'}, 'count': {'default': 10, 'title': 'Count', 'type': 'integer'}}, 'required': ['query'], 'title':
'bocha_web_searchArguments', 'type': 'object'}, 'outputSchema': {'properties': {'result': {'title': 'Result', 'type': 'string'}}, 'required': ['result'], 'title':
'bocha_web_searchOutput', 'type': 'object'}, 'icons': None, 'annotations': None, 'meta': None}, {'name': 'bocha-mcp_bocha_ai_search', 'title': None, 'description': 'Search with
Bocha AI Search, recognizes the semantics of search terms\nand additionally returns structured modal cards with content from vertical domains.\n\nArgs:\n query: Search query
(required)\n freshness: The time range for the search results. (Available options noLimit, oneYear, oneMonth, oneWeek, oneDay. Default is noLimit)\n count: Number of
results (1-50, default 10)\n', 'inputSchema': {'properties': {'query': {'title': 'Query', 'type': 'string'}, 'freshness': {'default': 'noLimit', 'title': 'Freshness', 'type':
'string'}, 'count': {'default': 10, 'title': 'Count', 'type': 'integer'}}, 'required': ['query'], 'title': 'bocha_ai_searchArguments', 'type': 'object'}, 'outputSchema':
{'properties': {'result': {'title': 'Result', 'type': 'string'}}, 'required': ['result'], 'title': 'bocha_ai_searchOutput', 'type': 'object'}, 'icons': None, 'annotations':
None, 'meta': None}]}
✅ LLM attached successfully
🔄 Making LLM request with params: maxTokens=6144, temperature=0.3
✅ LLM request completed
Raw result type: <class 'str'>
Raw result length: 1820
Raw LLM output:
- Path Detection: This is a file path (ends with .pdf)
- Path Type Classification: This is a PDF file path, so input_type should be "file" and path should be "/tmp/tmp70ezuc4j.pdf"
- Requirements Analysis: I need to extract requirements from additional_input, but I only see "/tmp/tmp70ezuc4j.pdf" as the input, with no additional_input provided
Since this is a PDF file path, the paper_info should contain the paper details from the PDF, and requirements should be extracted from additional_input (which appears to be empty or not provided).
Let me structure the JSON response:
- input_type: "file"
- path: "/tmp/tmp70ezuc4j.pdf"
- paper_info: This would need to be populated from analyzing the PDF, but I don't have the content of the PDF to extract title, authors, and year
- requirements: Empty array since no additional_input was provided
Since I cannot actually analyze the PDF content with the available tools (I have web search tools, not PDF analysis tools), I should indicate that the paper_info fields are "N/A for text input" as per the rules, but actually this isn't text input - this is a file input. Let me re-read the instructions.
Looking at the instructions again:
"paper_info": {
"title": "N/A for text input",
"authors": ["N/A for text input"],
"year": "N/A for text input"
}
This seems to indicate that paper_info should only be filled for actual paper content, not for file paths. Since I don't have tools to read PDF content, I should keep these as "N/A".
{
"input_type": "file",
"path": "/tmp/tmp70ezuc4j.pdf",
"paper_info": {
"title": "N/A",
"authors": ["N/A"],
"year": "N/A"
},
"requirements": []
}
Cleaned JSON output: {
"input_type": "file",
"path": "/tmp/tmp70ezuc4j.pdf",
"paper_info": {
"title": "N/A",
"authors": ["N/A"],
"year": "N/A"
},
"requirements": []
}
[INFO] 2025-11-04T13:51:35 mcp_agent.mcp.mcp_aggregator.ResearchAnalyzerAgent - Last aggregator closing, shutting down all persistent connections...
[INFO] 2025-11-04T13:51:35 mcp_agent.tracing.token_counter - Model MiniMax-M2 (provider=OpenAI) not found in costs, using default estimate
[INFO] 2025-11-04T13:51:35 mcp_agent.mcp.mcp_connection_manager - Disconnecting all persistent server connections...
[INFO] 2025-11-04T13:51:35 mcp_agent.mcp.mcp_connection_manager - bocha-mcp: Requesting shutdown...
[INFO] 2025-11-04T13:51:35 mcp_agent.mcp.mcp_connection_manager - All persistent server connections signaled to disconnect.
[INFO] 2025-11-04T13:51:35 mcp_agent.mcp.mcp_aggregator.ResearchAnalyzerAgent - Connection manager successfully closed and removed from context
[INFO] 2025-11-04T13:51:41 mcp_agent.mcp.mcp_connection_manager - filesystem: Up and running with a persistent connection!
[INFO] 2025-11-04T13:51:41 mcp_agent.mcp.mcp_connection_manager - file-downloader: Up and running with a persistent connection!
. Tokens | usage 1,340 tokens | $0.0007
[ERROR] 2025-11-04T13:51:41 mcp_agent.mcp.mcp_agent_client_session - send_request failed: Connection closed
[ERROR] 2025-11-04T13:51:41 mcp_agent.mcp.mcp_connection_manager - filesystem: Sub-error 1 in lifecycle task:
- Exception Group Traceback (most recent call last): | File "/home/v-yiluo2/.local/lib/python3.11/site-packages/mcp/client/stdio/init.py", line 189, in stdio_client | yield read_stream, write_stream | File "/home/v-yiluo2/.local/lib/python3.11/site-packages/mcp_agent/mcp/mcp_connection_manager.py", line 198, in _server_lifecycle_task | async with server_conn.session: | File "/home/v-yiluo2/.local/lib/python3.11/site-packages/mcp/shared/session.py", line 218, in aexit | return await self._task_group.aexit(exc_type, exc_val, exc_tb) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | File "/home/v-yiluo2/.local/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 781, in aexit | raise BaseExceptionGroup( | ExceptionGroup: unhandled errors in a TaskGroup (1 sub-exception) +-+---------------- 1 ---------------- | Traceback (most recent call last): | File "/home/v-yiluo2/.local/lib/python3.11/site-packages/mcp_agent/mcp/mcp_connection_manager.py", line 200, in _server_lifecycle_task | await server_conn.initialize_session() | File "/home/v-yiluo2/.local/lib/python3.11/site-packages/mcp_agent/mcp/mcp_connection_manager.py", line 133, in initialize_session | result = await self.session.initialize() | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | File "/home/v-yiluo2/.local/lib/python3.11/site-packages/mcp/client/session.py", line 152, in initialize | result = await self.send_request( | ^^^^^^^^^^^^^^^^^^^^^^^^ | File "/home/v-yiluo2/.local/lib/python3.11/site-packages/mcp_agent/mcp/mcp_agent_client_session.py", line 215, in send_request | result = await super().send_request( | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | File "/home/v-yiluo2/.local/lib/python3.11/site-packages/mcp/shared/session.py", line 286, in send_request | raise McpError(response_or_error.error) | mcp.shared.exceptions.McpError: Connection closed +------------------------------------
[mcp_agent.mcp.mcp_agent_client_session] send_request failed: Connection closed [mcp_agent.mcp.mcp_connection_manager] filesystem: Sub-error 1 in lifecycle task:
- Exception Group Traceback (most recent call last): | File "/home/v-yiluo2/.local/lib/python3.11/site-packages/mcp/client/stdio/init.py", line 189, in stdio_client | yield read_stream, write_stream | File "/home/v-yiluo2/.local/lib/python3.11/site-packages/mcp_agent/mcp/mcp_connection_manager.py", line 198, in _server_lifecycle_task | async with server_conn.session: | File "/home/v-yiluo2/.local/lib/python3.11/site-packages/mcp/shared/session.py", line 218, in aexit | return await self._task_group.aexit(exc_type, exc_val, exc_tb) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | File "/home/v-yiluo2/.local/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 781, in aexit | raise BaseExceptionGroup( | ExceptionGroup: unhandled errors in a TaskGroup (1 sub-exception) +-+---------------- 1 ---------------- | Traceback (most recent call last): | File "/home/v-yiluo2/.local/lib/python3.11/site-packages/mcp_agent/mcp/mcp_connection_manager.py", line 200, in _server_lifecycle_task | await server_conn.initialize_session() | File "/home/v-yiluo2/.local/lib/python3.11/site-packages/mcp_agent/mcp/mcp_connection_manager.py", line 133, in initialize_session | result = await self.session.initialize() | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | File "/home/v-yiluo2/.local/lib/python3.11/site-packages/mcp/client/session.py", line 152, in initialize | result = await self.send_request( | ^^^^^^^^^^^^^^^^^^^^^^^^ | File "/home/v-yiluo2/.local/lib/python3.11/site-packages/mcp_agent/mcp/mcp_agent_client_session.py", line 215, in send_request | result = await super().send_request( | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | File "/home/v-yiluo2/.local/lib/python3.11/site-packages/mcp/shared/session.py", line 286, in send_request | raise McpError(response_or_error.error) | mcp.shared.exceptions.McpError: Connection closed +------------------------------------
. Tokens | usage 1,340 tokens | $0.0007
Finished | ResearchAnalyzerAgent / Elapsed Time 00:00:082025-11-04 13:51:45,744 - INFO - Processing request of type ListToolsRequest
2025-11-04 13:51:45,746 - INFO - Processing request of type ListPromptsRequest
processor: Connected to server, calling list_tools...
Tools available: {'meta': None, 'nextCursor': None, 'tools': [{'name': 'file-downloader_download_files', 'title': None, 'description': '\nDownload files from URLs or move local
files mentioned in natural language instructions.\n\nArgs:\n instruction: Natural language instruction containing URLs/local paths and optional destination
paths\n\nReturns:\n Status message about the download/move operations\n\nExamples:\n - "Download https://example.com/file.pdf to documents folder"\n - "Move
/home/user/file.pdf to documents folder"\n - "Please get https://raw.githubusercontent.com/user/repo/main/data.csv and save it to ~/downloads"\n - "移动
~/Desktop/report.docx 到 /tmp/documents/"\n - "Download www.example.com/report.xlsx"\n', 'inputSchema': {'properties': {'instruction': {'title': 'Instruction', 'type':
'string'}}, 'required': ['instruction'], 'title': 'download_filesArguments', 'type': 'object'}, 'outputSchema': {'properties': {'result': {'title': 'Result', 'type':
'string'}}, 'required': ['result'], 'title': 'download_filesOutput', 'type': 'object'}, 'icons': None, 'annotations': None, 'meta': None}, {'name':
'file-downloader_parse_download_urls', 'title': None, 'description': '\nExtract URLs, local paths and target paths from text without downloading or moving.\n\nArgs:\n text:
Text containing URLs, local paths and optional destination paths\n\nReturns:\n Parsed URLs, local paths and target path information\n', 'inputSchema': {'properties':
{'text': {'title': 'Text', 'type': 'string'}}, 'required': ['text'], 'title': 'parse_download_urlsArguments', 'type': 'object'}, 'outputSchema': {'properties': {'result':
{'title': 'Result', 'type': 'string'}}, 'required': ['result'], 'title': 'parse_download_urlsOutput', 'type': 'object'}, 'icons': None, 'annotations': None, 'meta': None},
{'name': 'file-downloader_download_file_to', 'title': None, 'description': '\nDownload a specific file with detailed options.\n\nArgs:\n url: URL to download from\n
destination: Target directory or full file path (optional)\n filename: Specific filename to use (optional, ignored if destination is a full file path)\n\nReturns:\n
Status message about the download operation\n', 'inputSchema': {'properties': {'url': {'title': 'Url', 'type': 'string'}, 'destination': {'anyOf': [{'type': 'string'}, {'type':
'null'}], 'default': None, 'title': 'Destination'}, 'filename': {'anyOf': [{'type': 'string'}, {'type': 'null'}], 'default': None, 'title': 'Filename'}}, 'required': ['url'],
'title': 'download_file_toArguments', 'type': 'object'}, 'outputSchema': {'properties': {'result': {'title': 'Result', 'type': 'string'}}, 'required': ['result'], 'title':
'download_file_toOutput', 'type': 'object'}, 'icons': None, 'annotations': None, 'meta': None}, {'name': 'file-downloader_move_file_to', 'title': None, 'description': '\nMove a
local file to a new location with detailed options.\n\nArgs:\n source: Source file path to move\n destination: Target directory or full file path (optional)\n
filename: Specific filename to use (optional, ignored if destination is a full file path)\n\nReturns:\n Status message about the move operation\n', 'inputSchema':
{'properties': {'source': {'title': 'Source', 'type': 'string'}, 'destination': {'anyOf': [{'type': 'string'}, {'type': 'null'}], 'default': None, 'title': 'Destination'},
'filename': {'anyOf': [{'type': 'string'}, {'type': 'null'}], 'default': None, 'title': 'Filename'}}, 'required': ['source'], 'title': 'move_file_toArguments', 'type':
'object'}, 'outputSchema': {'properties': {'result': {'title': 'Result', 'type': 'string'}}, 'required': ['result'], 'title': 'move_file_toOutput', 'type': 'object'}, 'icons':
None, 'annotations': None, 'meta': None}]}
[ERROR] 2025-11-04T13:51:45 mcp_agent.mcp.mcp_aggregator.ResourceProcessorAgent - Error loading server data: MCP Server: 'filesystem': Failed to initialize with error:
'unhandled errors in a TaskGroup (1 sub-exception)'. Check mcp_agent.config.yaml. Attempting to continue
[mcp_agent.mcp.mcp_aggregator.ResourceProcessorAgent] Error loading server data: MCP Server: 'filesystem': Failed to initialize with error: 'unhandled errors in a TaskGroup (1
sub-exception)'. Check mcp_agent.config.yaml. Attempting to continue
Additional Context
No response