mirror of
https://github.com/GH05TCREW/MetasploitMCP.git
synced 2026-07-20 14:10:10 -04:00
[PR #7] [MERGED] Fix timeout handling and add debugging for MCP tools #11
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/GH05TCREW/MetasploitMCP/pull/7
Author: @cbdmaul
Created: 8/17/2025
Status: ✅ Merged
Merged: 8/17/2025
Merged by: @GH05TCREW
Base:
main← Head:fix/timeout-handling-and-debugging📝 Commits (4)
fe2eeb0minor fixesfd4911aMerge branch 'main' of https://github.com/GH05TCREW/MetasploitMCP1aec612Fix timeout handling and add debugging for MCP tools4bed20dFix failing unit tests and improve integration test setup📊 Changes
13 files changed (+1966 additions, -25 deletions)
View changed files
➕
Makefile(+95 -0)📝
MetasploitMCP.py(+241 -25)📝
README.md(+123 -0)➕
bash.exe.stackdump(+16 -0)➕
conftest.py(+157 -0)➕
pytest.ini(+38 -0)➕
requirements-test.txt(+6 -0)📝
requirements.txt(+1 -0)➕
run_tests.py(+129 -0)➕
tests/__init__.py(+1 -0)➕
tests/test_helpers.py(+341 -0)➕
tests/test_options_parsing.py(+247 -0)➕
tests/test_tools_integration.py(+571 -0)📄 Description
Problem
The
list_exploitscall was hanging for 3+ minutes when the Metasploit server was slow or unresponsive, with no debug logs or user feedback about the issue.Solution
Added comprehensive timeout handling and debugging improvements:
✅ Timeout Handling
RPC_CALL_TIMEOUT = 30seconds constant for RPC operationsasyncio.wait_for()to prevent hanging:list_exploits()andlist_payloads()list_active_sessions()andlist_listeners()✅ Debug Logging & Error Handling
check_msf_connection()helper function for connection status✅ User Feedback
Testing
Impact
Files Changed
MetasploitMCP.py- Core timeout and debugging improvementstests/test_helpers.py- Fixed unit test expectationstests/test_tools_integration.py- Improved integration test mockingResolves the timeout issue where list_exploits would hang indefinitely.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.