mirror of
https://github.com/GH05TCREW/MetasploitMCP.git
synced 2026-07-19 13:36:43 -04:00
Add missing POST endpoint handler for MCP SSE transport messages
This commit is contained in:
+6
-1
@@ -1389,7 +1389,6 @@ app = FastAPI(
|
||||
|
||||
# Setup MCP transport (SSE for HTTP mode)
|
||||
sse = SseServerTransport("/messages/")
|
||||
# DO NOT manually add routes for /messages - it's handled internally by SseServerTransport
|
||||
|
||||
@app.get("/sse", tags=["MCP"])
|
||||
async def handle_sse_connection(request: Request):
|
||||
@@ -1399,6 +1398,12 @@ async def handle_sse_connection(request: Request):
|
||||
await mcp._mcp_server.run(read_stream, write_stream, mcp._mcp_server.create_initialization_options())
|
||||
logger.info(f"SSE connection closed from {request.client.host}:{request.client.port}")
|
||||
|
||||
@app.post("/messages/", tags=["MCP"])
|
||||
async def handle_post_message(request: Request):
|
||||
"""Handle client POST messages for MCP communication."""
|
||||
logger.info(f"Received POST message from {request.client.host}:{request.client.port}")
|
||||
return await sse.handle_post_message(request.scope, request.receive, request._send)
|
||||
|
||||
@app.get("/healthz", tags=["Health"])
|
||||
async def health_check():
|
||||
"""Check connectivity to the Metasploit RPC service."""
|
||||
|
||||
Reference in New Issue
Block a user