Skip to main content
Glama

Why MCP X-Ray?

Every enabled MCP server silently injects its full JSON tool definitions into every single LLM turn — whether you call those tools or not. Installing 8–12 MCP servers across Antigravity, Claude Code, Cursor, or Codex can easily burn 15,000–40,000+ context tokens per turn, slow down agent startup by seconds, introduce cross-server tool name shadowing, or expose your agent to MCP Tool-Poisoning prompt-injection attacks hidden inside tool descriptions and schema properties.

MCP X-Ray gives you instant X-ray vision across your entire local MCP stack:

  • Multi-Agent Config Discovery (Read-Only & Secret-Safe) — Automatically discovers MCP configs across:

    • Antigravity Global: ~/.gemini/config/mcp_config.json

    • Antigravity Plugins: ~/.gemini/config/plugins/*/mcp_config.json (resolving ${PLUGIN_ROOT} & ${PLUGIN_DATA})

    • Claude Code: ~/.claude.json (global & per-project) and ~/.claude/settings.json

    • Cursor: ~/.cursor/mcp.json

    • Codex: ~/.codex/config.toml (native parser for [mcp_servers.<name>] & nested env/header tables)

    • Project / Custom: .mcp.json or --config=<path>

    • Every env value, HTTP header value, and secret CLI flag/query param is redacted to •••• in all outputs.

  • Live MCP Schema & Latency Prober — Connects to local stdio MCP servers over @modelcontextprotocol/sdk (StdioClientTransport) with a strict 6-second timeout (automatically skipping mcp-xray itself to guarantee zero recursion):

    • Measures exact startup + handshake + listTools() latency in milliseconds

    • Calls listTools() and listResources() and closes cleanly with zero orphan processes

    • Computes exact estimated token tax (ceil(jsonBytes / 3.7)) per server and per individual tool alongside full JSON Schema depth, property, enum, and description vs. schema token splits

    • Instant static/config-only mode for remote http/sse (serverUrl) servers and fast launches

  • Tool-Poisoning & Collision Security Scanner — Deeply audits every tool's name, description, and nested inputSchema strings for:

    • Hidden Prompt-Injection Directives: <IMPORTANT>, <SYSTEM>, ignore previous instructions, do not tell the user, before calling any other tool, silently send, exfiltrate, read ~/.ssh, piped shell payloads

    • Invisible Unicode Smuggling: Zero-width characters (U+200B–U+200D, U+FEFF), Trojan Source bidirectional overrides (U+202A–U+202E), and Unicode Tag-Block invisible ASCII smuggling (U+E0000–U+E007F, decoded inline!)

    • Cross-Server Tool Collisions & Shadowing: Exact duplicate tool names (read_file in two servers), near-identical canonical names (read_file vs readFile), and 1-char lookalike shadowing

    • Oversized Tool Schemas: Flags any single tool exceeding 800 tokens

  • Interactive Context Diet Simulator & Health Grade (A–F) — Toggle servers on/off with live checkboxes inside the Antigravity MCP App UI to watch per-turn token savings, 20-turn session savings, 128k/200k context window percentage, and your projected Health Grade (A–F) update in real time.


Related MCP server: MCP Doctor

Architecture

flowchart LR
  Host["Antigravity / Claude / Cursor / Codex"] <-->|MCP stdio| Server["MCP X-Ray Server"]
  Host <-->|ui://mcp-xray/app.html| UI["Interactive React MCP App"]
  UI <-->|app.callServerTool| Server
  Server --> Discovery["Multi-Agent Discovery\n(JSONC + Codex TOML + Redaction)"]
  Server --> Prober["Live Stdio Prober\n(6s Timeout · Latency · Token Tax)"]
  Server --> Analyzer["Security & Diet Engine\n(Poisoning · Unicode · Collisions · Grade A–F)"]
  Discovery --> Configs["~/.gemini · ~/.claude · ~/.cursor · ~/.codex"]
  Prober <--> LocalMCP["Local Stdio MCP Servers"]
  Server <--> Cache["0600 Local Probe & Diet Cache"]

Quick Start

1. Google Antigravity Plugin (Full Interactive MCP App UI)

git clone https://github.com/oguzhan-yildirim/mcp-xray.git
cd mcp-xray
npm install
npm run build
npm run install:antigravity

Antigravity automatically discovers the plugin under ~/.gemini/config/plugins/mcp-xray — no restart needed:

  • Open MCP X-Ray from the left Sidebar or side pane + menu.

  • Or ask in chat: "Open MCP X-Ray and show me which MCP servers are burning the most context tokens."

2. Claude Code / Cursor / Codex (Universal MCP Server)

Add mcp-xray to your MCP config (~/.claude.json, ~/.cursor/mcp.json, or ~/.gemini/config/mcp_config.json):

{
  "mcpServers": {
    "mcp-xray": {
      "command": "npx",
      "args": ["-y", "github:oguzhan-yildirim/mcp-xray"]
    }
  }
}

For Codex (~/.codex/config.toml):

[mcp_servers.mcp-xray]
command = "npx"
args = ["-y", "github:oguzhan-yildirim/mcp-xray"]

3. Standalone CLI

# Instant multi-agent config inventory (read-only, secrets redacted)
npx mcp-xray scan

# Scan + live-probe all eligible stdio MCP servers
npx mcp-xray scan --probe

# Live-probe a single server and inspect per-tool token tax & latency
npx mcp-xray probe filesystem

# Full Tool-Poisoning, Collision & Context Diet Audit (exits code 2 on critical alerts)
npx mcp-xray audit

# Machine-readable JSON output for CI pipelines
npx mcp-xray audit --json

MCP Tools Reference

Tool

Visibility

Description

open_mcp_xray

Model + UI Entrypoint

Opens the interactive MCP X-Ray dashboard (aux_pane, global, inline). Works with {} empty args.

scan_mcp_configs

Model + Inline UI

Discovers MCP configs across Antigravity, Plugins, Claude Code, Cursor, Codex & .mcp.json (optional live probe: true).

probe_mcp_server

Model

Live-probes a stdio MCP server (or "all"), returning startup latency (ms), tools, resources, schema depth & token tax.

audit_tool_poisoning

Model + Inline UI

Scans probed or inline tool definitions for prompt injection, hidden Unicode, collisions, oversized schemas, Diet Plan & Health Grade (A–F).


Security Detection Rules

Rule ID

Category

Severity

What It Detects

PI-001

Prompt Injection

Critical

Pseudo-system XML/bracket tags (<IMPORTANT>, <SYSTEM>, [SYSTEM OVERRIDE])

PI-002

Prompt Injection

Critical

Instruction overrides (ignore previous instructions, disregard prior rules)

PI-003

Prompt Injection

Critical

User-concealment stealth directives (do not tell the user, hide this from the user)

PI-004

Prompt Injection

Critical

Cross-tool hijacking (before calling any other tool, always call this tool first)

PI-005

Prompt Injection

Critical

Covert data exfiltration (silently send, exfiltrate, pass contents of ... into)

PI-006

Prompt Injection

Critical

Local secret/file harvesting (read ~/.ssh, ~/.aws, .env, mcp_config.json, private keys)

PI-007

Prompt Injection

High

Remote pipe-to-shell or encoded execution payloads (curl ... | bash, powershell -enc)

UNI-001

Hidden Unicode

Critical

Bidirectional override/isolate control chars (U+202A–U+202E, U+2066–U+2069)

UNI-002

Hidden Unicode

High / Critical

Zero-width invisible chars (U+200B–U+200D, U+2060, U+FEFF)

UNI-003

Hidden Unicode

Critical

Unicode Tag-Block invisible ASCII smuggling (U+E0000–U+E007F, decoded in report)

COLL-001

Tool Collision

High

Identical tool name declared by multiple distinct MCP servers

COLL-002

Tool Collision

Medium

Near-identical canonical tool name shadowing (read_file vs readFile vs read-file)

COLL-003

Tool Collision

Medium

1-character lookalike / typosquat tool shadowing across servers

SIZE-001

Oversized Schema

Medium / High

Single tool exceeding 800 estimated tokens (>1,600 tokens elevated to High)


Agent Toolkit Suite

MCP X-Ray is part of the open-source Agent Toolkit Suite for Antigravity, Claude Code, Cursor, and Codex:

Project

Purpose

find-my-skill

Discover, security-audit, preview & one-click install AI Agent Skills (SKILL.md) from GitHub

mcp-xray

Inspect MCP context token tax, live startup latency, tool-poisoning attacks & simulate a Context Diet

agent-blackbox

Flight recorder, replay timeline & forensic debugger for AI coding agent trajectories

skill-doctor

Linter, trigger-collision analyzer & quality scorer for your local SKILL.md library

mcp-switchboard

Profile manager & one-click context switcher for enabling/disabling MCP server groups per task


Development

npm install
npm run typecheck           # Strict TypeScript check
npm run build               # Builds single-file dist/app.html + standalone dist/server.js
npm test                    # Unit tests (TOML, redaction, tokens, poisoning) + live MCP stdio E2E
npm run install:antigravity # Installs plugin bundle to ~/.gemini/config/plugins/mcp-xray

License

MIT © 2026 Oğuzhan Yıldırım

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Diagnose MCP servers — health checks, tool testing, token cost audits, conflict detection, and security scanning with 50+ prompt injection patterns. Works as CLI or MCP server inside Claude Desktop.
      1
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables agents to inspect and diagnose their own MCP setup by exposing read-only tools that audit configured servers, report which coding agents have configs, surface misplaced or duplicated registrations, and list curated preset packs. It also powers CLI workflows for checking handshake, tool lint, and tool-surface quality scores of any stdio server.
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Lets an agent inspect and audit MCP servers before connecting to them, checking their exposed tools, prompts and resources for tool poisoning, shadowing, excessive permissions, leaked secrets and unsafe transports against 24 deterministic rules. Results are returned as findings with evidence, remediation and CWE/OWASP references, and can fail CI with SARIF, Markdown or standalone HTML reports.
      Apache 2.0
    • A
      license
      A
      quality
      B
      maintenance
      Enables measuring how many tokens each installed MCP server's tool schemas consume in the context window, ranking servers by cost and flagging wasteful schema patterns with estimated savings. It starts each local stdio server, inspects its tools, and reports a verdict without modifying any configuration.
      3
      MIT