mcp-annuities-server
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
MCP Annuities Server
Consolidated & fixed from MCP-Example-main + mcp-prompt-templates-main
For: VS Code + Claude Code on WSL/Ubuntu
π Open
README.htmlin a browser for the full documentation with embedded architecture diagrams.
What Was Fixed
Issue in original repos | Fix applied |
Hardcoded |
|
Windows paths + | WSL-friendly |
Two separate repos | Merged into one: 5 tools + 1 resource + 3 prompts |
Low-level | FastMCP |
No automated test |
|
| Use |
Key rule applied: tool count kept to 5. Too many tools breaks LLM tool-selection reliability.
Related MCP server: Personal Finance MCP
Project Structure
mcp-annuities-server/
βββ CLAUDE.md
βββ README.md β this file
βββ README.html β full docs with diagrams (open in browser)
βββ requirements.txt
βββ server.py β MCP server (5 tools + 1 resource + 3 prompts)
βββ test_client.py β standalone end-to-end test
βββ claude_desktop_config.example.json
βββ .vscode/
β βββ mcp.json
βββ data/
β βββ annuities.csv β 500-row dataset
β βββ generate_data.py
βββ templates/
βββ annuity_review/ β config.yaml + template.md
βββ client_summary/
βββ portfolio_report/Setup
cd ~/mcp-annuities-server
python3 -m venv .venv
.venv/bin/pip install -r requirements.txt
.venv/bin/python data/generate_data.pyFull Lifecycle β How a Request Flows
[1] User terminal (VS Code / WSL)
β Natural-language request typed
βΌ
[2] Claude Code reasoning (Sonnet / Opus)
β Matches request to tool schema
β Produces tool_use block: {name, arguments}
βΌ
[3] MCP stdio handshake
β JSON-RPC 2.0 sent over child process stdin
β Server lives in .venv/bin/python subprocess
βΌ
[4] FastMCP dispatch + validation
β Validates args against JSON Schema (from type hints)
β Routes to the matching @mcp.tool() function
βΌ
[5] Tool execution
β get_client: reads annuities.csv, returns matching row
β calculate_payout: amortization math, no data lookup
βΌ
[6] data/annuities.csv
β 500 rows, 15 columns, all values stored as strings
β
ββββΊ Result serialized β stdout β layers 4β3β2β1 β userTool chaining (your session)
When you said "calculate the payout for this client", Claude Code chained two tools without any orchestrator script:
"Calculate the payout..."
β Call 1: get_client("CLIENT_0001") [retrieves record]
β Model extracts current_account_value + rate [type-converts strings]
β Call 2: calculate_payout(principal, rate, term) [math]
β Final answer combining both resultsThis is the live minimal version of Domain 1's agentic loop.
Layer-by-Layer Explanations
Layer 1 β User terminal
The terminal is just the I/O surface. All orchestration (deciding which
tool to call, building JSON-RPC, managing the subprocess) happens inside
the claude process, not in bash. Auth: use Claude Pro login (not API
key) to avoid extra billing. The ANTHROPIC_API_KEY env var set for your
Python lab scripts causes the "both auth methods" warning in Claude Code.
Layer 2 β Claude Code reasoning
Tool selection is pure pattern matching against schema descriptions.
"look up CLIENT_0001" matches get_client because its description says
"Retrieve full annuity contract details for one client by ID". A vague
description causes wrong picks β this is the "tool boundary design"
Domain 2 exam concept. The model emits a tool_use block, Claude Code
intercepts it, sends to layer 3, and waits for the result before writing
the final answer.
Layer 3 β MCP stdio handshake
Server.py is spawned ONCE as a child process at session start (not per
call). Three pipes wired: stdin (requests in), stdout (results out),
stderr (logs β never corrupts the protocol). JSON-RPC 2.0, newline-
delimited. The β Failed to connect happened because realpath resolved
the venv symlink to /usr/bin/python3.12 (no mcp package) β $(pwd)/ .venv/bin/python keeps the venv path and the handshake succeeds.
Layer 4 β FastMCP dispatch + validation
FastMCP's event loop reads each JSON-RPC line, dispatches on method: tools/call, validates arguments against the auto-generated JSON Schema
(from type hints) before calling Python, serializes the return value into
a text content block, and writes the response to stdout. No print()
allowed in server.py β it would corrupt the stream.
Layer 5 β Tool execution
get_client: linear scan of CSV, returns matching dict (all strings).
calculate_payout: amortization formula with zero-rate edge-case handler
and explicit input validation (returns structured error, not exception).
Both are pure functions with no side effects β safe for an LLM to call.
Layer 6 β data/annuities.csv
500 rows, 15 columns (client_id, dob, age, product_type, premium_amount, crediting_rate_pct, term_years, monthly_payment, surrender_charge_pct, rider, risk_profile, state, payment_frequency, contract_start_date, current_account_value). IMPORTANT: csv.DictReader returns ALL values as strings β tools doing math must cast with float()/int(). Pydantic models with typed fields do this automatically (Domain 4 connection).
Step-by-Step: Wire into Claude Code
# 1. Standalone test (proves server logic, no AI)
.venv/bin/python test_client.py
# 2. MCP Inspector (visual debugging)
npx @modelcontextprotocol/inspector .venv/bin/python server.py
# 3. Register with Claude Code
claude mcp remove annuities-server # if exists
claude mcp add annuities-server -- "$(pwd)/.venv/bin/python" server.py
claude mcp list
# β annuities-server: .../.venv/bin/python server.py - β Connected
# 4. Fix auth (if showing Opus / API billing)
claude /logout
# β choose claude.ai YES, API key NO
# 5. Launch and test
claude
/mcp
"Use the annuities-server to look up CLIENT_0001"Tool / Resource / Prompt Reference
Tools (5)
Tool | Purpose | Key args |
| Look up one client |
|
| Filter portfolio |
|
| Aggregate stats |
|
| Amortized payout |
|
| Utility math |
|
Resource
URI | Content |
| Raw CSV of all 500 rows |
Prompts
Prompt | Purpose | Args |
| Suitability assessment |
|
| Client letter |
|
| Executive report |
|
CCAF Exam Domain Mapping
What you built | Exam concept | Domain |
| Tool schema design | D2 |
stdio subprocess transport | Local MCP deployment | D2 |
| MCP client configuration | D2 |
5-tool limit | Tool boundary / reasoning overload | D2 |
| Resources vs tools distinction | D2 |
YAML + | MCP prompt templates | D2 |
get_client β calculate_payout chaining | Implicit task decomposition | D1 |
CLAUDE.md at project root | CLAUDE.md hierarchy | D3 |
String CSV β Pydantic coercion | Structured output enforcement | D4 |
JSON-RPC id correlation | Context / multi-turn state | D5 |
Quick Reference
# Golden path
cd ~/mcp-annuities-server && source .venv/bin/activate
python test_client.py # sanity check
claude mcp list # β Connected
claude # launch
/mcp # verify
"Use annuities-server to look up CLIENT_0001"
# Fix β Failed to connect
claude mcp remove annuities-server
claude mcp add annuities-server -- "$(pwd)/.venv/bin/python" server.py
# Fix Opus / API billing instead of Pro
claude /logout β claude.ai YES β API key NO<-- See all tables with row Last updated: 2026-06-13 -->
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogβ¦
This server cannot be deployed
Maintenance
Related MCP Connectors
Personal finance, bank account, and shared memory connector for Claude, ChatGPT, Gemini Spark & more
Connect AI agents to financial institution origination, analytics, and compliance workflows.
AI-native interface to Milemarker: query AUM & positions, manage advisors, run platform workflows.
443 finance tools, 60 prompts: quant, SEC and EU filings, fact checks, rates, odds, DeFi, macro.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceProvides retirement planning computations for AI agents, including Monte Carlo simulations, tax burden modeling across all US states, Social Security claiming optimization, and cost-of-living comparisons.7 npmMIT
- AlicenseBqualityCmaintenanceProvides 77 deterministic financial calculators, live market data, and a meta-advisor that chains tools into prioritized plans from plain-language descriptions.777MIT
- FlicenseNot gradedqualityDmaintenanceExposes portfolio allocation, concentration risk, retirement projections, RAG document search, and a full multi-agent financial advisor query as MCP tools for use from Claude Code.-
- AlicenseNot gradedqualityAmaintenanceEnables AI assistants to access and analyze financial data such as stocks, ETFs, crypto, forex, commodities, company fundamentals, financial statements, and market insights through 250+ configurable tools.624 npmApache 2.0