Add it to Claude Code
claude mcp add -e "DATABASE_URL=${DATABASE_URL}" -e "SECRET_KEY=${SECRET_KEY}" -e "FRONTEND_URL=${FRONTEND_URL}" mcp-accounting -- docker run -i --rm mcp-accountingDATABASE_URLSECRET_KEYFRONTEND_URLMake your agent remember this setup
mcp-accounting's config, env vars, and the gotchas you hit — recalled in every future Claude Code, Cursor, and Codex session.
npx conare@latestFree · one command · indexes the sessions already on disk. Set up in the browser instead →
What it does
- Ingest and store financial transaction data
- Automated detection of large transaction anomalies
- Identification of duplicate payment entries
- AI-powered explanations for financial anomalies
- Production-ready authentication system with JWT
Tools 3
get_transactionsRetrieve stored financial transaction data.detect_large_expensesIdentify transactions that exceed a specific threshold.find_duplicate_paymentsScan for duplicate payment entries in the dataset.Environment Variables
DATABASE_URLrequiredPostgreSQL connection stringSECRET_KEYrequiredSecret key for JWT authenticationFRONTEND_URLrequiredURL for the frontend applicationTry it
Original README from Eduardo-Lucas/mcp-accounting
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
🧱 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
- User registers
- User is created as inactive/unverified
- Verification token generated (DB)
- Email sent with verification link
Email Verification
Token validated
User marked as:
is_active = Trueis_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
- Request reset
- Token generated and emailed
- User submits new password
- 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/registerPOST /auth/loginGET /verify-emailPOST /forgot-passwordPOST /reset-password
Core Features
POST /upload-transactionsPOST /tools/get_transactionsPOST /tools/detect_large_expensesPOST /tools/find_duplicate_paymentsPOST /report/anomaliesPOST /report/anomalies/explain
🐳 Running with Docker
docker compose up --build
Access:
- API Docs: http://localhost:8000/docs
- Frontend: http://localhost:3000
⚙️ 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
Baseinstance - 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