Enterprise multi-agent financial analytics platform leveraging Anthropic's Model Context Protocol (MCP) and Claude 3.5 Sonnet for automated text-to-SQL execution, market data integration, and self-healing validation loops.

Multi-Agent Financial Analytics Copilot (fin-copilot-mcp)

CI/CD PipelinePython 3.11+Code Style: RuffLicense: MIT

An enterprise-grade, deterministic multi-agent financial analytics engine built on Anthropic's Model Context Protocol (MCP) and Claude 3.5 Sonnet. The system processes complex natural language financial queries, translates them into dialect-validated PostgreSQL / DuckDB SQL, pulls live telemetry/market data, and executes a self-healing verification loop before presenting synthesized results.

๐Ÿ— Architecture & Agent Topology

The system uses specialized, domain-isolated agents decoupled from underlying tools using MCP JSON-RPC protocol standards.

                    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                    โ”‚       User Query Interface / API       โ”‚
                    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                         โ”‚
                                         โ–ผ
                    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                    โ”‚ Orchestrator Agent (Claude 3.5 Sonnet)  โ”‚
                    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                         โ”‚
         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
         โ”‚ (MCP Protocol)                โ”‚ (MCP Protocol)                โ”‚ (MCP Protocol)
         โ–ผ                               โ–ผ                               โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”           โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”           โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  mcp-server-sql  โ”‚           โ”‚mcp-server-stripe โ”‚           โ”‚mcp-server-market โ”‚
โ”‚ (PostgreSQL/Duck)โ”‚           โ”‚  (Billing Specs) โ”‚           โ”‚ (YFinance API)   โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜           โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜           โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
         โ”‚
         โ”‚ (Execution Error)
         โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  Self-Healing    โ”‚ โ”€โ”€ (Retry Stack Trace) โ”€โ”€โ–บ [ Orchestrator Agent ]
โ”‚  Validation Loop โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ”‘ Key Features

  • MCP-Native Architecture: Fully decoupled tool servers using standard JSON-RPC over stdio / Server-Sent Events (SSE).
  • Self-Healing Text-to-SQL Loop: Runs deterministic dry-run verification (EXPLAIN) before execution. Automatically captures AST/syntax errors and feeds stack traces back to Claude for up to 3 repair retries.
  • Double-Entry Validation: Micro-agent verifying mathematical consistency, row cross-totals, and currency alignment prior to output synthesis.
  • Strict Type & Schema Safety: Runtime validation via Pydantic v2 and static type checking with MyPy.
  • Cross-Platform Developer Experience: Powers setup, linting, formatting, and testing on Windows (via PowerShell / py) and Linux/macOS seamlessly.

๐Ÿ›  Tech Stack

Component Technology Purpose
LLM / Reasoning Claude 3.5 Sonnet (anthropic) Intent decomposition, tool orchestration, and SQL generation
Protocol Layer FastMCP / Model Context Protocol Standardized tool/resource encapsulation over JSON-RPC
Analytical Engine PostgreSQL / DuckDB / SQLite OLAP/OLTP query execution, AST validation, and schema inspection
Market Data Yahoo Finance (yfinance) Macroeconomic benchmarks, equity quotes, and volume metrics
Configuration pydantic-settings Type-safe environment management and secret handling
Developer Tooling uv / pip, ruff, mypy, pytest Hermetic builds, linting, typing, and testing

๐Ÿ“ Repository Structure

fin-copilot-mcp/
โ”œโ”€โ”€ .github/
โ”‚   โ””โ”€โ”€ workflows/
โ”‚       โ””โ”€โ”€ ci.yml                 # CI pipeline (lint, type-check, unit & integration tests)
โ”œโ”€โ”€ config/
โ”‚   โ””โ”€โ”€ mcp_servers.json          # System tool topologies and connection mappings
โ”œโ”€โ”€ docker/
โ”‚   โ”œโ”€โ”€ Dockerfile.orchestrator    # Production container for agent runtime
โ”‚   โ””โ”€โ”€ Dockerfile.mcp-server      # Container specification for standalone MCP servers
โ”œโ”€โ”€ src/
โ”‚   โ””โ”€โ”€ fin_copilot/
โ”‚       โ”œโ”€โ”€ core/                  # Base configuration, logging, exceptions
โ”‚       โ”œโ”€โ”€ mcp_servers/           # Standalone FastMCP server modules (SQL, Stripe, Market)
โ”‚       โ”œโ”€โ”€ agents/                # Orchestrator agent logic, prompts, and healing loops
โ”‚       โ””โ”€โ”€ utils/                 # Telemetry and formatting helpers
โ”œโ”€โ”€ tests/
โ”‚   โ”œโ”€โ”€ unit/                      # FastMCP tool & resource unit tests
โ”‚   โ”œโ”€โ”€ integration/               # Multi-agent self-healing loop tests
โ”‚   โ””โ”€โ”€ evals/                     # Benchmarks for Text-to-SQL translation accuracy
โ”œโ”€โ”€ scripts/
โ”‚   โ”œโ”€โ”€ setup.ps1                  # Windows PowerShell setup script
โ”‚   โ””โ”€โ”€ setup.sh                   # Linux / macOS bash setup script
โ”œโ”€โ”€ pyproject.toml                 # Packaging, dependencies, and linter rules
โ”œโ”€โ”€ .gitignore                     # Industry-standard Python ignore rules
โ”œโ”€โ”€ .env.example                   # Environment variable template
โ””โ”€โ”€ README.md

๐Ÿš€ Quickstart

Prerequisites

  • Python >= 3.11
  • uv or standard pip
  • Anthropic API Key (ANTHROPIC_API_KEY)

Installation & Setup

On Windows (PowerShell):
# 1. Clone the repository
git clone https://github.com/your-username/fin-copilot-mcp.git
cd fin-copilot-mcp

# 2. Run PowerShell Setup Script
.\scripts\setup.ps1

# 3. Configure environment variables
Copy-Item .env.example .env
On Linux / macOS (Bash):
# 1. Clone the repository
git clone https://github.com/your-username/fin-copilot-mcp.git
cd fin-copilot-mcp

# 2. Run Setup Script
chmod +x ./scripts/setup.sh
./scripts/setup.sh

# 3. Configure environment variables
cp .env.example .env

๐Ÿ›ก Security & Guardrails

  • Read-Only Database Connections: SQL MCP server limits execution strictly to SELECT statements and dialect dry-runs.
  • Token Sandboxing: API keys are isolated within environment settings classes and never exposed across tool execution boundaries.
  • Data Masking: Structural masking applied to sensitive financial attributes prior to model context generation.

๐Ÿ“œ License

Distributed under the MIT License. See LICENSE for details.

MCP Server ยท Populars

MCP Server ยท New

    getArbor-dev

    Arbor

    Graph-native code intelligence that replaces embedding-based RAG with deterministic program understanding.

    Community getArbor-dev
    Q00

    ouroboros

    Agent OS: Stop prompting. Start specifying.

    Community Q00
    velane-sh

    velane

    Velane is agentic cloud for deploying your basic workflows, agents and sub-agents. 800+ OAuth integrations, sandboxed Bun and Python execution, and a full deployment pipeline managed via MCP

    Community velane-sh
    MCPBlender

    BlenderMCP

    ๐ŸŽจ Control Blender 3D with Claude AI โ€” prompt-driven 3D modeling, materials & scene generation via MCP

    Community MCPBlender
    MCPBlender

    AbletonMCP

    ๐ŸŽต Control Ableton Live with Claude AI โ€” create tracks, arrange clips & compose music via MCP

    Community MCPBlender