Skip to main content

Advanced Microsoft Sentinel Threat Analysis and Automated Response System

Project description

Advanced Sentinel MCP Server

Advanced Microsoft Sentinel Threat Analysis and Automated Response System

๐ŸŽฏ Key Features

1. Threat Intelligence Analyst ๐Ÿ”

In-depth analysis and intelligence for threat events

  • MITRE ATT&CK Mapping: Automatically map alerts/incidents to MITRE framework
  • Threat Actor Profiling: Generate attacker profiles based on TTPs
  • IoC Extraction and Analysis: Automatically extract and enrich threat indicators (IPs, domains, hashes, etc.)
  • Threat Context Provision: Kill Chain stages, threat severity, response priorities

Main Tools:

  • threat_event_analysis: In-depth threat event analysis
  • mitre_attack_mapping: MITRE ATT&CK framework mapping
  • ioc_extraction: IoC extraction and enrichment
  • threat_actor_profiling: Threat actor profile generation

2. Attack Path Predictor ๐ŸŽฏ

Machine learning-based attack path prediction and Kill Chain analysis

  • Next TTP Prediction: Predict next attack stages based on observed techniques
  • Kill Chain Analysis: Analyze current attack progression and completion
  • Attack Timeline Reconstruction: Visualize attack paths through event correlation
  • Attack Velocity Analysis: Estimate attack progression speed and time to Impact

Main Tools:

  • next_ttp_prediction: ML-based next TTP prediction
  • kill_chain_analysis: Kill Chain progress analysis
  • attack_timeline_reconstruction: Attack timeline reconstruction

3. Response Coordinator ๐Ÿ“‹

Business impact assessment and response resource optimization

  • Business Impact Assessment: Quantify business impact of incidents
  • Response Plan Generation: Automated response playbook matching and plan generation
  • Resource Prioritization: Determine response priorities for multiple incidents
  • SLA Management: Set response time targets by severity

Main Tools:

  • business_impact_assessment: Business impact assessment
  • response_plan_generation: Automated response plan generation
  • resource_prioritization: Resource prioritization

4. Automation Executor โš™๏ธ

Automated response action execution and approval workflows

  • Automated Response Actions: Host isolation, IP blocking, account disabling, etc.
  • Approval Workflow: Risk-based approval process management
  • Playbook Execution: Automated execution of predefined response playbooks
  • Action Tracking and Rollback: Track execution history and rollback when needed

Main Tools:

  • execute_response_action: Execute response actions
  • approve_response_action: Approve actions
  • list_available_playbooks: List available playbooks
  • execute_playbook: Execute playbooks
  • rollback_action: Rollback actions

๐Ÿ—๏ธ Architecture

sentinel-advanced-mcp/
โ”œโ”€โ”€ server.py                      # MCP server main
โ”œโ”€โ”€ tools/                         # MCP tools
โ”‚   โ”œโ”€โ”€ base.py                    # Tool base class
โ”‚   โ”œโ”€โ”€ threat_analyst_tools.py   # TI analysis tools
โ”‚   โ”œโ”€โ”€ attack_predictor_tools.py # Attack prediction tools
โ”‚   โ”œโ”€โ”€ response_coordinator_tools.py  # Response coordination
โ”‚   โ””โ”€โ”€ automation_executor_tools.py   # Automation execution
โ”œโ”€โ”€ ml_models/                     # ML models
โ”‚   โ”œโ”€โ”€ ttp_predictor.py          # TTP prediction engine
โ”‚   โ””โ”€โ”€ attack_graph.py           # Attack graph analysis
โ”œโ”€โ”€ intelligence/                  # Threat intelligence
โ”‚   โ”œโ”€โ”€ mitre_attck.py            # MITRE ATT&CK framework
โ”‚   โ””โ”€โ”€ ioc_enrichment.py         # IoC enrichment
โ”œโ”€โ”€ playbooks/                     # Response playbooks
โ”‚   โ””โ”€โ”€ executor.py               # Playbook execution engine
โ””โ”€โ”€ utilities/                     # Utilities
    โ”œโ”€โ”€ task_manager.py           # Async task management
    โ””โ”€โ”€ cache.py                  # Caching

