[PR #3141] [CLOSED] [GUI] web: retry a failed GET /mcp instead of hiding the MCP tools for the session (#3113) #4474

Closed
opened 2026-11-07 15:36:17 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/3141
Author: @ctr-137
Created: 10/19/2026
Status: ❌ Closed

Base: main ← Head: web-mcp-retry


📝 Commits (1)

  • cf4b626 web: retry a failed GET /mcp instead of hiding the MCP tools for the session (#3113)

📊 Changes

3 files changed (+144 additions, -11 deletions)

View changed files

📝 docs/DETAILS.md (+3 -1)
➕ serve/test_web_mcp_retry.py (+89 -0)
📝 serve/web/app.js (+52 -10)

📄 Description

Issue: #3113 (the web-app half; #3135 fixed the server half)

Summary

loadMcp() returned on !r.ok and on a fetch exception, and scheduled a retry only while a server's status was
literally starting. One failed GET /mcp - a 401 before the API key was entered, a server restart, a proxy hiccup

  • disabled the MCP tools for the life of the tab: the card was hidden, mcpInfo.tools stayed 0, and every chat
    request left strata_mcp off. That is the second way #3113's "the backend loaded 14 tools, the page does not use
    them" can happen.

What changed

  • serve/web/app.js
    • A failed status fetch (network error, 5xx, 401, or a body that stops arriving) is retried after 3, 6, 12 and then
      every 30 seconds; a success resets the backoff.
    • A 404 (an older server without /mcp) is not retried, and it clears a stale tool list.
    • The Monitor's MCP card says why the status is missing ("MCP status needs the API key (About > Settings)", "the
      server is unreachable; retrying") instead of silently disappearing. A list from the last successful fetch stays
      visible and is labelled "last known state shown".
    • Entering or changing the API key asks again immediately instead of waiting out the backoff; turning the MCP
      toggle on does the same when no tools are known.
  • docs/DETAILS.md: one sentence on the retry schedule.
  • serve/test_web_mcp_retry.py: a node test pins the schedule, the 404 stop, the 401 message, the success reset and
    the starting poll (skipped without node, like test_web_sampling).

Validation

  • node --check serve/web/app.js - syntax OK.
  • python -m unittest serve.test_web_mcp_retry serve.test_web_sampling - 5 tests, OK.
  • Manual, in the browser, against a real python -m serve.server --engine mock --port 8096 --api-key k --mcp-config ... and the Streamable HTTP fake MCP server:
    • before the key: the Monitor card shows "MCP status needs the API key (About > Settings)";
    • after entering the key in About > Settings: "6 tools · 1 of 1 servers connected" with the fake server's
      tools, without a reload.
  • Regression: with serve/web/app.js reverted (the test kept), the node test fails (mcpError is not defined);
    with the change it passes.
  • The full serve suite: 849 tests; the only error is test_winjob.TestWinJob (a Windows tasklist call
    returning None here), the same one as on unmodified main (848 tests). test_keepawake is timing-flaky under
    the full run and passes alone; neither is related to this change.

What I left alone

  • The hard-coded 10 s MCP start wait is a separate change.
  • A cut-off HTTP transport answer is PR #3139.
  • The retry stops at a 404 on purpose: an older server has no /mcp, and retrying forever would only fill the
    console.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/3141 **Author:** [@ctr-137](https://github.com/ctr-137) **Created:** 10/19/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `web-mcp-retry` --- ### 📝 Commits (1) - [`cf4b626`](https://github.com/Niko1221/Strata/commit/cf4b6262c3b8d3c87fa2d33ec85dc0b9d242503f) web: retry a failed GET /mcp instead of hiding the MCP tools for the session (#3113) ### 📊 Changes **3 files changed** (+144 additions, -11 deletions) <details> <summary>View changed files</summary> 📝 `docs/DETAILS.md` (+3 -1) ➕ `serve/test_web_mcp_retry.py` (+89 -0) 📝 `serve/web/app.js` (+52 -10) </details> ### 📄 Description Issue: #3113 (the web-app half; #3135 fixed the server half) ## Summary `loadMcp()` returned on `!r.ok` and on a fetch exception, and scheduled a retry only while a server's status was literally `starting`. One failed `GET /mcp` - a 401 before the API key was entered, a server restart, a proxy hiccup - disabled the MCP tools for the life of the tab: the card was hidden, `mcpInfo.tools` stayed 0, and every chat request left `strata_mcp` off. That is the second way #3113's "the backend loaded 14 tools, the page does not use them" can happen. ## What changed - `serve/web/app.js` - A failed status fetch (network error, 5xx, 401, or a body that stops arriving) is retried after 3, 6, 12 and then every 30 seconds; a success resets the backoff. - A 404 (an older server without `/mcp`) is not retried, and it clears a stale tool list. - The Monitor's MCP card says why the status is missing ("MCP status needs the API key (About > Settings)", "the server is unreachable; retrying") instead of silently disappearing. A list from the last successful fetch stays visible and is labelled "last known state shown". - Entering or changing the API key asks again immediately instead of waiting out the backoff; turning the MCP toggle on does the same when no tools are known. - `docs/DETAILS.md`: one sentence on the retry schedule. - `serve/test_web_mcp_retry.py`: a node test pins the schedule, the 404 stop, the 401 message, the success reset and the `starting` poll (skipped without node, like `test_web_sampling`). ## Validation - `node --check serve/web/app.js` - syntax OK. - `python -m unittest serve.test_web_mcp_retry serve.test_web_sampling` - **5 tests, OK**. - **Manual, in the browser**, against a real `python -m serve.server --engine mock --port 8096 --api-key k --mcp-config ...` and the Streamable HTTP fake MCP server: - before the key: the Monitor card shows **"MCP status needs the API key (About > Settings)"**; - after entering the key in About > Settings: **"6 tools · 1 of 1 servers connected"** with the fake server's tools, without a reload. - Regression: with `serve/web/app.js` reverted (the test kept), the node test fails (`mcpError is not defined`); with the change it passes. - The full `serve` suite: **849 tests; the only error is `test_winjob.TestWinJob`** (a Windows `tasklist` call returning `None` here), the same one as on unmodified `main` (848 tests). `test_keepawake` is timing-flaky under the full run and passes alone; neither is related to this change. ## What I left alone - The hard-coded 10 s MCP start wait is a separate change. - A cut-off HTTP transport answer is PR #3139. - The retry stops at a 404 on purpose: an older server has no `/mcp`, and retrying forever would only fill the console. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 15:36:17 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#4474
No description provided.