Skip to main content
Glama

MCP Accounting Platform

An AI-powered accounting anomaly detection platform built with FastAPI, PostgreSQL, React, and OpenAI, featuring a complete production-ready authentication system.


πŸš€ Overview

MCP Accounting is a full-stack system designed to:

  • Ingest financial transaction data

  • Detect anomalies (large transactions, duplicates)

  • Generate AI-powered explanations

  • Expose functionality as MCP-style callable APIs


Related MCP server: Quack MCP

🧱 Tech Stack

Backend

  • FastAPI

  • SQLAlchemy

  • PostgreSQL

  • Passlib (bcrypt)

  • JWT (authentication)

  • Docker

Frontend

  • React (TypeScript)

  • Tailwind CSS

AI Layer

  • OpenAI API (explanations)


πŸ” Authentication System (Production-Ready)

Features Implemented

  • βœ… User registration

  • βœ… Email verification (token-based)

  • βœ… Secure password hashing (bcrypt)

  • βœ… Login with JWT (stateless auth)

  • βœ… Password reset flow

  • βœ… Protected routes (JWT-ready)


Auth Flow

Registration

  1. User registers

  2. User is created as inactive/unverified

  3. Verification token generated (DB)

  4. Email sent with verification link

Email Verification

  • Token validated

  • User marked as:

    • is_active = True

    • is_verified = True

  • Token invalidated after use

Login

  • Validates:

    • Email exists

    • Password matches (bcrypt)

    • User is verified

  • Returns JWT:

{
  "access_token": "jwt-token",
  "token_type": "bearer"
}

Password Reset

  1. Request reset

  2. Token generated and emailed

  3. User submits new password

  4. Token invalidated


πŸ—οΈ Architecture

Frontend (React)
        ↓
FastAPI (API Layer)
        ↓
Service Layer (Business Logic)
        ↓
SQLAlchemy ORM
        ↓
PostgreSQL
        ↓
AI Layer (OpenAI)

πŸ”„ Data Flow

Register β†’ Verify Email β†’ Login β†’ Upload CSV
        ↓
Store Transactions β†’ Detect Anomalies
        ↓
Generate Report β†’ AI Explanation

🧩 API Endpoints

Auth

  • POST /auth/register

  • POST /auth/login

  • GET /verify-email

  • POST /forgot-password

  • POST /reset-password

Core Features

  • POST /upload-transactions

  • POST /tools/get_transactions

  • POST /tools/detect_large_expenses

  • POST /tools/find_duplicate_payments

  • POST /report/anomalies

  • POST /report/anomalies/explain


🐳 Running with Docker

docker compose up --build

Access:


βš™οΈ Environment Variables

DATABASE_URL=postgresql://postgres:postgres@db:5432/mcp_accounting
SECRET_KEY=your-secret-key
FRONTEND_URL=http://localhost:3000

🧠 Key Technical Decisions

1. Separation of Token Types

Use Case

Mechanism

Email verification

DB token

Password reset

DB token

Authentication

JWT


2. Security Practices

  • Password hashing via bcrypt

  • No plaintext password storage

  • Token invalidation after use

  • Generic login errors (no user enumeration)


3. SQLAlchemy Best Practices

  • Single Base instance

  • Proper model registration

  • Dependency-injected DB sessions


4. Dockerized Environment

  • Service-based networking (db)

  • Environment-driven configuration

  • Clean container rebuilds


πŸ§ͺ Current Status

  • βœ… End-to-end functional

  • βœ… Authentication fully implemented

  • βœ… Stable Docker environment

  • βœ… Clean API contracts

  • βœ… AI integration working


πŸ“Œ Next Steps

  • Alembic migrations (schema versioning)

  • JWT-protected endpoints

  • Role-based access control (RBAC)

  • Background jobs (email queue)

  • Token hashing (security hardening)

  • Observability (logs + metrics)


πŸ’‘ Project Purpose

This project demonstrates:

  • Real-world backend architecture

  • Secure authentication design

  • AI integration into financial workflows

  • MCP-style API exposure for automation


πŸ‘¨β€πŸ’» Author

Developed as a production-style backend system to showcase:

  • Python / FastAPI expertise

  • System design & architecture

  • Secure authentication flows

  • AI-driven application design


πŸ“„ License

MIT License

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      C
      maintenance
      AI-first CSV analysis tool that enables AI agents to analyze, query, and audit large CSV files directly within conversations, turning raw data into actionable insights.
      2
      -
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables LLM agents to load, explore, and analyze CSV and Excel files using DuckDB, with tools for SQL querying, statistical analysis, expense optimization, and anomaly detection.
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Provides financial audit reporting and ledger query tools for AI agents, enabling generation of compliance, risk, and transaction reports and querying of transaction data, balances, and summaries from an in-memory SQLite database via MCP.
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      Enables AI agents to screen journal entries against 11 rules, prioritize them by risk score, and run balance checks, duplicate detection, and Benford analysis via MCP.
      5
      63 npm
      3
      MIT