Splunk SOC MCP Server

Splunk SOC MCP Server

Enables AI-assisted SOC workflows by connecting Claude Desktop to Splunk Enterprise for security event analysis and incident response.

Category
访问服务器

README

AI-Powered SOC Demo with Splunk + MCP

Overview

This demo showcases AI-assisted Security Operations Center (SOC) workflows using:

  • Splunk Enterprise (Docker) - SIEM platform with sample security data
  • MCP Server - Bridge between Claude and Splunk
  • Claude Desktop/Cline - AI assistant for SOC analysts

Architecture

Claude Desktop (with MCP) 
    ↓
MCP Server (Python)
    ↓
Splunk Docker Container
    ↓
Security Events Sample Security Data

Prerequisites

  • Git installed
  • Docker Desktop installed and running
  • Python 3.10+
  • Claude Desktop installed
  • 8GB RAM minimum
  • 20GB disk space

1. Install Docker Desktop for Windows

  1. Download from: https://www.docker.com/products/docker-desktop
  2. Install and restart your computer
  3. Ensure WSL 2 is enabled (Docker Desktop will prompt you)
  4. Start Docker Desktop and wait for it to be running

2. Install Python

  1. Download Python 3.10 or higher from: https://www.python.org/downloads/
  2. Important: Check "Add Python to PATH" during installation
  3. Verify installation:
python --version

3. Install Git (Optional, for cloning)

Download from: https://git-scm.com/download/win


Phase 1: Splunk Setup with Security Data

Setup Workflow Overview

Step 1: Launch Splunk (Docker)
   ↓
Step 2: Generate sample security data (Python script)
   ↓
Step 3: Import data into Splunk (Web UI or HEC)
   ↓
Step 4: Verify data in Splunk (Search queries)
   ↓
Step 5: Setup Python environment (MCP server)
   ↓
Step 6: Configure Claude Desktop (MCP config)
   ↓
Step 7: Work as a SOC Engineer

Step-by-Step Setup

Step 1: Create Project Directory (Powershell commands on Windows)

# Create directory
mkdir C:\splunk-mcp-soc-demo
cd C:\splunk-mcp-soc-demo

git clone https://github.com/asecurityguru/ai-driven-soc-demo-repo.git
cd ai-driven-soc-demo-repo

copy generate_sample_data.py,requirements.txt,splunk_mcp_server.py ..\ #Copying files from git repo to splunk-mcp-soc-demo directory

cd .. # Moving out of git repo

# Download all the files from the demo into this directory
# (Use the files provided or download them)

Step 2: Launch Splunk Docker Container

Note: We're running without a volume mount for simplicity and reliability.

# Run Splunk Enterprise
docker run -d \
  --platform linux/amd64 \
  -p 8000:8000 -p 8088:8088 -p 8089:8089 \
  -e "SPLUNK_START_ARGS=--accept-license" \
  -e 'SPLUNK_PASSWORD=Netguru123!' \
  -e "SPLUNK_GENERAL_TERMS=--accept-sgt-current-at-splunk-com" \
  -e "SPLUNK_HEC_TOKEN=abcd1234-abcd-1234-abcd-1234abcd1234" \
  --name splunk \
  splunk/splunk:latest

# Wait for Splunk to start (takes 2-3 minutes)
Write-Host "Waiting for Splunk to start..." -ForegroundColor Yellow
Start-Sleep -Seconds 180

# Check status
docker logs -f splunk


Administer Splunk Enterprise Docker containers

To see a list of example commands and environment variables for running Splunk Enterprise in a container, run:

docker run -it splunk/splunk help

To see a list of your running containers, run:

docker ps

To stop your Splunk Enterprise container, run:

docker container stop <container_id>

To restart a stopped container, run:

docker container start <container_id>

To access a running Splunk Enterprise container to perform administrative tasks, such as modifying configuration files, run:

docker exec -it <container_id> bash


Step 3: Verify Splunk Access

  1. Open browser: http://localhost:8000
  2. Login with:
    • Username: admin
    • Password: Netguru123!

Step 4: Generate Sample Security Data

Create realistic security events:

# Generate sample security events (49 events)
python generate_sample_data.py

What this creates:

  • sample_security_events.json with 49 realistic security events
  • Attack scenarios: brute force, malware C2, data exfiltration, port scanning, privilege escalation
  • Normal traffic baseline for comparison

Expected output:

✅ Generated 49 security events
📁 Saved to: sample_security_events.json

Event breakdown:
  - Brute Force Attacks: 12 events
  - Data Exfiltration: 1 event
  - Malware C2 Traffic: 5 events
  - Port Scanning: 9 events
  - Privilege Escalation: 1 event
  - Phishing: 1 event
  - Normal Traffic: 20 events

Step 5: Import Data into Splunk via Web UI

1. Open Splunk Web UI

