Skip to main content

Complete personal-finance MCP server + website (76 deterministic tools)

Project description

๐Ÿ’ฐ Personal Finance MCP

Deterministic personal-finance toolkit exposed over the Model Context Protocol โ€” 76 calculators, a meta-advisor, and live market data, with a polished web UI. Grounded in established financial mathematics.

Python 3.10+ MCP Tests License: MIT Live on Hugging Face

Live demo: https://sarveshtalele-personal-finance-mcp.hf.space Connector URL: https://sarveshtalele-personal-finance-mcp.hf.space/mcp


Overview

Most finance "assistants" guess at numbers. This one doesn't. It ships 76 deterministic calculators โ€” same inputs, same answer, every time โ€” and lets an LLM route a plain-language question to the right tools. Describe your situation ("I'm 30, earn โ‚น1L/month, want to retire at 60") and the create_financial_plan orchestrator chains the relevant calculators into a single prioritised plan.

It runs three ways from one codebase:

  • As an MCP server โ€” connect it to Claude Desktop, Claude Code, Cursor, or any MCP client.
  • As a website โ€” a Next.js UI with a live calculator, a market dashboard, and a tool catalog.
  • As a hosted connector โ€” deployed to a Hugging Face Docker Space; one URL does all three.

Highlights

  • ๐Ÿ”ข Deterministic โ€” pure math, no model inference for the numbers.
  • ๐Ÿค– Story โ†’ tools โ€” the model maps intent to tools; users never name them.
  • ๐Ÿ‡ฎ๐Ÿ‡ณ Theory-grounded โ€” TVM, debt, PPF/SSY/NSC/EPF, bonds, derivatives, MPT, and more.
  • ๐Ÿ›ฐ๏ธ Live market data โ€” mutual-fund NAVs (AMFI), FX (ECB), equity quotes (Yahoo) โ€” no API keys.
  • ๐Ÿ”’ Hardened โ€” stateless, rate-limited, input-bounded APIs with security headers/CSP.

Tool catalog โ€” 76 tools, 13 categories

Category Tools Examples
Time Value of Money 10 future/present value, annuity, perpetuity, EAR, real return
Portfolio Analytics 11 CAPM, Sharpe, Sortino, Treynor, alpha, allocation, rebalancing
Financial Planning 9 net worth, ratios, emergency fund, retirement, education, insurance
Small Savings (India) 8 PPF, SSY, NSC, KVP, SCSS, RD, FD, EPF
Mutual Funds 7 SIP, SWP, lumpsum-vs-SIP, CAGR, NAV, expense-ratio impact
Debt & Loans 6 EMI, amortization, prepayment, consolidation, invest-vs-prepay
Fixed Income 6 bond price, YTM, current yield, duration, convexity, zero-coupon
Derivatives 5 futures fair value, option payoff, put-call parity, Black-Scholes, beta hedge
Equity Valuation 5 DDM, two-stage DDM, P/E, DCF, dividend yield
Live Market Data 4 MF search, live NAV, FX rate, stock/index quote
Cash Flow & Budgeting 3 household cash flow, debt-to-income, contingency fund
Risk Profiling 1 suitability score โ†’ suggested equity/debt split
Advisor 1 create_financial_plan โ€” the story โ†’ plan orchestrator

Browse them all (with live descriptions) at /tools.


Quick start

Use the hosted connector (no install)

Claude Desktop โ€” Settings โ†’ Connectors โ†’ Add custom connector โ†’ paste:

https://sarveshtalele-personal-finance-mcp.hf.space/mcp

Claude Code

claude mcp add --transport http personal-finance https://sarveshtalele-personal-finance-mcp.hf.space/mcp

Cursor / VS Code โ€” add to mcp.json:

{
  "mcpServers": {
    "personal-finance": {
      "url": "https://sarveshtalele-personal-finance-mcp.hf.space/mcp",
      "transport": "http"
    }
  }
}

Install from PyPI (stdio server)

pip install personal-finance-mcp     # or: uvx personal-finance-mcp

Then point Claude Desktop at it:

{
  "mcpServers": {
    "personal-finance": { "command": "uvx", "args": ["personal-finance-mcp"] }
  }
}

Run locally from source

git clone https://github.com/sarveshtalele/personal-finance-mcp.git
cd personal-finance-mcp
pip install -e .

# Option A โ€” classic stdio MCP server (offline, no web)
python -m src

