@thomasgorisse/finance-mcp 1.0.0
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.
- package/LICENSE +21 -0
- package/PRIVACY.md +41 -0
- package/README.md +58 -0
- package/TERMS.md +47 -0
- package/dist/disclaimer.d.ts +8 -0
- package/dist/disclaimer.d.ts.map +1 -0
- package/dist/disclaimer.js +14 -0
- package/dist/disclaimer.js.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +187 -0
- package/dist/index.js.map +1 -0
- package/dist/tools/calculate-budget.d.ts +28 -0
- package/dist/tools/calculate-budget.d.ts.map +1 -0
- package/dist/tools/calculate-budget.js +137 -0
- package/dist/tools/calculate-budget.js.map +1 -0
- package/dist/tools/calculate-retirement.d.ts +35 -0
- package/dist/tools/calculate-retirement.d.ts.map +1 -0
- package/dist/tools/calculate-retirement.js +130 -0
- package/dist/tools/calculate-retirement.js.map +1 -0
- package/dist/tools/compare-investments.d.ts +52 -0
- package/dist/tools/compare-investments.d.ts.map +1 -0
- package/dist/tools/compare-investments.js +94 -0
- package/dist/tools/compare-investments.js.map +1 -0
- package/dist/tools/inflation-calculator.d.ts +34 -0
- package/dist/tools/inflation-calculator.d.ts.map +1 -0
- package/dist/tools/inflation-calculator.js +116 -0
- package/dist/tools/inflation-calculator.js.map +1 -0
- package/dist/tools/simulate-loan.d.ts +39 -0
- package/dist/tools/simulate-loan.d.ts.map +1 -0
- package/dist/tools/simulate-loan.js +106 -0
- package/dist/tools/simulate-loan.js.map +1 -0
- package/dist/tools/tax-optimizer.d.ts +53 -0
- package/dist/tools/tax-optimizer.d.ts.map +1 -0
- package/dist/tools/tax-optimizer.js +191 -0
- package/dist/tools/tax-optimizer.js.map +1 -0
- package/package.json +51 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 SceneView Tools
|
|
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.
|
package/PRIVACY.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Privacy Policy — finance-mcp
|
|
2
|
+
|
|
3
|
+
_Last updated: 2026-03-26_
|
|
4
|
+
|
|
5
|
+
## Data Collection
|
|
6
|
+
|
|
7
|
+
finance-mcp **does not collect, store, or transmit any personal or financial
|
|
8
|
+
data**. All calculations run locally within the MCP server process.
|
|
9
|
+
|
|
10
|
+
## What We Don't Collect
|
|
11
|
+
|
|
12
|
+
- No income, expense, or salary data
|
|
13
|
+
- No investment portfolio information
|
|
14
|
+
- No tax identification numbers
|
|
15
|
+
- No personally identifiable information
|
|
16
|
+
- No usage analytics or telemetry
|
|
17
|
+
- No cookies or tracking
|
|
18
|
+
|
|
19
|
+
## Third-Party Services
|
|
20
|
+
|
|
21
|
+
finance-mcp does not connect to any external APIs or third-party services.
|
|
22
|
+
All computations are performed offline using built-in mathematical models.
|
|
23
|
+
|
|
24
|
+
## Data Retention
|
|
25
|
+
|
|
26
|
+
There is no data retention because no data is collected. Each tool call is
|
|
27
|
+
stateless — inputs are processed and results returned without persistence.
|
|
28
|
+
|
|
29
|
+
## Children's Privacy
|
|
30
|
+
|
|
31
|
+
finance-mcp does not knowingly collect information from children under 13.
|
|
32
|
+
|
|
33
|
+
## Changes
|
|
34
|
+
|
|
35
|
+
We may update this privacy policy from time to time. Changes will be posted
|
|
36
|
+
in the repository.
|
|
37
|
+
|
|
38
|
+
## Contact
|
|
39
|
+
|
|
40
|
+
For privacy-related questions, open an issue at:
|
|
41
|
+
https://github.com/mcp-tools-lab/finance-mcp/issues
|
package/README.md
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# finance-mcp
|
|
2
|
+
|
|
3
|
+
Personal finance MCP server for AI assistants. Loan simulation, budgeting, investment comparison, retirement planning, French tax optimization, and inflation calculator.
|
|
4
|
+
|
|
5
|
+
> **DISCLAIMER: This is NOT financial advice.** All calculations are for informational and educational purposes only. Results use simplified models and may not reflect all real-world variables. Always consult a qualified financial advisor before making any financial decisions.
|
|
6
|
+
|
|
7
|
+
## Tools
|
|
8
|
+
|
|
9
|
+
| Tool | Description |
|
|
10
|
+
|------|-------------|
|
|
11
|
+
| `simulate_loan` | Loan simulation (mortgage, car, student, personal) with amortization table |
|
|
12
|
+
| `calculate_budget` | Monthly budget analysis with savings rate and 50/30/20 rule |
|
|
13
|
+
| `compare_investments` | Compare investment options with nominal, real, and after-tax returns |
|
|
14
|
+
| `calculate_retirement` | Retirement planning — how much to save monthly to reach your goal |
|
|
15
|
+
| `tax_optimizer` | French tax analysis and optimization (bareme progressif, PFU, PER, PEA) |
|
|
16
|
+
| `inflation_calculator` | Real value of money over time with inflation scenarios |
|
|
17
|
+
|
|
18
|
+
## Installation
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npm install -g finance-mcp
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Usage with Claude Desktop
|
|
25
|
+
|
|
26
|
+
Add to your `claude_desktop_config.json`:
|
|
27
|
+
|
|
28
|
+
```json
|
|
29
|
+
{
|
|
30
|
+
"mcpServers": {
|
|
31
|
+
"finance": {
|
|
32
|
+
"command": "npx",
|
|
33
|
+
"args": ["finance-mcp"]
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Pricing
|
|
40
|
+
|
|
41
|
+
| Tier | Price | Limits |
|
|
42
|
+
|------|-------|--------|
|
|
43
|
+
| Free | $0/month | 20 tool calls/month |
|
|
44
|
+
| Pro | $14.99/month | Unlimited |
|
|
45
|
+
|
|
46
|
+
## Development
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
npm install
|
|
50
|
+
npm run build
|
|
51
|
+
npm test
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## License
|
|
55
|
+
|
|
56
|
+
MIT - SceneView Tools
|
|
57
|
+
|
|
58
|
+
See [TERMS.md](./TERMS.md) and [PRIVACY.md](./PRIVACY.md) for full terms and privacy policy.
|
package/TERMS.md
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Terms of Service — finance-mcp
|
|
2
|
+
|
|
3
|
+
_Last updated: 2026-03-26_
|
|
4
|
+
|
|
5
|
+
## Disclaimer
|
|
6
|
+
|
|
7
|
+
**This software is NOT financial advice.** All calculations, simulations, and
|
|
8
|
+
suggestions provided by finance-mcp are for **informational and educational
|
|
9
|
+
purposes only**. Always consult a qualified financial advisor before making
|
|
10
|
+
financial decisions.
|
|
11
|
+
|
|
12
|
+
## Service Tiers
|
|
13
|
+
|
|
14
|
+
| Tier | Price | Limits |
|
|
15
|
+
|------|-------|--------|
|
|
16
|
+
| Free | $0/month | 20 tool calls per month |
|
|
17
|
+
| Pro | $14.99/month | Unlimited tool calls, priority support |
|
|
18
|
+
|
|
19
|
+
## Accuracy
|
|
20
|
+
|
|
21
|
+
While we strive for accuracy, finance-mcp:
|
|
22
|
+
- Uses simplified models that may not reflect all real-world variables
|
|
23
|
+
- Does not account for all tax regulations or recent legislative changes
|
|
24
|
+
- May produce results that differ from actual financial outcomes
|
|
25
|
+
- Is not a substitute for professional financial planning
|
|
26
|
+
|
|
27
|
+
## Limitation of Liability
|
|
28
|
+
|
|
29
|
+
SceneView Tools shall not be liable for any financial losses, damages, or
|
|
30
|
+
consequences arising from the use of this software. Users assume all risk
|
|
31
|
+
associated with financial decisions made based on outputs from this tool.
|
|
32
|
+
|
|
33
|
+
## Data
|
|
34
|
+
|
|
35
|
+
finance-mcp does **not** store, transmit, or persist any user financial data.
|
|
36
|
+
All calculations are performed locally and results are returned directly to
|
|
37
|
+
the calling application.
|
|
38
|
+
|
|
39
|
+
## Changes
|
|
40
|
+
|
|
41
|
+
We reserve the right to modify these terms at any time. Continued use of the
|
|
42
|
+
software constitutes acceptance of updated terms.
|
|
43
|
+
|
|
44
|
+
## Contact
|
|
45
|
+
|
|
46
|
+
For questions about these terms, open an issue at:
|
|
47
|
+
https://github.com/mcp-tools-lab/finance-mcp/issues
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Standard disclaimer appended to all tool responses.
|
|
3
|
+
*
|
|
4
|
+
* IMPORTANT: finance-mcp is NOT financial advice.
|
|
5
|
+
*/
|
|
6
|
+
export declare const DISCLAIMER: string;
|
|
7
|
+
export declare function withDisclaimer(text: string): string;
|
|
8
|
+
//# sourceMappingURL=disclaimer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"disclaimer.d.ts","sourceRoot":"","sources":["../src/disclaimer.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,UAAU,QAKqC,CAAC;AAE7D,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEnD"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Standard disclaimer appended to all tool responses.
|
|
3
|
+
*
|
|
4
|
+
* IMPORTANT: finance-mcp is NOT financial advice.
|
|
5
|
+
*/
|
|
6
|
+
export const DISCLAIMER = "\n\n---\n" +
|
|
7
|
+
"DISCLAIMER: This is NOT financial advice. These calculations are for " +
|
|
8
|
+
"informational and educational purposes only. Results use simplified models " +
|
|
9
|
+
"and may not reflect all real-world variables. Always consult a qualified " +
|
|
10
|
+
"financial advisor before making any financial decisions.";
|
|
11
|
+
export function withDisclaimer(text) {
|
|
12
|
+
return text + DISCLAIMER;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=disclaimer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"disclaimer.js","sourceRoot":"","sources":["../src/disclaimer.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,MAAM,UAAU,GACrB,WAAW;IACX,uEAAuE;IACvE,6EAA6E;IAC7E,2EAA2E;IAC3E,0DAA0D,CAAC;AAE7D,MAAM,UAAU,cAAc,CAAC,IAAY;IACzC,OAAO,IAAI,GAAG,UAAU,CAAC;AAC3B,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* finance-mcp — Personal Finance MCP Server
|
|
4
|
+
*
|
|
5
|
+
* DISCLAIMER: This is NOT financial advice. All calculations are for
|
|
6
|
+
* informational and educational purposes only. Consult a qualified
|
|
7
|
+
* financial advisor before making financial decisions.
|
|
8
|
+
*
|
|
9
|
+
* @author SceneView Tools
|
|
10
|
+
* @license MIT
|
|
11
|
+
*/
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;;;;;;;;GASG"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* finance-mcp — Personal Finance MCP Server
|
|
4
|
+
*
|
|
5
|
+
* DISCLAIMER: This is NOT financial advice. All calculations are for
|
|
6
|
+
* informational and educational purposes only. Consult a qualified
|
|
7
|
+
* financial advisor before making financial decisions.
|
|
8
|
+
*
|
|
9
|
+
* @author SceneView Tools
|
|
10
|
+
* @license MIT
|
|
11
|
+
*/
|
|
12
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
13
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
14
|
+
import { z } from "zod";
|
|
15
|
+
import { simulateLoan } from "./tools/simulate-loan.js";
|
|
16
|
+
import { calculateBudget } from "./tools/calculate-budget.js";
|
|
17
|
+
import { compareInvestments } from "./tools/compare-investments.js";
|
|
18
|
+
import { calculateRetirement } from "./tools/calculate-retirement.js";
|
|
19
|
+
import { taxOptimizer } from "./tools/tax-optimizer.js";
|
|
20
|
+
import { inflationCalculator } from "./tools/inflation-calculator.js";
|
|
21
|
+
const server = new McpServer({
|
|
22
|
+
name: "finance-mcp",
|
|
23
|
+
version: "1.0.0",
|
|
24
|
+
description: "Personal finance tools: loan simulation, budgeting, investment comparison, " +
|
|
25
|
+
"retirement planning, tax optimization (FR), and inflation calculator. " +
|
|
26
|
+
"NOT financial advice — consult a professional.",
|
|
27
|
+
});
|
|
28
|
+
// --- Tool 1: simulate_loan ---
|
|
29
|
+
server.tool("simulate_loan", "Simulate a loan (mortgage, car, student, personal) with amortization table. " +
|
|
30
|
+
"Calculates monthly payments, total interest, total cost. NOT financial advice.", {
|
|
31
|
+
type: z.enum(["mortgage", "car", "student", "personal"]).describe("Loan type"),
|
|
32
|
+
principal: z.number().positive().describe("Loan amount in EUR"),
|
|
33
|
+
annualRate: z.number().min(0).describe("Annual interest rate (e.g. 3.5 for 3.5%)"),
|
|
34
|
+
termYears: z.number().positive().describe("Loan term in years"),
|
|
35
|
+
insuranceRate: z
|
|
36
|
+
.number()
|
|
37
|
+
.min(0)
|
|
38
|
+
.optional()
|
|
39
|
+
.describe("Monthly insurance rate as % of principal (e.g. 0.03)"),
|
|
40
|
+
fullTable: z.boolean().optional().describe("Show full amortization table (default: abbreviated)"),
|
|
41
|
+
}, async (args) => {
|
|
42
|
+
try {
|
|
43
|
+
const result = simulateLoan(args);
|
|
44
|
+
return { content: [{ type: "text", text: result.summary }] };
|
|
45
|
+
}
|
|
46
|
+
catch (e) {
|
|
47
|
+
return { content: [{ type: "text", text: `Error: ${e.message}` }], isError: true };
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
// --- Tool 2: calculate_budget ---
|
|
51
|
+
server.tool("calculate_budget", "Analyze monthly budget from income and expenses. Calculates savings rate, " +
|
|
52
|
+
"budget health (50/30/20 rule), and recommendations. NOT financial advice.", {
|
|
53
|
+
monthlyIncome: z.number().positive().describe("Monthly net income in EUR"),
|
|
54
|
+
fixedExpenses: z
|
|
55
|
+
.record(z.string(), z.number())
|
|
56
|
+
.describe('Fixed expenses as {"rent": 800, "insurance": 120, ...}'),
|
|
57
|
+
variableExpenses: z
|
|
58
|
+
.record(z.string(), z.number())
|
|
59
|
+
.describe('Variable expenses as {"food": 400, "transport": 100, ...}'),
|
|
60
|
+
savingsGoals: z
|
|
61
|
+
.record(z.string(), z.number())
|
|
62
|
+
.optional()
|
|
63
|
+
.describe('Savings goals as {"emergency_fund": 200, "vacation": 100}'),
|
|
64
|
+
currency: z.string().optional().describe("Currency code (default: EUR)"),
|
|
65
|
+
}, async (args) => {
|
|
66
|
+
try {
|
|
67
|
+
const result = calculateBudget(args);
|
|
68
|
+
return { content: [{ type: "text", text: result.summary }] };
|
|
69
|
+
}
|
|
70
|
+
catch (e) {
|
|
71
|
+
return { content: [{ type: "text", text: `Error: ${e.message}` }], isError: true };
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
// --- Tool 3: compare_investments ---
|
|
75
|
+
server.tool("compare_investments", "Compare investment options (stocks, bonds, real estate, savings accounts) " +
|
|
76
|
+
"over a time horizon. Shows nominal, real, and after-tax returns. NOT financial advice.", {
|
|
77
|
+
initialAmount: z.number().min(0).describe("Initial investment amount in EUR"),
|
|
78
|
+
monthlyContribution: z.number().min(0).optional().describe("Monthly contribution in EUR"),
|
|
79
|
+
horizonYears: z.number().positive().describe("Investment horizon in years"),
|
|
80
|
+
inflationRate: z.number().min(0).optional().describe("Annual inflation rate % (default: 2)"),
|
|
81
|
+
taxRate: z.number().min(0).max(100).optional().describe("Tax rate on gains % (default: 30 for FR PFU)"),
|
|
82
|
+
options: z
|
|
83
|
+
.array(z.object({
|
|
84
|
+
name: z.string().describe("Investment name"),
|
|
85
|
+
expectedReturn: z.number().describe("Expected annual return %"),
|
|
86
|
+
riskLevel: z.number().min(1).max(10).describe("Risk level 1-10"),
|
|
87
|
+
annualFees: z.number().min(0).optional().describe("Annual fees %"),
|
|
88
|
+
taxable: z.boolean().optional().describe("Whether gains are taxed"),
|
|
89
|
+
liquidity: z
|
|
90
|
+
.enum(["immediate", "days", "weeks", "months", "years"])
|
|
91
|
+
.optional()
|
|
92
|
+
.describe("Liquidity level"),
|
|
93
|
+
}))
|
|
94
|
+
.min(1)
|
|
95
|
+
.describe("Investment options to compare"),
|
|
96
|
+
}, async (args) => {
|
|
97
|
+
try {
|
|
98
|
+
const result = compareInvestments(args);
|
|
99
|
+
return { content: [{ type: "text", text: result.summary }] };
|
|
100
|
+
}
|
|
101
|
+
catch (e) {
|
|
102
|
+
return { content: [{ type: "text", text: `Error: ${e.message}` }], isError: true };
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
// --- Tool 4: calculate_retirement ---
|
|
106
|
+
server.tool("calculate_retirement", "Retirement planning calculator. Determines how much to save monthly to reach " +
|
|
107
|
+
"your retirement income goal, accounting for inflation and pension. NOT financial advice.", {
|
|
108
|
+
currentAge: z.number().positive().describe("Current age"),
|
|
109
|
+
retirementAge: z.number().positive().describe("Target retirement age"),
|
|
110
|
+
lifeExpectancy: z.number().positive().optional().describe("Planning life expectancy (default: 85)"),
|
|
111
|
+
currentSavings: z.number().min(0).describe("Current retirement savings in EUR"),
|
|
112
|
+
desiredMonthlyIncome: z.number().positive().describe("Desired monthly income in retirement (today's EUR)"),
|
|
113
|
+
expectedReturn: z.number().optional().describe("Expected annual investment return % (default: 5)"),
|
|
114
|
+
inflationRate: z.number().optional().describe("Expected annual inflation % (default: 2)"),
|
|
115
|
+
expectedPension: z.number().min(0).optional().describe("Expected monthly pension (today's EUR)"),
|
|
116
|
+
currentMonthlySavings: z.number().min(0).optional().describe("Current monthly savings in EUR"),
|
|
117
|
+
}, async (args) => {
|
|
118
|
+
try {
|
|
119
|
+
const result = calculateRetirement(args);
|
|
120
|
+
return { content: [{ type: "text", text: result.summary }] };
|
|
121
|
+
}
|
|
122
|
+
catch (e) {
|
|
123
|
+
return { content: [{ type: "text", text: `Error: ${e.message}` }], isError: true };
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
// --- Tool 5: tax_optimizer ---
|
|
127
|
+
server.tool("tax_optimizer", "French tax analysis and optimization suggestions. Calculates income tax using " +
|
|
128
|
+
"bareme progressif, quotient familial, PFU on investments, and suggests legal " +
|
|
129
|
+
"tax optimization strategies (PER, PEA, assurance-vie, etc.). NOT financial advice.", {
|
|
130
|
+
annualGrossSalary: z.number().min(0).describe("Annual gross salary in EUR"),
|
|
131
|
+
filingStatus: z
|
|
132
|
+
.enum(["single", "married", "married_separate", "pacs"])
|
|
133
|
+
.describe("Filing status"),
|
|
134
|
+
numberOfChildren: z.number().int().min(0).optional().describe("Number of children"),
|
|
135
|
+
dependents: z.number().int().min(0).optional().describe("Other dependents"),
|
|
136
|
+
rentalIncome: z.number().min(0).optional().describe("Annual rental income in EUR"),
|
|
137
|
+
investmentIncome: z.number().min(0).optional().describe("Annual investment income in EUR"),
|
|
138
|
+
capitalGains: z.number().min(0).optional().describe("Annual capital gains in EUR"),
|
|
139
|
+
existingDeductions: z
|
|
140
|
+
.record(z.string(), z.number())
|
|
141
|
+
.optional()
|
|
142
|
+
.describe("Existing deductions as {\"charity\": 500}"),
|
|
143
|
+
selfEmployed: z.boolean().optional().describe("Whether also self-employed (micro-entrepreneur)"),
|
|
144
|
+
selfEmploymentRevenue: z.number().min(0).optional().describe("Annual self-employment revenue in EUR"),
|
|
145
|
+
}, async (args) => {
|
|
146
|
+
try {
|
|
147
|
+
const result = taxOptimizer(args);
|
|
148
|
+
return { content: [{ type: "text", text: result.summary }] };
|
|
149
|
+
}
|
|
150
|
+
catch (e) {
|
|
151
|
+
return { content: [{ type: "text", text: `Error: ${e.message}` }], isError: true };
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
// --- Tool 6: inflation_calculator ---
|
|
155
|
+
server.tool("inflation_calculator", "Calculate the real value of money over time accounting for inflation. " +
|
|
156
|
+
"Shows purchasing power erosion, future equivalent amounts, and scenario comparisons. " +
|
|
157
|
+
"NOT financial advice.", {
|
|
158
|
+
amount: z.number().positive().describe("Amount in EUR"),
|
|
159
|
+
years: z.number().positive().describe("Number of years"),
|
|
160
|
+
inflationRate: z.number().min(0).optional().describe("Annual inflation rate % (default: 2)"),
|
|
161
|
+
direction: z
|
|
162
|
+
.enum(["future", "past"])
|
|
163
|
+
.optional()
|
|
164
|
+
.describe("future = what will this buy in N years; past = what was this worth N years ago"),
|
|
165
|
+
scenarios: z
|
|
166
|
+
.array(z.number().min(0))
|
|
167
|
+
.optional()
|
|
168
|
+
.describe("Additional inflation rates to compare (e.g. [1, 3, 5])"),
|
|
169
|
+
}, async (args) => {
|
|
170
|
+
try {
|
|
171
|
+
const result = inflationCalculator(args);
|
|
172
|
+
return { content: [{ type: "text", text: result.summary }] };
|
|
173
|
+
}
|
|
174
|
+
catch (e) {
|
|
175
|
+
return { content: [{ type: "text", text: `Error: ${e.message}` }], isError: true };
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
// Start server
|
|
179
|
+
async function main() {
|
|
180
|
+
const transport = new StdioServerTransport();
|
|
181
|
+
await server.connect(transport);
|
|
182
|
+
}
|
|
183
|
+
main().catch((error) => {
|
|
184
|
+
console.error("Fatal error:", error);
|
|
185
|
+
process.exit(1);
|
|
186
|
+
});
|
|
187
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;;;;;;;;GASG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAEtE,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC;IAC3B,IAAI,EAAE,aAAa;IACnB,OAAO,EAAE,OAAO;IAChB,WAAW,EACT,6EAA6E;QAC7E,wEAAwE;QACxE,gDAAgD;CACnD,CAAC,CAAC;AAEH,gCAAgC;AAChC,MAAM,CAAC,IAAI,CACT,eAAe,EACf,8EAA8E;IAC5E,gFAAgF,EAClF;IACE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,KAAK,EAAE,SAAS,EAAE,UAA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AAO,EAAE,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAChG,CAAC;AACH,CAAC,CACF,CAAC;AAEF,eAAe;AACf,KAAK,UAAU,IAAI;IACjB,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;AAClC,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,OAAO,CAAC,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;IACrC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export interface BudgetInput {
|
|
2
|
+
/** Monthly net income */
|
|
3
|
+
monthlyIncome: number;
|
|
4
|
+
/** Fixed expenses (rent, utilities, subscriptions, insurance, etc.) */
|
|
5
|
+
fixedExpenses: Record<string, number>;
|
|
6
|
+
/** Variable expenses (food, transport, entertainment, etc.) */
|
|
7
|
+
variableExpenses: Record<string, number>;
|
|
8
|
+
/** Savings goals (optional) */
|
|
9
|
+
savingsGoals?: Record<string, number>;
|
|
10
|
+
/** Currency code for display (default: EUR) */
|
|
11
|
+
currency?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface BudgetResult {
|
|
14
|
+
monthlyIncome: number;
|
|
15
|
+
totalFixedExpenses: number;
|
|
16
|
+
totalVariableExpenses: number;
|
|
17
|
+
totalExpenses: number;
|
|
18
|
+
totalSavingsGoals: number;
|
|
19
|
+
remainingAfterExpenses: number;
|
|
20
|
+
remainingAfterSavings: number;
|
|
21
|
+
savingsRate: number;
|
|
22
|
+
savingsRateAfterGoals: number;
|
|
23
|
+
health: "excellent" | "good" | "tight" | "deficit";
|
|
24
|
+
recommendations: string[];
|
|
25
|
+
summary: string;
|
|
26
|
+
}
|
|
27
|
+
export declare function calculateBudget(input: BudgetInput): BudgetResult;
|
|
28
|
+
//# sourceMappingURL=calculate-budget.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calculate-budget.d.ts","sourceRoot":"","sources":["../../src/tools/calculate-budget.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,WAAW;IAC1B,yBAAyB;IACzB,aAAa,EAAE,MAAM,CAAC;IACtB,uEAAuE;IACvE,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,+DAA+D;IAC/D,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzC,+BAA+B;IAC/B,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,+CAA+C;IAC/C,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,YAAY;IAC3B,aAAa,EAAE,MAAM,CAAC;IACtB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,qBAAqB,EAAE,MAAM,CAAC;IAC9B,aAAa,EAAE,MAAM,CAAC;IACtB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,sBAAsB,EAAE,MAAM,CAAC;IAC/B,qBAAqB,EAAE,MAAM,CAAC;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,qBAAqB,EAAE,MAAM,CAAC;IAC9B,MAAM,EAAE,WAAW,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;IACnD,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,WAAW,GAAG,YAAY,CAiEhE"}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { withDisclaimer } from "../disclaimer.js";
|
|
2
|
+
export function calculateBudget(input) {
|
|
3
|
+
const { monthlyIncome, fixedExpenses, variableExpenses, savingsGoals = {}, currency = "EUR" } = input;
|
|
4
|
+
if (monthlyIncome <= 0)
|
|
5
|
+
throw new Error("Monthly income must be positive");
|
|
6
|
+
const totalFixed = Object.values(fixedExpenses).reduce((a, b) => a + b, 0);
|
|
7
|
+
const totalVariable = Object.values(variableExpenses).reduce((a, b) => a + b, 0);
|
|
8
|
+
const totalExpenses = round2(totalFixed + totalVariable);
|
|
9
|
+
const totalSavingsGoals = Object.values(savingsGoals).reduce((a, b) => a + b, 0);
|
|
10
|
+
const remainingAfterExpenses = round2(monthlyIncome - totalExpenses);
|
|
11
|
+
const remainingAfterSavings = round2(remainingAfterExpenses - totalSavingsGoals);
|
|
12
|
+
const savingsRate = round2((remainingAfterExpenses / monthlyIncome) * 100);
|
|
13
|
+
const savingsRateAfterGoals = round2((remainingAfterSavings / monthlyIncome) * 100);
|
|
14
|
+
let health;
|
|
15
|
+
if (savingsRate >= 30)
|
|
16
|
+
health = "excellent";
|
|
17
|
+
else if (savingsRate >= 15)
|
|
18
|
+
health = "good";
|
|
19
|
+
else if (savingsRate >= 0)
|
|
20
|
+
health = "tight";
|
|
21
|
+
else
|
|
22
|
+
health = "deficit";
|
|
23
|
+
const recommendations = generateRecommendations(health, savingsRate, totalFixed, totalVariable, monthlyIncome, fixedExpenses, variableExpenses);
|
|
24
|
+
const summary = formatBudgetSummary({
|
|
25
|
+
monthlyIncome,
|
|
26
|
+
totalFixedExpenses: totalFixed,
|
|
27
|
+
totalVariableExpenses: totalVariable,
|
|
28
|
+
totalExpenses,
|
|
29
|
+
totalSavingsGoals,
|
|
30
|
+
remainingAfterExpenses,
|
|
31
|
+
remainingAfterSavings,
|
|
32
|
+
savingsRate,
|
|
33
|
+
savingsRateAfterGoals,
|
|
34
|
+
health,
|
|
35
|
+
recommendations,
|
|
36
|
+
summary: "",
|
|
37
|
+
fixedExpenses,
|
|
38
|
+
variableExpenses,
|
|
39
|
+
savingsGoals,
|
|
40
|
+
currency,
|
|
41
|
+
});
|
|
42
|
+
return {
|
|
43
|
+
monthlyIncome,
|
|
44
|
+
totalFixedExpenses: round2(totalFixed),
|
|
45
|
+
totalVariableExpenses: round2(totalVariable),
|
|
46
|
+
totalExpenses,
|
|
47
|
+
totalSavingsGoals: round2(totalSavingsGoals),
|
|
48
|
+
remainingAfterExpenses,
|
|
49
|
+
remainingAfterSavings,
|
|
50
|
+
savingsRate,
|
|
51
|
+
savingsRateAfterGoals,
|
|
52
|
+
health,
|
|
53
|
+
recommendations,
|
|
54
|
+
summary,
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
function round2(n) {
|
|
58
|
+
return Math.round(n * 100) / 100;
|
|
59
|
+
}
|
|
60
|
+
function generateRecommendations(health, savingsRate, totalFixed, totalVariable, income, fixedExpenses, variableExpenses) {
|
|
61
|
+
const recs = [];
|
|
62
|
+
if (health === "deficit") {
|
|
63
|
+
recs.push("Your expenses exceed your income. Immediate action needed to reduce spending or increase income.");
|
|
64
|
+
}
|
|
65
|
+
// 50/30/20 rule check
|
|
66
|
+
const fixedPct = (totalFixed / income) * 100;
|
|
67
|
+
const varPct = (totalVariable / income) * 100;
|
|
68
|
+
if (fixedPct > 50) {
|
|
69
|
+
recs.push(`Fixed expenses are ${fixedPct.toFixed(0)}% of income (recommended: under 50%). Consider renegotiating rent, insurance, or subscriptions.`);
|
|
70
|
+
}
|
|
71
|
+
if (varPct > 30) {
|
|
72
|
+
recs.push(`Variable expenses are ${varPct.toFixed(0)}% of income (recommended: under 30%). Track daily spending to identify reduction opportunities.`);
|
|
73
|
+
}
|
|
74
|
+
if (savingsRate < 20) {
|
|
75
|
+
recs.push("Target a 20% savings rate. Automate transfers to a savings account on payday.");
|
|
76
|
+
}
|
|
77
|
+
// Check for large individual categories
|
|
78
|
+
for (const [name, amount] of Object.entries({ ...fixedExpenses, ...variableExpenses })) {
|
|
79
|
+
const pct = (amount / income) * 100;
|
|
80
|
+
if (pct > 25) {
|
|
81
|
+
recs.push(`"${name}" alone is ${pct.toFixed(0)}% of income. Consider ways to reduce this expense.`);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
if (savingsRate >= 30) {
|
|
85
|
+
recs.push("Excellent savings rate! Consider investing surplus funds for long-term growth.");
|
|
86
|
+
}
|
|
87
|
+
if (recs.length === 0) {
|
|
88
|
+
recs.push("Your budget looks balanced. Keep monitoring and adjust as needed.");
|
|
89
|
+
}
|
|
90
|
+
return recs;
|
|
91
|
+
}
|
|
92
|
+
function formatBudgetSummary(r) {
|
|
93
|
+
const fmt = (n) => n.toFixed(2);
|
|
94
|
+
const healthEmoji = r.health === "excellent" ? "Excellent" :
|
|
95
|
+
r.health === "good" ? "Good" :
|
|
96
|
+
r.health === "tight" ? "Tight" : "DEFICIT";
|
|
97
|
+
const lines = [
|
|
98
|
+
`## Monthly Budget Analysis`,
|
|
99
|
+
"",
|
|
100
|
+
`**Status: ${healthEmoji}** | Savings rate: ${r.savingsRate}%`,
|
|
101
|
+
"",
|
|
102
|
+
"### Income",
|
|
103
|
+
`| Source | Amount (${r.currency}) |`,
|
|
104
|
+
`|--------|--------|`,
|
|
105
|
+
`| Net income | ${fmt(r.monthlyIncome)} |`,
|
|
106
|
+
"",
|
|
107
|
+
"### Fixed Expenses",
|
|
108
|
+
`| Category | Amount (${r.currency}) |`,
|
|
109
|
+
`|----------|--------|`,
|
|
110
|
+
];
|
|
111
|
+
for (const [name, amount] of Object.entries(r.fixedExpenses)) {
|
|
112
|
+
lines.push(`| ${name} | ${fmt(amount)} |`);
|
|
113
|
+
}
|
|
114
|
+
lines.push(`| **Total** | **${fmt(r.totalFixedExpenses)}** |`);
|
|
115
|
+
lines.push("", "### Variable Expenses");
|
|
116
|
+
lines.push(`| Category | Amount (${r.currency}) |`);
|
|
117
|
+
lines.push(`|----------|--------|`);
|
|
118
|
+
for (const [name, amount] of Object.entries(r.variableExpenses)) {
|
|
119
|
+
lines.push(`| ${name} | ${fmt(amount)} |`);
|
|
120
|
+
}
|
|
121
|
+
lines.push(`| **Total** | **${fmt(r.totalVariableExpenses)}** |`);
|
|
122
|
+
if (Object.keys(r.savingsGoals).length > 0) {
|
|
123
|
+
lines.push("", "### Savings Goals");
|
|
124
|
+
lines.push(`| Goal | Amount (${r.currency}) |`);
|
|
125
|
+
lines.push(`|------|--------|`);
|
|
126
|
+
for (const [name, amount] of Object.entries(r.savingsGoals)) {
|
|
127
|
+
lines.push(`| ${name} | ${fmt(amount)} |`);
|
|
128
|
+
}
|
|
129
|
+
lines.push(`| **Total** | **${fmt(r.totalSavingsGoals)}** |`);
|
|
130
|
+
}
|
|
131
|
+
lines.push("", "### Summary", `| | Amount (${r.currency}) |`, `|--|--------|`, `| Total expenses | ${fmt(r.totalExpenses)} |`, `| Remaining after expenses | ${fmt(r.remainingAfterExpenses)} |`, `| Savings goals | ${fmt(r.totalSavingsGoals)} |`, `| **Free cash** | **${fmt(r.remainingAfterSavings)}** |`, `| Savings rate | ${r.savingsRate}% |`, "", "### Recommendations");
|
|
132
|
+
for (const rec of r.recommendations) {
|
|
133
|
+
lines.push(`- ${rec}`);
|
|
134
|
+
}
|
|
135
|
+
return withDisclaimer(lines.join("\n"));
|
|
136
|
+
}
|
|
137
|
+
//# sourceMappingURL=calculate-budget.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calculate-budget.js","sourceRoot":"","sources":["../../src/tools/calculate-budget.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AA8BlD,MAAM,UAAU,eAAe,CAAC,KAAkB;IAChD,MAAM,EAAE,aAAa,EAAE,aAAa,EAAE,gBAAgB,EAAE,YAAY,GAAG,EAAE,EAAE,QAAQ,GAAG,KAAK,EAAE,GAAG,KAAK,CAAC;IAEtG,IAAI,aAAa,IAAI,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;IAE3E,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,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irement age */
|
|
5
|
+
retirementAge: number;
|
|
6
|
+
/** Life expectancy for planning (default: 85) */
|
|
7
|
+
lifeExpectancy?: number;
|
|
8
|
+
/** Current savings/investments */
|
|
9
|
+
currentSavings: number;
|
|
10
|
+
/** Desired monthly income in retirement (today's euros) */
|
|
11
|
+
desiredMonthlyIncome: number;
|
|
12
|
+
/** Expected annual investment return (%) */
|
|
13
|
+
expectedReturn?: number;
|
|
14
|
+
/** Expected inflation rate (%) */
|
|
15
|
+
inflationRate?: number;
|
|
16
|
+
/** Expected pension from state/employer (monthly, today's euros) */
|
|
17
|
+
expectedPension?: number;
|
|
18
|
+
/** Current monthly savings */
|
|
19
|
+
currentMonthlySavings?: number;
|
|
20
|
+
}
|
|
21
|
+
export interface RetirementResult {
|
|
22
|
+
yearsToRetirement: number;
|
|
23
|
+
yearsInRetirement: number;
|
|
24
|
+
inflationAdjustedMonthlyNeed: number;
|
|
25
|
+
monthlyGapAfterPension: number;
|
|
26
|
+
totalNeededAtRetirement: number;
|
|
27
|
+
projectedSavingsAtRetirement: number;
|
|
28
|
+
shortfall: number;
|
|
29
|
+
requiredMonthlySavings: number;
|
|
30
|
+
currentMonthlySavings: number;
|
|
31
|
+
onTrack: boolean;
|
|
32
|
+
summary: string;
|
|
33
|
+
}
|
|
34
|
+
export declare function calculateRetirement(input: RetirementInput): RetirementResult;
|
|
35
|
+
//# sourceMappingURL=calculate-retirement.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calculate-retirement.d.ts","sourceRoot":"","sources":["../../src/tools/calculate-retirement.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,eAAe;IAC9B,kBAAkB;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,4BAA4B;IAC5B,aAAa,EAAE,MAAM,CAAC;IACtB,iDAAiD;IACjD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,kCAAkC;IAClC,cAAc,EAAE,MAAM,CAAC;IACvB,2DAA2D;IAC3D,oBAAoB,EAAE,MAAM,CAAC;IAC7B,4CAA4C;IAC5C,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,kCAAkC;IAClC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,oEAAoE;IACpE,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,8BAA8B;IAC9B,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAChC;AAED,MAAM,WAAW,gBAAgB;IAC/B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,4BAA4B,EAAE,MAAM,CAAC;IACrC,sBAAsB,EAAE,MAAM,CAAC;IAC/B,uBAAuB,EAAE,MAAM,CAAC;IAChC,4BAA4B,EAAE,MAAM,CAAC;IACrC,SAAS,EAAE,MAAM,CAAC;IAClB,sBAAsB,EAAE,MAAM,CAAC;IAC/B,qBAAqB,EAAE,MAAM,CAAC;IAC9B,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CACjB;AAMD,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,eAAe,GAAG,gBAAgB,CAkG5E"}
|