FinOps Agentic Reconciliation MCP Server
This MCP server enables autonomous finance operations, providing tools to run 3-way matching audits, fetch unmatched invoices, trigger vendor holds, and retrieve vendor aging summaries. It integrates with an AI agent for policy-based discrepancy resolution and executive dashboards.
README
FinOps-Agentic-Reconciliation
Autonomous Procure-to-Pay (P2P) 3-Way Matching Data Pipeline, FastMCP Server, and Ops AI Resolution Engine
An enterprise-grade Finance Operations platform built to automate 3-way invoice reconciliation (PO vs. GRN vs. Invoice), audit line-item price & quantity variances, calculate financial exposure risk, and orchestrate autonomous discrepancy resolution using Model Context Protocol (MCP) tools.
📐 System Architecture
flowchart TD
subgraph Data Layer [ERP Data Ingestion]
PO[Purchase Orders CSV] --> DB[(SQLite / Postgres DB)]
GRN[Goods Received Notes CSV] --> DB
INV[Vendor Invoices CSV] --> DB
end
subgraph SQL Engine [Analytics & Reconciliation Pipeline]
DB --> CTE[3-Way Matching SQL CTEs & Window Functions]
CTE --> DISC[Discrepancy Matrix & Risk Scoring]
DISC --> DB_TABLES[Populate Discrepancies & Audit Logs]
end
subgraph Agentic Layer [Model Context Protocol & Ops AI Agent]
DB_TABLES <--> MCP[FastMCP Server]
MCP <--> AGENT[Ops AI Agent Resolution Engine]
AGENT --> POLICY[Corporate Financial Policy Rules]
POLICY --> ACTIONS[Auto-Approve / Hold / Credit Note Request]
end
subgraph Executive Layer [UI & Observability]
DB_TABLES --> DASHBOARD[Streamlit Executive & Ops Workbench]
ACTIONS --> DASHBOARD
end
🔥 Key Capabilities
-
Automated Procure-to-Pay (P2P) 3-Way Matching:
- Executes line-item reconciliation across Purchase Orders, Goods Received Notes, and Vendor Invoices.
- Categorizes financial anomalies:
UNIT_PRICE_VARIANCE,QTY_SHORTAGE,MISSING_GRN,DUPLICATE_INVOICE.
-
Model Context Protocol (MCP) Server (
src/mcp_server/):- Implements standard MCP JSON-RPC tool endpoints:
get_unmatched_invoices(status, min_severity)run_3way_matching_audit(invoice_number)trigger_vendor_hold(invoice_number, reason)fetch_vendor_aging_summary(vendor_id)
- Implements standard MCP JSON-RPC tool endpoints:
-
Autonomous Ops AI Agent (
src/agent/):- Processes flagged discrepancies in batches.
- Evaluates corporate financial policies (e.g. 1% price variance tolerance, auto-hold on missing GRN, credit note request for overbilling).
- Updates database state atomically and logs immutable audit trails.
-
Executive Ops Workbench & Analytics Dashboard (
src/dashboard/app.py):- Dark-mode Streamlit dashboard with real-time KPI metrics (Auto-Match %, Financial Exposure Risk INR, Hours Saved).
- Side-by-side PO vs. GRN vs. Invoice line-item comparison tool.
- Live AI Agent execution terminal with simulation logs.
- Accounts Payable aging buckets (Current, 1-30, 31-60, 60+ days) and vendor risk scatter matrix.
📊 Discrepancy Taxonomy & Policy Matrix
| Anomaly Type | Condition | Severity | Financial Exposure | Autonomous Action |
|---|---|---|---|---|
| Immaterial Variance | Price variance $\le 1.0%$ | LOW |
Minor | AUTO_APPROVE |
| Unit Price Mismatch | Invoice rate > Agreed PO rate | HIGH / CRITICAL |
(Billed Price - PO Price) * Qty |
REQUEST_CREDIT_NOTE & ON_HOLD |
| Quantity Shortage | Billed Qty > GRN Received Qty | HIGH |
Shortage Qty * Billed Price |
APPROVE_PARTIAL & ON_HOLD |
| Missing GRN | Invoice received before warehouse receipt | HIGH |
Total Billed Amount | HOLD_PAYMENT |
| Duplicate Invoice | Same PO/Invoice submitted multiple times | CRITICAL |
Total Billed Amount | BLOCK_IMMEDIATELY |
⚡ Quickstart Guide
1. Prerequisites & Environment Setup
git clone https://github.com/your-username/FinOps-Agentic-Reconciliation.git
cd FinOps-Agentic-Reconciliation
# Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
2. Generate ERP Data & Run Reconciliation Pipeline
# Generate 1,000+ realistic transaction records and run ETL pipeline
make etl
# Or run directly via Python:
python -m src.pipeline.etl_reconciliation
3. Run Automated Tests
make test
4. Launch Ops Workbench Dashboard
make dashboard
Open your browser at http://localhost:8501.
📁 Repository Structure
FinOps-Agentic-Reconciliation/
├── README.md # Technical documentation & architecture
├── pyproject.toml # Package configuration
├── requirements.txt # Pinned dependencies
├── Makefile # Developer CLI shortcuts
├── config/
│ └── settings.yaml # Financial thresholds & tolerance settings
├── data/
│ ├── raw_pos.csv # Sample PO transactions
│ ├── raw_grns.csv # Sample GRN receipts
│ └── raw_invoices.csv # Sample Vendor Invoices
├── sql/
│ ├── 01_schema_init.sql # Relational DDL & performance indexes
│ ├── 02_three_way_matching.sql # 3-Way matching CTEs & window functions
│ └── 03_vendor_aging_kpis.sql # AP aging aggregation queries
├── src/
│ ├── pipeline/
│ │ ├── generate_synthetic_data.py # ERP synthetic transaction generator
│ │ └── etl_reconciliation.py # Main ETL reconciliation engine
│ ├── mcp_server/
│ │ └── ops_mcp_server.py # FastMCP JSON-RPC server implementation
│ ├── agent/
│ │ ├── ops_agent.py # FinOps AI Agent batch execution engine
│ │ └── discrepancy_rules.py # Deterministic financial policies
│ └── dashboard/
│ └── app.py # Streamlit Executive Ops Workbench
└── tests/
├── test_reconciliation.py # Discrepancy rule unit tests
└── test_mcp_server.py # MCP tool integration tests
🛡️ License
Distributed under the MIT License. See LICENSE for more information.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。