treasury-mcp-os 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ __pycache__/
2
+ *.pyc
3
+ .DS_Store
4
+ *.backup
5
+ uv.lock
6
+ .venv/
7
+ .claude/settings.local.json
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Grant Page
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,189 @@
1
+ Metadata-Version: 2.5
2
+ Name: treasury-mcp-os
3
+ Version: 0.1.0
4
+ Summary: MCP server for small-business treasury and credit analysis: cash, forecasting, working capital, covenants, FX, and loan readiness.
5
+ Project-URL: Homepage, https://github.com/GPBK-STUY/treasury-mcp-os
6
+ Project-URL: Repository, https://github.com/GPBK-STUY/treasury-mcp-os
7
+ Project-URL: Live demo, https://treasury-mcp-os-hrxsrpycxbotvmejybhmvy.streamlit.app/
8
+ Author: Grant Page
9
+ License-Expression: MIT
10
+ License-File: LICENSE
11
+ Keywords: banking,cash-flow,credit,fintech,mcp,mcp-server,model-context-protocol,small-business,treasury
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Intended Audience :: Financial and Insurance Industry
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Topic :: Office/Business :: Financial
20
+ Requires-Python: >=3.11
21
+ Requires-Dist: mcp[cli]<2,>=1.26
22
+ Requires-Dist: pandas>=2.1.0
23
+ Requires-Dist: pydantic-settings>=2.0.0
24
+ Requires-Dist: pydantic>=2.0.0
25
+ Provides-Extra: apps
26
+ Requires-Dist: openpyxl>=3.1.5; extra == 'apps'
27
+ Requires-Dist: pdfplumber>=0.11.10; extra == 'apps'
28
+ Requires-Dist: pymupdf>=1.27.2.3; extra == 'apps'
29
+ Requires-Dist: python-docx>=1.2.0; extra == 'apps'
30
+ Requires-Dist: streamlit>=1.30.0; extra == 'apps'
31
+ Description-Content-Type: text/markdown
32
+
33
+ # Credit Analysis
34
+
35
+ Two tools built on one engine. Pick your door.
36
+
37
+ ---
38
+
39
+ <!-- mcp-name: io.github.GPBK-STUY/treasury-mcp-os -->
40
+
41
+ ## For AI Agents
42
+
43
+ TreasuryOS is an **MCP server** with 9 treasury and credit tools. Agents: start with **[AGENTS.md](AGENTS.md)**.
44
+
45
+ [![Run on Replit](https://replit.com/badge/github/GPBK-STUY/treasury-mcp-os)](https://replit.com/github/GPBK-STUY/treasury-mcp-os)
46
+
47
+ **Add to any MCP client** (Claude Desktop, Cursor, Windsurf, etc.), no clone needed:
48
+ ```json
49
+ {
50
+ "mcpServers": {
51
+ "treasury-os": {
52
+ "command": "uvx",
53
+ "args": ["treasury-mcp-os"]
54
+ }
55
+ }
56
+ }
57
+ ```
58
+
59
+ Claude Code: `claude mcp add treasury-os -- uvx treasury-mcp-os`
60
+
61
+ Point it at your own data with `TREASURY_DATA_DIR=/path/to/csvs` (defaults to the bundled demo company).
62
+
63
+ **Remote / HTTP** (Replit, cloud hosts): `MCP_TRANSPORT=streamable-http PORT=8000 python server.py` → `http://<host>:8000/mcp`
64
+
65
+ Claude Code and VS Code pick up the server automatically from `.mcp.json` and `.vscode/mcp.json` when you open the repo.
66
+
67
+ ---
68
+
69
+ ## For Business Owners
70
+
71
+ **Find out if you're ready for a business loan — free, in 5 minutes.**
72
+
73
+ Upload your bank statements and credit reports. Get a 0-100 readiness score, see what's hurting you, learn what to fix, find out which loans you qualify for, and get a checklist of what to bring to the bank.
74
+
75
+ No account needed. No cost. No sales pitch.
76
+
77
+ **[Try it now →](https://treasury-mcp-os-hrxsrpycxbotvmejybhmvy.streamlit.app/)**
78
+
79
+ **What you get:**
80
+ - A readiness score based on the same things a bank looks at
81
+ - What's helping and what's hurting — in plain English
82
+ - Which loans fit your profile (SBA, line of credit, equipment financing, etc.)
83
+ - A prioritized list of what to fix before you apply
84
+ - A checklist of what to bring to the banker meeting
85
+
86
+ **How to use it:**
87
+ 1. Click the link above
88
+ 2. Hit **"See a Demo Score"** to see how it works
89
+ 3. Switch to **"Upload My Files"** in the sidebar
90
+ 4. Drop in your bank statements, credit reports, or financial docs
91
+ 5. See your score and game plan
92
+
93
+ ---
94
+
95
+ ## For Bankers & Relationship Managers
96
+
97
+ **A portfolio dashboard that does the prep work for you.**
98
+
99
+ Search clients, pull up profiles, see financing readiness across your book. The same scoring engine, built for the RM workflow — one search bar to get the full picture on any client.
100
+
101
+ **[Open RM Dashboard →](https://treasury-os-rm.streamlit.app/)**
102
+
103
+ **What you get:**
104
+ - Portfolio view with search across all clients
105
+ - Client profiles with credit, cash, covenants, and readiness score
106
+ - 9 analysis tools: cash position, forecast, working capital, credit assessment, covenant monitoring, FX exposure, idle cash, payment optimization
107
+ - MCP server integration with Claude Desktop for AI-powered analysis
108
+
109
+ **Quick start (Claude Desktop):**
110
+ ```bash
111
+ git clone https://github.com/GPBK-STUY/treasury-mcp-os.git ~/Desktop/treasury-mcp-os
112
+ bash ~/Desktop/treasury-mcp-os/setup.sh
113
+ ```
114
+
115
+ See [QUICKSTART.md](QUICKSTART.md) for full setup.
116
+
117
+ ---
118
+
119
+ ## How It's Built
120
+
121
+ One analysis engine powers everything. Three apps serve different audiences.
122
+
123
+ | App | Who it's for | Live link | File |
124
+ |-----|-------------|-----------|------|
125
+ | Credit Analysis | Business owners | [Launch](https://treasury-mcp-os-hrxsrpycxbotvmejybhmvy.streamlit.app/) | `smb_app.py` |
126
+ | RM Dashboard | Bank RMs | [Launch](https://treasury-os-rm.streamlit.app/) | `rm_dashboard.py` |
127
+ | Full Dashboard | Power users | [Launch](https://treasury-mcp-os-hrxsrpycxbotvmejybhmvy.streamlit.app/) | `app.py` |
128
+
129
+ ### The Scoring Engine
130
+
131
+ Six categories, each scored 0-100:
132
+
133
+ | Category | What It Measures |
134
+ |----------|-----------------|
135
+ | Personal Credit | FICO, credit card usage, payment history, inquiries |
136
+ | Business Credit | Paydex, years in business, vendor payment speed, liens |
137
+ | Cash Position | Total cash, account count, 90-day forecast |
138
+ | Working Capital | Current ratio, collection speed, cash cycle, runway |
139
+ | Existing Debt | Covenant compliance, breaches, warnings |
140
+ | Documentation | Which key documents have been uploaded |
141
+
142
+ ### Analysis Tools (9)
143
+
144
+ ```
145
+ Cash Position Aggregator Credit Report Parser
146
+ Idle Cash Scanner Credit Position Assessor
147
+ Cash Flow Forecaster Covenant Monitor
148
+ Working Capital Analyzer FX Exposure Scanner
149
+ Payment Optimizer
150
+ ```
151
+
152
+ ### File Upload
153
+
154
+ Accepts CSV, Excel (.xlsx), Word (.docx), and PDF. Auto-detects content type by scanning column headers and maps to the right data format.
155
+
156
+ ### Run Locally
157
+
158
+ ```bash
159
+ git clone https://github.com/GPBK-STUY/treasury-mcp-os.git
160
+ cd treasury-mcp-os
161
+ pip install -r requirements.txt
162
+ streamlit run smb_app.py # Business owner app
163
+ streamlit run rm_dashboard.py # RM dashboard
164
+ streamlit run app.py # Full dashboard
165
+ ```
166
+
167
+ ### File Structure
168
+
169
+ ```
170
+ treasury-mcp-os/
171
+ ├── smb_app.py ← Credit Analysis (business owner app)
172
+ ├── rm_dashboard.py ← RM portfolio dashboard
173
+ ├── app.py ← Full dashboard (all 11 pages)
174
+ ├── server.py ← MCP server for Claude Desktop
175
+ ├── tools/ ← Shared analysis engine (9 tools)
176
+ ├── sample_data/ ← Demo data (Apex Manufacturing Corp)
177
+ ├── portfolio_data/ ← Multi-client data for RM dashboard
178
+ └── setup.sh ← One-command Claude Desktop installer
179
+ ```
180
+
181
+ ---
182
+
183
+ ## About
184
+
185
+ Built by [Grant Page](mailto:gpage2771@gmail.com) — 5 years in commercial banking, now building the tools that should have existed the whole time.
186
+
187
+ ## License
188
+
189
+ MIT
@@ -0,0 +1,157 @@
1
+ # Credit Analysis
2
+
3
+ Two tools built on one engine. Pick your door.
4
+
5
+ ---
6
+
7
+ <!-- mcp-name: io.github.GPBK-STUY/treasury-mcp-os -->
8
+
9
+ ## For AI Agents
10
+
11
+ TreasuryOS is an **MCP server** with 9 treasury and credit tools. Agents: start with **[AGENTS.md](AGENTS.md)**.
12
+
13
+ [![Run on Replit](https://replit.com/badge/github/GPBK-STUY/treasury-mcp-os)](https://replit.com/github/GPBK-STUY/treasury-mcp-os)
14
+
15
+ **Add to any MCP client** (Claude Desktop, Cursor, Windsurf, etc.), no clone needed:
16
+ ```json
17
+ {
18
+ "mcpServers": {
19
+ "treasury-os": {
20
+ "command": "uvx",
21
+ "args": ["treasury-mcp-os"]
22
+ }
23
+ }
24
+ }
25
+ ```
26
+
27
+ Claude Code: `claude mcp add treasury-os -- uvx treasury-mcp-os`
28
+
29
+ Point it at your own data with `TREASURY_DATA_DIR=/path/to/csvs` (defaults to the bundled demo company).
30
+
31
+ **Remote / HTTP** (Replit, cloud hosts): `MCP_TRANSPORT=streamable-http PORT=8000 python server.py` → `http://<host>:8000/mcp`
32
+
33
+ Claude Code and VS Code pick up the server automatically from `.mcp.json` and `.vscode/mcp.json` when you open the repo.
34
+
35
+ ---
36
+
37
+ ## For Business Owners
38
+
39
+ **Find out if you're ready for a business loan — free, in 5 minutes.**
40
+
41
+ Upload your bank statements and credit reports. Get a 0-100 readiness score, see what's hurting you, learn what to fix, find out which loans you qualify for, and get a checklist of what to bring to the bank.
42
+
43
+ No account needed. No cost. No sales pitch.
44
+
45
+ **[Try it now →](https://treasury-mcp-os-hrxsrpycxbotvmejybhmvy.streamlit.app/)**
46
+
47
+ **What you get:**
48
+ - A readiness score based on the same things a bank looks at
49
+ - What's helping and what's hurting — in plain English
50
+ - Which loans fit your profile (SBA, line of credit, equipment financing, etc.)
51
+ - A prioritized list of what to fix before you apply
52
+ - A checklist of what to bring to the banker meeting
53
+
54
+ **How to use it:**
55
+ 1. Click the link above
56
+ 2. Hit **"See a Demo Score"** to see how it works
57
+ 3. Switch to **"Upload My Files"** in the sidebar
58
+ 4. Drop in your bank statements, credit reports, or financial docs
59
+ 5. See your score and game plan
60
+
61
+ ---
62
+
63
+ ## For Bankers & Relationship Managers
64
+
65
+ **A portfolio dashboard that does the prep work for you.**
66
+
67
+ Search clients, pull up profiles, see financing readiness across your book. The same scoring engine, built for the RM workflow — one search bar to get the full picture on any client.
68
+
69
+ **[Open RM Dashboard →](https://treasury-os-rm.streamlit.app/)**
70
+
71
+ **What you get:**
72
+ - Portfolio view with search across all clients
73
+ - Client profiles with credit, cash, covenants, and readiness score
74
+ - 9 analysis tools: cash position, forecast, working capital, credit assessment, covenant monitoring, FX exposure, idle cash, payment optimization
75
+ - MCP server integration with Claude Desktop for AI-powered analysis
76
+
77
+ **Quick start (Claude Desktop):**
78
+ ```bash
79
+ git clone https://github.com/GPBK-STUY/treasury-mcp-os.git ~/Desktop/treasury-mcp-os
80
+ bash ~/Desktop/treasury-mcp-os/setup.sh
81
+ ```
82
+
83
+ See [QUICKSTART.md](QUICKSTART.md) for full setup.
84
+
85
+ ---
86
+
87
+ ## How It's Built
88
+
89
+ One analysis engine powers everything. Three apps serve different audiences.
90
+
91
+ | App | Who it's for | Live link | File |
92
+ |-----|-------------|-----------|------|
93
+ | Credit Analysis | Business owners | [Launch](https://treasury-mcp-os-hrxsrpycxbotvmejybhmvy.streamlit.app/) | `smb_app.py` |
94
+ | RM Dashboard | Bank RMs | [Launch](https://treasury-os-rm.streamlit.app/) | `rm_dashboard.py` |
95
+ | Full Dashboard | Power users | [Launch](https://treasury-mcp-os-hrxsrpycxbotvmejybhmvy.streamlit.app/) | `app.py` |
96
+
97
+ ### The Scoring Engine
98
+
99
+ Six categories, each scored 0-100:
100
+
101
+ | Category | What It Measures |
102
+ |----------|-----------------|
103
+ | Personal Credit | FICO, credit card usage, payment history, inquiries |
104
+ | Business Credit | Paydex, years in business, vendor payment speed, liens |
105
+ | Cash Position | Total cash, account count, 90-day forecast |
106
+ | Working Capital | Current ratio, collection speed, cash cycle, runway |
107
+ | Existing Debt | Covenant compliance, breaches, warnings |
108
+ | Documentation | Which key documents have been uploaded |
109
+
110
+ ### Analysis Tools (9)
111
+
112
+ ```
113
+ Cash Position Aggregator Credit Report Parser
114
+ Idle Cash Scanner Credit Position Assessor
115
+ Cash Flow Forecaster Covenant Monitor
116
+ Working Capital Analyzer FX Exposure Scanner
117
+ Payment Optimizer
118
+ ```
119
+
120
+ ### File Upload
121
+
122
+ Accepts CSV, Excel (.xlsx), Word (.docx), and PDF. Auto-detects content type by scanning column headers and maps to the right data format.
123
+
124
+ ### Run Locally
125
+
126
+ ```bash
127
+ git clone https://github.com/GPBK-STUY/treasury-mcp-os.git
128
+ cd treasury-mcp-os
129
+ pip install -r requirements.txt
130
+ streamlit run smb_app.py # Business owner app
131
+ streamlit run rm_dashboard.py # RM dashboard
132
+ streamlit run app.py # Full dashboard
133
+ ```
134
+
135
+ ### File Structure
136
+
137
+ ```
138
+ treasury-mcp-os/
139
+ ├── smb_app.py ← Credit Analysis (business owner app)
140
+ ├── rm_dashboard.py ← RM portfolio dashboard
141
+ ├── app.py ← Full dashboard (all 11 pages)
142
+ ├── server.py ← MCP server for Claude Desktop
143
+ ├── tools/ ← Shared analysis engine (9 tools)
144
+ ├── sample_data/ ← Demo data (Apex Manufacturing Corp)
145
+ ├── portfolio_data/ ← Multi-client data for RM dashboard
146
+ └── setup.sh ← One-command Claude Desktop installer
147
+ ```
148
+
149
+ ---
150
+
151
+ ## About
152
+
153
+ Built by [Grant Page](mailto:gpage2771@gmail.com) — 5 years in commercial banking, now building the tools that should have existed the whole time.
154
+
155
+ ## License
156
+
157
+ MIT
@@ -0,0 +1,224 @@
1
+ """Pydantic models for Treasury Management MCP Server."""
2
+ from __future__ import annotations
3
+ from typing import Dict, List, Optional
4
+ from pydantic import BaseModel, Field
5
+
6
+
7
+ class AccountPosition(BaseModel):
8
+ """Single account position."""
9
+ account_id: str = Field(..., description="Unique account identifier")
10
+ bank_name: str = Field(..., description="Financial institution name")
11
+ account_type: str = Field(..., description="checking, savings, money_market, or cd")
12
+ currency: str = Field(..., description="ISO currency code")
13
+ balance: float = Field(..., description="Current balance")
14
+ yield_rate_bps: int = Field(..., description="Annual yield in basis points")
15
+ last_updated: str = Field(..., description="Last update timestamp")
16
+
17
+
18
+ class CashPositionReport(BaseModel):
19
+ """Aggregated cash position across all accounts."""
20
+ total_balance: float = Field(..., description="Total balance")
21
+ by_currency: Dict[str, float] = Field(..., description="Balance by currency")
22
+ by_account_type: Dict[str, float] = Field(..., description="Balance by account type")
23
+ accounts: List[AccountPosition] = Field(..., description="Individual positions")
24
+ as_of: str = Field(..., description="Report timestamp")
25
+
26
+
27
+ class IdleCashOpportunity(BaseModel):
28
+ """Single idle cash optimization opportunity."""
29
+ account_id: str = Field(..., description="Account identifier")
30
+ bank_name: str = Field(..., description="Financial institution")
31
+ current_balance: float = Field(..., description="Current balance")
32
+ operating_reserve_needed: float = Field(..., description="Required reserve")
33
+ idle_amount: float = Field(..., description="Deployable amount")
34
+ current_yield_bps: int = Field(..., description="Current yield bps")
35
+ recommended_yield_bps: int = Field(..., description="Target yield bps")
36
+ annual_opportunity_cost: float = Field(..., description="Annual cost of inaction")
37
+ recommended_action: str = Field(..., description="Suggested action")
38
+
39
+
40
+ class IdleCashReport(BaseModel):
41
+ """Summary of idle cash opportunities."""
42
+ total_idle_cash: float = Field(..., description="Total idle cash")
43
+ total_annual_opportunity_cost: float = Field(..., description="Total annual cost")
44
+ opportunities: List[IdleCashOpportunity] = Field(..., description="Opportunities")
45
+
46
+
47
+ class CashFlowProjection(BaseModel):
48
+ """Single period cash flow projection."""
49
+ period: str = Field(..., description="Period identifier")
50
+ starting_balance: float = Field(..., description="Opening balance")
51
+ expected_inflows: float = Field(..., description="Projected inflows")
52
+ expected_outflows: float = Field(..., description="Projected outflows")
53
+ net_flow: float = Field(..., description="Net cash flow")
54
+ ending_balance: float = Field(..., description="Closing balance")
55
+ confidence: str = Field(..., description="high, medium, or low")
56
+
57
+
58
+ class CashFlowForecast(BaseModel):
59
+ """Complete cash flow forecast."""
60
+ forecast_horizon_days: int = Field(..., description="Forecast horizon in days")
61
+ projections: List[CashFlowProjection] = Field(..., description="Period projections")
62
+ surplus_periods: List[str] = Field(..., description="Surplus periods")
63
+ deficit_periods: List[str] = Field(..., description="Deficit periods")
64
+ recommendation: str = Field(..., description="Recommended actions")
65
+
66
+
67
+ class WorkingCapitalMetrics(BaseModel):
68
+ """Working capital and liquidity metrics."""
69
+ current_assets: float = Field(..., description="Total current assets")
70
+ current_liabilities: float = Field(..., description="Total current liabilities")
71
+ net_working_capital: float = Field(..., description="Net working capital")
72
+ current_ratio: float = Field(..., description="Current ratio")
73
+ days_sales_outstanding: float = Field(..., description="DSO")
74
+ days_payable_outstanding: float = Field(..., description="DPO")
75
+ cash_conversion_cycle_days: float = Field(..., description="CCC in days")
76
+ daily_burn_rate: float = Field(..., description="Daily cash burn")
77
+ runway_days: float = Field(..., description="Days of runway")
78
+ assessment: str = Field(..., description="Health assessment")
79
+ guardrail_warnings: List[str] = Field(default_factory=list, description="Active guardrail flags")
80
+
81
+
82
+ class PaymentRecommendation(BaseModel):
83
+ """Single payment optimization recommendation."""
84
+ vendor_name: str = Field(..., description="Vendor name")
85
+ invoice_amount: float = Field(..., description="Invoice amount")
86
+ due_date: str = Field(..., description="Due date")
87
+ discount_terms: str = Field(..., description="e.g. 2/10 net 30")
88
+ discount_amount: float = Field(..., description="Dollar discount")
89
+ annualized_return_pct: float = Field(..., description="Annualized return %")
90
+ recommendation: str = Field(..., description="pay_early or hold")
91
+ reasoning: str = Field(..., description="Explanation")
92
+
93
+
94
+ class PaymentOptimizationReport(BaseModel):
95
+ """Payment optimization summary."""
96
+ recommendations: List[PaymentRecommendation] = Field(..., description="Recommendations")
97
+ total_discount_available: float = Field(..., description="Total discounts")
98
+ total_annualized_savings: float = Field(..., description="Total annualized savings")
99
+ cash_required_for_early_payments: float = Field(..., description="Cash needed")
100
+
101
+
102
+ class FXExposure(BaseModel):
103
+ """Single FX exposure."""
104
+ currency: str = Field(..., description="ISO currency code")
105
+ exposure_type: str = Field(..., description="receivable or payable")
106
+ notional_amount: float = Field(..., description="Foreign currency amount")
107
+ usd_equivalent: float = Field(..., description="USD equivalent")
108
+ hedge_status: str = Field(..., description="hedged, unhedged, or partial")
109
+ days_to_settlement: int = Field(..., description="Days to settlement")
110
+ estimated_var_usd: float = Field(..., description="Value at Risk USD")
111
+
112
+
113
+ class FXExposureReport(BaseModel):
114
+ """FX exposure summary."""
115
+ exposures: List[FXExposure] = Field(..., description="Exposures")
116
+ total_unhedged_usd: float = Field(..., description="Total unhedged USD")
117
+ total_var_usd: float = Field(..., description="Total VaR USD")
118
+ largest_single_exposure_currency: str = Field(..., description="Largest currency")
119
+ recommendation: str = Field(..., description="Hedging recommendation")
120
+
121
+
122
+ class CovenantStatus(BaseModel):
123
+ """Single covenant status."""
124
+ covenant_name: str = Field(..., description="Covenant name")
125
+ covenant_type: str = Field(..., description="Covenant type")
126
+ required_threshold: float = Field(..., description="Required threshold")
127
+ current_value: float = Field(..., description="Current value")
128
+ headroom_pct: float = Field(..., description="Headroom percentage")
129
+ status: str = Field(..., description="compliant, warning, or breach")
130
+ next_test_date: str = Field(..., description="Next test date")
131
+
132
+
133
+ class CovenantReport(BaseModel):
134
+ """Covenant compliance summary."""
135
+ covenants: List[CovenantStatus] = Field(..., description="Covenant statuses")
136
+ overall_status: str = Field(..., description="Overall status")
137
+ breaches: int = Field(..., description="Number of breaches")
138
+ warnings: int = Field(..., description="Number of warnings")
139
+ recommendation: str = Field(..., description="Recommended actions")
140
+
141
+
142
+ # ── Credit Report Models ──────────────────────────────────────────────
143
+
144
+ class PersonalCreditProfile(BaseModel):
145
+ """Parsed personal credit report for a guarantor."""
146
+ borrower_name: str = Field(..., description="Guarantor full name")
147
+ credit_score: int = Field(..., description="FICO or VantageScore")
148
+ score_model: str = Field(..., description="Score model (e.g. FICO 8)")
149
+ report_date: str = Field(..., description="Date credit was pulled")
150
+ total_tradelines: int = Field(..., description="Total trade lines on file")
151
+ open_tradelines: int = Field(..., description="Currently open trade lines")
152
+ revolving_utilization_pct: float = Field(..., description="Revolving utilization %")
153
+ total_revolving_balance: float = Field(..., description="Total revolving balances")
154
+ total_revolving_limit: float = Field(..., description="Total revolving limits")
155
+ total_installment_balance: float = Field(..., description="Total installment balances")
156
+ monthly_installment_payments: float = Field(..., description="Monthly installment payment total")
157
+ derogatory_marks: int = Field(..., description="Derogatory marks count")
158
+ collections: int = Field(..., description="Collections count")
159
+ public_records: int = Field(..., description="Public records count")
160
+ late_payments_30d: int = Field(..., description="30-day late payments")
161
+ late_payments_60d: int = Field(..., description="60-day late payments")
162
+ late_payments_90d: int = Field(..., description="90+ day late payments")
163
+ payment_history_pct: float = Field(..., description="On-time payment percentage")
164
+ oldest_account_years: float = Field(..., description="Age of oldest account in years")
165
+ recent_inquiries_6mo: int = Field(..., description="Hard inquiries in last 6 months")
166
+ bankruptcies: int = Field(..., description="Bankruptcy filings")
167
+ foreclosures: int = Field(..., description="Foreclosures")
168
+ tax_liens: int = Field(..., description="Tax liens")
169
+ score_tier: str = Field(..., description="excellent, good, fair, poor, or very_poor")
170
+
171
+
172
+ class BusinessCreditProfile(BaseModel):
173
+ """Parsed business credit report."""
174
+ business_name: str = Field(..., description="Legal business name")
175
+ report_date: str = Field(..., description="Date report was pulled")
176
+ paydex_score: int = Field(..., description="D&B Paydex score (0-100)")
177
+ intelliscore: Optional[int] = Field(None, description="Experian Intelliscore (1-100)")
178
+ years_in_business: float = Field(..., description="Years in operation")
179
+ industry: str = Field(..., description="Industry classification")
180
+ total_trade_experiences: int = Field(..., description="Total trade references")
181
+ current_pct: float = Field(..., description="Percent of trades paid current")
182
+ days_beyond_terms_avg: float = Field(..., description="Avg days beyond payment terms")
183
+ high_credit: float = Field(..., description="Highest credit extended")
184
+ total_balance_outstanding: float = Field(..., description="Total outstanding balance")
185
+ payment_trend: str = Field(..., description="improving, stable, or declining")
186
+ derogatory_count: int = Field(..., description="Derogatory trade experiences")
187
+ liens: int = Field(..., description="UCC liens or tax liens")
188
+ judgments: int = Field(..., description="Judgments on file")
189
+ ucc_filings: int = Field(..., description="UCC filings count")
190
+ bankruptcy_flag: bool = Field(..., description="Bankruptcy on file")
191
+ d_and_b_rating: str = Field(..., description="D&B credit rating (e.g. 3A2)")
192
+ paydex_tier: str = Field(..., description="low_risk, moderate_risk, or high_risk")
193
+
194
+
195
+ class CreditReportSummary(BaseModel):
196
+ """Combined personal + business credit report output."""
197
+ personal_profiles: List[PersonalCreditProfile] = Field(..., description="Guarantor credit profiles")
198
+ business_profile: Optional[BusinessCreditProfile] = Field(None, description="Business credit profile")
199
+ report_date: str = Field(..., description="Analysis timestamp")
200
+
201
+
202
+ class CreditRiskFactor(BaseModel):
203
+ """Individual risk or opportunity identified in credit analysis."""
204
+ category: str = Field(..., description="credit_score, utilization, payment_history, etc.")
205
+ severity: str = Field(..., description="positive, neutral, watch, concern, or critical")
206
+ finding: str = Field(..., description="What was found")
207
+ impact: str = Field(..., description="How this affects lending decisions")
208
+ recommendation: str = Field(..., description="Specific action to take")
209
+
210
+
211
+ class CreditPositionAssessment(BaseModel):
212
+ """Integrated credit + cash flow lending readiness assessment."""
213
+ business_name: str = Field(..., description="Business name")
214
+ assessment_date: str = Field(..., description="Assessment timestamp")
215
+ overall_credit_rating: str = Field(..., description="strong, acceptable, marginal, weak, or adverse")
216
+ personal_score_avg: float = Field(..., description="Average guarantor FICO score")
217
+ personal_score_lowest: int = Field(..., description="Lowest guarantor score")
218
+ business_paydex: Optional[int] = Field(None, description="Business Paydex score")
219
+ combined_debt_to_income: Optional[float] = Field(None, description="Combined personal DTI ratio")
220
+ personal_guaranty_strength: str = Field(..., description="strong, adequate, weak, or insufficient")
221
+ risk_factors: List[CreditRiskFactor] = Field(..., description="Identified risks and opportunities")
222
+ lending_capacity_estimate: str = Field(..., description="Estimated borrowing capacity range")
223
+ cross_sell_opportunities: List[str] = Field(..., description="Product recommendations based on credit profile")
224
+ recommendation: str = Field(..., description="Overall recommendation for the relationship")
@@ -0,0 +1,62 @@
1
+ [project]
2
+ name = "treasury-mcp-os"
3
+ version = "0.1.0"
4
+ description = "MCP server for small-business treasury and credit analysis: cash, forecasting, working capital, covenants, FX, and loan readiness."
5
+ readme = "README.md"
6
+ license = "MIT"
7
+ license-files = ["LICENSE"]
8
+ authors = [{ name = "Grant Page" }]
9
+ requires-python = ">=3.11"
10
+ keywords = ["mcp", "mcp-server", "model-context-protocol", "treasury", "banking", "fintech", "credit", "cash-flow", "small-business"]
11
+ classifiers = [
12
+ "Development Status :: 3 - Alpha",
13
+ "Intended Audience :: Financial and Insurance Industry",
14
+ "Topic :: Office/Business :: Financial",
15
+ "Programming Language :: Python :: 3",
16
+ "Programming Language :: Python :: 3.11",
17
+ "Programming Language :: Python :: 3.12",
18
+ "Programming Language :: Python :: 3.13",
19
+ "Operating System :: OS Independent",
20
+ ]
21
+ dependencies = [
22
+ "mcp[cli]>=1.26,<2",
23
+ "pandas>=2.1.0",
24
+ "pydantic>=2.0.0",
25
+ "pydantic-settings>=2.0.0",
26
+ ]
27
+
28
+ [project.optional-dependencies]
29
+ apps = [
30
+ "streamlit>=1.30.0",
31
+ "openpyxl>=3.1.5",
32
+ "pdfplumber>=0.11.10",
33
+ "pymupdf>=1.27.2.3",
34
+ "python-docx>=1.2.0",
35
+ ]
36
+
37
+ [project.scripts]
38
+ treasury-mcp-os = "treasury_mcp_os.server:main"
39
+
40
+ [project.urls]
41
+ Homepage = "https://github.com/GPBK-STUY/treasury-mcp-os"
42
+ Repository = "https://github.com/GPBK-STUY/treasury-mcp-os"
43
+ "Live demo" = "https://treasury-mcp-os-hrxsrpycxbotvmejybhmvy.streamlit.app/"
44
+
45
+ [tool.hatch.build]
46
+ exclude = ["**/__pycache__", "**/*.pyc", "**/*.backup", "**/.DS_Store"]
47
+
48
+ [tool.hatch.build.targets.sdist]
49
+ include = ["server.py", "models.py", "tools", "sample_data", "treasury_mcp_os", "README.md", "LICENSE"]
50
+
51
+ [tool.hatch.build.targets.wheel]
52
+ packages = ["treasury_mcp_os"]
53
+
54
+ [tool.hatch.build.targets.wheel.force-include]
55
+ "server.py" = "treasury_mcp_os/server.py"
56
+ "models.py" = "treasury_mcp_os/models.py"
57
+ "tools" = "treasury_mcp_os/tools"
58
+ "sample_data" = "treasury_mcp_os/sample_data"
59
+
60
+ [build-system]
61
+ requires = ["hatchling>=1.27"]
62
+ build-backend = "hatchling.build"
@@ -0,0 +1,9 @@
1
+ account_id,bank_name,account_type,currency,balance,yield_rate_bps,last_updated
2
+ ACCT-001,Citizens Bank,checking,USD,2847500.00,0,2026-02-07
3
+ ACCT-002,Citizens Bank,savings,USD,1250000.00,125,2026-02-07
4
+ ACCT-003,Citizens Bank,money_market,USD,3500000.00,435,2026-02-07
5
+ ACCT-004,JPMorgan Chase,checking,USD,1875000.00,0,2026-02-07
6
+ ACCT-005,JPMorgan Chase,money_market,USD,2100000.00,450,2026-02-07
7
+ ACCT-006,Deutsche Bank,checking,EUR,985000.00,0,2026-02-07
8
+ ACCT-007,Deutsche Bank,savings,EUR,450000.00,275,2026-02-07
9
+ ACCT-008,Citizens Bank,cd,USD,1000000.00,510,2026-02-07