Dead code: utils/api.ts duplicate client, unused useIsGM/useIsOwner hooks, broken mcpClient #39

Closed
opened 2026-08-23 05:42:06 +00:00 by nasandre · 1 comment
Owner

Cleanup (relates to #6)

Verified-unused code paths in the frontend:

  1. `frontend/src/utils/api.ts` — entire duplicate API layer, zero imports anywhere (grep confirms); overlaps with open issue #6
  2. `frontend/src/hooks/useAuth.ts` — `useIsGM()` and `useIsOwner()` defined, never used (pages use authStore directly)
  3. `frontend/src/api/client.ts` mcpClient (~60 lines) — never called by any page/component; additionally its REST-style calls (`GET /resources?uri=`, `POST /tools`) don't match FastMCP's streamable-HTTP JSON-RPC protocol, so it could never have worked against the current server

Suggested fix

Delete 1 & 2; either implement real MCP protocol support (JSON-RPC over /mcp) or drop mcpClient until needed.

## Cleanup (relates to #6) Verified-unused code paths in the frontend: 1. \`frontend/src/utils/api.ts\` — entire duplicate API layer, **zero imports** anywhere (grep confirms); overlaps with open issue #6 2. \`frontend/src/hooks/useAuth.ts\` — \`useIsGM()\` and \`useIsOwner()\` defined, never used (pages use authStore directly) 3. \`frontend/src/api/client.ts\` mcpClient (~60 lines) — never called by any page/component; additionally its REST-style calls (\`GET /resources?uri=\`, \`POST /tools\`) don't match FastMCP's streamable-HTTP JSON-RPC protocol, so it could never have worked against the current server ## Suggested fix Delete 1 & 2; either implement real MCP protocol support (JSON-RPC over /mcp) or drop mcpClient until needed.
Author
Owner

✅ Fixed (commit 05b5453) — verified-zero-imports code deleted:

  • frontend/src/utils/api.ts (whole duplicate layer)
  • frontend/src/hooks/useAuth.ts (unused useIsGM/useIsOwner)
  • mcpClient class + MCP_BASE_URL from api/client.ts (~70 lines)
    Build passes; bundle shrinks by ~1.5kB gzipped of dead weight.
✅ **Fixed** (commit `05b5453`) — verified-zero-imports code deleted: - `frontend/src/utils/api.ts` (whole duplicate layer) - `frontend/src/hooks/useAuth.ts` (unused `useIsGM`/`useIsOwner`) - `mcpClient` class + `MCP_BASE_URL` from api/client.ts (~70 lines) Build passes; bundle shrinks by ~1.5kB gzipped of dead weight.
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
nasandre/wh40-rogue-trader#39
No description provided.