mcp-banking-tools
MCP server for deterministic financial transactions, providing tools to fetch account balances, check blocked PIX keys, and execute atomic PIX transfers with integer-cent precision.
README
🔌 mcp-banking-tools
Deterministic Financial Tooling Microservice: High-performance, production-grade Model Context Protocol (MCP) server built with FastMCP Python (SSE Mode), Threaded Database Connection Pooling, Bandit SAST Security Scanning, and Pytest Unit Testing, containerized and published to GitHub Container Registry (
ghcr.io).
🎯 Executive Summary & Architectural Purpose
In autonomous AI agent systems, granting language models direct database access or relying on probabilistic text instructions is a catastrophic security risk.
mcp-banking-tools acts as the isolated deterministic execution bridge between AI Agents (via NVIDIA NeMo Guardrails) and the core financial ledger (PostgreSQL). Every action is encapsulated within type-safe, auditable tools enforcing strict integer-cents monetary precision (amount_cents: int).
🏛️ Strategic Architecture & DevSecOps Matrix
[ Kubernetes Cluster (K3s) ]
+-----------------------+ SSE (HTTP :8001) +---------------------------------+
| NVIDIA NeMo Server | -----------------------> | mcp-banking-tools (FastMCP) |
| / Agentic Framework | | - Threaded Connection Pool |
+-----------------------+ +---------------------------------+
|
| SQL (TCP :5432)
v
+---------------------------------+
| PostgreSQL 16 Alpine |
| - characters (balances) |
| - blocked_pix_keys (BACEN) |
| - transactions (audit ledger) |
+---------------------------------+
🛡️ Quality & DevSecOps Pipeline
Every push to main triggers a 2-stage GitHub Actions pipeline enforcing enterprise standards:
| Tooling Layer | Technology | Engineering Guarantee |
|---|---|---|
| Linter & Formatter | Ruff & Black | 100% PEP 8 compliant, ultra-fast Python code formatting. |
| Static Type Checker | Mypy | Enforces strict static typing on all tool parameters. |
| SAST Security Scanner | Bandit | Scans for SQL injection risks, hardcoded credentials, and unsafe sockets. |
| Automated Unit Tests | Pytest + pytest-mock | Validates tool logic, balance checks, and transaction edge cases. |
| Container Registry | GHCR (ghcr.io) |
Multi-architecture builds (linux/amd64, linux/arm64) pushed to GitHub Container Registry. |
🛠️ Provided FastMCP Tools Registry
1. get_account_balance(pix_key: str)
- Description: Fetches real-time account balances (in cents and BRL) and risk profiles for test characters (
Leo Vance,Maria Silva,Enterprise X Corp). - Return Contract:
{ "status": "success", "name": str, "pix_key": str, "balance_cents": int, "balance_brl": float, "risk_profile": str }
2. check_blocked_pix_key(pix_key: str)
- Description: Queries the BACEN (Central Bank of Brazil) fraud registry table (
blocked_pix_keys) for malicious PIX keys (fraudster@pix.com). - Return Contract:
{ "status": "blocked" | "clean", "is_fraud": bool, "pix_key": str, "reason": str }
3. transfer_pix(origin_pix_key: str, destination_pix_key: str, amount_cents: int)
- Description: Executes an atomic, thread-safe PIX financial transfer between accounts.
- Financial Precision: Enforces integer cents (
amount_cents: int) to eliminate floating-point IEEE 754 rounding vulnerabilities. AppliesFOR UPDATErow locking in PostgreSQL to prevent race conditions.
📖 Auxiliary Technical Documentation
🚀 Local Development & Testing
# 1. Install dependencies & quality tools
pip install -r requirements.txt
# 2. Run code quality checks
ruff check src/ tests/
black --check src/ tests/
mypy src/
bandit -r src/
# 3. Run unit tests
pytest -v tests/
# 4. Start FastMCP Server locally (SSE mode)
python -m src.server
Recommended Servers
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.
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.
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.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
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.
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.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
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.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.