MCP-SOC Middleware
Enables AI agents to interact with Splunk SIEM and TheHive SOAR through a unified MCP interface, providing 12 tools for alert triage, case management, and security operations.
README
MCP-SOC Middleware
MCP-Based Middleware for Integrating Agentic AI with Legacy SOC Infrastructure
PMICS Batch 05 | University of Dhaka, Department of CSE
CSE-810: Project on Cyber Security
Authors: Md. Abdullah Bin Salaam (H-28) · Ovishek Pal (H-54)
Supervisor: Prof. Dr. Mamun Or Rashid
One-Command Startup
git clone https://github.com/your-org/mcp-soc-middleware.git && cd mcp-soc-middleware
cp .env.example .env # fill in ANTHROPIC_API_KEY at minimum
docker compose up -d # starts all 5 services
Wait ~90 seconds for Splunk and TheHive to initialise, then visit:
| Service | URL | Default credentials |
|---|---|---|
| MCP Middleware API | http://localhost:8000/docs | Bearer: mcp-dev-token-change-me-in-production-abc123 |
| Splunk Web UI | http://localhost:8001 | admin / changeme123! |
| TheHive | http://localhost:9000 | admin@thehive.local / secret |
| Cortex | http://localhost:9001 | (first-run wizard) |
| Elasticsearch | http://localhost:9200 | (no auth in dev) |
Architecture
┌─────────────────────────────────────────────────────┐
│ AI Agent Layer │
│ (SOCOrchestrator + Anthropic Claude) │
└───────────────────────┬─────────────────────────────┘
│ MCP (Bearer Token)
┌───────────────────────▼─────────────────────────────┐
│ MCP Unified Access Layer :8000 │
│ FastAPI · ToolRegistry · AuditLog · RateLimit │
└──────────┬────────────────────────┬─────────────────┘
│ │
┌──────────▼──────────┐ ┌──────────▼──────────────┐
│ SplunkAdapter │ │ TheHiveAdapter │
│ 5 MCP tools │ │ 7 MCP tools │
└──────────┬──────────┘ └──────────┬───────────────┘
│ │
┌──────────▼──────────┐ ┌──────────▼──────────────┐
│ Splunk Enterprise │ │ TheHive 5 + ES 7 │
│ REST API :8089 │ │ REST API :9000 │
└─────────────────────┘ └─────────────────────────┘
Project Structure
mcp-soc-middleware/
├── mcp_server/ # FastAPI MCP server package
│ ├── main.py # App factory, lifespan, MCP endpoints
│ ├── core/
│ │ ├── registry.py # Dynamic tool registry and adapter loader
│ │ └── auth.py # Bearer token authentication dependency
│ ├── adapters/
│ │ ├── base_adapter.py # Abstract adapter contract
│ │ ├── splunk_adapter.py # Splunk SIEM adapter (5 tools)
│ │ └── thehive_adapter.py # TheHive SOAR adapter (7 tools)
│ ├── middleware/
│ │ ├── audit.py # JSONL audit logging middleware
│ │ └── rate_limit.py # slowapi rate limiter
│ ├── models/
│ │ ├── tool_models.py # MCP ToolDefinition, Request, Response models
│ │ └── alert_models.py # Normalised alert / observable schemas
│ └── utils/ # (extensible — logging helpers, etc.)
│
├── agent/
│ ├── orchestrator.py # ReAct loop + MCP client + Anthropic API
│ ├── workflows/
│ │ └── triage_workflow.py # Pre-built task strings for common workflows
│ └── prompts/ # (extensible — prompt template files)
│
├── config/
│ └── settings.py # Pydantic-Settings configuration model
│
├── tests/
│ ├── unit/adapters/
│ │ ├── test_splunk_adapter.py
│ │ └── test_thehive_adapter.py
│ ├── integration/ # (full end-to-end tests against live services)
│ └── fixtures/ # Shared test data and factory-boy factories
│
├── scripts/
│ ├── bootstrap.sh # One-time local setup (venv + .env)
│ └── splunk_bootstrap.sh # Generate Splunk API token post-startup
│
├── docker/
│ ├── Dockerfile # Multi-stage image for mcp-middleware service
│ ├── splunk/
│ │ ├── inputs.conf # Splunk monitor stanza for sample data
│ │ └── sample_alerts.json # Synthetic SOC alerts for dev seeding
│ └── thehive/
│ └── application.conf # TheHive minimal config pointing to ES
│
├── logs/ # Audit JSONL logs (git-ignored)
├── docs/ # Architecture diagrams and runbooks
├── docker-compose.yml # Full local dev stack (5 services)
├── requirements.txt # Pinned Python dependencies
├── pyproject.toml # Build config, ruff, mypy, pytest settings
├── .env.example # All required environment variables with defaults
└── README.md # This file
Local Development (without Docker)
# 1. Bootstrap virtual environment
bash scripts/bootstrap.sh
source .venv/bin/activate
# 2. Start only the platform dependencies via Docker
docker compose up -d splunk elasticsearch thehive
# 3. Generate a Splunk API token (first time only)
bash scripts/splunk_bootstrap.sh
# → Paste the printed token into .env as SPLUNK_TOKEN=...
# 4. Run the MCP server
python -m mcp_server.main
# Server starts at http://localhost:8000
# 5. In a separate terminal: run the AI agent on a triage task
python - <<'EOF'
import asyncio
from agent.orchestrator import SOCOrchestrator
from agent.workflows.triage_workflow import alert_triage_task
async def main():
agent = SOCOrchestrator()
result = await agent.run(alert_triage_task(time_window="-4h", severity="high"))
print(result)
asyncio.run(main())
EOF
Running Tests
pytest # all tests with coverage
pytest tests/unit -v # unit tests only (no live services needed)
pytest tests/integration -v # requires docker compose up -d
MCP API Reference
All endpoints require Authorization: Bearer <MCP_BEARER_TOKEN>.
GET /tools/list
Returns the full tool catalogue (12 tools across Splunk + TheHive adapters).
POST /tools/call
{
"name": "splunk.search_alerts",
"arguments": {
"severity": "high",
"earliest": "-4h",
"limit": 50
}
}
Available Tools
| Tool | Platform | Description |
|---|---|---|
splunk.search_alerts |
Splunk | Search notable events by severity/time |
splunk.get_alert_details |
Splunk | Full field set for one event ID |
splunk.search_events |
Splunk | Arbitrary SPL query |
splunk.get_index_summary |
Splunk | Available indexes and sourcetypes |
splunk.acknowledge_notable |
Splunk | Update notable event status/owner |
thehive.create_case |
TheHive | Create a new case |
thehive.get_case |
TheHive | Retrieve case by ID |
thehive.list_cases |
TheHive | List cases by status/severity |
thehive.create_alert |
TheHive | Create an alert from external data |
thehive.add_observable |
TheHive | Add IP/domain/hash/URL to a case |
thehive.update_case_status |
TheHive | Update status and add summary note |
thehive.add_task |
TheHive | Create an analyst task inside a case |
Extending with a New Adapter
- Create
mcp_server/adapters/my_tool_adapter.pyinheritingBaseAdapter. - Implement
register_tools()returning yourToolDefinitionlist. - Expose module-level
register_tools(),adapter_setup(),adapter_teardown()functions. - Add the module path to
ADAPTER_MODULESinmcp_server/main.py.
No changes to the registry, middleware, or AI agent are required.
Environment Variables
See .env.example for the full annotated list. Minimum required for local dev:
ANTHROPIC_API_KEY=sk-ant-api03-... # required for AI agent
MCP_BEARER_TOKEN=... # any strong random string
SPLUNK_TOKEN=... # from scripts/splunk_bootstrap.sh
THEHIVE_API_KEY=... # from TheHive UI → Admin → Users
License
MIT © 2026 Md. Abdullah Bin Salaam & Ovishek Pal
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。