A transparent stdio proxy that sits between AI clients and Razorpay's official Model Context Protocol (MCP) server to enforce deterministic runtime safety on financial tool execution.
Live Demo: https://structura-mlsv.onrender.com
Autonomous AI agents executing financial actions cannot rely on prompt-based guardrails. Furthermore, Razorpay's official MCP server offers only binary access (--read-only or unrestricted execution), and generic API gateways cannot inspect inside JSON-RPC frames or track state across multiple calls.
Structura fills this gap by providing:
- Deterministic Policy Enforcement: Evaluates tool calls against YAML-defined rules without an LLM in the decision loop. Schema-validated via Zod; fails closed on missing or invalid configurations.
- Transaction Structuring Detection: Detects smurfing and structuring patterns across calls. For example, five ₹10,000 refunds on the same
payment_idtrip a ₹15,000 threshold on the 2nd call and triggerREQUIRE_APPROVAL, whereas five ₹10,000 refunds spread across five different payments pass (ALLOW). - Human Approval Queue: Intercepted calls enter an SQLite queue reviewable in an embedded React + Vite dashboard before downstream execution.
- Tamper-Evident Audit Chain: Every inbound frame, decision, and payload hash is committed to an SQLite hash-chain (
SHA-256). A standalone CLI verifier (structura verify-audit-log) detects edited rows, deleted rows, and recomputed hashes.
rules:
- tool: create_refund
action: REQUIRE_APPROVAL
conditions:
amount: { gt: 1000000 } # Subunits: > ₹10,000 triggers human review
structuring:
- tool: create_refund
group_by: payment_id
threshold: 1500000 # Cumulative > ₹15,000 triggers REQUIRE_APPROVAL
window_hours: 24Decisions resolve strictly to ALLOW, DENY, or REQUIRE_APPROVAL.
- Runtime & Language: Node.js 22, TypeScript
- Validation: Zod (fail-closed schema enforcement)
- Database & Storage: SQLite (
better-sqlite3) - Dashboard UI: React, Vite, Tailwind CSS
- Protocol: Model Context Protocol (MCP) JSON-RPC 2.0 over
stdio
# 1. Clone & install
git clone https://github.com/CodeWithRJ006/Structura.git
cd Structura && npm install
# 2. Build proxy & dashboard
npm run build
# 3. Run proxy (wraps Razorpay MCP on stdio)
npm start
# 4. Verify cryptographic audit log integrity
npx structura verify-audit-log