Repository navigation
Conversation
The --integrations loader imported each module as
`marketplace.{filename stem}`. Four marketplace files have dots in
their names (any.run, stealthwatchv6.10, symantecemailsecurity.cloud,
tenable.io), and the import system reads every dot as a package
separator, so those 19 tools could never be enabled.
Load each enabled module from its file path under
`secops_soar_mcp.marketplace.<stem with dots replaced by underscores>`
instead. --integrations names are unchanged, an already-imported module
is reused, and a module that fails to import is removed from
sys.modules before the existing error handling logs it. Loading by path
also no longer depends on the marketplace directory being on sys.path.
Closes google#350
…ilures - Import the marketplace package and set each loaded module as an attribute on it, as a regular import does. Without this, `secops_soar_mcp.marketplace.tenable_io` attribute access and mock.patch targets under it raised AttributeError. - Remove a partially executed module from sys.modules on any exception, including SystemExit and KeyboardInterrupt, so a later call cannot reuse it. - Log every failure to load a module as an import failure. Errors other than ImportError, such as SyntaxError, were logged as "Failed during registration call". - Drop the missing __init__.py warning: loading by file path no longer depends on it. - test_every_marketplace_module_loads also fails on warnings, so a module without register_tools is caught.
Contributor
Author
|
Hi @dandye , Follow-up comment: loaded modules are now bound on the |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The
--integrationsloader inserver/secops-soar/secops_soar_mcp/server.pyimported each enabled module asmarketplace.{filename stem}. Four marketplace files have dots in their names, and the import system reads every dot as a package separator. Those modules could never load, so their 19 tools could not be enabled:any.runstealthwatchv6.10symantecemailsecurity.cloudtenable.ioThe loader now imports each enabled module from its file path, under
secops_soar_mcp.marketplace.<stem with dots replaced by underscores>.Closes #350
Behavior
--integrationsnames are unchanged, so--integrations tenable.io(orTenable.io) works as documented.sys.modules. The existing error handling then logs the failure and the other integrations still load.sys.path. Running the server as a package (python -m secops_soar_mcp.server) from any working directory now loads integrations. This is the loader failure described in [secops-soar] Dynamic marketplace tool import fails with ModuleNotFoundError when running installed package #293, and it overlaps theserver.pychange in fix(secops-soar): resolve marketplace imports and synchronize setup.py (#151, #293, #294) #295. Thesetup.pydependency fix in fix(secops-soar): resolve marketplace imports and synchronize setup.py (#151, #293, #294) #295 ([secops-soar] setup.py is missing python-dotenv dependency from install_requires #294) is separate and still needed.Tests
New
tests/unit/test_marketplace_loading.py(7 tests):@mcp.tool()it defines is registered.Tenable.io, Any.Run).sys.modules.The first two tests fail on
main: all 294 modules fail withNo module named 'marketplace'under pytest. All 7 pass with this change.tests/unitpasses on Python 3.11, 3.12 and 3.14 (18 passed).I also ran the real server over stdio against a stub SOAR API with
--integrations tenable.io,any.run,stealthwatchv6.10,symantecemailsecurity.cloud,CSV:main--directory .../secops_soar_mcp run server.py)python -m secops_soar_mcp.server, another cwd)Notes
marketplace.<stem>tosecops_soar_mcp.marketplace.<stem>. Nothing in the repo refers to the old names.docs/toc.mdlinkssoar_integrations/tenable_io.md, which does not exist. I left that for a separate docs change.