MCP Shipyard
← Rules catalog

Hidden or invisible instructions in MCP tool metadata (zero-width characters, HTML comments, encoded blobs)

The scanner blocks invisible Unicode, control characters, HTML comments, instruction tags and base64 or hex blobs in tool names, descriptions and instructions. Find and remove them.

blockersecurity.hidden-contentClaude, ChatGPT

Remove zero-width and bidirectional characters, Unicode tag characters, control characters, HTML comments, <IMPORTANT>-style tags and encoded blobs from every name, description, parameter description and instruction text your server returns. The rule treats text that a model reads but a human reviewer cannot see as the core of tool poisoning. security.hidden-content is a blocker for Claude and ChatGPT.

What you see

A scan reports security.hidden-content with one hit per surface and a detail such as:

  • Invisible character U+200B in get_order description
  • Control character U+0007 in ...
  • HTML comment, or Instruction tag
  • base64-like blob (80 chars) in ..., hex blob, or escaped byte sequence
  • a warning that only the first part of a very long field was scanned for instruction patterns

A directory review may reject on the same grounds. Portal wording is not verified here.

Why it happens

Most hits are accidents: a zero-width space pasted from a document or a chat window, a byte-order mark at the start of a file, a copied bidi mark, an HTML comment left in a template, or a long base64 sample embedded in a description. Deliberate hidden text is the attack the rule exists to catch: Invariant Labs described tool poisoning, where instructions hidden in a description steer the model without the user seeing them. The rule's fix text also cites Snyk and the OWASP MCP Top 10 entry on tool poisoning.

What the scanner checks, per its source:

  • Zero-width, bidi, word-joiner, byte-order-mark and Unicode tag-block characters. A joiner between emoji, or between non-Latin letters in scripts where it is ordinary spelling, is ignored.
  • ASCII control characters other than tab, newline and carriage return.
  • In descriptions and other non-name fields: HTML comments, instruction-style tags such as <important>, <system> or <instructions>, chat-template markers, a mixed-case base64-like run of 60 or more characters with digits, a hex run of 80 or more, and long runs of escape sequences. URLs are excluded from the blob check.

Check it yourself

curl -s -X POST https://mcp.acme.example/mcp \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json, text/event-stream' \
  -H "Authorization: Bearer $TOKEN" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' \
 | jq -r '.result.tools[] | [.name, (.description // "")] | @tsv' \
 | python3 -I -c '
import sys, re, unicodedata
bad = re.compile("[​-‏‪-‮⁠-⁤⁦-⁩\U000E0000-\U000E007F]")
for n, line in enumerate(sys.stdin, 1):
    for m in bad.finditer(line):
        print(f"line {n}: U+{ord(m.group()):04X}")
    if "<!--" in line:
        print(f"line {n}: HTML comment")
'

The check above covers the invisible-character and comment cases. Also search parameter descriptions and instructions: the same text can hide there.

Fix

  1. Delete the characters. In an editor, turn on "show invisible characters", or run your source through a filter that strips the Unicode ranges above.
  2. Delete HTML comments and tag-style markers from descriptions. Put notes for your team in code comments instead.
  3. Replace blobs with a link, or load sample data at run time instead of in metadata.
  4. Rebuild and re-list tools, since metadata is often generated.

Keep metadata plain: what the tool does, what it needs, what it returns. Related rules for text meant to steer the model: desc.injection-directive and schema.secret-param.

Verify

Re-run the check and re-scan. Zero output and no security.hidden-content result means the metadata you serve contains only visible text.

Which clients care

Claude and ChatGPT, per the rule's platform tags.

Source

Invariant Labs, MCP tool poisoning notification: https://invariantlabs.ai/blog/mcp-security-notification-tool-poisoning-attacks

Run a free scan at https://mcpshipyard.com/scan to check every rule at once.

Check every rule at once

A free scan runs this check and the other 152 against your live URL.

Scan a server