finance-agent

finance-agent

Enables AI agents to call deterministic finance tools (compound interest, loan payment, currency conversion, etc.) through MCP, with a shared tool registry used by both the agent loop and MCP clients.

Category
Visit Server

README

๐Ÿค– Finance Agent + MCP

Python License: MIT MCP Tool use

An LLM agent that answers finance questions by calling tools (it never does the math itself), and exposes those same tools as an MCP server so any MCP client โ€” like Claude Desktop โ€” can use them too.

The idea worth stealing: the tools live in one registry and are exposed twice โ€” to the agent loop and to MCP. Define once, no drifting schemas. That's the kind of structure that scales on a team.

โœจ Features

  • Tool-use agent loop with multi-step tool calls and a printed tool trace.
  • MCP server (FastMCP) exposing the same tools to any MCP host.
  • Provider-swappable โ€” Anthropic Claude (default) or OpenAI, one env var.
  • Deterministic finance tools, unit-tested with no API key.

๐Ÿงฐ Tools

Tool What it computes
compound_interest future value of a lump sum
cagr compound annual growth rate (%)
loan_payment monthly payment for an amortizing loan
future_value_of_savings future value of monthly contributions
convert_currency FX conversion (static sample rates)

๐Ÿ—๏ธ Architecture

flowchart LR
    R["Shared tool registry<br/>(finagent.tools)"] --- Agent["Agent loop<br/>Claude / OpenAI"]
    R --- MCP["MCP server<br/>(FastMCP)"]
    U[User] --> Agent --> Ans[Answer + tool trace]
    Host["MCP client<br/>(Claude Desktop)"] --> MCP

More in docs/architecture.md.

๐Ÿš€ Quickstart

# Install (Python 3.10+)
pip install -e .
pip install -r requirements.txt

# Configure
cp .env.example .env       # add ANTHROPIC_API_KEY (or set LLM_PROVIDER=openai)

# Ask the agent (it will call tools and show its work)
python scripts/chat.py "If I save $300/month at 8% for 25 years, how much will I have?"
python scripts/chat.py "Monthly payment on a $250k mortgage at 6.5% over 30 years?"
python scripts/chat.py "Convert 5000 BRL to USD, then grow it at 10% for 5 years."

Example output:

=== Tool calls ===
  โ€ข future_value_of_savings({'monthly_contribution': 300, 'annual_rate_pct': 8, 'years': 25}) -> {'future_value': 285809.08, ...}
=== Answer ===
Saving $300/month at 8% for 25 years grows to about $285,809.

๐Ÿ”Œ Use it from Claude Desktop (MCP)

Run the server:

python -m finagent.mcp_server

Then add it to your Claude Desktop config (claude_desktop_config.json). Use the Python from the env where you installed the package:

{
  "mcpServers": {
    "finance-agent": {
      "command": "python",
      "args": ["-m", "finagent.mcp_server"]
    }
  }
}

Claude can now call compound_interest, loan_payment, etc. directly.

๐Ÿ—‚๏ธ Project structure

finance-agent-mcp/
โ”œโ”€โ”€ src/finagent/
โ”‚   โ”œโ”€โ”€ tools.py        # the shared tool registry (pure functions + schemas)
โ”‚   โ”œโ”€โ”€ agent.py        # provider-swappable tool-use loop
โ”‚   โ”œโ”€โ”€ mcp_server.py   # exposes the registry over MCP (FastMCP)
โ”‚   โ””โ”€โ”€ config.py
โ”œโ”€โ”€ scripts/chat.py     # CLI agent
โ”œโ”€โ”€ tests/test_tools.py # pure unit tests (no key)
โ””โ”€โ”€ docs/architecture.md

โœ… Tests

pytest -q     # tests the finance math directly โ€” no API key required

๐Ÿงญ Roadmap

  • [x] Tool registry + 5 finance tools (unit-tested)
  • [x] Tool-use agent loop (Claude / OpenAI)
  • [x] MCP server exposing the same tools
  • [ ] Add a live FX-rate tool + a market-data tool
  • [ ] Streaming responses + a small web UI
  • [ ] Trace/observability hooks (tie in with project #3)

๐Ÿ“„ License

MIT โ€” see LICENSE.


Built by Arturio Amorim Sobrinho โ€” AI/LLM Engineer. GitHub ยท LinkedIn

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured