Skip to content

fix: unblock anonymous /mcp, repair feature cards, correct demo schema - #24

Merged
idanmann10 merged 1 commit into
mainfrom
claude/fix-chat-component-bugs-bYFa6
May 13, 2026
Merged

fix: unblock anonymous /mcp, repair feature cards, correct demo schema#24
idanmann10 merged 1 commit into
mainfrom
claude/fix-chat-component-bugs-bYFa6

Conversation

@idanmann10

Copy link
Copy Markdown
Owner

Summary

Three bugs you flagged:

1. "When putting the URL into chat it gets a weird error"

The landing page, README, and FAQ all say "free, no API key, 60 calls/min per client" — but authMiddleware was returning 401 unauthorized on /mcp in production for every request without a bearer token. Pasting https://mcp.shopdeals.sh/mcp into Claude / ChatGPT / Cursor surfaced that 401 as a "weird error" instead of just working.

  • Added /mcp and /api to the prod anonymous allowlist (src/auth/anonymous.ts).
  • buildApp({ allowAnonymous }) now defaults to true; the route-level allowlist already gates which paths anonymous can reach in prod, so the env-gated default was redundant and bug-prone.
  • The global rate limiter previously keyed off principal.clientHash, which is the literal string "anonymous" for every unauthenticated caller — meaning all free users shared one 60/min bucket. Anonymous traffic is now keyed off x-forwarded-for / cf-connecting-ip / x-real-ip, so each IP gets its own 60/min as advertised.

2. "Built for AI agents — clicking a component doesn't auto-expand"

The click handler was only on .fc-top (the tiny icon + pill strip at the top of each card). Clicking the title, body, or empty card area did nothing. Now the entire collapsed card is the click target; once expanded, the CTA link still navigates (we skip the expand handler when the target is an <a> or <button> inside an already-expanded card). The focus ring + cursor: pointer moved to the card itself.

3. "Add a full AI prompt that works and test it"

While doing this I noticed the demo and README example called find_best_deal with maxPriceCents and applyCouponsneither field exists on the actual Zod schema ({ query, country?, alternatives? }). A real agent following that example would have failed validation.

  • Demo + README now use the real schema.
  • Demo extended to two tool calls — find_best_deal then get_code_for_url — to show a full agent flow (compare sellers, then verify the winning coupon before recommending it).
  • README gains a copy-paste prompt users can drop into their AI client.

Test plan

  • npm run typecheck clean
  • npm run lint clean
  • npm test — all 166 tests pass (including test/auth/middleware.test.ts and test/landing/landing.test.ts)
  • Manual: paste https://mcp.shopdeals.sh/mcp into Claude Desktop with no API key after deploy → tools/list succeeds
  • Manual: run the README prompt against the live server → both tool calls succeed
  • Manual: click anywhere on a collapsed feature card on shopdeals.sh → expands

https://claude.ai/code/session_01YFa2Xf6Bkw3rnR3DXeVtgj


Generated by Claude Code

…correct demo schema

The hosted endpoint advertises "free, no API key" everywhere (landing page,
README, FAQ) but the auth middleware was returning 401 on /mcp in production
for any request without a bearer token — so pasting https://mcp.shopdeals.sh/mcp
into Claude / ChatGPT / Cursor surfaced a "weird error" instead of working.

  * Add `/mcp` and `/api` to the prod anonymous allowlist so the documented
    flow actually works.
  * Default `buildApp({ allowAnonymous })` to true; route-level gating in
    `isAnonymousAllowed` already constrains what anonymous can reach.
  * Key the global MCP rate limiter off the source IP for anonymous callers
    so the shared "anonymous" clientHash no longer collapses every free user
    into a single 60/min bucket.

Landing-page UX:
  * Feature cards under "Built for AI agents" now expand from a click
    anywhere on the collapsed card (previously only the small header
    region was clickable). The CTA link still navigates once expanded.
  * The static `find_best_deal` example used args that don't exist on the
    real Zod schema (`maxPriceCents`, `applyCoupons`). Replaced with the
    actual surface (`query`, `alternatives`) and added a second tool call
    (`get_code_for_url`) so the demo shows a full multi-tool agent flow.

README's "Example conversation" mirrors the corrected demo and gains a
ready-to-paste prompt users can run against the live server.
@vercel

vercel Bot commented May 13, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
snap-ai Ready Ready Preview, Comment May 13, 2026 8:49pm

@idanmann10
idanmann10 marked this pull request as ready for review May 13, 2026 20:51
@idanmann10
idanmann10 merged commit 28488ff into main May 13, 2026
3 checks 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.

2 participants