๐Ÿš€ Installation and Execution

1. Requirements

  • Python 3.10 or higher
  • Azure Sentinel Workspace
  • Azure Authentication (Azure CLI or Service Principal)

2. Installation

# Create virtual environment
python -m venv .venv

# Activate virtual environment (Windows)
.venv\Scripts\activate

# Activate virtual environment (Linux/Mac)
source .venv/bin/activate

# Install dependencies
pip install -r requirements.txt

3. Environment Setup

# Copy environment variables file
cp .env.example .env

# Edit .env file (enter Azure information)
vi .env

Required Environment Variables:

AZURE_SUBSCRIPTION_ID=your-subscription-id
AZURE_RESOURCE_GROUP=your-resource-group
AZURE_WORKSPACE_NAME=your-workspace-name
AZURE_WORKSPACE_ID=your-workspace-guid

4. Azure Authentication

Option A: Azure CLI (Recommended for Development/Testing)

az login
az account set --subscription your-subscription-id

Option B: Service Principal (Recommended for Production)

# Set in .env
AZURE_TENANT_ID=your-tenant-id
AZURE_CLIENT_ID=your-client-id
AZURE_CLIENT_SECRET=your-client-secret

5. Server Execution

python server.py

๐Ÿ“š Usage Examples

Example 1: Threat Event Analysis

# In-depth incident analysis
{
  "tool": "threat_event_analysis",
  "parameters": {
    "incident_number": 12345,
    "timespan": "24h"
  }
}

# Results:
# - MITRE ATT&CK mapping
# - Extracted IoC list
# - Threat summary and recommendations

Example 2: Next Attack Stage Prediction

# Prediction based on observed TTPs
{
  "tool": "next_ttp_prediction",
  "parameters": {
    "observed_tactics": ["TA0001", "TA0002", "TA0003"],
    "observed_techniques": ["T1566", "T1059", "T1053"],
    "time_elapsed_minutes": 120,
    "top_k": 5
  }
}

# Results:
# - Next expected tactics (with probabilities)
# - Next expected techniques (with probabilities)
# - Attack likelihood analysis
# - Defense recommendations

Example 3: Response Plan Generation

# Automated response plan generation
{
  "tool": "response_plan_generation",
  "parameters": {
    "incident_number": 12345,
    "auto_match": true
  }
}

# Results:
# - Matched playbooks
# - Execution plan (action list)
# - Approval requirements
# - Expected impact

Example 4: Playbook Execution

# Execute ransomware response playbook
{
  "tool": "execute_playbook",
  "parameters": {
    "playbook_id": "pb_ransomware_001",
    "incident_data": {
      "host": "DESKTOP-001",
      "account": "user@company.com",
      "severity": "Critical"
    },
    "auto_approve": false,
    "execute_immediately": false
  }
}

# Results:
# - Generated action list
# - Actions pending approval
# - Auto-approved actions
# - Next steps guide

๐Ÿ›ก๏ธ Security Considerations

โš ๏ธ Important: Test Environment Only

This MCP server is designed for use in test/development environments only.

Additional Considerations for Production Use:

  1. Action Execution Permissions: Automation Executor requires strong permissions - strict RBAC configuration essential
  2. Approval Workflow: Critical actions must implement multi-stage approval processes
  3. Audit Logs: Record all action execution history in separate logging system
  4. Data Exposure: Sentinel data may contain sensitive information - consider data masking
  5. Network Isolation: MCP server should operate in secure network segment

Permission Requirements

Azure Sentinel:

  • Microsoft.OperationalInsights/workspaces/read
  • Microsoft.OperationalInsights/workspaces/query/*/read
  • Microsoft.SecurityInsights/*/read

Automation Execution (Optional):

  • Microsoft.SecurityInsights/incidents/write
  • Microsoft.Logic/workflows/run/action

๐Ÿ”ง Extension and Customization

Adding New Playbooks

# Add to playbooks/executor.py

