Inspiration

Inspiration

In clinical mental health practice, interactive tools like Cognitive Behavioral Therapy (CBT) thought records, pacing routines, and behavioral activation logs are essential for patient engagement. However, browser AI agents typically rely on brittle DOM scraping or simulated mouse clicks. We built TheraFlow / MindBridge to explore how the new WebMCP client-side standard enables AI agents to dynamically generate, scaffold, and adapt interactive clinical interventions with zero DOM scraping, backed by deterministic crisis circuit breakers.

What It Does

TheraFlow turns a web workspace into an agent-executable clinical environment:

  • Interactive Tool Registration: Registers structured tools (generate_cbt_thought_record, build_pacing_grounding_exercise, trigger_crisis_containment) directly via document.modelContext.registerTool.
  • Dynamic DOM Scaffolding: Agents pass structured clinical parameters to render interactive tables and visual grounding animations.
  • Deterministic Safety Overrides: If acute distress signals are evaluated, the agent triggers an immediate client-side containment sequence that locks the active workspace and presents verified support lifelines.
  • Non-Repudiable Audit Telemetry: Every tool invocation and safety state transition writes to an on-screen runtime telemetry log.

How We Built It

  • Client-Side Architecture: Pure JavaScript, semantic HTML5, and CSS3 designed for zero-latency execution.
  • WebMCP Standard: Implements document.modelContext tool declarations with input validation, schema descriptions, and client-side sanitization.
  • Deployment: Hosted directly on GitHub Pages with MIT licensing.

Challenges We Overcame

Balancing open agent interaction with strict ethical boundaries required implementing deterministic safety containment. We ensured that clinical safety overrides always take precedence over generative outputs.

Accomplishments That We're Proud Of

  • Fully functional WebMCP registration working natively in Chrome.
  • Smooth 4-7-8 visual pacing animation that adjusts pacing dynamically.
  • A clear telemetry logging interface that makes agent tool calls visible in real time. *Assisting clinicians provide easier and safer assignments and instructions to clients.

What We Learned

WebMCP makes human-agent collaboration in web apps far more robust and predictable than traditional screen-reading and UI simulation. Dynamic AI helps clinicians like me use AI more ethically and safely.

What's next for TheraFlow: Ethical Clinical WebMCP Agent

The future is open, and hopefully we can provide more resources and support both for clients and management for the private practice clinician or organization.

Built With

Share this project:

Updates

Submission history