HomeFree ScannerDocsPricingBlogDownload

MCP Server, Claude Code & Cursor Security: Complete Prompt Injection & Workstation Hardening Guide

By ClaudeArmor Security Research • Updated November 30, 2026 • 11 min technical guide

Autonomous AI coding assistants — including Anthropic Claude Code, Claude Desktop, Cursor, Windsurf, GitHub Copilot Agent Mode, and Cline — execute with your full local OS user privileges. When connected to third-party Model Context Protocol (MCP) servers, a single poisoned GitHub issue, untrusted README, or unpinned npx -y MCP server can trigger indirect prompt injection and silent credential exfiltration.

🔌 Audit Your claude_desktop_config.json or mcp.json Free Paste your local MCP configuration into our client-side Security Workbench to catch unpinned npx -y servers, root filesystem exposure, and leaked tokens.
Audit MCP Config Free →

1. The Top 4 Attack Vectors Against AI Coding Agents

2. Hardening claude_desktop_config.json and .cursor/mcp.json

Replace mutable @latest auto-installs and broad home-directory mounts with version-pinned, least-privilege configurations:

{
  "mcpServers": {
    "filesystem-safe": {
      "command": "npx",
      "args": [
        "--no-install",
        "@modelcontextprotocol/[email protected]",
        "/Users/dev/projects/current-app-only"
      ]
    }
  }
}
  1. Never pass ~ or /Users/<you> to filesystem MCP servers — scope strictly to one repository folder.
  2. Never hardcode raw API keys inside mcp.json if the file lives inside a repository or synced dotfile repo.
  3. Disable auto-approve / YOLO shell execution whenever inspecting third-party repositories (scan unfamiliar GitHub repos first).

3. Real-Time Prompt Injection Detection & Secret Redaction

Static config hygiene cannot stop indirect prompt injection arriving mid-session from external APIs, logs, or documentation pages. ClaudeArmor Security adds a deterministic, zero-trust enforcement layer around all 20 major AI coding agents:

Protect Your Workstation with a ClaudeArmor Defense Pass (from $27) →

Frequently Asked Questions

What is MCP tool poisoning and indirect prompt injection?

MCP tool poisoning hides adversarial instructions inside a tool's schema description or untrusted external content (issues, docs, web pages). When Claude Code or Cursor ingests that text, the model may follow the attacker's instructions and leak local secrets through another connected tool.

How do I stop Claude Code and Cursor from reading my .env secrets?

Add explicit deny rules for .env*, ~/.ssh/*, and ~/.aws/*, keep production credentials out of global shell RC files, and run ClaudeArmor's local MCP firewall to block unauthorized credential reads at the OS/proxy layer.

How can I audit my claude_desktop_config.json or .cursor/mcp.json for risky MCP servers?

Pin exact package versions instead of npx -y @latest, scope filesystem paths to a single workspace directory, and run an instant client-side check at claudearmorsec.com/workbench.html.