# Option B โ€” unified server: website + /mcp connector + /api  (http://localhost:7860)
cd web && npm install && npm run build && cd ..
python -m src.web

For stdio, point Claude Desktop at the local process:

{
  "mcpServers": {
    "personal-finance": { "command": "python", "args": ["-m", "src"] }
  }
}

The website

python -m src.web serves everything on one port:

Path What
/ Next.js site โ€” home, tool catalog, live calculator, market dashboard, setup guide
/mcp MCP server over streamable-HTTP โ€” the connector URL
/api/* JSON endpoints (tool catalog, calculators, live market data)

Architecture

src/
โ”œโ”€โ”€ server.py            # FastMCP server โ€” registers all tool modules
โ”œโ”€โ”€ __main__.py          # `python -m src`  (stdio transport)
โ”œโ”€โ”€ tools/               # pure math fns + per-module register(mcp)
โ”‚   โ”œโ”€โ”€ tvm.py  debt.py  planning.py  bonds.py  stocks.py  mutual_funds.py
โ”‚   โ”œโ”€โ”€ portfolio.py  derivatives.py  india_savings.py  cashflow.py
โ”‚   โ”œโ”€โ”€ risk_profile.py  advisor.py   # advisor = story โ†’ plan orchestrator
โ”‚   โ””โ”€โ”€ marketdata.py    # live AMFI / Frankfurter / Yahoo (keyless)
โ”œโ”€โ”€ models/              # Pydantic schemas + enums
โ”œโ”€โ”€ utils/               # output formatters
โ””โ”€โ”€ web/                 # unified Starlette server (MCP + /api + static site)
    โ”œโ”€โ”€ server.py        # routes, security middleware, calculator registry
    โ””โ”€โ”€ __main__.py      # `python -m src.web`  (uvicorn, port 7860)

web/                     # Next.js front-end (static export โ†’ web/out)
โ””โ”€โ”€ app/                 # home, tools, calculator, dashboard, connect

Each tool file keeps deterministic pure functions separate from the thin @mcp.tool wrappers, so the same functions power the MCP server, the web calculators, and the tests.


Security

  • Stateless โ€” no database, no sessions; every call is independent and reproducible.
  • Hardened API โ€” per-IP rate limiting, request-body cap, and input validation that bounds loop-driving parameters (years/months/age) to prevent denial-of-service.
  • Security headers โ€” CSP (with frame-ancestors for the Hugging Face embed), X-Content-Type-Options, Referrer-Policy, Permissions-Policy; CORS limited to GET/POST without credentials. The header middleware is implemented at the ASGI layer so it never buffers the streaming /mcp (SSE) responses.
  • No secrets in the app โ€” live-data sources are public and keyless.

See SECURITY.md to report a vulnerability.


Development

pip install -e ".[dev]"
pytest -q                       # 119 tests
ruff check .                    # lint
python -m src.web               # run the full stack locally

Deployment

Deployed as a Hugging Face Docker Space, auto-synced from GitHub on every push to main (see .github/workflows/hf-sync.yml). Full instructions โ€” local, Docker, and Hugging Face โ€” are in docs/deployment.md.


Contributing

Contributions are welcome โ€” see CONTRIBUTING.md and the Code of Conduct. Good first issues: add a calculator (a pure function + a register wrapper + a test), improve descriptions for better tool routing, or extend the web UI.


Disclaimer

Educational tool for illustrating standard financial formulas. Not investment advice. Figures are illustrative; verify before making financial decisions.

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.1.0.tar.gz (162.6 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.1.0-py3-none-any.whl (55.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: personal_finance_mcp-1.1.0.tar.gz
  • Upload date:
  • Size: 162.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for personal_finance_mcp-1.1.0.tar.gz
Algorithm Hash digest
SHA256 c3b1023b73b45075b64e0210bfe091b317e99c1c0c0e1073a6dac37d457b8636
MD5 5108433abd02ea3a5697fa14b321ca84
BLAKE2b-256 5506da515511f08c00c0cb53f99864415176e4819e97dd8acccc7bf3f7d3ce42

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for personal_finance_mcp-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 47208927e560be26b409930f089a39e131dd5db97f03de461ebe664cfcfd77f5
MD5 58866b354df04c9b9469ca926878d86d
BLAKE2b-256 00f68c0acc51d77572619ad2a6bbac48c1e35c59a9c5487e20f1888e7c515360

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