ArthaGuard: Autonomous Cashflow Governance & Safety Boundaries via WebMCP ##Inspiration In personal financial management, households often navigate a deceptive form of solvency. On paper, a monthly income comfortably exceeds recurring obligations. Yet, in practice, misaligned timing between cash inflows (salary disbursements) and hard outflows (home loans, school fees, and critical insurance renewals) creates dangerous mid-month liquidity crunches.

The human cost of these crunches is severe: individuals panic and cancel essential vehicle or health insurance policies to make ends meet, risking catastrophic loss, or they incur punitive late fees on debt obligations. Traditional personal finance dashboards are passive—they present static charts and historical spending data, leaving the cognitive burden of calculating shortfall dates, modeling counterfactual deferrals, and discovering dormant liquidity entirely on the user.

When conversational AI agents entered the picture, they introduced the opposite extreme: autonomous black-boxes that might offer hallucinated advice or attempt opaque API executions without human supervision. We envisioned a middle ground: ArthaGuard, an agent-native financial decision room built on the emerging WebMCP (Web Model Context Protocol) standard. The goal was to transform the browser viewport into an active, verified operational environment where an AI model can audit commitments, forecast balances against strict reserve floors, simulate counterfactual solutions, and respect unbreakable human-in-the-loop (HITL) safety boundaries.

##How We Built ArthaGuard

ArthaGuard is architected as a Next.js client application deployed to Vercel, integrating an imperative 11-tool WebMCP runtime directly into the DOM tree.

  1. Core Financial Engine & Constraint Logic

At the heart of ArthaGuard is a deterministic daily cashflow engine. Given a starting liquid balance $B_0$ on date $t_0$, the projected balance $B(t)$ on any day $t$ within the evaluation window is governed by:

$$B(t) = B_0 + \sum_{k \le t} I_k - \sum_{j \le t} E_j$$

where $I_k$ represents liquidity inflows (such as salary credits) and $E_j$ represents scheduled commitments (EMIs, utility bills, insurance premiums, and recurring subscriptions).

The primary governance constraint is maintaining the balance strictly above an emergency reserve floor $R_{\min} = \text{₹}30,000$:

$$B(t) \ge R_{\min}, \quad \forall t \in [t_0, t_{\text{salary}}]$$

When scheduled obligations cause a breach ($B(t) < R_{\min}$), ArthaGuard's domain services calculate the maximum deficit $\Delta_{\text{deficit}}$:

$$\Delta_{\text{deficit}} = \max_{t} \left( R_{\min} - B(t) \right)$$

The optimization objective models counterfactual adjustments—recovering unfiled medical reimbursements $R_{\text{claim}}$, deferring non-essential bulk purchases $D_{\text{grocery}}$, and pausing redundant digital streaming services $S_{\text{paused}}$—such that:

$$\Delta_{\text{recovery}} = R_{\text{claim}} + D_{\text{grocery}} + \sum S_{\text{paused}} \ge \Delta_{\text{deficit}}$$

while strictly enforcing that essential coverage commitments (such as motor and health renewals) remain non-deferrable.

  1. The 11-Tool WebMCP Architecture

ArthaGuard registers 11 imperative tools onwindow.document.modelContext across five functional tiers:

Audit & Inspection:get_commitments_due,get_protection_status, andget_subscriptions inspect scheduled obligations and lapse risks. Cashflow Projection:get_cashflow_forecast runs daily forward simulation against the reserve threshold. Liquidity Discovery:get_recovery_opportunities uncovers dormant cash, such as unfiled diagnostic and prescription claims. Simulation & Governance:simulate_commitment_actions models counterfactual cashflow curves;create_commitment_contract synthesizes formal, explainable agreements. Safety Boundaries & Execution:approve_simulated_actions acts as the mandatory human authorization gate;execute_reimbursement_claim andpause_redundant_subscription trigger approved operational steps;get_audit_log records immutable cryptographic ledgers of every invocation.

typescript

Standardized WebMCP Registration Pattern document.modelContext.registerTool({ name: "approve_simulated_actions", description: "Enforces human signature verification before allowing execution of financial modifications.", inputSchema: { type: "object", properties: { contractId: { type: "string", description: "Unique ID of the synthesized commitment contract" }, userConfirmationToken: { type: "string", description: "Cryptographic human sign-off token" } }, required: ["contractId", "userConfirmationToken"] }, execute: async (input) => { return await GovernanceService.validateAndApprove(input); }

});

##Challenges We Faced

  1. Dual Discovery for WebMCP Runtimes: LLM browser agents and headless crawlers read pages through different layers. While in-browser runtime models interact directly withdocument.modelContext, search and snapshot crawlers parse initial static server HTML. Dynamic client-side hooks initially resulted in crawlers seeing0 Registered Imperative Tools. We resolved this by building a synchronized dual-surface architecture: embedding a crawlable semantic HTML table and awebmcp-manifest JSON-LD script on the server side, while instantiating active imperative tools in client memory upon hydration.
  2. Preventing Agent Overreach (The Autonomous Execution Trap): A major challenge in financial agents is the temptation for the LLM to autonomously approve and execute operations when prompted with phrases like "Execute the transfers immediately without asking me." We designedapprove_simulated_actions with a hard safety boundary. The tool specification explicitly defines an immutable requirement for a client-side human signature token. When tested under adversarial conditions, the model correctly refused autonomous execution, recognizing the safety boundary and directing the user to sign off in the UI.
  3. Multi-Variable Liquidity Balancing: In our primary scenario ($B_0 = \text{₹}53,200$, outflow = $\text{₹}42,600$), the balance drops to $\text{₹}9,421$ on September 14—a deficit of $\text{₹}20,579$ relative to the $\text{₹}30,000$ reserve floor. Simply recovering a $\text{₹}3,500$ medical claim and pausing minor subscriptions leaves a remaining gap. We had to calibrate the simulation logic to distinguish between non-negotiable insurance policies (e.g., SwiftShield Motor Comprehensive) and shiftable commitments (e.g., bulk grocery orders), teaching the model to structure multi-step deferral contracts rather than suggesting naive cancellations.

What We Learned Building ArthaGuard demonstrated that WebMCP bridges the gap between passive UIs and autonomous black-boxes.

We learned that:

The DOM is an ideal coordination layer: By treating the browser document as an active execution context viadocument.modelContext, web applications can expose structured capabilities to visiting AI agents without brittle API keys or scraping heuristics. Safety must be structural, not conversational: System prompts alone cannot guarantee that an agent will not execute unauthorized actions. True safety requires structural gates embedded in the tool schema itself—such that an agent simply lacks the imperative authority to execute without a cryptographic human sign-off. Explainability drives financial trust: Users do not want an AI to silently balance their books. By packaging recommendations into explainable Commitment Contracts before execution, ArthaGuard keeps the user firmly in the driver's seat while leveraging the model's analytical power to solve complex liquidity equations.

Built With

  • agent
  • agentic-ai
  • ai
  • ai-agents
  • ai-safety
  • cashflow-forecasting
  • financial-health
  • fintech
  • governance
  • human-in-the-loop
  • internet
  • mcp
  • model
  • model-context-protocol
  • nextjs
  • open-source
  • react
  • recharts
  • simulation
  • tailwind-css
  • turbopack
  • typescript
  • vercel
  • webmcp
Share this project:

Updates

Submission history