Technical Tutorial
12 min read

Building a Mortgage AI Agent with MCP: From Classification to Underwriting

Technical walkthrough of building mortgage AI agents using Model Context Protocol (MCP). Walk through a complete loan scenario: document arrives → classified → extracted → income calculated → underwritten → conditions generated — all via MCP tools any LLM can use.

Yatin Karnik

CEO & Founder, Confer Solutions

Model Context Protocol (MCP) is Anthropic's open standard for connecting AI models to external tools and data sources. Unlike proprietary function calling APIs, MCP defines a universal protocol that works across LLM providers. Confer built 32+ mortgage-specific MCP tools spanning document processing, income calculation, asset verification, credit analysis, underwriting, and compliance. This tutorial walks through a complete loan origination workflow powered entirely by MCP tools — demonstrating how any MCP-compatible LLM can perform mortgage underwriting tasks previously requiring specialized software and human expertise.

What is the Model Context Protocol?

MCP is to AI agents what REST APIs are to web services — a standardized way to expose functionality. Before MCP, building an AI agent that could "pull a credit report" or "calculate mortgage income" meant:

  • 1.Writing custom integration code for each LLM provider (OpenAI's function calling format, Claude's tool use format, etc.)
  • 2.Rebuilding the same integration when switching LLM providers
  • 3.Maintaining separate codebases for each tool across different AI frameworks

MCP solves this by defining a standard protocol. You build an MCP server that exposes tools (like calculate_income or classify_document). Any MCP-compatible client — Claude Desktop, OpenAI assistants, custom agents built with LangChain or CrewAI — can discover and use those tools without custom integration work.

// Traditional approach (different for each LLM)
openai.chat.completions.create(tools=[...]) // OpenAI format
anthropic.messages.create(tools=[...]) // Claude format
google.generativeai.chat(tools=[...]) // Gemini format
// MCP approach (universal)
mcp_client.connect_to_server("mortgage-tools")
// Any LLM can now use the same tools

Confer's MCP Architecture: 32+ Tools Across 4 Domains

Confer's MCP platform organizes mortgage tools into four domain-specific servers:

Document Domain

MCP Server: confer-docs-mcp

  • • classify_document
  • • extract_fields
  • • validate_pdf
  • • ocr_image
  • • stack_documents
  • • check_completeness
  • • verify_signatures

Income Domain

MCP Server: confer-income-mcp

  • • calculate_income_1084
  • • verify_employment
  • • trending_analysis
  • • validate_paystubs
  • • parse_schedule_c
  • • calculate_rental_income
  • • k1_partnership_income

Asset & Credit Domain

MCP Server: confer-assets-mcp

  • • verify_assets
  • • check_reserves
  • • pull_credit
  • • analyze_tradelines
  • • large_deposit_analysis
  • • source_of_funds
  • • verify_gift_funds

Underwriting Domain

MCP Server: confer-underwriting-mcp

  • • run_aus
  • • qm_atr_check
  • • trid_timer
  • • generate_conditions
  • • dual_wire_verification
  • • hmda_populate
  • • export_mismo
  • • calculate_dti

Each MCP server runs independently but shares a common data model. An AI agent can connect to all four servers and orchestrate complex workflows spanning multiple domains.

Walkthrough: A Loan Scenario from Upload to Underwriting

Let's follow a self-employed borrower's loan application through the complete MCP-powered workflow:

1Document Upload & Classification

Borrower uploads a PDF of their 2025 tax return (1040 with Schedule C). The document hits the MCP workflow:

// AI agent receives document upload event
mcp.call("classify_document", {document_id: "doc_12345"})
↓ Tier 1: Pattern matching (checks for "Form 1040" header)
→ Classification: "Tax Return - Form 1040"
→ Confidence: 98%
→ Contains: Schedule C detected
↓ Extract structured data
mcp.call("extract_fields", {document_id: "doc_12345", schema: "1040"})
→ AGI: $98,500
→ Wages (W-2): $0
→ Business income (Schedule C): $98,500

Result: Document classified as 1040, Schedule C identified, key fields extracted — all in under 3 seconds.

2Income Calculation (Fannie Mae 1084)

Agent identifies self-employment income. Needs to calculate qualifying income per Fannie Mae 1084 guidelines:

// Retrieve Schedule C details
mcp.call("parse_schedule_c", {document_id: "doc_12345"})
→ Line 31 (Net Profit): $85,000
→ Line 13 (Depreciation): $12,000
→ Line 30 (Business Use of Home): $4,800
→ Line 24b (Meals, 50%): $3,200
↓ Calculate qualifying income using deterministic engine
mcp.call("calculate_income_1084", {
net_profit: 85000,
depreciation: 12000,
business_use_home: 4800,
meals_50pct: 3200,
year: 2025
})
→ Qualifying Income (Annual): $105,800
→ Qualifying Income (Monthly): $8,816.67
→ Audit Trail: 1084 worksheet generated

Result: Monthly qualifying income $8,816.67 calculated deterministically with full add-back documentation.

3Employment Verification & Trending

Self-employment requires 2-year history. Agent checks prior year tax return:

// Borrower previously uploaded 2024 tax return
mcp.call("calculate_income_1084", {document_id: "doc_11234", year: 2024})
→ Year 2024 Qualifying Income: $7,200/month
↓ Run 2-year trending analysis
mcp.call("trending_analysis", {
year1_income: 7200,
year2_income: 8816.67,
income_type: "self_employment"
})
→ Trend: +22.4% (stable/increasing)
→ Use: 2-year average = $8,008.34/month
→ Flag: None (income stable)

