{"id":48387780,"url":"https://github.com/marc-shade/fraud-detection-mcp","last_synced_at":"2026-04-05T22:38:44.936Z","repository":{"id":316897704,"uuid":"1064947119","full_name":"marc-shade/fraud-detection-mcp","owner":"marc-shade","description":"Advanced fraud detection MCP server with behavioral biometrics, real-time anomaly detection, and explainable AI for comprehensive fraud prevention","archived":false,"fork":false,"pushed_at":"2026-02-22T14:31:11.000Z","size":3181,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-05T22:38:41.800Z","etag":null,"topics":["anthropic","behavioral-biometrics","claude","fraud-detection","fraud-prevention","fraudulent-transactions","mcp","model-context-protocol","security"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/marc-shade.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY_AUDIT.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-26T20:03:26.000Z","updated_at":"2026-02-22T14:31:15.000Z","dependencies_parsed_at":"2025-09-27T13:19:21.413Z","dependency_job_id":"3579c9d5-f763-4f2f-98fd-e63a73e9e556","html_url":"https://github.com/marc-shade/fraud-detection-mcp","commit_stats":null,"previous_names":["marc-shade/fraud-detection-mcp"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/marc-shade/fraud-detection-mcp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marc-shade%2Ffraud-detection-mcp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marc-shade%2Ffraud-detection-mcp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marc-shade%2Ffraud-detection-mcp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marc-shade%2Ffraud-detection-mcp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marc-shade","download_url":"https://codeload.github.com/marc-shade/fraud-detection-mcp/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marc-shade%2Ffraud-detection-mcp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31452899,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-05T21:22:52.476Z","status":"ssl_error","status_checked_at":"2026-04-05T21:22:51.943Z","response_time":75,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["anthropic","behavioral-biometrics","claude","fraud-detection","fraud-prevention","fraudulent-transactions","mcp","model-context-protocol","security"],"created_at":"2026-04-05T22:38:44.260Z","updated_at":"2026-04-05T22:38:44.883Z","avatar_url":"https://github.com/marc-shade.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Advanced Fraud Detection MCP\n\n[![MCP](https://img.shields.io/badge/MCP-Compatible-blue)](https://modelcontextprotocol.io)\n[![Python-3.10+](https://img.shields.io/badge/Python-3.10%2B-green)](https://python.org)\n[![License](https://img.shields.io/badge/License-MIT-yellow)](LICENSE)\n[![Part of Agentic System](https://img.shields.io/badge/Part_of-Agentic_System-brightgreen)](https://github.com/marc-shade/agentic-system-oss)\n\n\u003e **Fraud detection and anomaly analysis for financial security — now with AI agent-to-agent transaction protection.**\n\nPart of the [Agentic System](https://github.com/marc-shade/agentic-system-oss) - a 24/7 autonomous AI framework with persistent memory.\n\n## Overview\n\n\u003cimg src=\"assets/bloodhound_avatar.png\" alt=\"Fraud Detection Bloodhound\" width=\"300\" style=\"border-radius: 15px;\" align=\"right\"\u003eA sophisticated, open-source Model Context Protocol (MCP) server for advanced fraud detection using cutting-edge algorithms and techniques. This system combines behavioral biometrics, machine learning, real-time anomaly detection, and **AI agent behavioral fingerprinting** for comprehensive fraud prevention.\n\n**Built for the Modern Threat Landscape** - Designed to detect sophisticated fraud patterns including synthetic identities, account takeovers, AI-generated attacks, and the emerging threat of **agent-to-agent transaction fraud** (McKinsey projects $3-5T in agent-mediated commerce by 2030).\n\n## Key Features\n\n### Core Detection Algorithms\n- **Isolation Forest**: Fast anomaly detection for real-time processing\n- **XGBoost Ensemble**: High-performance gradient boosting for pattern recognition\n- **Autoencoders**: Deep learning-based anomaly detection for complex patterns\n- **Graph Neural Networks**: Network analysis for fraud ring detection\n- **Behavioral Biometrics**: Keystroke dynamics, mouse patterns, and interaction analysis\n\n### Agent-to-Agent Transaction Protection\n- **Traffic Classification**: Automatic detection of AI agent vs human traffic (Stripe ACP, Visa TAP, Mastercard Agent Pay, Google AP2, and more)\n- **Agent Identity Verification**: API key format validation, JWT token expiry checks, agent registry\n- **Agent Behavioral Fingerprinting**: Per-agent Isolation Forest baselines replacing human biometrics\n- **Mandate Compliance**: Spending limits, merchant whitelists, time windows, geographic restrictions\n- **Collusion Detection**: Graph-based circular flow, temporal clustering, and volume anomaly detection\n- **Agent Reputation Scoring**: Longitudinal trust from history, consistency, and collusion safety\n\n### Advanced Capabilities\n- **Real-time Processing**: Sub-second transaction analysis\n- **Adaptive Learning**: Continuous model improvement from new data\n- **Multi-modal Analysis**: Combines transaction data, behavioral patterns, and network analysis\n- **Explainable AI**: Clear reasoning for fraud decisions with agent-specific explanations\n- **Privacy-First**: On-device processing with minimal data exposure\n\n## Architecture\n\n### Core Components\n\n1. **Anomaly Detection Engine**\n   - Isolation Forest for fast outlier detection\n   - One-Class SVM for boundary-based detection\n   - Local Outlier Factor (LOF) for density-based detection\n\n2. **Behavioral Analysis Module**\n   - Keystroke dynamics profiling\n   - Mouse movement pattern analysis\n   - Touch interaction biometrics\n   - Session behavior tracking\n\n3. **Transaction Pattern Engine**\n   - Velocity analysis (transaction frequency/amounts)\n   - Geographic anomaly detection\n   - Merchant pattern analysis\n   - Time-based pattern recognition\n\n4. **Network Analysis System**\n   - Graph-based fraud ring detection\n   - Community detection algorithms\n   - Relationship scoring\n   - Entity resolution\n\n5. **Agent Transaction Pipeline** (New)\n   - Traffic source classification (human/agent/unknown)\n   - Agent identity registry and credential verification\n   - Behavioral fingerprinting with per-agent Isolation Forest baselines\n   - Mandate verification (spending limits, merchant/location/time constraints)\n   - Collusion detection via directed graph analysis\n   - Longitudinal reputation scoring\n\n6. **Risk Scoring Framework**\n   - Multi-factor risk calculation with agent-aware weighting\n   - Confidence intervals\n   - Threshold management\n   - Alert prioritization\n\n## Technical Specifications\n\n- **Language**: Python 3.10+\n- **ML Libraries**: scikit-learn, XGBoost, PyTorch\n- **Graph Processing**: NetworkX\n- **API**: FastMCP (Model Context Protocol)\n- **Testing**: pytest (727 tests, 80%+ coverage)\n\n## Installation\n\n### Quick Start\n\n```bash\n# Clone the repository\ngit clone https://github.com/marc-shade/fraud-detection-mcp\ncd fraud-detection-mcp\n\n# Create virtual environment (recommended)\npython -m venv fraud_env\nsource fraud_env/bin/activate  # On Windows: fraud_env\\Scripts\\activate\n\n# Install dependencies\npip install -r requirements.txt\n\n# Install the package\npython setup.py install\n```\n\n### Claude Code Integration\n\nAdd to your Claude Desktop configuration:\n\n```json\n{\n  \"mcpServers\": {\n    \"fraud-detection-mcp\": {\n      \"command\": \"/path/to/fraud-detection-mcp/fraud_env/bin/python\",\n      \"args\": [\"/path/to/fraud-detection-mcp/server.py\"],\n      \"env\": {\n        \"FRAUD_DETECT_MODEL_PATH\": \"/path/to/fraud-detection-mcp/models\",\n        \"FRAUD_DETECT_LOG_LEVEL\": \"INFO\"\n      }\n    }\n  }\n}\n```\n\n## Usage\n\n### MCP Tools Available (24 tools)\n\n#### Core Fraud Detection\n| Tool | Description |\n|------|-------------|\n| `analyze_transaction` | Real-time transaction fraud analysis |\n| `detect_behavioral_anomaly` | Behavioral biometrics anomaly detection |\n| `assess_network_risk` | Graph-based fraud ring detection |\n| `generate_risk_score` | Comprehensive weighted risk assessment |\n| `explain_decision` | Explainable AI reasoning (human + agent-aware) |\n\n#### Agent-to-Agent Transaction Protection\n| Tool | Description |\n|------|-------------|\n| `classify_traffic_source` | Detect human vs AI agent traffic (supports Stripe ACP, Visa TAP, Mastercard, Google AP2, PayPal, Coinbase, OpenAI, Anthropic) |\n| `verify_agent_identity` | Validate agent credentials (API keys, JWT tokens, registry lookup) |\n| `analyze_agent_transaction` | Full agent-aware analysis pipeline (identity + fingerprint + mandate + transaction) |\n| `verify_transaction_mandate` | Check transactions against agent spending mandates |\n| `detect_agent_collusion` | Graph-based detection of coordinated agent behavior |\n| `score_agent_reputation` | Longitudinal reputation from trust, history, consistency, collusion safety |\n\n#### Model Management \u0026 Operations\n| Tool | Description |\n|------|-------------|\n| `train_models` | ML training pipeline with SMOTE and optional Optuna tuning |\n| `get_model_status` | Model source, configuration, and saved model paths |\n| `analyze_batch` | Batch transaction analysis with prediction caching |\n| `get_inference_stats` | Inference engine statistics and cache performance |\n| `generate_synthetic_dataset` | Generate realistic test datasets |\n| `analyze_dataset` | Analyze stored CSV/JSON datasets for fraud patterns |\n| `run_benchmark` | Performance benchmarking of the detection pipeline |\n| `health_check` | System health with model status, cache stats, resource usage |\n\n### Example Usage\n\n```python\n# Analyze a transaction\nresult = mcp_client.call(\"analyze_transaction\", {\n    \"transaction_id\": \"txn_123\",\n    \"amount\": 5000.00,\n    \"merchant\": \"Electronics Store\",\n    \"location\": \"New York, NY\",\n    \"timestamp\": \"2025-09-26T14:30:00Z\",\n    \"behavioral_data\": {\n        \"keystroke_dynamics\": [...],\n        \"mouse_patterns\": [...],\n        \"session_data\": {...}\n    }\n})\n\n# Result includes risk score, confidence, and explanation\n{\n    \"risk_score\": 0.85,\n    \"risk_level\": \"HIGH\",\n    \"confidence\": 0.92,\n    \"detected_anomalies\": [\n        \"unusual_amount_for_merchant\",\n        \"abnormal_keystroke_dynamics\",\n        \"geographic_anomaly\"\n    ],\n    \"explanation\": \"Transaction shows multiple risk factors...\",\n    \"recommended_action\": \"require_additional_verification\"\n}\n```\n\n## Algorithm Details\n\n### 1. Isolation Forest\n- **Purpose**: Fast anomaly detection for real-time processing\n- **Advantage**: O(n log n) complexity, handles high-dimensional data\n- **Use Case**: First-line defense for transaction screening\n\n### 2. XGBoost Ensemble\n- **Purpose**: Pattern recognition with high accuracy\n- **Features**: Handles imbalanced datasets, feature importance\n- **Use Case**: Primary classification for known fraud patterns\n\n### 3. Behavioral Biometrics\n- **Keystroke Dynamics**: Timing patterns between keystrokes\n- **Mouse Biometrics**: Movement velocity, acceleration, click patterns\n- **Touch Analytics**: Pressure, swipe patterns, gesture recognition\n\n### 4. Graph Neural Networks\n- **Network Analysis**: Entity relationships and fraud rings\n- **Community Detection**: Identifying suspicious clusters\n- **Entity Resolution**: Linking related accounts/devices\n\n## Performance Metrics\n\n- **Detection Rate**: \u003e95% for known fraud patterns\n- **False Positive Rate**: \u003c2% with proper tuning\n- **Response Time**: \u003c100ms for real-time analysis\n- **Throughput**: 10,000+ transactions per second\n- **Model Accuracy**: 97%+ on benchmark datasets\n\n## Privacy and Security\n\n- **On-Device Processing**: Sensitive data never leaves local environment\n- **Differential Privacy**: Noise injection for model training\n- **Encryption**: All data encrypted at rest and in transit\n- **Audit Trails**: Complete decision logging\n- **Compliance**: GDPR, PCI-DSS, SOX ready\n\n## Defense Insider Threat Compliance\n\nComprehensive defense-grade insider threat detection and compliance modules aligned with federal standards and executive orders.\n\n### Insider Threat Program\n\nPer **Executive Order 13587** and **NITTF** (National Insider Threat Task Force) guidance:\n\n- **28 Behavioral Indicators** from the NITTF Insider Threat Guide covering access anomalies, data movement, evasion, foreign nexus, counter-intelligence, physical security, and personal conduct\n- **User Activity Monitoring (UAM)** aligned with CNSSD 504 requirements\n- **Risk Scoring**: Weighted indicator aggregation producing 0-100 scores\n- **Threat Levels**: 4-tier model aligned with DHS NTAS (BASELINE / ADVISORY / ELEVATED / IMMINENT)\n- **Case Referral Reports**: Formal referral generation with executive summary, risk timeline, and legal notices\n\n### SIEM Integration\n\nDefense-grade security event correlation and multi-format output:\n\n- **Common Event Format (CEF)** for ArcSight\n- **Log Event Extended Format (LEEF)** for IBM QRadar\n- **Syslog RFC 5424** with structured data\n- **8 Correlation Rules** detecting multi-indicator attack patterns (data exfiltration sequences, credential compromise chains, foreign intelligence patterns, pre-departure exfiltration, and more)\n- **MITRE ATT\u0026CK Enrichment**: Maps all indicators to ATT\u0026CK technique IDs with tactic and reference URLs\n- **DoD 8570/8140 Classification**: Incidents categorized as CAT-1 through CAT-7\n- **Batch Export**: JSON and CSV export for offline analysis with time/severity/user filters\n\n### Cleared Personnel Monitoring\n\nFor users with security clearances per **SEAD 4** and **SEAD 6**:\n\n- **Continuous Evaluation (CE)**: Real-time monitoring per SEAD 6 covering financial, criminal, foreign travel, foreign contacts, and public records\n- **Whole Person Assessment**: All 13 adjudicative guidelines from SEAD 4:\n  - (A) Allegiance, (B) Foreign Influence, (C) Foreign Preference, (D) Sexual Behavior, (E) Personal Conduct, (F) Financial Considerations, (G) Alcohol, (H) Drug Involvement, (I) Psychological Conditions, (J) Criminal Conduct, (K) Handling Protected Information, (L) Outside Activities, (M) Use of Information Technology\n- **Need-to-Know Verification** per NIST 800-53 AC-3 and AC-25\n- **SF-86 Consistency Checks**: Cross-reference questionnaire data against known records\n- **Clearance Lifecycle**: Track PENDING / INTERIM / FINAL / SUSPENDED / REVOKED / EXPIRED states\n- **Polygraph Compliance**: CI, Full Scope, and Lifestyle polygraph tracking\n- **Personnel Security Action Reports** per EO 12968\n\n### Compliance Dashboard\n\nMetrics and reporting for executive briefings:\n\n- **NITTF Maturity Scoring**: Five levels from Initial to Optimizing with per-criterion tracking\n- **Key Risk Indicators (KRIs)**: MTTD, MTTR, false positive rate, true positive rate, alert volume with 7-day and 30-day trend analysis\n- **Compliance Posture**: Weighted scoring against NIST 800-53 PS/PE/AC control families\n- **Model Drift Detection**: Statistical z-score testing of model performance metrics\n- **Executive Summary Reports**: Aggregated briefing-ready reports with recommendations\n- **Export**: JSON and CSV export with optional historical data\n\n### Defense Compliance MCP Tools\n\n| Tool | Description |\n|------|-------------|\n| `assess_insider_threat` | Run insider threat assessment on user activity (28 behavioral indicators) |\n| `generate_siem_events` | Export events in CEF/LEEF/Syslog with MITRE ATT\u0026CK enrichment |\n| `evaluate_cleared_personnel` | Run SEAD 4/6 cleared personnel analytics and CE checks |\n| `get_compliance_dashboard` | Get NITTF maturity, KRIs, compliance posture, and executive summary |\n| `generate_threat_referral` | Generate formal case referral or personnel security action report |\n\n### NIST 800-53 Control Coverage\n\n| Control ID | Control Name | Coverage |\n|------------|-------------|----------|\n| PS-1 | Personnel Security Policy and Procedures | Maturity assessment |\n| PS-2 | Position Risk Designation | Maturity assessment |\n| PS-3 | Personnel Screening | Insider threat indicators, CE checks, clearance validation |\n| PS-4 | Personnel Termination | Post-termination access detection |\n| PS-5 | Personnel Transfer | Access scope violation detection |\n| PS-6 | Access Agreements | Reporting compliance, agreement violation detection |\n| PS-7 | External Personnel Security | Maturity assessment |\n| PS-8 | Personnel Sanctions | Maturity assessment |\n| PE-2 | Physical Access Authorizations | Badge tailgating, after-hours physical access |\n| PE-3 | Physical Access Control | Physical access anomaly detection |\n| PE-6 | Monitoring Physical Access | Physical security integration |\n| AC-2 | Account Management | Privilege escalation, dormant accounts, credential sharing |\n| AC-3 | Access Enforcement | Need-to-know verification |\n| AC-6 | Least Privilege | Access scope violation detection |\n| AC-25 | Reference Monitor | Compartment access verification |\n\n### Defense Compliance Architecture\n\n```\ncompliance/\n  __init__.py                  # Package exports\n  insider_threat.py            # EO 13587 / NITTF insider threat detection\n  siem_integration.py          # CEF/LEEF/Syslog event generation \u0026 correlation\n  cleared_personnel.py         # SEAD 4/6 cleared personnel analytics\n  dashboard_metrics.py         # NITTF maturity, KRIs, compliance posture\n```\n\nAll compliance modules:\n- Run entirely locally with no external service dependencies\n- Are thread-safe for concurrent assessments\n- Use graceful degradation (server runs without them if not installed)\n- Follow existing server patterns (`@mcp.tool()`, `@_monitored()`, `Dict[str, Any]` returns)\n\n## Contributing\n\nThis is an open-source project. Contributions welcome for:\n- New detection algorithms\n- Performance optimizations\n- Additional behavioral biometrics\n- Extended documentation\n- Test coverage\n- etc.\n\n## License\n\nMIT License - See LICENSE file for details\n---\n\n## Part of the MCP Ecosystem\n\nThis server integrates with other MCP servers for comprehensive AGI capabilities:\n\n| Server | Purpose |\n|--------|---------|\n| [enhanced-memory-mcp](https://github.com/marc-shade/enhanced-memory-mcp) | 4-tier persistent memory with semantic search |\n| [agent-runtime-mcp](https://github.com/marc-shade/agent-runtime-mcp) | Persistent task queues and goal decomposition |\n| [agi-mcp](https://github.com/marc-shade/agi-mcp) | Full AGI orchestration with 21 tools |\n| [cluster-execution-mcp](https://github.com/marc-shade/cluster-execution-mcp) | Distributed task routing across nodes |\n| [node-chat-mcp](https://github.com/marc-shade/node-chat-mcp) | Inter-node AI communication |\n| [ember-mcp](https://github.com/marc-shade/ember-mcp) | Production-only policy enforcement |\n\nSee [agentic-system-oss](https://github.com/marc-shade/agentic-system-oss) for the complete framework.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarc-shade%2Ffraud-detection-mcp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarc-shade%2Ffraud-detection-mcp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarc-shade%2Ffraud-detection-mcp/lists"}