Skip to content

fix: handle empty base URL, loopback/blank frames, Windows smoke test, and add --check - #13

Open
ewwhardik wants to merge 1 commit into
prooflinedev:mainfrom
ewwhardik:fix/env-loopback-and-check-flag
Open

ewwhardik wants to merge 1 commit into
prooflinedev:mainfrom
ewwhardik:fix/env-loopback-and-check-flag

Conversation

@ewwhardik

Copy link
Copy Markdown

Who this helps

Coding-agent users and contributors setting up @proofline/mcp in Cursor, Claude Code, Codex, or Windows environments benefit from four concrete fixes and a preflight diagnostic command:

  1. Empty PROOFLINE_BASE_URL handling (src/bridge.js): Previously env.PROOFLINE_BASE_URL ?? "https://proofline.sh" treated an empty environment string ("", often left by CI/IDE .env templates) as an invalid URL and exited 1. Empty PROOFLINE_BASE_URL now counts as unset and falls back cleanly to https://proofline.sh, matching @proofline/sdk.
  2. Loopback dev origins (src/bridge.js): Allows http://localhost and http://127.x.y.z alongside [::1] for local HTTP test/proxy endpoints, while preserving strict rejection of credentials, paths, query/fragment, and remote HTTP.
  3. Blank keepalive frames & specific sanitized startup errors (src/bridge.js, src/cli.js): Ignores empty/CRLF-only stdio lines instead of throwing -32700 parse errors, adds User-Agent: proofline-mcp/<version>, surfaces which env var failed (set PROOFLINE_TOKEN vs invalid origin) without ever echoing token/URL values, and adds proofline-mcp --check so users can validate setup before launching an agent.
  4. Windows test:package fix (scripts/packed-smoke.js): Spawning npm.cmd directly via execFileSync raises spawnSync npm.cmd EINVAL on Node >= 22 on Windows. Invoking process.env.npm_execpath via process.execPath (with shell: process.platform === "win32" fallback) fixes npm run test:package cross-platform.

How I verified it

All checks run after the final edit inside mcp on Node v26.13.1 / Windows 11:

  • npm run check (node --check src/cli.js && node --check src/bridge.js) — passed
  • npm test (node --test tests/*.test.js) — 13/13 passed (12 existing + new coverage for empty PROOFLINE_BASE_URL, localhost/127.0.0.2, CRLF/blank keepalive frames, User-Agent, and --check)
  • npm run test:package (node scripts/packed-smoke.js) — packed tarball, installed into a clean temp dir, and ran 11/11 tests/bridge.test.js + --version checks cleanly

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant