[secops-soar] --integrations cannot load marketplace modules with dots in their filenames
Summary
register_tools in server/secops-soar/secops_soar_mcp/server.py builds each integration's import path as f"marketplace.{py_file.stem}" and passes it to importlib.import_module. Four marketplace modules have dots in their filenames. The import system treats every dot as a package separator, so these modules can never be imported. The loader catches the ImportError and logs it, and the server starts without those tools.
The affected modules and their tool counts:
| Module | Tools |
|---|---|
any.run.py |
6 |
stealthwatchv6.10.py |
3 |
symantecemailsecurity.cloud.py |
2 |
tenable.io.py |
8 |
In total, 19 tools cannot be enabled. docs/soar_integrations/any_run.md and docs/soar_integrations/stealthwatchv6.10.md document tools that users cannot load.
Noted as a pre-existing issue in #347.
Reproduction
On main at bc045e2, from server/secops-soar/secops_soar_mcp, run the same call the loader makes:
$ python -c "import importlib; importlib.import_module('marketplace.tenable.io')"
ModuleNotFoundError: No module named 'marketplace.tenable'
The other three fail the same way:
marketplace.any.run No module named 'marketplace.any'
marketplace.stealthwatchv6.10 No module named 'marketplace.stealthwatchv6'
marketplace.symantecemailsecurity.cloud No module named 'marketplace.symantecemailsecurity'
Starting the server with --integrations tenable.io therefore reaches the except ImportError branch, which logs Failed to import module marketplace.tenable.io and registers none of the Tenable tools.
#295 changes the path to secops_soar_mcp.marketplace.{module_stem} with a marketplace.{module_stem} fallback. It still passes the dotted stem to import_module, so it does not fix this case.
Proposed fix
Load each module from its file path instead of by dotted name. This keeps the --integrations names users already pass (tenable.io) unchanged:
import importlib.util
import sys
module_name = f"secops_soar_mcp.marketplace.{module_stem.replace('.', '_')}"
spec = importlib.util.spec_from_file_location(module_name, py_file)
module = importlib.util.module_from_spec(spec)
sys.modules[module_name] = module
spec.loader.exec_module(module)
This also stops depending on the current working directory, which is the problem #295 addresses. The two changes should be coordinated.
The alternative is to rename the files to tenable_io.py and so on. That changes the user-facing --integrations name, and these modules are generated outside this repo, so the generator would need to change too.
For a test, add a unit test that runs the loader over every marketplace/*.py module and asserts that each one imports and exposes register_tools. It would fail on main for exactly these four modules.