Payment-Risk-Exception-AI-Agent-MCP
MCP server that provides tools for retrieving transaction context and recording AI decisions or creating human reviews for payment risk exceptions. Enables LLM agents to handle exception transactions in a hybrid payment-decisioning workflow.
README
Payment-Risk-Exception-AI-Agent
A local application example that demonstrates a hybrid payment-decisioning workflow. A rule based deterministic decision policy first assesess transactions and automatically approves or denies. The transactions that have mismatched info but not severe enough to trigger a denial is routed to an LLM agent which reviews the transactions then approves/denies or sends for human-review.
This example uses the following:
- Stripe's official Python SDK (
stripe-python) - Stripe's official mock server (
stripe-mock) - Rule based deterministic decision policy
- Simulated Merchant Data
- LLM Agent
- MCP Server with discoverable tools
- FastAPI REST endpoints
- SQLite
- Docker
- Postman API testing
- Analyst dashboard
The four demo transactions
- Everything matches
- Travel mismatch
- Compounding risk
- Mixed evidence
LLM Agent MCP flow
For exception transactions, the model itself selects the tools:
LLM
└─ calls get_transaction_context through MCP
└─ receives Stripe + merchant context and deterministic signals
└─ then calls exactly one MCP terminal tool:
├─ record_ai_decision (approve or deny)
└─ create_human_review
The Python orchestrator executes the tool calls requested by the model. It does not silently replace the model with a deterministic fallback and does not choose the terminal MCP action on the model's behalf.
Setup
For testing, please create an .env file and provide the LLM key.
Run:
docker compose up --build
Open:
- Dashboard:
http://localhost:8000 - Health/API configuration:
http://localhost:8000/api/health - FastAPI docs:
http://localhost:8000/docs - MCP endpoint:
http://localhost:8001/mcp - Stripe Mock:
http://localhost:12111
Important boundaries
- Stripe Mock returns fixture-based Stripe objects. It does not process money, run Stripe risk models, or preserve a real payment lifecycle.
- Merchant session and account data are simulated demo data.
- Clean transactions stay on deterministic policy; the model is called only for exceptions.
- The MCP server allows context retrieval, AI decision persistence, and human-review creation.
- Human-review resolution is intentionally absent from MCP. Only the analyst REST/dashboard path can resolve it.
Screenshots:
Main Screen:

Rules Fired:

AI Explanation:

Transaction Details:

Video Preview:
https://github.com/user-attachments/assets/84ff0226-a9cb-4c60-a4f7-ed301f0b5f5d
Recommended Servers
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.
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.
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.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
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.
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.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
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.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.