Result: 2-year average income $8,008.34/month. No declining trend flag. Employment continuity verified.

4Asset Verification & Credit Pull

Agent pulls credit report and verifies assets for down payment and reserves:

// Pull credit report
mcp.call("pull_credit", {borrower_id: "bor_456"})
→ FICO: 745
→ Liabilities: $850/month (auto loan)
↓ Analyze uploaded bank statements
mcp.call("verify_assets", {document_ids: ["doc_98765", "doc_98766"]})
→ Checking: $45,000 (2-month avg)
→ Savings: $120,000 (2-month avg)
→ Total Liquid Assets: $165,000
↓ Check for large deposits
mcp.call("large_deposit_analysis", {document_ids: ["doc_98765", "doc_98766"]})
⚠ Flag: Deposit $15,000 on 10/15/2025 (requires LOE)

Result: Credit 745, liabilities $850/month, liquid assets $165,000. One large deposit flagged for explanation.

5Automated Underwriting & DTI Calculation

With income, credit, and assets verified, agent runs AUS and calculates DTI:

// Calculate debt-to-income ratio
mcp.call("calculate_dti", {
monthly_income: 8008.34,
proposed_housing_payment: 2100,
monthly_liabilities: 850
})
→ Front-end DTI: 26.2% (2100 / 8008)
→ Back-end DTI: 36.8% ((2100 + 850) / 8008)
↓ Run Desktop Underwriter (DU)
mcp.call("run_aus", {
aus_type: "DU",
loan_data: {...}
})
→ DU Recommendation: Approve/Eligible
→ Required Reserves: 6 months PITIA
→ Max DTI: 45% (actual: 36.8% ✓)

Result: DTI 36.8%, DU Approve/Eligible. Loan meets agency guidelines.

6Condition Generation

Based on all analysis, agent generates underwriting conditions:

// Generate conditions from underwriting findings
mcp.call("generate_conditions", {
findings: underwriting_analysis,
flags: [large_deposit_flag]
})
→ Condition 1: Provide LOE for deposit $15,000 on 10/15/25
→ Condition 2: Verify reserves $12,600 (6mo PITIA)
→ Condition 3: Provide proof of homeowner's insurance
→ Condition 4: Update credit report if >120 days before closing

Result: 4 conditions generated. Loan moves to conditional approval status.

Total workflow time: Under 2 minutes from document upload to conditional approval. Every step — classification, extraction, calculation, verification, underwriting, condition generation — executed via standardized MCP tools with full audit trails. Any MCP-compatible LLM could have orchestrated this exact workflow.

Why MCP Matters for Mortgage AI

The power of MCP isn't the individual tools — it's the composability and portability:

LLM Portability

Switch from Claude to GPT-4 to Gemini without rewriting tool integrations. MCP tools work across all providers. When a better model releases, you upgrade the LLM — not the tools.

Tool Composability

Agents chain tools together: classify_document → extract_fields → calculate_income → run_aus. Each tool handles one task well. Composed together, they automate entire workflows.

Audit Trail by Default

Every MCP tool call is logged: inputs, outputs, timestamps, confidence scores. For mortgage compliance (7-year retention), this is critical. The audit trail is built into the protocol, not bolted on later.

Deterministic Where Needed

MCP tools can be deterministic (income calculation) or LLM-assisted (document classification). The protocol doesn't care. You get AI where it's useful and deterministic math where it's required.

Using Confer's MCP Tools in Your Own Agents

You don't need to adopt Confer's LOS to use the MCP tools. Three integration options:

Option 1: Claude Desktop (Zero-Code)

Install Claude Desktop. Configure Confer's MCP servers in your Claude config. Ask Claude: "Pull credit for borrower ID 12345 and calculate DTI." Claude auto-discovers and uses the tools.

// claude_desktop_config.json
{
"mcpServers": {
"confer-income": {
"command": "npx",
"args": ["confer-income-mcp"]
}
}
}

Option 2: LangChain / CrewAI (Custom Agents)

Build custom mortgage agents with LangChain or CrewAI. Connect to Confer's MCP servers as tool providers.

from langchain.tools import MCPTool
income_tool = MCPTool.from_server("confer-income-mcp")
agent = create_agent(tools=[income_tool, ...])

Option 3: REST API (Existing LOS Integration)

Don't want to run MCP servers? Use Confer's hosted REST API that wraps MCP tools. Call via HTTP:

POST /api/v1/income/calculate_1084
{
"net_profit": 85000,
"depreciation": 12000,
"year": 2025
}

All three options access the same underlying MCP tools. Choose based on your integration needs and technical stack.

Frequently Asked Questions

YK

Yatin Karnik

CEO & Founder, Confer Solutions

Yatin Karnik spent nearly two decades as Senior Vice President at Wells Fargo Home Mortgage, where he architected operational systems processing thousands of loans monthly. He founded Confer Solutions to make mortgage AI tools accessible, portable, and compliant through open standards like MCP.

Learn More About Yatin →

Ready to Build AI-Powered Mortgage Workflows?

Explore Confer's 32+ MCP tools for mortgage document processing, income calculation, and automated underwriting. Use them standalone or integrate with your existing LOS.