Skip to main content

Complete Financial Planning MVP MCP Server

Project description

๐Ÿ’ฐ Personal Finance MCP Server

Deterministic personal finance calculator powered by Model Context Protocol โ€” based on the Core Financial Principles.

Python 3.10+ MCP SDK Tests License: MIT


โœจ What It Does

Connect this server to Claude Desktop, Claude Code, or any MCP client to get 54 financial calculation tools with:

  • ๐Ÿ”ข Deterministic outputs โ€” same inputs โ†’ same results, always
  • ๐Ÿ“– Theory-grounded โ€” every formula traced to core financial concepts
  • ๐Ÿ“ Full formula display โ€” shows the exact calculation, not just the answer
  • ๐Ÿ‡ฎ๐Ÿ‡ณ Indian finance context โ€” โ‚น formatting, SIP planning, EMI calculations
  • ๐Ÿš€ Zero external APIs โ€” works fully offline, no LLM dependency for math

๐Ÿ“ฆ Quick Start

1. Install

cd personal-finance-mcp

# Using uv (recommended)
uv venv && source .venv/bin/activate
uv pip install -e ".[dev]"

# Or using pip
python -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"

2. Connect to Claude Desktop

Add to your claude_desktop_config.json:

{
  "mcpServers": {
    "personal-finance": {
      "command": "uv",
      "args": [
        "run",
        "--directory",
        "/ABSOLUTE/PATH/TO/personal-finance-mcp",
        "personal-finance-mcp"
      ]
    }
  }
}

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json Windows: %APPDATA%/Claude/claude_desktop_config.json

3. Test

pytest tests/ -v            # Run all 100+ tests
python -m src               # Start the server manually

๐Ÿ›  Tool Categories (54 Tools)

๐Ÿ“Š Time Value of Money โ€” 10 tools

Tool Description
calculate_future_value FV with any compounding frequency
calculate_present_value Discount future cash flows to today
calculate_annuity_fv Future value of regular payments (SIP)
calculate_annuity_pv Present value of regular payments
calculate_perpetuity Value of infinite periodic payments
calculate_rule_of_72 Quick doubling time estimate
calculate_effective_rate Nominal โ†’ Effective Annual Rate
calculate_real_return Inflation-adjusted return (Fisher)
calculate_inflation_impact Future cost after inflation
calculate_savings_needed Monthly savings for a target corpus

๐Ÿ’ณ Debt Management โ€” 6 tools

Tool Description
calculate_emi EMI for any loan
loan_amortization Month-wise principal/interest split
compare_loans Side-by-side loan comparison
calculate_prepayment_savings Interest saved by prepaying
invest_or_prepay_loan Should you invest or prepay?
analyze_debt_consolidation Should you consolidate debts?

๐Ÿ“‹ Financial Planning โ€” 9 tools

Tool Description
calculate_net_worth Assets - Liabilities statement
analyze_financial_ratios Savings, DTI, liquidity, solvency
calculate_emergency_fund Recommended buffer size
analyze_budget 50/30/20 rule analysis
plan_financial_goal Goal setting with inflation adjustment
plan_retirement Retirement corpus & SIP calculator
plan_education Child education fund planner
calculate_insurance_need Human Life Value method
financial_health_check 0-100 health score with rating

๐Ÿ“ˆ Bond Analysis โ€” 6 tools

Tool Description
calculate_bond_price DCF bond pricing
calculate_ytm Yield to Maturity (Newton-Raphson)
calculate_current_yield Annual coupon / market price
calculate_bond_duration Macaulay & Modified Duration
calculate_bond_convexity Second-order interest rate risk
calculate_zero_coupon_bond Zero-coupon bond pricing

๐Ÿ“Š Stock Valuation โ€” 5 tools

Tool Description
value_stock_ddm Gordon Growth Model
value_stock_two_stage_ddm Two-stage DDM
value_stock_pe P/E relative valuation + PEG
value_stock_dcf Discounted Cash Flow
calculate_dividend_yield Dividend yield %

๐Ÿฆ Mutual Funds โ€” 7 tools

Tool Description
calculate_sip_returns SIP calculator with step-up
calculate_sip_needed Monthly SIP for a target corpus
compare_lumpsum_vs_sip Lump sum vs SIP comparison
analyze_expense_ratio_impact How expense ratio erodes returns
calculate_swp Systematic Withdrawal Plan duration
calculate_cagr Compound Annual Growth Rate
calculate_nav Net Asset Value calculation

๐Ÿ“Š Portfolio Analytics โ€” 11 tools

Tool Description
calculate_portfolio_return Weighted expected return
calculate_portfolio_risk Portfolio variance & std deviation
analyze_two_asset_portfolio Two-asset analysis + min variance
calculate_capm_return CAPM expected return
calculate_sharpe_ratio Risk-adjusted return (total risk)
calculate_treynor_ratio Risk-adjusted return (systematic)
calculate_jensens_alpha Manager skill measurement
calculate_information_ratio Consistency vs benchmark
calculate_sortino_ratio Downside-risk-adjusted return
suggest_asset_allocation Age & risk-based allocation
rebalance_portfolio Trades needed for target allocation

๐Ÿ’ฌ Example Usage in Claude

"Calculate EMI for a 50 lakh home loan at 8.5% for 20 years"

Output:

โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
  EMI Calculation
โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
  Emi: โ‚น43,391.16
  Total Payment: โ‚น1,04,13,878.40
  Total Interest: โ‚น54,13,878.40
  Interest To Principal Ratio: 1.0828
  Principal: โ‚น50,00,000.00
  Annual Rate: 8.5%
  Tenure Months: 240

  Formula: EMI = 50,00,000.00 ร— 0.007083 ร— (1+0.007083)^240 / ((1+0.007083)^240 - 1)

  

๐Ÿ— Architecture

Tools Layer โ†’ Calculators Layer โ†’ Models Layer
     โ”‚               โ”‚                โ”‚
  MCP interface   Pure math      Pydantic validation
  + formatting    functions      + enums
  • Calculators: Pure functions, no side effects, deterministic
  • Tools: MCP wrappers with formatting
  • Models: Pydantic schemas for input validation

See Architecture.md for full details.


๐Ÿ“ Project Structure

personal-finance-mcp/
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ server.py              # MCP server entry point
โ”‚   โ”œโ”€โ”€ __main__.py            # python -m src entry point
โ”‚   โ”œโ”€โ”€ calculators/           # Pure math functions (7 modules)
โ”‚   โ”‚   โ”œโ”€โ”€ tvm.py             # Time Value of Money
โ”‚   โ”‚   โ”œโ”€โ”€ debt.py            # EMI, amortization
โ”‚   โ”‚   โ”œโ”€โ”€ ratios.py          # Financial ratios, health score
โ”‚   โ”‚   โ”œโ”€โ”€ bonds.py           # Bond pricing, YTM, duration
โ”‚   โ”‚   โ”œโ”€โ”€ stocks.py          # DDM, DCF, P/E valuation
โ”‚   โ”‚   โ”œโ”€โ”€ mutual_funds.py    # SIP, SWP, CAGR, NAV
โ”‚   โ”‚   โ””โ”€โ”€ portfolio.py       # MPT, CAPM, Sharpe, alpha
โ”‚   โ”œโ”€โ”€ tools/                 # MCP tool definitions (7 modules)
โ”‚   โ”œโ”€โ”€ models/                # Pydantic schemas & enums
โ”‚   โ””โ”€โ”€ utils/                 # Formatters & helpers
โ”œโ”€โ”€ tests/                     # 100+ unit & integration tests
โ”œโ”€โ”€ docs/                      # setup, testing, deployment, documentation
โ”œโ”€โ”€ config/                    # Claude Desktop config example
โ”œโ”€โ”€ Plan.md                    # Project roadmap
โ”œโ”€โ”€ Architecture.md            # System design
โ”œโ”€โ”€ log.md                     # Development changelog
โ”œโ”€โ”€ Dockerfile                 # Container deployment
โ”œโ”€โ”€ run_production.py          # SSE server launcher
โ”œโ”€โ”€ pyproject.toml             # Package configuration
โ””โ”€โ”€ LICENSE                    # MIT License

๐Ÿš€ Deployment Options

Method Transport Use Case
Claude Desktop stdio Personal use โ€” simplest
Claude Code stdio Development / coding
SSE Server HTTP Remote clients, team use
Docker HTTP Production deployment

See docs/deployment.md for full instructions.


๐Ÿ“š Documentation

Document Description
docs/documentation.md Full tool reference with formulas
docs/setup.md Installation & connection guide
docs/testing.md Test structure & running tests
docs/deployment.md Local, SSE, Docker deployment
Architecture.md System design & data flow
Plan.md Roadmap & module breakdown
log.md Development changelog

๐Ÿ”‘ Key Design Decisions

  1. Stateless โ€” No database, no sessions. Every tool call is self-contained.
  2. Deterministic โ€” Pure math, no randomness, no AI inference for numbers.
  3. Layered โ€” Tools โ†’ Calculators โ†’ Models, each with single responsibility.
  4. Offline-first โ€” Zero external API calls. Works without internet.
  5. Theory-grounded โ€” Every formula is mathematically deterministic.

๐Ÿ“„ License

MIT โ€” free to use, modify, and distribute.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

personal_finance_mcp-1.0.0.tar.gz (118.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

personal_finance_mcp-1.0.0-py3-none-any.whl (36.4 kB view details)

Uploaded Python 3

File details

Details for the file personal_finance_mcp-1.0.0.tar.gz.

File metadata

  • Download URL: personal_finance_mcp-1.0.0.tar.gz
  • Upload date:
  • Size: 118.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for personal_finance_mcp-1.0.0.tar.gz
Algorithm Hash digest
SHA256 cbc94062e1b63cd41ed242bfdd3071722763d73bb4f0ec23b28bd77fff01306c
MD5 588ef537103b4141a829608d8889699c
BLAKE2b-256 2a478e9e042f03829922b7b30e1ca13303e29bfc56aad4cead97fe0e2f6022c2

See more details on using hashes here.

File details

Details for the file personal_finance_mcp-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: personal_finance_mcp-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 36.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for personal_finance_mcp-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d720f5760dbcc93478b403e993e766b674ef98db69208aa515c85012ae43042c
MD5 9de9c768ab229fa780b41ff3b4b2b404
BLAKE2b-256 dbccbee69a5e5e6888d2c45f7194a3ce01dc942ffdba27027a1ed0ce865ce9b9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page