# Find all MCP config files in your project
find . -name "*.json" | xargs grep -l '"command"' 2>/dev/null | grep -i mcp # Or check Claude Code's config location
cat ~/.config/claude/mcp_servers.json 2>/dev/null || \
cat ~/Library/Application\ Support/claude/mcp_servers.json 2>/dev/null
# Find all MCP config files in your project
find . -name "*.json" | xargs grep -l '"command"' 2>/dev/null | grep -i mcp # Or check Claude Code's config location
cat ~/.config/claude/mcp_servers.json 2>/dev/null || \
cat ~/Library/Application\ Support/claude/mcp_servers.json 2>/dev/null
# Find all MCP config files in your project
find . -name "*.json" | xargs grep -l '"command"' 2>/dev/null | grep -i mcp # Or check Claude Code's config location
cat ~/.config/claude/mcp_servers.json 2>/dev/null || \
cat ~/Library/Application\ Support/claude/mcp_servers.json 2>/dev/null
// .mcp-policy.json — document and enforce this
{ "allowed_commands": [ "npx", "/usr/local/bin/mcp-filesystem", "/usr/local/bin/mcp-github" ], "blocked_patterns": [ "sh", "bash", "zsh", "fish", "python", "python3", "node", "-weight: 500;">curl", "-weight: 500;">wget", "nc", "ncat" ]
}
// .mcp-policy.json — document and enforce this
{ "allowed_commands": [ "npx", "/usr/local/bin/mcp-filesystem", "/usr/local/bin/mcp-github" ], "blocked_patterns": [ "sh", "bash", "zsh", "fish", "python", "python3", "node", "-weight: 500;">curl", "-weight: 500;">wget", "nc", "ncat" ]
}
// .mcp-policy.json — document and enforce this
{ "allowed_commands": [ "npx", "/usr/local/bin/mcp-filesystem", "/usr/local/bin/mcp-github" ], "blocked_patterns": [ "sh", "bash", "zsh", "fish", "python", "python3", "node", "-weight: 500;">curl", "-weight: 500;">wget", "nc", "ncat" ]
}
# Audit what's in the environment your agent process inherits
env | grep -E "(KEY|SECRET|TOKEN|PASSWORD|CREDENTIAL|API)" | cut -d= -f1
# Audit what's in the environment your agent process inherits
env | grep -E "(KEY|SECRET|TOKEN|PASSWORD|CREDENTIAL|API)" | cut -d= -f1
# Audit what's in the environment your agent process inherits
env | grep -E "(KEY|SECRET|TOKEN|PASSWORD|CREDENTIAL|API)" | cut -d= -f1
# Example: run MCP server with restricted filesystem via Docker
-weight: 500;">docker run --rm \ --read-only \ --tmpfs /tmp \ --network=none \ --cap-drop=ALL \ your-mcp-server:latest # Or use firejail for native processes
firejail --noprofile --private --net=none npx @your-org/mcp-server
# Example: run MCP server with restricted filesystem via Docker
-weight: 500;">docker run --rm \ --read-only \ --tmpfs /tmp \ --network=none \ --cap-drop=ALL \ your-mcp-server:latest # Or use firejail for native processes
firejail --noprofile --private --net=none npx @your-org/mcp-server
# Example: run MCP server with restricted filesystem via Docker
-weight: 500;">docker run --rm \ --read-only \ --tmpfs /tmp \ --network=none \ --cap-drop=ALL \ your-mcp-server:latest # Or use firejail for native processes
firejail --noprofile --private --net=none npx @your-org/mcp-server
#!/usr/bin/env bash
# .-weight: 500;">git/hooks/pre-push echo "Running LucidShark pre-push checks..." # SCA: validate all dependencies against live registry
lucidshark scan --sca --block-unregistered # Secrets: catch credentials that leaked into the diff
lucidshark scan --secrets # SAST: catch security anti-patterns the agent introduced
lucidshark scan --sast echo "Pre-push checks passed."
#!/usr/bin/env bash
# .-weight: 500;">git/hooks/pre-push echo "Running LucidShark pre-push checks..." # SCA: validate all dependencies against live registry
lucidshark scan --sca --block-unregistered # Secrets: catch credentials that leaked into the diff
lucidshark scan --secrets # SAST: catch security anti-patterns the agent introduced
lucidshark scan --sast echo "Pre-push checks passed."
#!/usr/bin/env bash
# .-weight: 500;">git/hooks/pre-push echo "Running LucidShark pre-push checks..." # SCA: validate all dependencies against live registry
lucidshark scan --sca --block-unregistered # Secrets: catch credentials that leaked into the diff
lucidshark scan --secrets # SAST: catch security anti-patterns the agent introduced
lucidshark scan --sast echo "Pre-push checks passed."
# Log all MCP tool invocations if your framework supports it
# Claude Code example: check session transcript for unexpected tool calls
grep -A2 '"tool_name"' ~/.config/claude/sessions/*.json | \ grep -v -E "(read_file|write_file|list_directory|bash)" | \ grep "tool_name"
# Log all MCP tool invocations if your framework supports it
# Claude Code example: check session transcript for unexpected tool calls
grep -A2 '"tool_name"' ~/.config/claude/sessions/*.json | \ grep -v -E "(read_file|write_file|list_directory|bash)" | \ grep "tool_name"
# Log all MCP tool invocations if your framework supports it
# Claude Code example: check session transcript for unexpected tool calls
grep -A2 '"tool_name"' ~/.config/claude/sessions/*.json | \ grep -v -E "(read_file|write_file|list_directory|bash)" | \ grep "tool_name" - Zero-click IDE injection: A malicious MCP JSON config in a repository gets picked up automatically when your IDE indexes the project. Windsurf and Cursor are both confirmed vulnerable. No user action required.
- Prompt injection to config: An attacker who can influence model context (via a README, a comment, a file the agent reads) can potentially inject content that leads to malicious MCP server configuration. The model processes the content, the config gets written, STDIO executes it.
- Marketplace poisoning: Researchers successfully submitted malicious MCP servers to 9 of 11 tested registries without detection. If you are pulling MCP servers from a registry, you are in this attack surface.
- Slopsquatting via MCP config: MCP configurations reference package names. AI agents suggesting MCP servers can hallucinate package names. Attackers register those names. The STDIO vulnerability converts an -weight: 500;">install into execution. - API keys in environment variables available to the shell where the agent runs
- SSH keys loaded into the agent
- AWS/GCP/Azure credentials accessible via credential files or environment
- Database connection strings in .env files in scanned directories - Relying solely on application-layer input filtering. Flowise did this. It was bypassed. The execution model means filtering is always playing catch-up with bypass techniques.
- Trusting MCP marketplace listings. 9 of 11 tested registries accepted malicious submissions without review. Listing presence is not safety verification.
- Assuming the model will self-detect the issue. Five AI agent failures, zero self-detections in a 36-day study published this week. The model does not have reliable awareness that it has been manipulated.
- Waiting for Anthropic to patch the protocol. The "by design" response is definitive. Architecture-level protection has to come from your stack.