MCP Banking Model Risk Management Server
by pmcavallo
README.md
# MCP Banking Model Risk Management Server
An MCP (Model Context Protocol) server that automates model documentation validation, dependency analysis, and regulatory compliance checking for banking credit risk models.
## The Problem
Model Risk Management teams at banks face a persistent challenge: **documentation drift**. Model code evolves through versions, but PowerPoint presentations shown to validation committees contain outdated thresholds. Excel data dictionaries don't match the variables actually used in SAS code. White papers describe methodology that was changed two versions ago.
This creates regulatory risk. Federal Reserve SR 11-7 guidance requires accurate, complete model documentation. Manual cross-referencing across dozens of files is error-prone and time-consuming.
## The Solution
This MCP server provides 10 tools that enable AI assistants (Claude, GPT, etc.) to:
- **Validate consistency** across model code, data dictionaries, presentations, and documentation
- **Analyze dependencies** to understand change impact before modifying models
- **Check regulatory compliance** against SR 11-7 requirements
- **Compare versions** to identify what changed between model releases
## Architecture
```
MCP Protocol
Claude/LLM <──────────────────────────────────> Banking MCP Server
│
┌───────────────────────────────────┼───────────────────────────────────┐
│ │ │
v v v
┌─────────────┐ ┌──────────────┐ ┌──────────────┐
│ Model Code │ │ Excel │ │ Word │
│ (.sas, .py) │ │ Dictionaries │ │ Documents │
└─────────────┘ └──────────────┘ └──────────────┘
│ │ │
│ v │
│ ┌──────────────┐ │
└─────────────────────────>│ Model │<───────────────────────────┘
│ Registry │
│ (JSON) │
└──────────────┘
│
┌─────────────────────────────────┼─────────────────────────────────┐
v v v
┌─────────────┐ ┌──────────────┐ ┌──────────────┐
│ PowerPoint │ │ Dependency │ │ SR 11-7 │
│Presentations│ │ Graph │ │ Compliance │
└─────────────┘ │ (16 models)│ │ Checker │
└──────────────┘ └──────────────┘
```
## Tools (10)
| Tool | Description |
|------|-------------|
| `list_model_files` | List all SAS and Python model files in the repository |
| `extract_sas_parameters` | Parse DSCR/LTV thresholds, property segments, and model variables from SAS code |
| `read_excel_dictionary` | Extract variable definitions, data types, and business rules from Excel data dictionaries |
| `check_cross_file_consistency` | Validate that model code matches data dictionary (thresholds, variables, segments) |
| `compare_model_versions` | Diff two model versions to identify changes in variables, thresholds, and performance |
| `list_word_documents` | List available white papers, meeting minutes, and validation reports |
| `extract_word_content` | Query Word documents by section (methodology, limitations, performance, etc.) |
| `map_model_dependencies` | Analyze upstream/downstream dependencies and estimate revalidation effort |
| `check_sr11_compliance` | Validate model documentation against Federal Reserve SR 11-7 requirements |
| `check_presentation_consistency` | Detect outdated information in PowerPoint presentations vs current model code |
## Use Cases
### 1. Cross-File Consistency Validation
> "Does my SAS code match what's documented in the data dictionary?"
```
Tool: check_cross_file_consistency
Input: sas_filename="CRE_PD_v4.2.sas", excel_filename="CRE_PD_data_dictionary.xlsx"
Output: Report showing DSCR threshold matches (1.25), LTV matches (0.80), 4 segments consistent
```
### 2. Model Version Comparison
> "What changed between v3.5 and v4.2 of the CRE-PD model?"
```
Tool: compare_model_versions
Input: model_name="CRE_PD", version_old="v3.5", version_new="v4.2"
Output: Added unemployment_rate variable, expanded from 3 to 4 property segments, AUC improved 0.823 -> 0.842
```
### 3. Dependency and Impact Analysis
> "If I change the CRE-PD model, what downstream models are affected?"
```
Tool: map_model_dependencies
Input: model_id="CRE-PD-001", analysis_type="impact"
Output: 3 direct consumers (CECL-CRE, STRESS-TEST, MODEL-MONITOR), 4 indirect, estimated 240-360 hours revalidation
```
### 4. SR 11-7 Compliance Checking
> "Does this model have complete documentation for the next regulatory exam?"
```
Tool: check_sr11_compliance
Input: model_id="CRE-PD-001"
Output: SUBSTANTIALLY_COMPLIANT (8/9 requirements met), missing dedicated validation report
```
### 5. Presentation Consistency Checking
> "Is this committee presentation accurate, or does it show outdated thresholds?"
```
Tool: check_presentation_consistency
Input: pptx_filename="CRE_PD_Validation_Presentation.pptx", sas_filename="CRE_PD_v4.2.sas"
Output: DSCR mismatch on slide 5 (shows 1.20, code uses 1.25), segment count mismatch on slide 3 (shows 3, code has 4)
```
## Model Inventory
The server manages a registry of 16 credit risk models across 4 layers:
| Layer | Models | Description |
|-------|--------|-------------|
| Layer 1 | CRE-PD, CRE-LGD, CNI-PD, RES-MORT-PD, CC-PD, AUTO-PD, SB-PD | Source PD/LGD models |
| Layer 2 | CECL-CRE, CECL-CNI, CECL-RES, CECL-CARDS, CECL-AUTO, CECL-SB | CECL reserve calculations |
| Layer 3 | ECON-CAPITAL | Economic capital aggregation |
| Layer 4 | STRESS-TEST, MODEL-MONITOR | Stress testing and monitoring |
## Installation
### Prerequisites
- Python 3.10+
- pip
### Setup
```bash
# Clone the repository
git clone https://github.com/your-username/mcp_banking_workflows.git
cd mcp_banking_workflows
# Install dependencies
pip install -r requirements.txt
```
### Dependencies
```
mcp # Model Context Protocol framework
openpyxl # Excel file handling
python-docx # Word document extraction
python-pptx # PowerPoint extraction
pytest # Testing
```
## Running the Server
### Direct execution
```bash
python servers/banking_filesystem_server.py
```
### With MCP Inspector (for testing)
```bash
# Windows
set CLIENT_PORT=6290 && set SERVER_PORT=6291 && npx @modelcontextprotocol/inspector py servers/banking_filesystem_server.py
# Unix/Mac
CLIENT_PORT=6290 SERVER_PORT=6291 npx @modelcontextprotocol/inspector python servers/banking_filesystem_server.py
```
### Claude Desktop Integration
Add to `claude_desktop_config.json`:
```json
{
"mcpServers": {
"banking-mrm": {
"command": "python",
"args": ["C:/Projects/mcp_banking_workflows/servers/banking_filesystem_server.py"]
}
}
}
```
## Testing
```bash
# Run all tests
pytest tests/
# Run individual test suites
python tests/test_sr11_compliance.py
python tests/test_dependency_mapping.py
python tests/test_version_comparison_tool.py
python tests/test_word_extraction.py
python tests/test_presentation_consistency.py
```
## Project Structure
```
mcp_banking_workflows/
├── servers/
│ └── banking_filesystem_server.py # MCP server (2000+ lines, 10 tools)
├── mock_data/
│ ├── model_registry.json # 16 models with full metadata
│ ├── models/ # SAS and Python model code
│ │ ├── CRE_PD_v4.2.sas
│ │ ├── CRE_PD_v3.5.sas
│ │ └── CNI_PD_v5.0.py
│ ├── excel/ # Data dictionaries
│ │ ├── CRE_PD_data_dictionary.xlsx
│ │ └── CNI_PD_data_dictionary.xlsx
│ ├── word/ # White papers, meeting minutes
│ │ ├── CRE_PD_Model_Documentation_v4.2.docx
│ │ └── Model_Validation_Committee_Minutes_Nov2024.docx
│ └── presentations/ # Committee presentations
│ └── CRE_PD_Validation_Presentation.pptx
├── tests/
│ ├── test_sr11_compliance.py
│ ├── test_dependency_mapping.py
│ ├── test_version_comparison_tool.py
│ ├── test_word_extraction.py
│ └── test_presentation_consistency.py
├── requirements.txt
└── README.md
```
## Tech Stack
- **Python 3.10+** - Core language
- **MCP (Model Context Protocol)** - Anthropic's protocol for AI tool integration
- **openpyxl** - Excel parsing
- **python-docx** - Word document extraction
- **python-pptx** - PowerPoint content extraction
- **asyncio** - Async tool execution
## Regulatory Context
This server supports compliance with:
- **SR 11-7** - Federal Reserve guidance on Model Risk Management
- **OCC 2011-12** - OCC guidance on Model Risk Management
- **CECL** - Current Expected Credit Losses accounting standard
## Author
Paulo Cavallo - Model Risk Management / AI Engineering
## License
MIT License - See LICENSE file for details
This server cannot be deployed
Maintenance
ActivityInactive
ResponsivenessNo recent community issues