Production-ready AI agent for loan servicing and collections in financial services. Built with Arcade (MCP runtime with auth, governance, and audit) and YugabyteDB (distributed PostgreSQL with pgvector).
An autonomous agent that handles the daily workflow of a Customer Success Manager — portfolio health checks, delinquency analysis, recovery pattern search via vector embeddings, personalized borrower outreach, report generation, and fraud escalation — all through governed tool calls with delegated OAuth and full audit trails.
Enterprise AI agents in banking and financial services face two infrastructure gaps:
- The data gap — Agents need transactions, vector search, analytics, and session memory in one database. Not stitched together from separate systems.
- The tool gap — APIs wrapped in MCP are not agent-ready tools. Agents act on behalf of humans — they need delegated auth, scoped permissions, and governance built into the runtime.
LoanOps AI demonstrates how to solve both with YugabyteDB (distributed SQL + pgvector for agentic data access patterns) and Arcade (the MCP runtime that handles tool execution, just-in-time OAuth, and policy enforcement simultaneously).
┌── YugabyteDB Tools (4 custom domain tools)
│
┌──────────┐ ┌──────────┐ ├── Gmail (send as the user via OAuth)
│ LoanOps │ │ Arcade │ │
│ AI Chat │──▶│ MCP │──├── Google Docs (generate reports)
│ (Vercel) │ │ Gateway │ │
└──────────┘ │ │ ├── Slack (escalate alerts)
│ Auth │ │
│ Gov. │ └── Linear (create tasks)
└──────────┘
All tools — custom YugabyteDB tools and third-party integrations — are accessed through a single Arcade MCP Gateway. The application never imports service-specific SDKs. One auth layer, one governance layer, one audit trail across every tool.
| Layer | Technology |
|---|---|
| Frontend | Next.js 16, TypeScript, Tailwind CSS, shadcn/ui |
| LLM Orchestration | Vercel AI SDK v6 (ai, @ai-sdk/anthropic, @ai-sdk/mcp) |
| LLM | Anthropic Claude (claude-sonnet-4-20250514) |
| Tool Runtime | Arcade MCP Gateway — delegated OAuth, policy enforcement, contextual access hooks, audit logging |
| Database | YugabyteDB — distributed PostgreSQL with pgvector for vector similarity search |
| Custom MCP Server | Python, arcade-mcp-server SDK |
| Protocol | Model Context Protocol (MCP) — Streamable HTTP transport |
Arcade enforces three layers of security on every tool call:
- Policy enforcement — Contextual Tool Access filters which tools each user can invoke, based on identity provider rules
- Delegated OAuth — Just-in-time authentication at the moment of action. The agent sends emails as the user via their own OAuth credentials. No service accounts. Credentials never touch the LLM.
- Governance hooks — Pre-execution input validation, prompt injection scanning, post-execution PII redaction, and complete audit trail exportable to SIEM via OpenTelemetry
- Node.js 18+, Python 3.10+, Docker
git clone <repo-url> loanops-ai && cd loanops-ai
make installmake setupStarts YugabyteDB in Docker, loads the schema, and seeds realistic financial data: 500 borrowers, 800 loans across 5 types (personal, mortgage, auto, business, line of credit), 50k+ payments with delinquency patterns, 100 recovery case narratives with pre-baked pgvector embeddings (1536-dim, OpenAI text-embedding-3-small), and 15 fraud signals.
make devOpens at http://localhost:3000 in mock mode with a pre-loaded demo conversation. No API keys required to see the UI.
a. Expose YugabyteDB via ngrok:
ngrok tcp 5433b. Deploy the custom MCP server to Arcade Cloud:
arcade login
arcade secret set YUGABYTEDB_URL="postgresql://yugabyte:yugabyte@<ngrok-host>:<ngrok-port>/yugabyte"
arcade secret set OPENAI_API_KEY="sk-..."
cd tools && uv sync && arcade deploy -e src/loanops/server.pyc. Create an MCP Gateway in the Arcade Dashboard. Select your loanops_yugabytedb tools alongside Gmail, Google Docs, Google Calendar, Slack, and Linear.
d. Configure your .env:
ANTHROPIC_API_KEY=sk-ant-...
ARCADE_API_KEY=arc_...
ARCADE_GATEWAY_URL=https://api.arcade.dev/mcp/<your-gateway>
ARCADE_USER_ID=you@arcade.dev
YUGABYTEDB_URL=postgresql://yugabyte:yugabyte@localhost:5433/yugabyte
Restart make dev. The app auto-detects live mode when Arcade credentials are configured.
Domain-specific tools that encode loan servicing business logic. The agent speaks the domain, not SQL. The database is protected — the LLM never sees or writes raw queries.
| Tool | Description |
|---|---|
get_portfolio_summary |
Multi-table aggregation: active loans, outstanding balance, DPD 30/60/90+ buckets, average credit score, missed payments |
analyze_delinquencies |
CTE with payment consistency scoring, recovery likelihood ranking, and fraud signal cross-reference |
semantic_search_recovery_patterns |
pgvector cosine similarity search over embedded recovery case narratives |
get_borrower_360 |
Scatter-gather across 4 tables: borrower profile, loan history, payment ledger, fraud signals |
| Prompt | What Happens |
|---|---|
| "Give me today's portfolio health check" | Agent calls get_portfolio_summary — multi-table aggregation on YugabyteDB |
| "Show me delinquent borrowers to follow up with" | Agent calls analyze_delinquencies — CTE with recovery scoring + fraud cross-ref |
| "What recovery approaches worked for a first-time business delinquency?" | Agent calls semantic_search_recovery_patterns — pgvector cosine similarity |
| "Send a payment reminder to Maria Santos" | Agent looks up borrower on YugabyteDB, then sends personalized email via Gmail using delegated OAuth |
| "Generate my daily briefing for my manager Sarah" | Agent creates a structured Google Doc with portfolio summary, actions taken, and fraud flags |
| "Flag Robert Keane — his income docs look suspicious" | Agent creates a Slack alert and a Linear task with full fraud signal details |
| Name | Pattern | Outstanding | Key Detail |
|---|---|---|---|
| Maria Santos | Reliable late payer | $12,400 | Always pays 5-12 days late |
| James Chen | Occasional miss | $34,200 | One prior miss, quickly resolved |
| Apex Industrial LLC | First-ever delinquency | $287,000 | Business account, 22 DPD |
| Robert Keane | Deteriorating + fraud | $18,900 | OPEN income mismatch signal |
loanops-ai/
├── web/ # Next.js frontend + API routes
│ ├── src/app/ # Pages, /api/chat (Vercel AI SDK), /api/db
│ ├── src/components/ # Chat, Tool Panel, Architecture, DB Explorer
│ └── src/lib/ # MCP client, Claude config, tool registry
├── tools/ # Custom YugabyteDB MCP server (Python)
│ └── src/loanops/server.py # 4 tools, deployed to Arcade Cloud
├── database/ # Schema, seed data, pre-baked embeddings
│ ├── schema.sql # DDL: borrowers, loans, payments, recovery_history (VECTOR), fraud_signals
│ ├── seed_data.py # Realistic financial data generator
│ └── embeddings.json # 100 pre-computed 1536-dim vectors
├── docker-compose.yml # YugabyteDB (distributed PostgreSQL)
├── Makefile
└── .env.example
| Command | Description |
|---|---|
make install |
Install all dependencies |
make setup |
Start YugabyteDB, load schema, seed data with pgvector embeddings |
make dev |
Start Next.js dev server |
make deploy |
Deploy custom MCP server to Arcade Cloud |
make clean |
Tear down Docker volumes |
- Arcade Documentation — MCP runtime, tool auth, governance
- Arcade Tool Design Patterns — 54 patterns with code examples
- YugabyteDB Documentation — distributed PostgreSQL, pgvector
- Vercel AI SDK — LLM orchestration, MCP client, streaming
- Model Context Protocol — open standard for tool integration
