Skip to content

fix(mcp,core): #3504 silent npx exit + dead URL hints + score contracts#15

Merged
milstan merged 2 commits intomainfrom
milstan/mcp-connect-fix-and-e2e
Apr 21, 2026
Merged

fix(mcp,core): #3504 silent npx exit + dead URL hints + score contracts#15
milstan merged 2 commits intomainfrom
milstan/mcp-connect-fix-and-e2e

Conversation

@milstan
Copy link
Copy Markdown
Contributor

@milstan milstan commented Apr 21, 2026

Summary

Three failure modes a user hits before getting any work done, fixed in one pass:

  • product#3504npx -y @leadbay/mcp exited 0 silently on Node 25 because isEntrypoint compared the npx shim symlink to the resolved dist/bin.js. Both sides now go through realpathSync. New test/smoke/npx-entrypoint.test.ts is the regression guard (reproduce-then-fix verified).
  • Replaced dead app.leadbay.ai URLs in error strings + READMEs with the real recovery commands. Hints now include --region <us\|fr> because the CLI refuses without it (anti-cross-region credential-leak guard).
  • avg_score_0_to_10 was lying — per-question AI agent scores are discrete boosts (-10/0/10/20). Renamed to avg_qualification_boost. JSDoc on AiAgentResponse.score, LeadPayload.score, and LeadPayload.ai_agent_lead_score now documents the real contract (similarity + qualification boost, combined and normalized server-side to 0-100).

Live smoke harness extended with composite-level checks + optional thinking-model judge writing a redacted report to .context/. Token-first via LEADBAY_TEST_TOKEN; macOS Keychain fallback (refuses plaintext password env var). Versions: core 0.2.0→0.2.1 (private), leadclaw + mcp 0.2.1→0.2.2 (openclaw plugin manifest synced).

Test plan

  • pnpm -r typecheck green across core / leadclaw / mcp
  • pnpm test — unit suite passes
  • pnpm --filter @leadbay/mcp test:smokenpx-entrypoint.test.ts passes; live.test.ts passes against real account (LEADBAY_TEST_TOKEN + ANTHROPIC_API_KEY)
  • Reproduce-then-fix gate for #3504: stash realpath fix → smoke fails with empty stdout; restore → passes
  • After merge: comment on product#3504 with PR link + before/after npx --help transcript

🤖 Generated with Claude Code

milstan and others added 2 commits April 21, 2026 14:30
…e contracts

Three failure modes a user hits before they get any work done, fixed in one pass.

1. #3504 — `npx -y @leadbay/mcp` silently exits 0 on Node 25. The `isEntrypoint`
   check compared `process.argv[1]` (the npx shim symlink) to `import.meta.url`
   (the resolved `dist/bin.js`); they never match, so `main()` never runs and
   the MCP host sees a dead connection with no diagnostic. Both sides now go
   through `realpathSync` so the symlink collapses. Reproduce-then-fix verified
   with a new `test/smoke/npx-entrypoint.test.ts` regression guard.

2. Dead `app.leadbay.ai` URLs in error strings and READMEs replaced with the
   real recovery commands (`leadbay-mcp install`, `leadbay-mcp login`). Hints
   now include `--region <us|fr>` because the CLI refuses without it (anti-
   cross-region credential-leak guard) — earlier draft would have dead-ended
   the user a second time.

3. `avg_score_0_to_10` on `pull_leads` / `bulk_qualify_leads` was lying: per-
   question AI agent scores are discrete boosts (-10/0/10/20), not 0-10
   averages. Renamed to `avg_qualification_boost` with JSDoc on the underlying
   `AiAgentResponse.score` interface explaining the real contract. Documented
   `score` (ICP similarity) vs `ai_agent_lead_score` (deep-AI qualification
   boost) — they're combined and normalized server-side to 0-100.

Live smoke harness extended with composite-level checks + optional thinking-
model judge that writes a redacted report to `.context/`. Token-first via
`LEADBAY_TEST_TOKEN`; macOS Keychain fallback (refuses plaintext password env
var, on purpose). Versions: core 0.2.0→0.2.1 (private), leadclaw + mcp
0.2.1→0.2.2 (openclaw plugin manifest synced).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Both branches independently bumped mcp/leadclaw to 0.2.2. Combined into a
single 0.2.2 release: this branch's npx silent-exit fix + dead URL hints +
score-contract correction PLUS main's mental-model docs (SERVER_INSTRUCTIONS
inbox/two-scoring-layers/daily-rhythm + per-tool description rewrites + the
new openclaw.plugin.json description). Single coherent release rather than
two near-simultaneous tags.

Conflicts resolved:
- packages/leadclaw/CHANGELOG.md: merged 0.2.2 entries.
- packages/leadclaw/openclaw.plugin.json: kept main's longer description.
- packages/mcp/CHANGELOG.md: merged 0.2.2 entries.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@milstan milstan merged commit b4feaf5 into main Apr 21, 2026
1 check passed
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