mortgage-mcp
MCP server for mortgage loan processing, providing tools to look up property info, analyze locality, verify documents, schedule site visits, evaluate loan applications, and generate final PDF reports.
README
Mortgage MCP Server
An MCP (Model Context Protocol) server for mortgage loan processing, built with the official Python MCP SDK (FastMCP). Modeled on how an enterprise mortgage system is architected: an AI assistant only ever sees a small set of high-level business tools, while all database access, third-party API calls, and financial logic stay in an internal service layer.
Exposed MCP Tools
Only these six tools are registered on the server — everything else is an internal Python function that Claude/the LLM never sees directly:
| Tool | Purpose |
|---|---|
lookup_property(address) |
Retrieve full property info, geocoding on first lookup only |
analyze_locality(address) |
Nearby schools, hospitals, banks, transit, etc. in one response |
verify_documents(property_id) |
Check sale deed / owner ID / tax receipt exist |
schedule_site_visit(property_id, visit_date, officer_name) |
Create a site inspection |
evaluate_loan_application(customer_id, property_id, requested_amount) |
Full DTI/LTV/EMI/risk evaluation |
generate_final_report(application_id) |
Build the consolidated PDF mortgage report |
Project Layout
mortgage_mcp/
├── server.py # MCP server entry point — wiring only
├── config.py # Loads .env, exposes typed settings
├── db.py # MySQL connection pool + query helpers
├── requirements.txt
├── .env.example
├── database/
│ └── schema.sql # Normalized MySQL schema
├── services/ # ALL business logic lives here (never MCP tools)
│ ├── customer_service.py
│ ├── property_service.py
│ ├── maps_service.py # Google Geocoding / Places (New) / Routes
│ ├── document_service.py
│ ├── inspection_service.py
│ ├── loan_service.py
│ └── report_service.py
├── tools/
│ └── mortgage_tools.py # The ONLY module defining MCP tools (thin)
├── documents/ # documents/property_<id>/{sale_deed,owner_id,tax_receipt}.pdf
├── inspections/ # inspection report text files
└── reports/ # generated PDF mortgage reports
Setup
-
Install dependencies
pip install -r requirements.txt -
Create the database
mysql -u root -p < database/schema.sql -
Configure environment
cp .env.example .env # then edit .env with your DB credentials and Google Maps API keyYour Google Cloud project needs the Geocoding API, Places API (New), and Routes API enabled for the key in
GOOGLE_MAPS_API_KEY. -
Seed sample data (optional)
Insert a customer and property manually via MySQL, or add a small seed script —
services/customer_service.insert_customer()andservices/property_service.insert_property()are ready to use for this. -
Run the server
python server.pyOr, for local development with the MCP Inspector:
mcp dev server.py -
Connect from Claude Desktop / another MCP client
Add an entry to your client's MCP config pointing at this server, e.g. for Claude Desktop's
claude_desktop_config.json:{ "mcpServers": { "mortgage-mcp": { "command": "python", "args": ["/absolute/path/to/mortgage_mcp/server.py"] } } }
Design Notes
- Tools stay thin. Every function in
tools/mortgage_tools.pydoes input validation, calls one or more service functions, and returns a JSON-serializable dict. No SQL and norequestscalls appear in that file. - Geocoding is cached.
properties.latitude/longitudeare only populated once, on firstlookup_property/analyze_localitycall for an address; subsequent calls read straight from MySQL. - Document verification is a seam, not a dead end.
document_service.pycurrently only checks file existence, butverify_sale_deed(),verify_owner_id(), andverify_tax_receipt()are separate functions specifically so OCR or AI-based content verification can be dropped into each one independently later, without touchingverify_documents()'s MCP interface. - Loan policy is configurable, not hard-coded. Max LTV/DTI ratios,
minimum credit score, and the base interest rate all come from
.envviaconfig.LoanPolicyConfig, so bank rules can be tuned without code changes. - Reports are self-contained.
generate_final_reportrecomputes the loan evaluation at report-build time (viareport_service.py) so the PDF always reflects current data rather than a stale snapshot.
Extending
- Add new MCP tools only in
tools/mortgage_tools.py, keeping them thin. - Add new business logic as functions inside the relevant
services/*.pymodule (or a new service module) — never inline in the tool layer. - New database tables/columns go in
database/schema.sqlplus a matching service module function; keep raw SQL out oftools/and out ofserver.py.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。