feat(scan): add mock_env support for MCP servers requiring env vars#370
Merged
feat(scan): add mock_env support for MCP servers requiring env vars#370
Conversation
🔒 MCP Security Scan Results✅ agentql-mcp
Summary: Scanned 1 MCP server(s), all passed security checks. ✅ |
MCP servers that require environment variables (like API URLs or tokens) cannot be security scanned because the scanner needs to start the server to discover tools. This adds a `mock_env` field to spec.yaml that allows specifying placeholder environment variables for scanning purposes. Changes: - generate_mcp_config.py: Extract mock_env from security section - run_scan.py: Add --config flag and pass --stdio-env args to scanner - build-containers.yml: Use config file approach for run_scan.py - Documentation: Add mock_env to spec.yaml reference and usage examples Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Replace insecure_ignore with mock_env to allow mcp-scanner to start the server and scan its tools. The mock AGENTQL_API_KEY is not a real credential - it's a placeholder that lets the server initialize. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
38baeed to
ced6837
Compare
rdimitrov
approved these changes
Feb 5, 2026
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
mock_envfield to spec.yaml for MCP servers that require environment variables to startinsecure_ignore: truerun_scan.pyto accept config via JSON file and pass--stdio-envargs to mcp-scannerProblem
MCP servers that require environment variables (like
SEARXNG_URL,NOTION_TOKEN, etc.) cannot be security scanned because:insecure_ignore: truewhich completely skips the scanSolution
Add a
mock_envfield tospec.yamlthat specifies placeholder environment variables to pass to the scanner:Changes
scripts/mcp-scan/generate_mcp_config.pymock_envfrom spec.yaml and include in JSON outputscripts/mcp-scan/run_scan.py--configflag, readmock_env, pass--stdio-envto scanner.github/workflows/build-containers.ymldocs/adding-servers.mdmock_envfield and usagescripts/mcp-scan/README.mdTest plan
generate_mcp_config.pyoutputsmock_envfield (empty array for existing servers)run_scan.py --configworks with mock_env🤖 Generated with Claude Code