Summary
The routing hook (hooks/core/routing.mjs) unconditionally denies every WebFetch call and redirects to ctx_fetch_and_index, with no exemption for claude.ai/code/artifact/{uuid} URLs. This makes it impossible to fetch the actual content of a Claude Code artifact through Claude Code's tool set while context-mode is active.
Root cause
ctx_fetch_and_index is a plain unauthenticated HTTP fetch with no JS rendering. claude.ai/code/artifact/{uuid} pages are SPA-rendered and require Claude Code's native WebFetch authenticated fetch path (this is documented directly in WebFetch's own tool description as an explicit exception: "claude.ai/code/artifact/{uuid} URLs ARE fetchable, WebFetch uses your claude.ai login"). Redirecting these URLs to ctx_fetch_and_index can only ever return the SPA shell, never the artifact's rendered content — there is no workaround through the sandboxed tool.
Suggested fix
Add an exemption in the WebFetch handler so claude.ai/preview.claude.ai artifact URLs bypass the redirect and reach the real WebFetch tool, e.g.:
if (canonical === "WebFetch") {
const url = toolInput.url ?? "";
if (/^https:\/\/(preview\.)?claude\.ai\/code\/artifact\//.test(url)) {
return null;
}
return mcpRedirect({ /* ...existing redirect... */ });
}
Verified locally: this patch, applied both to the installed plugin cache and the marketplace source copy, restores correct artifact fetching (tested against a real published artifact).
Secondary note (not the main bug, worth being aware of)
Once the redirect is bypassed, WebFetch's native artifact handling saves the full page HTML (1MB+, mostly embedded base64 web fonts) to a file and returns only a small head preview, rather than a prompt-processed extract. Not something this plugin needs to fix, but worth documenting for anyone hitting this: pull real content out of the saved HTML via a script that strips <style>/<script> tags rather than reading the raw file.
Environment
- context-mode plugin version: 1.0.162
- Reproduced via Claude Code with context-mode installed as a marketplace plugin
Summary
The routing hook (
hooks/core/routing.mjs) unconditionally denies everyWebFetchcall and redirects toctx_fetch_and_index, with no exemption forclaude.ai/code/artifact/{uuid}URLs. This makes it impossible to fetch the actual content of a Claude Code artifact through Claude Code's tool set while context-mode is active.Root cause
ctx_fetch_and_indexis a plain unauthenticated HTTP fetch with no JS rendering.claude.ai/code/artifact/{uuid}pages are SPA-rendered and require Claude Code's nativeWebFetchauthenticated fetch path (this is documented directly inWebFetch's own tool description as an explicit exception: "claude.ai/code/artifact/{uuid} URLs ARE fetchable, WebFetch uses your claude.ai login"). Redirecting these URLs toctx_fetch_and_indexcan only ever return the SPA shell, never the artifact's rendered content — there is no workaround through the sandboxed tool.Suggested fix
Add an exemption in the
WebFetchhandler soclaude.ai/preview.claude.aiartifact URLs bypass the redirect and reach the realWebFetchtool, e.g.:Verified locally: this patch, applied both to the installed plugin cache and the marketplace source copy, restores correct artifact fetching (tested against a real published artifact).
Secondary note (not the main bug, worth being aware of)
Once the redirect is bypassed,
WebFetch's native artifact handling saves the full page HTML (1MB+, mostly embedded base64 web fonts) to a file and returns only a small head preview, rather than a prompt-processed extract. Not something this plugin needs to fix, but worth documenting for anyone hitting this: pull real content out of the saved HTML via a script that strips<style>/<script>tags rather than reading the raw file.Environment