fix: AIFW-21695: Missing API coverage in MCP Scan module#101
Open
vokit-cisco wants to merge 1 commit into
Open
fix: AIFW-21695: Missing API coverage in MCP Scan module#101vokit-cisco wants to merge 1 commit into
vokit-cisco wants to merge 1 commit into
Conversation
Signed-off-by: Volodymyr Kit <vokit@cisco.com>
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
Adds missing API coverage in MCP Scan module by implementing the MCP Server Stats endpoint.
This change extends the MCP scan client with the ability to retrieve aggregated statistics for MCP servers, including attack techniques, scan coverage metrics, and threat analysis data. The implementation includes comprehensive request/response models and unit test coverage.
Changes
server_stats()method toMCPScanBasefor retrieving MCP server statistics.GetMCPServerStatsResponse- top-level response for server stats queries.MCPServerStats- aggregated statistics for a single MCP server.AttackTechnique- technique data including severity and context.ScanCoverage- capability scan coverage metrics.ContextObject- context object reference for error/threat association.ContextObjectTypeenum - types of context objects (MCP_SERVER, MCP_REGISTRY, MCP_SCAN_WORKFLOW).RegistrationMethodenum for MCP server registration methods (MANUAL, REGISTRY).mcp_servers_stats()route function for endpoint construction.ListMCPServersRequestwith new filtering options:scan_date- filter by last scan date.server_types- filter by server type (Remote/Code).limitfield to pagination model for maximum fetch count.__init__.pyto include new response models and types.test_mcp_scan_base.py:server_stats()method with various server IDs.manage_mcp_servers.py- integrated stats retrieval.mcp_server_scan.py- showcased new stats functionality.Test Plan
test_mcp_scan_base.py(404 tests added/updated).test_mcpscan_routes.py(route coverage verified).Compatibility Notes
server_stats()to retrieve aggregated statistics for MCP servers.Files Modified
aidefense/mcpscan/__init__.py- Added model exports.aidefense/mcpscan/mcp_scan_base.py- Addedserver_stats()method (38 lines added).aidefense/mcpscan/models.py- Added new models and enums (99 lines added).aidefense/mcpscan/routes.py- Addedmcp_servers_stats()route function.aidefense/tests/test_mcp_scan_base.py- Added comprehensive test suite (404 new lines).aidefense/tests/test_mcpscan_routes.py- Added route tests.examples/mcpscan/manage_mcp_servers.py- Updated with stats retrieval example.examples/mcpscan/mcp_server_scan.py- Enhanced with new functionality showcase (39 lines added).Total: 604 insertions(+), 5 deletions(-)