URL: http://localhost:8000

Login credentials:
  Username: admin
  Password: Netguru123!

2. Upload the Data

  • Click "Settings""Add Data"
  • Click "Upload"
  • Click "Select File" and choose sample_security_events.json
  • Click "Next"

3. Configure Source Type (IMPORTANT!)

On the "Set Source Type" page:

  • Source Type: Select "_json" from dropdown
  • Click "Advanced" to expand settings
  • LINE_BREAKER field:
    • ⚠️ If you see a weird value like \N+01+, DELETE IT
    • Leave it blank or set to: ([\r\n]+)
  • Event Breaks: Should be "Every Line"
  • Click "Apply Settings"
  • Click "Save As", Keep Category as "Structured" and App as "Search & Reporting"
  • Click "Save" and then Click "OK" if override warning appears
  • Click "Next"

4. Set Input Settings

  • Create "netguru" index
  • Index: Select "netguru"
  • Click "Review"

5. Submit

  • Review settings
  • Click "Submit"
  • You should see: "File has been uploaded successfully"

6. Verify Data Import

Click "Start Searching" or go to Search & Reporting, then run:

Count events:

index=netguru | stats count

Expected result: Should show 49 (or more if you uploaded multiple times)

View sample events:

index=netguru | head 10

Step 6: Setup Python Virtual Environment

# Create virtual environment
python3 -m venv netguru

# Activate virtual environment
source netguru/bin/activate

# Deactivate virtual environment
deactivate

# Install dependencies
pip3 install --upgrade pip
pip3 install -r requirements.txt
pip3 install "mcp<2" splunk-sdk requests


****** Modified Requirements ******

mcp<2.0.0
#mcp>=0.9.0
splunk-sdk>=2.0.0
requests>=2.31.0
python-dotenv>=1.0.0



Step 7: Test MCP Server

# Test the MCP server (press Ctrl+C to stop)
python3 splunk_mcp_server.py

If you see no errors, the MCP server is working! Press Ctrl+C to stop.


Step 8: Configure Claude Desktop

8.1: Install Claude Desktop and login to Claude and check MCP servers

Download: https://claude.ai/download


8.2: Determine Your Claude Desktop Installation Type (Powershell commands for Windows)

Windows - Check which version you have:

#### Option 1: Check for Microsoft Store version
Test-Path "$env:LOCALAPPDATA\Packages\Claude_pzs8sxrjxfjjc"

#### If returns TRUE = You have Microsoft Store version
#### If returns FALSE = You have Direct Download version

Or check manually:

#### Search for Claude executable
Get-ChildItem -Path "$env:LOCALAPPDATA" -Recurse -Filter "Claude.exe" -ErrorAction SilentlyContinue | Select-Object FullName

#### If path contains "Packages\Claude_pzs8sxrjxfjjc" = Microsoft Store version
#### If path contains "Programs\Claude" = Direct Download version

macOS/Linux:

#### Check config location
ls ~/Library/Application\ Support/Claude/claude_desktop_config.json

#### If exists = Standard installation
#### If not exists = Check alternate locations

8.3: Configure Based on Your Installation Type (Powershell commands for Windows)

🏪 For Microsoft Store Version (Windows)

Step 1: Check if the directory exists

Test-Path "$env:LOCALAPPDATA\Packages\Claude_pzs8sxrjxfjjc\LocalCache\Roaming\Claude"

If it returns FALSE, create the directory first:

New-Item -ItemType Directory -Force -Path "$env:LOCALAPPDATA\Packages\Claude_pzs8sxrjxfjjc\LocalCache\Roaming\Claude"

Verify the directory in explorer

explorer "$env:LOCALAPPDATA\Packages\Claude_pzs8sxrjxfjjc\LocalCache\Roaming\Claude"

Step 2: Now create the config file

notepad "$env:LOCALAPPDATA\Packages\Claude_pzs8sxrjxfjjc\LocalCache\Roaming\Claude\claude_desktop_config.json"

Notepad will ask: "Do you want to create a new file?" - Click YES


# Step 3: Add this configuration in the Notepad file (replace path with your actual path):

**If file is EMPTY or NEW:**

