Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions server/secops-soar/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ readme = "README.md"
requires-python = ">=3.11"
dependencies = [
"aiohttp>=3.11.15",
"mcp[cli]>=1.4.1"
"certifi>=2026.1.4",
"mcp[cli]>=1.4.1",
]

[project.optional-dependencies]
Expand All @@ -17,4 +18,4 @@ test = [

[build-system]
requires = ["setuptools>=61.0"]
build-backend = "setuptools.build_meta"
build-backend = "setuptools.build_meta"
12 changes: 10 additions & 2 deletions server/secops-soar/secops_soar_mcp/bindings.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,20 @@ async def _get_valid_scopes():
async def bind():
"""Binds global variables."""
global http_client, valid_scopes

# Parse SSL_VERIFY from env, default to True if not set
ssl_verify_raw = os.getenv(consts.ENV_SOAR_SSL_VERIFY, "true").lower()
ssl_verify = ssl_verify_raw == "true"

http_client = HttpClient(
os.getenv(consts.ENV_SOAR_URL), os.getenv(consts.ENV_SOAR_APP_KEY)
os.getenv(consts.ENV_SOAR_URL),
os.getenv(consts.ENV_SOAR_APP_KEY),
ssl_verify
)
valid_scopes = await _get_valid_scopes()


async def cleanup():
"""Cleans up global variables."""
await http_client.close()
if http_client:
await http_client.close()
12 changes: 7 additions & 5 deletions server/secops-soar/secops_soar_mcp/http_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@
class HttpClient:
"""HTTP client for making requests to the SecOps SOAR API."""

def __init__(self, base_url: str, app_key: str):
def __init__(self, base_url: str, app_key: str, ssl_verify: bool = True):
self.base_url = base_url
self.app_key = app_key
self._session = None
self.ssl_verify = ssl_verify

def _get_session(self) -> aiohttp.ClientSession:
if self._session is None:
Expand Down Expand Up @@ -58,7 +59,7 @@ async def get(
headers = await self._get_headers()
try:
async with self._get_session().get(
self.base_url + endpoint, params=params, headers=headers
self.base_url + endpoint, params=params, headers=headers, ssl=self.ssl_verify
) as response:
response.raise_for_status() # Raise an exception for 4xx/5xx responses
return await response.json()
Expand Down Expand Up @@ -87,7 +88,7 @@ async def post(
headers = await self._get_headers()
try:
async with self._get_session().post(
self.base_url + endpoint, json=req, params=params, headers=headers
self.base_url + endpoint, json=req, params=params, headers=headers, ssl=self.ssl_verify
) as response:
response.raise_for_status()
data = await response.content.read()
Expand Down Expand Up @@ -118,7 +119,7 @@ async def patch(
headers = await self._get_headers()
try:
async with self._get_session().patch(
self.base_url + endpoint, json=req, params=params, headers=headers
self.base_url + endpoint, json=req, params=params, headers=headers, ssl=self.ssl_verify
) as response:
response.raise_for_status()
return await response.json()
Expand All @@ -129,4 +130,5 @@ async def patch(
return None

async def close(self):
await self._get_session().close()
if self._session:
await self._get_session().close()
3 changes: 2 additions & 1 deletion server/secops-soar/secops_soar_mcp/utils/consts.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

ENV_SOAR_URL = "SOAR_URL"
ENV_SOAR_APP_KEY = "SOAR_APP_KEY"

ENV_SOAR_SSL_VERIFY = "SOAR_SSL_VERIFY"

class Endpoints:
"""Endpoints for SOAR."""
Expand All @@ -40,3 +40,4 @@ class Endpoints:
LIST_INVOLVED_EVENTS_BY_ALERT = (
"/api/1p/external/v1.0/cases/{CASE_ID}/alerts/{ALERT_ID}/involvedEvents"
)