custom_playbook = ResponsePlaybook(
    playbook_id="pb_custom_001",
    name="Custom Response Playbook",
    description="Response for specific scenario",
    trigger_conditions={
        "severity": ["Critical"],
        "techniques": ["T1234"]
    },
    actions=[
        ResponseAction(
            action_id="act_custom_001",
            action_type=ActionType.BLOCK_IP,
            target="malicious_ips",
            requires_approval=False
        )
    ],
    execution_mode="semi_auto"
)

Adding New Tools

# tools/custom_tools.py

from tools.base import MCPToolBase

class MyCustomTool(MCPToolBase):
    name = "my_custom_tool"
    description = "Custom analysis tool"

    async def run(self, ctx: Context, **kwargs) -> Dict:
        # Implementation
        return self.wrap_result({"data": "result"})

def register_tools(mcp: FastMCP):
    MyCustomTool.register(mcp)

๐Ÿ“Š Performance Optimization

  • Caching: Frequently accessed data uses TTL cache (default 10 minutes)
  • Parallel Processing: Independent queries executed in parallel
  • Query Optimization: KQL queries select only necessary columns

๐Ÿ› Troubleshooting

Authentication Errors

# Re-authenticate Azure CLI
az logout
az login
az account set --subscription your-subscription-id

Query Timeouts

# Increase timeout in task_manager.py
timeout=120.0  # default 60 seconds

Module Import Errors

# Check Python path
export PYTHONPATH="${PYTHONPATH}:$(pwd)"

๐Ÿ“ License and Copyright

Copyright (c) 2025 jmstar85. All rights reserved.

This software and associated documentation files (the "Software") are the exclusive property of jmstar85. All rights, title, and interest in and to the Software are owned by jmstar85.

Terms of Use

This project is provided for educational and research purposes only.

Copyright Protection

  • Unauthorized copying, distribution, modification, or use of this Software, in whole or in part, is strictly prohibited without explicit written permission from the copyright owner.
  • Any violation of these terms may result in legal action and you may be subject to civil and criminal penalties under applicable copyright laws.
  • All intellectual property rights, including but not limited to copyrights, patents, and trade secrets, remain with jmstar85.

Disclaimer

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED. IN NO EVENT SHALL THE COPYRIGHT OWNER BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER LIABILITY ARISING FROM THE USE OF THE SOFTWARE.

For licensing inquiries or permission requests, please contact the repository owner.

๐Ÿค Contributing

Feature improvements and bug fixes are welcome.

โšก Roadmap

  • Real-time threat monitoring dashboard
  • Advanced ML model integration (LSTM, Transformer)
  • External threat intelligence feed integration (VirusTotal, AbuseIPDB, etc.)
  • Actual Azure Logic Apps integration
  • Slack/Teams notification integration
  • SIEM data visualization (Grafana)

Built: 2025 Version: 1.0.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file iflow_mcp_jmstar85_azure_sentinel_mcp-1.0.0.tar.gz.

File metadata

  • Download URL: iflow_mcp_jmstar85_azure_sentinel_mcp-1.0.0.tar.gz
  • Upload date:
  • Size: 42.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for iflow_mcp_jmstar85_azure_sentinel_mcp-1.0.0.tar.gz
Algorithm Hash digest
SHA256 666283b0baae273f25bb9b4ba83c867aff82c1edc28db71113f6430d6ff7b13a
MD5 c79c075fb7bc447b011a38d09644c1ca
BLAKE2b-256 193de23a615b8fc6af558e795ae8c872581981a6a50f12923c8718881dabbfb6

See more details on using hashes here.

File details

Details for the file iflow_mcp_jmstar85_azure_sentinel_mcp-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: iflow_mcp_jmstar85_azure_sentinel_mcp-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 9.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for iflow_mcp_jmstar85_azure_sentinel_mcp-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3e6dcfc4d8396d74916ece8e31e221f94b49622843f5249a0ddf01f2636e3abf
MD5 742c26d33e47cbe9495ac5b0dd5054ec
BLAKE2b-256 ee067b89582edfe618e5c3009c05dd429940d000633dd81b236f5a39363574aa

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page