MCP Accounting

MCP Accounting

An API-based accounting analysis tool that identifies financial anomalies like unusually large transactions and duplicate payments from CSV datasets. It allows AI agents to perform automated financial auditing and transaction analysis through structured tool endpoints.

Category
Visit Server

README

MCP Accounting

An AI-ready accounting anomaly detection API built with Python and FastAPI. This project demonstrates how financial analysis capabilities can be exposed as callable tools, making them usable by automation systems or AI agents.

The system analyzes accounting transactions, detects suspicious patterns, and generates AI explanations for flagged anomalies.


Overview

Traditional accounting analysis is often manual and time-consuming. This project explores a different architecture:

Expose accounting analytics as API tools that can be called by software or AI agents.

The service:

  1. Accepts accounting datasets (CSV)
  2. Detects potential anomalies
  3. Generates a structured report
  4. Uses AI to explain suspicious transactions

Current Features

✔ Upload accounting datasets via API ✔ Detect unusually large transactions ✔ Detect duplicate vendor payments ✔ Generate anomaly reports ✔ AI-generated explanations for suspicious transactions ✔ Clean modular FastAPI architecture ✔ CLI testing with curl and jq


Architecture

The backend follows a layered architecture:

HTTP API
   ↓
API Routes
   ↓
Service Layer
   ↓
Data Layer

Project structure:

mcp-accounting
│
├── app
│   ├── api
│   │   └── routes.py
│   │
│   ├── core
│   │   └── config.py
│   │
│   ├── data
│   │   └── loader.py
│   │
│   ├── mcp
│   │   └── tools.py
│   │
│   ├── models
│   │   └── schemas.py
│   │
│   ├── services
│   │   ├── anomaly_detection.py
│   │   ├── report_service.py
│   │   └── explanation_service.py
│   │
│   └── main.py
│
├── data
│   └── transactions.csv
│
├── requirements.txt
└── README.md

Installation

Clone the repository:

git clone https://github.com/<your-username>/mcp-accounting.git
cd mcp-accounting

Create a virtual environment:

python -m venv venv
source venv/bin/activate

Install dependencies:

pip install -r requirements.txt

Environment Variables

Create a .env file in the project root:

OPENAI_API_KEY=your_api_key_here

The application loads this automatically using python-dotenv.


Running the Server

Start the FastAPI server:

uvicorn app.main:app --reload

Server runs at:

http://127.0.0.1:8000

API Documentation

Swagger UI:

http://127.0.0.1:8000/docs

API Endpoints

Health Check

GET /health

Example:

curl http://127.0.0.1:8000/health

Upload Transactions Dataset

POST /upload-transactions

Example:

curl -F "file=@data/transactions.csv" \
http://127.0.0.1:8000/upload-transactions

Detect Large Transactions

POST /tools/detect_large_expenses

Example:

curl -X POST http://127.0.0.1:8000/tools/detect_large_expenses | jq

Detect Duplicate Payments

POST /tools/find_duplicate_payments

Example:

curl -X POST http://127.0.0.1:8000/tools/find_duplicate_payments | jq

Generate Anomaly Report

POST /report/anomalies

Example:

curl -X POST http://127.0.0.1:8000/report/anomalies | jq

Example response:

{
  "summary": {
    "transactions_analyzed": 5,
    "anomalies_detected": 3
  },
  "anomalies": [...]
}

Generate AI-Explained Anomaly Report

POST /report/anomalies/explain

Example:

curl -X POST http://127.0.0.1:8000/report/anomalies/explain | jq

Example output:

{
  "vendor": "Dell",
  "amount": "8200.00",
  "anomaly_type": "large_transaction",
  "ai_explanation": "This transaction is significantly higher than the vendor's typical payments and may require further review."
}

Example Dataset

date,description,vendor,amount
2025-01-01,Office Supplies,Staples,120
2025-01-05,Consulting Fee,ABC Consulting,1500
2025-01-10,Consulting Fee,ABC Consulting,1500
2025-01-15,Equipment,Dell,8200
2025-01-20,Software License,Microsoft,300

Technology Stack

  • Python
  • FastAPI
  • Pandas
  • Uvicorn
  • OpenAI API
  • python-dotenv

Development Status

This project is an early MVP exploring AI-assisted accounting analysis.

Planned improvements include:

  • Vendor spending anomaly detection
  • Time-based financial behavior analysis
  • Batch AI explanations
  • PostgreSQL persistence
  • MCP-compatible tool schemas
  • Simple analytics dashboard

License

MIT License


Author

Edu Senior Python Developer

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