committed 07:31PM - 17 Aug 26 UTC
* feat(frontend): document the MCP endpoint on the API page
The app has been se…rving an MCP endpoint at /mcp since the backend grew one -- the frontend proxies
it through to the backend, preserving the streamable-HTTP transport -- but nothing in the UI said
so. The API page now has a card for it: what it is, the URL, a client configuration to paste, and
the fact that it needs no key or account, alongside a link to the documentation.
The URL is read from the origin the page is served from rather than hard-coded, so a self-hosted or
local instance shows its own address and the snippet works as-is.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* test(frontend): pin the MCP URL assertion to the origin under test
Copilot's review made a fair point: the test said the URL follows the origin the page is served
from, but asserted only that "/mcp" appeared somewhere in the card. A URL hard-coded to the hosted
instance would have passed it just as well.
It now asserts the origin the test itself runs under, in both places the URL is shown -- the code
block and the client configuration. Checked by mutation: replacing the computed URL with a
hard-coded https://wetterdienst.eobs.org/mcp fails the test.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* fix(frontend): only advertise MCP when the backend actually serves it
Review caught a case the card got wrong: the MCP endpoint lives behind the optional `[mcp]` extra,
so an instance installed with `pip install wetterdienst[restapi]` has no `/mcp` route at all. The
backend knows this -- its index page prints the endpoint only when `_mount_mcp` succeeded -- but the
API page showed the URL and a paste-ready client configuration unconditionally, sending every
visitor of such an instance to a 404.
`GET /api/version` now reports `mcp_enabled` next to the version, and the card renders only when it
is true. That flag is the honest answer and cheap to ask for; probing `/mcp` is not, since on the
streamable-HTTP transport a request opens a session rather than asking a question.
The page reads it with `$fetch` rather than `useFetch`: it is a fact about the backend rather than
page state, and `useFetch` keys by URL, so it would hand back whatever the app shell had already
cached for /api/version. The test registers the endpoint instead of stubbing the global fetch, the
way the glossary test already does. Both directions are covered and mutation-checked: dropping the
`v-if` fails the "says nothing about MCP" test.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>