-
Notifications
You must be signed in to change notification settings - Fork 58
[Windows] Server never persists pointed element — hardcoded /tmp path breaks get-pointed-element #22
Description
Summary
On Windows, get-pointed-element always returns "No element is currently pointed", even though the Chrome extension connects fine and reports ✓ Element sent successfully. The element never reaches the MCP tool.
Root cause
SharedStateService.SHARED_STATE_PATH is hardcoded to a POSIX path:
// packages/server/src/services/shared-state-service.ts:6 static SHARED_STATE_PATH = '/tmp/mcp-pointer-shared-state.json';
On Windows, Node resolves /tmp/... to C:\tmp\... (root of the current drive), which usually doesn't exist. So:
- Extension sends the element → server receives it (
📨 Received message from browser). saveState()callsfs.writeFile('/tmp/...')→ fails withENOENT(directory doesn't exist).- The error is swallowed by the
try/catch(onlylogger.error, and the Web Store build isIS_DEV=false, so nothing is visible in the SW console). getPointedElement()→readState()→ENOENT→ returnsnull→ tool returns"No element is currently pointed".
The browser side is 100% fine — it's purely the server failing to persist state on Windows.
Environment
- OS: Windows 11
- Node: v24
- Chrome: 145
- Extension
0.6.0,@mcp-pointer/server@0.6.0 - Client: Claude Code
Reproduction
- Install on a Windows machine that has no
C:\tmpdirectory. Alt+Clickan element — the service worker console shows✓ Element sent successfully.- Call
get-pointed-element→ always"No element is currently pointed".
Confirmation
Manually creating C:\tmp works around it: the state file appears at C:\tmp\mcp-pointer-shared-state.json and the tool returns the element. This confirms the path is the culprit.
Suggested fix
Use os.tmpdir() (cross-platform) instead of the hardcoded /tmp/:
import os from 'os'; import path from 'path'; static SHARED_STATE_PATH = path.join(os.tmpdir(), 'mcp-pointer-shared-state.json');
This preserves the cross-instance shared-state behavior (all instances for the same user resolve to the same temp dir) while working on Windows, macOS and Linux.
I have a PR ready for this and will link it shortly.