```json
{
  "mcpServers": {
    "splunk-soc": {
      "command": "C:\\splunk-mcp-soc-demo\\venv\\Scripts\\python.exe",
      "args": [
        "C:\\splunk-mcp-soc-demo\\splunk_mcp_server.py"
      ],
      "env": {
        "SPLUNK_HOST": "localhost",
        "SPLUNK_PORT": "8089",
        "SPLUNK_USERNAME": "admin",
        "SPLUNK_PASSWORD": "Admin123!"
      }
    }
  }
}

If file ALREADY HAS CONTENT (e.g., preferences):

{
  "preferences": {
    "coworkScheduledTasksEnabled": false,
    "sidebarMode": "chat"
  },
  "mcpServers": {
    "splunk-soc": {
      "command": "C:\\splunk-mcp-soc-demo\\venv\\Scripts\\python.exe",
      "args": [
        "C:\\splunk-mcp-soc-demo\\splunk_mcp_server.py"
      ],
      "env": {
        "SPLUNK_HOST": "localhost",
        "SPLUNK_PORT": "8089",
        "SPLUNK_USERNAME": "admin",
        "SPLUNK_PASSWORD": "Admin123!"
      }
    }
  }
}
  1. Save the file

  2. Restart Claude Desktop:

# Kill all Claude processes
Get-Process | Where-Object {$_.Name -like "*Claude*"} | Stop-Process -Force

# Wait a moment
Start-Sleep -Seconds 3

# Restart Claude Desktop from Start Menu
  1. Verify: Look for MCP server in developer settings in Claude Desktop

💻 For Direct Download Version (Windows)

Config File Location:

%APPDATA%\Claude\claude_desktop_config.json

Steps:

  1. Create/Edit config file:
# Open with notepad
notepad "$env:APPDATA\Claude\claude_desktop_config.json"

# Or navigate to folder
explorer "$env:APPDATA\Claude"
  1. Add this configuration:
{
  "mcpServers": {
    "splunk-soc": {
      "command": "C:\\splunk-mcp-soc-demo\\venv\\Scripts\\python.exe",
      "args": [
        "C:\\splunk-mcp-soc-demo\\splunk_mcp_server.py"
      ],
      "env": {
        "SPLUNK_HOST": "localhost",
        "SPLUNK_PORT": "8089",
        "SPLUNK_USERNAME": "admin",
        "SPLUNK_PASSWORD": "Netguru123!"
      }
    }
  }
}
  1. Save and restart Claude Desktop

  2. Verify:

Logs Location:

explorer "$env:APPDATA\Claude\logs"

🍎 For macOS

Config File Location:

~/Library/Application Support/Claude/claude_desktop_config.json

Steps:

  1. Edit config file:
vi ~/Library/Application\ Support/Claude/claude_desktop_config.json

  1. Add this configuration:

}

  "mcpServers": {
    "splunk-soc": {
      "command": " /Users/v.henry/Desktop/CCC/splunk-mcp-soc-demo/netguru/bin/python3",
      "args": [
        "/Users/v.henry/Desktop/CCC/splunk-mcp-soc-demo/splunk_mcp_server.py"
      ],
      "env": {
        "SPLUNK_HOST": "localhost",
        "SPLUNK_PORT": "8089",
        "SPLUNK_USERNAME": "admin",
        "SPLUNK_PASSWORD": "Netguru123!"
      }
    }
  }
}


********* File ***********

{
  "mcpServers": {
    "splunk-soc": {
      "command": "/Users/v.henry/Desktop/CCC/splunk-mcp-soc-demo/netguru/bin/python",
      "args": [
        "/Users/v.henry/Desktop/CCC/splunk-mcp-soc-demo/splunk_mcp_server.py"
      ],
      "env": {
        "SPLUNK_HOST": "localhost",
        "SPLUNK_PORT": "8089",
        "SPLUNK_USERNAME": "admin",
        "SPLUNK_PASSWORD": "Netguru123!"
      }
    }
  },
  "coworkUserFilesPath": "/Users/v.henry/Claude",
  "preferences": {
    "launchPreviewPersistedWorkspaces": [],
    "launchPreviewSessionScopedSessions": [],
    "coworkScheduledTasksEnabled": true,
    "coworkHipaaRestricted": false,
    "ccdScheduledTasksEnabled": true,
    "bypassPermissionsGateByAccount": {
      "fa433d58-284c-46a3-b603-89b5b94fc5dc": false


***********************************




  1. Save (Ctrl+X, then Y, then Enter)

  2. Restart Claude Desktop


🐧 For Linux

Config File Location:

~/.config/Claude/claude_desktop_config.json

Steps:

  1. Edit config file:
nano ~/.config/Claude/claude_desktop_config.json
  1. Add configuration (same format as macOS above)

  2. Save and restart


Step 9: Testing the Integration

Once Claude Desktop is restarted and showing the 🔌 icon, try these prompts:

1. Alert Triage

Get all high severity security alerts from the last 24 hours and prioritize them for me.

2. Threat Investigation

Investigate IP address 142.250.185.46 - what activity have we seen and is it malicious?

3. User Investigation

Analyze all activity for user "tdavis" in the last 24 hours. Is there any suspicious behavior?

4. Brute Force Detection

Are there any brute force attacks happening? Show me accounts with multiple failed login attempts.

5. Data Exfiltration

Detect any unusual data transfers that might indicate data exfiltration.

6. Security Metrics

Give me a security operations summary for the last 24 hours with key metrics.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选