Financial Context Engine
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Financial Context EngineWhat's my current net worth and monthly return?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Financial Context Engine
An MCP (Model Context Protocol) server that exposes personal financial data — transaction ledger, portfolio holdings, live/historical market prices, and quantitative risk metrics — as standardized Tools, Resources, and Prompts. Any MCP host (Claude Desktop, Claude.ai, Cursor) can connect to it and reason over real, deterministically computed numbers instead of estimating them.
This project is 100% pure Python. It runs natively on Windows — no WSL, no Docker, no Linux subsystem required. DuckDB, FastMCP, numpy/pandas, and yfinance are all pip-installable packages with native Windows wheels.
Architecture
┌──────────────────────────────────────────────┐
│ MCP HOST (Claude Desktop, etc.) │
└────────────────────┬───────────────────────────┘
│ MCP protocol (stdio)
┌────────────────────▼───────────────────────────┐
│ FINANCIAL CONTEXT ENGINE (this repo) │
│ ┌───────────┐ ┌────────────┐ ┌──────────────┐ │
│ │ RESOURCES │ │ TOOLS │ │ PROMPTS │ │
│ └─────┬─────┘ └─────┬──────┘ └──────┬───────┘ │
└────────┼─────────────┼───────────────┼──────────┘
│ │ │
┌────────▼─────────────▼───────────────▼──────────┐
│ DuckDB │ Rate Limiter + yfinance │ Quant │
│ (local) │ (token bucket, cached) │ (numpy) │
└───────────────────────────────────────────────────┘No LLM lives inside this server. It's a data + compute backend that any MCP-compatible chat client connects to.
Related MCP server: FinClaw
Setup on Windows (VS Code, no WSL)
1. Install Python
Python 3.11+ from python.org (check "Add to PATH" during install). Verify in a regular Windows PowerShell or VS Code terminal (not WSL):
python --version2. Open the project folder in VS Code
File > Open Folder... → select the financial-context-engine folder.
3. Create a virtual environment
In the VS Code terminal (make sure it's PowerShell or Command Prompt, not a WSL terminal — check the terminal dropdown in the top-right of the terminal panel):
python -m venv .venv
.venv\Scripts\activateYour prompt should now show (.venv). If PowerShell blocks the activation script with an execution-policy error, run this once (you've hit this before with other projects):
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser4. Install dependencies
pip install -r requirements.txt5. Copy the environment template
copy .env.example .envDefaults work out of the box (in-memory rate limiting, no Redis needed). Only edit .env if you want an Alpha Vantage API key or Redis-backed rate limiting later.
6. Seed demo data
python -m db.seedThis creates data/finance.duckdb with ~6 months of synthetic transactions and 7 sample holdings — safe to demo, no real financial data involved.
7. Run the full test suite
pytest tests/ -vYou should see 33 passed.
8. Run the server in MCP Inspector (interactive dev mode)
fastmcp dev server.pyThis opens a browser-based inspector where you can call every tool and view every resource manually — no LLM needed, no config files needed. This is the fastest way to confirm everything works after any change.
Connecting to Claude Desktop
Once you've verified the server works in MCP Inspector, add it to Claude Desktop's config so you can chat with it directly.
Open Claude Desktop → Settings → Developer → Edit Config (or find
claude_desktop_config.jsondirectly — on Windows it's usually at%APPDATA%\Claude\claude_desktop_config.json).Add an entry (use the full absolute Windows path to your project and to the venv's python.exe):
{
"mcpServers": {
"financial-context-engine": {
"command": "C:\\path\\to\\financial-context-engine\\.venv\\Scripts\\python.exe",
"args": ["C:\\path\\to\\financial-context-engine\\server.py"]
}
}
}Restart Claude Desktop. You should see a 🔨 tools icon indicating the server connected — try asking: "What's my current net worth?" or "Compute my portfolio's Sharpe ratio."
Project Structure
financial-context-engine/
├── server.py # MCP server entrypoint — run this
├── db/
│ ├── schema.sql # DuckDB table definitions
│ ├── models.py # Pydantic models (typed, shared everywhere)
│ ├── store.py # LedgerStore — the only module that touches SQL
│ └── seed.py # generates synthetic demo data
├── market/
│ ├── rate_limiter.py # token bucket (in-memory + Redis modes)
│ ├── client.py # yfinance wrapper: cache -> rate limiter -> fetch
│ ├── history.py # historical price fetching for quant calcs
│ └── demo.py # standalone script proving the limiter works
├── analytics/
│ └── quant.py # Sharpe, Monte Carlo VaR, correlation, HHI — pure numpy
├── mcpapp/ # (named mcpapp, not mcp, to avoid shadowing the MCP SDK)
│ ├── context.py # wires store + rate limiter + market client together
│ ├── tools.py # @mcp.tool() definitions
│ ├── resources.py # @mcp.resource() definitions
│ ├── prompts.py # @mcp.prompt() definitions
│ └── stream.py # background polling for "live" prices
└── tests/ # 33 tests across every module aboveWhat Each Tool Does
Tool | Purpose |
| Current price/P-E/52-week range, rate-limited + cached |
| Filter transaction history |
| Last N days of transactions |
| Cash + invested totals, per-account breakdown |
| Sharpe ratio, Monte Carlo VaR (95%/99%, 1-day/1-month), correlation matrix, concentration (HHI) — all computed in Python, not estimated by the model |
| Latest background-polled prices for your holdings |
| Dollar-value buy/sell suggestions vs. a target allocation |
What Each Resource Exposes
Resource URI | Content |
| Net worth snapshot |
| Last 30 days of transactions |
| Current holdings |
| Background-polled live prices |
| Rate limiter decision log (allowed/blocked/cached) — transparency into throttling |
Design Notes
Why deterministic Python math instead of letting the LLM calculate? LLMs are unreliable at multi-step arithmetic, especially statistics like Sharpe ratio or Value-at-Risk where a small error compounds. Every number this server returns is computed by numpy/pandas from real data, so the model's job is reasoning and communication, not arithmetic.
Why rate-limit market data calls? Free-tier providers (yfinance's soft limits, Alpha Vantage's 25 calls/day) get exhausted fast if an LLM calls them on every message. The token-bucket limiter (reused from a standalone Distributed Rate Limiter project) plus a 60-second TTL cache keeps usage sane — see market/demo.py for a runnable proof: 50 rapid requests → 5 fetched, 30 cache hits, 15 correctly throttled.
Why polling instead of true SSE push for "live" prices? True MCP resource-subscription push depends on transport/session details that vary across FastMCP versions and host clients, and is genuinely fragile to get right without a Linux dev environment. A background-thread poller (mcpapp/stream.py) is the reliable choice here — it reads from the same rate-limited, cached client, so it never floods the market data provider even while "live." If you later deploy this on Linux/Codespaces, the polling loop can be swapped for mcp.send_resource_updated() calls without touching the state management.
Security & privacy:
All credentials load from
.env(gitignored), never logged, never returned in tool output.data/finance.duckdbis local-only and gitignored — nothing syncs to the cloud.The only outbound network calls are to the market data provider (ticker symbol only, no personal data).
Redis mode (for shared rate-limiting across multiple server instances) is opt-in via
.env, not required for normal use.
Running Individual Test Files
pytest tests/test_store.py -v # data layer (6 tests)
pytest tests/test_rate_limiter.py -v # token bucket (6 tests)
pytest tests/test_market_client.py -v # market data + cache (5 tests)
pytest tests/test_quant.py -v # Sharpe/VaR/correlation (10 tests)
pytest tests/test_stream.py -v # live price polling (3 tests)
pytest tests/test_tools.py -v # MCP tool logic (3 tests)
python -m tests.smoke_test # end-to-end, no pytest needed
python -m market.demo # rate limiter demo outputThis server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseBqualityAmaintenanceAn MCP server implementation that provides programmatic access to personal finance data through LunchMoney's API, enabling AI assistants to manage transactions, budgets, categories, and assets.593,74789MIT
- Alicense-qualityDmaintenanceMCP server that provides AI agents with financial tools including real-time quotes, backtesting, technical analysis, and multi-exchange data via a simple CLI interface.1MIT

Sablier MCP Serverofficial
AlicenseAqualityDmaintenanceAn MCP server that lets AI assistants analyze portfolios, stress-test scenarios, generate synthetic market paths, and scan SEC filings — in under 2 minutes.833MIT- AlicenseAqualityCmaintenanceAn MCP server that exposes trading analytics — technical indicators, portfolio state, risk metrics, and backtest results — as tools an LLM agent can call.5MIT
Related MCP Connectors
The financial MCP for AI agents - 90+ financial tables, SEC filings, signals, alt-data.
Real SEC, 13F, insider, congress & macro data your AI agent can cite. Hosted MCP, 24 tools.
MCP server exposing the Backtest360 engine API as tools for AI agents.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/PiyushDubey007/financial-context-engine-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server