From 46928cba3d4e68152d53ab00649c623fbb240cbd Mon Sep 17 00:00:00 2001 From: arc53-machine <232052973+arc53-machine@users.noreply.github.com> Date: Mon, 28 Sep 2026 23:16:42 +0100 Subject: [PATCH] Return the OAuth task id from the MCP test route The client follows an MCP sign-in by its task's events, but the test route kept only success, requires_oauth and auth_url, so the wizard and the custom MCP modal reported a failed sign-in before the popup could load. --- docsgpt/api/user/tools/mcp.py | 2 +- tests/api/user/test_tools_mcp_pg.py | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/docsgpt/api/user/tools/mcp.py b/docsgpt/api/user/tools/mcp.py index 318d1b91..d443a800 100644 --- a/docsgpt/api/user/tools/mcp.py +++ b/docsgpt/api/user/tools/mcp.py @@ -217,7 +217,7 @@ class TestMCPServerConfig(Resource): safe_result = { k: v for k, v in result.items() - if k in ("success", "requires_oauth", "auth_url") + if k in ("success", "requires_oauth", "auth_url", "task_id") } return make_response(jsonify(safe_result), 200) diff --git a/tests/api/user/test_tools_mcp_pg.py b/tests/api/user/test_tools_mcp_pg.py index 2037c6cc..3718763e 100644 --- a/tests/api/user/test_tools_mcp_pg.py +++ b/tests/api/user/test_tools_mcp_pg.py @@ -232,6 +232,8 @@ class TestTestMCPServerConfig: "success": False, "requires_oauth": True, "auth_url": "https://auth/ex", + "task_id": "task-123", + "message": "OAuth required", } with patch( @@ -252,6 +254,8 @@ class TestTestMCPServerConfig: response = TestMCPServerConfig().post() assert response.status_code == 200 assert response.json["requires_oauth"] is True + # The client follows the sign-in by this task's events. + assert response.json["task_id"] == "task-123" def test_unexpected_exception_returns_500(self, app): from docsgpt.api.user.tools.mcp import TestMCPServerConfig