LEANDRO CALADO FERREIRA

Harness Engineering · December 1, 2026

AI Coding Agents Are Installing Archived MCP Servers. Block Them in the Harness

Ask a coding agent to "add a GitHub MCP server" and it may write @modelcontextprotocol/server-github into your config. That package has been archived since May 2025. When I queried npm on December 1, 2026, its deprecation field read: "Archived and unmaintained; no security guarantees."

The agent is not lying to you. It is remembering. The package name was correct when its training data was collected, and nothing in the model knows that the repository was frozen later. That gap is now measurable, and the place to close it is the harness, not the prompt.

What the research found

On November 2, 2026, Glow Labs published research on the pattern it calls MCPhantom. The Cloud Security Alliance followed with a research note on November 10. The numbers are worth reading with their denominators intact:

The disclosure ended where archived code usually ends. The maintainers closed the advisory and said the server "is unmaintained, so no fix or release will come from this repository."

Why your existing controls miss it

An MCP server launched with npx never appears in package.json or a lockfile. Software composition analysis has no manifest to scan, and the flaws have no CVEs to match against. Endpoint detection sees a trusted Node process downloading a public package. Software inventory does not register it as an application.

The deprecation notice exists, but it reaches the wrong reader. npx still installs a deprecated package and prints a warning into a terminal the agent controls. Glow describes one session where the agent checked npm, received the "deprecated" notice, installed the package anyway and did not mention it to the user.

This is the core Harness Engineering lesson in miniature: a model's knowledge is a snapshot, so the harness has to verify every decision that turns into a side effect. Here the side effect is a new process with your credentials and your network access.

Step 1: find what is already installed

Start with an inventory. The script below reads the common MCP config locations, extracts packages launched through npx, and asks the npm registry whether each one is deprecated. It needs Python 3 and npm, nothing else.

#!/usr/bin/env python3
"""List MCP servers in agent configs whose npm package is deprecated."""
import json, pathlib, subprocess, sys

CONFIGS = ["~/.claude.json", "~/.cursor/mcp.json", ".mcp.json", ".cursor/mcp.json"]

def npm_packages(server):
    if server.get("command") not in ("npx", "npx.cmd"):
        return []
    args = [a for a in server.get("args", []) if not a.startswith("-")]
    return args[:1]

def servers(cfg):
    yield from cfg.get("mcpServers", {}).items()
    for project in cfg.get("projects", {}).values():   # ~/.claude.json keeps per-project servers
        yield from project.get("mcpServers", {}).items()

def deprecated(pkg):
    out = subprocess.run(["npm", "view", pkg, "deprecated"], capture_output=True, text=True)
    return out.stdout.strip()

found = 0
for path in CONFIGS:
    p = pathlib.Path(path).expanduser()
    if not p.is_file():
        continue
    for name, server in servers(json.loads(p.read_text())):
        for pkg in npm_packages(server):
            note = deprecated(pkg)
            if note:
                found += 1
                print(f"{p}: server '{name}' uses {pkg}\n    npm: {note}")
sys.exit(1 if found else 0)

I ran it against a test project that declared two servers, the archived GitHub server and the still-maintained filesystem server. It flagged only the first:

.mcp.json: server 'github' uses @modelcontextprotocol/server-github
    npm: Archived and unmaintained; no security guarantees. See https://github.com/modelcontextprotocol/servers-archived

The exit code is 1 when anything is found, so the same script can fail a CI job or a scheduled endpoint check. It does not hardcode a list of bad packages. It asks the registry each time, so it keeps working as more servers are archived.

Step 2: block new installs before they run

An inventory catches yesterday's mistakes. A pre-execution hook catches the next one. Claude Code runs PreToolUse hooks before a tool call executes and treats exit code 2 as a block, sending the hook's message back to the model. Other harnesses that support pre-execution hooks can reuse the same logic.

#!/usr/bin/env python3
"""PreToolUse hook: refuse npm packages marked deprecated before the agent installs them."""
import json, re, subprocess, sys

event = json.load(sys.stdin)
tool, args = event.get("tool_name", ""), event.get("tool_input", {})

if tool == "Bash":
    text = args.get("command", "")
elif tool in ("Write", "Edit") and args.get("file_path", "").endswith(("mcp.json", ".claude.json")):
    text = args.get("content", "") + args.get("new_string", "")
else:
    sys.exit(0)

candidates = set(re.findall(r"@[\w.-]+/[\w.-]+", text))
candidates |= set(re.findall(r"\bnpx\s+(?:-\S+\s+)*([\w.][\w.-]*)", text))

for pkg in sorted(candidates):
    note = subprocess.run(["npm", "view", pkg, "deprecated"],
                          capture_output=True, text=True, timeout=20).stdout.strip()
    if note:
        print(f"Blocked: {pkg} is deprecated on npm ({note}). "
              "Use a maintained package; for MCP, the service owner's official server.", file=sys.stderr)
        sys.exit(2)
sys.exit(0)

Register it in .claude/settings.json for a project, or in ~/.claude/settings.json for every project:

{
  "hooks": {
    "PreToolUse": [
      {
        "matcher": "Bash|Write|Edit",
        "hooks": [
          { "type": "command", "command": "python3 ~/.claude/hooks/block_deprecated_mcp.py" }
        ]
      }
    ]
  }
}

I fed the hook four simulated tool calls. It blocked claude mcp add github -- npx -y @modelcontextprotocol/server-github, blocked a config write that added the archived Puppeteer server, blocked an edit to ~/.claude.json that added the archived Slack server, and let npx -y @modelcontextprotocol/server-filesystem . and ls -la through.

Know its limits before you rely on it:

Step 3: approve one server per service

Glow and CSA converge on the same policy: pick one approved MCP server for each service, prefer the server published by the service owner, and add npm deprecation status to the approval criteria. For GitHub that means GitHub's own github-mcp-server rather than the archived reference implementation the agent remembers.

Once the list exists, the hook can enforce it as an allowlist instead of a denylist. That is the stronger design: the agent can propose anything, and the harness only executes what someone approved. The model's training cutoff stops being a supply chain dependency you never chose.

What this does not fix

Three of the four reported flaws have not been described publicly, so you cannot test for them directly. Removing the archived servers is the only complete answer for those. And any machine you do not scan keeps whatever its agent installed last year. Treat the inventory as a recurring job, not a one-time cleanup.

Sources