DEV Community

Discussion on: WebMCP and the Browser AI Layer: What Next.js Devs Need to Know

Collapse
 
mudassirworks profile image
Mudassir Khan

The “accidental safety” framing is exactly right. Next.js API routes get user context almost for free — auth middleware just runs. Move the same logic into an MCP tool and every handler is a blank slate. We hit this with an agent workflow: three tools that looked fine in isolation shared a userId assumption that evaporated once the orchestrator called them in sequence without threading the session. Your schema contract is basically what the middleware was silently doing. How would you handle the approval boundary for bulk writes, optimistic reject or a separate confirmation tool?