Logotipo de MCP Xray

MCP Xray

Organización
traceforce

MCP X-Ray is a unified open-source security scanning and penetration testing solution for Model Context Protocol (MCP) servers. It generates production-ready SARIF reports for seamless integration…

Editortraceforce
Repositoriomcp-xray
IdiomaGo
Forks
22
Estrellas
90
Herramientas disponibles
0
Tipo de transportestdio
LicenciaApache-2.0
Enlaces
  • Conecta herramientas a flujos de trabajo con IA

    MCP Xray ofrece funciones MCP que pueden usar los clientes y agentes de IA compatibles.

  • 0 herramientas disponibles

    Explora a continuación las acciones que se pueden invocar, con sus nombres y descripciones cuando el servidor los proporcione.

  • Configuración lista para copiar

    Usa los ejemplos de instalación para configurar este servidor en tu cliente MCP preferido.

  • Indicadores de interés en el código abierto

    90 estrellas y 22 forks en el repositorio enlazado.

MCP X-Ray

[!NOTE] Looking to secure AI agent skills? Check out Skill X-Ray, an open-source static security scanner that analyzes skill packages for malicious or risky behavior before installation, without executing them.

Overview

MCP X-Ray is a unified open-source security scanning and penetration testing solution for Model Context Protocol (MCP) servers. It generates production-ready SARIF reports for seamless integration with security tooling and CI/CD pipelines. Scan results can be optionally uploaded to Traceforce Atlas for centralized security management and tracking. Atlas has over 600 MCPs in its registry, providing a comprehensive security assessment database for the MCP ecosystem.

Installation

Prerequisites

Build from Source

bash
# Clone the repository
git clone https://github.com/traceforce/mcp-xray
cd mcp-xray

# Install required dependencies (buf, etc.)
make install-dependencies

# Build everything (generates protobuf code and builds the binary)
# The binary will be created as `mcpxray` in the current directory
make all

Usage

Configuration Scan

Scan MCP configs for security issues; run before pentest to baseline your setup.

bash
# Scan a specific MCP config file (uses token analyzer by default)
./mcpxray config-scan /path/to/mcp/config.json

# Scan all known MCP config paths automatically for Cursor, Claude and Windsurf.
# Known config locations (relative to home directory):
#   ~/.cursor/mcp.json (Cursor)
#   ~/Library/Application Support/Claude/claude_desktop_config.json (Claude Desktop)
#   ~/.codeium/windsurf/mcp_config.json (Windsurf)
./mcpxray config-scan --scan-known-configs

# Use LLM analyzer for more extensive and deepr analysis
./mcpxray config-scan /path/to/mcp/config.json --analyzer-type llm --llm-model claude-3-5-sonnet-20241022

# Specify custom output file
./mcpxray config-scan /path/to/mcp/config.json --output custom-report.sarif.json

Detection Capabilities:

  • Connection Security: Validates TLS certificates, detects unsafe localhost/loopback exposure, and validates OAuth 2.0 configuration (PRM/ASMD)
  • Secrets Detection: Scans for exposed credentials, API keys, and sensitive information
  • Tool Analysis: Analyzes tool descriptions using Token Analyzer (default) or LLM Analyzer for risks including arbitrary execution, injection vulnerabilities, authorization bypass, and information disclosure

Pentest

Execute security test plans by making actual tool calls against MCP servers. LLMs are required to run the pentest. Run this before actual deployment in production.

bash
# Run pentest with auto-generated test plan (requires LLM model)
./mcpxray pentest /path/to/mcp/config.json --llm-model claude-sonnet-4-5

# Use a custom test plan YAML file
./mcpxray pentest /path/to/mcp/config.json --test-plan /path/to/test-plan.yaml --llm-model claude-sonnet-4-5

Detection Capabilities: Code execution, SSRF, path traversal, authorization bypass, input injection, information disclosure, and DoS vulnerabilities

Repository Scan

Scan the codebase for vulnerabilities; use when you own or can change the code.

bash
# Scan current directory
./mcpxray repo-scan

# Scan a specific repository
./mcpxray repo-scan /path/to/repository

# Specify custom output file
./mcpxray repo-scan --output custom-report.sarif.json

Detection Capabilities:

  • SCA: Detects vulnerable dependencies using OSV API
  • SAST: Taint analysis that traces MCP tool/handler inputs (sources) to dangerous sinks — command injection, code injection, path traversal, SSRF, and SQL injection — plus the existing unsafe-command pattern rules
  • Secrets Detection: Scans for hardcoded secrets and credentials

The taint SAST uses the OpenGrep engine. Install the pinned, SHA-verified binary with make install-opengrep (Linux x86_64/arm64, macOS arm64/x86_64). On other platforms, install opengrep yourself and set MCPXRAY_OPENGREP_BIN. Taint analysis activates by installation: repo-scan runs it whenever the pinned engine is resolvable, and when the engine is absent it skips taint and still runs SCA, secrets, and the unsafe-command rules.

For cross-file, interprocedural taint on Go and TypeScript (and Python), install the CodeQL engine. It activates by installation too, and its findings are merged with OpenGrep's:

bash
make install-codeql                        # pinned CodeQL bundle (Linux x86_64, macOS, Windows)
./mcpxray repo-scan <repo>                 # every installed engine runs; results merged

CodeQL builds a database per language, so a scan takes noticeably longer once the bundle is installed; that cost is the price of cross-file analysis. To drop back to the fast intra-file pass, uninstall the engine the way you installed it: remove the bundle from make install-codeql (it lives next to the binary), or unset MCPXRAY_CODEQL_BIN if you pointed it at one. Python and TypeScript extract build-free (the target is never executed). Go has no build-free mode, so CodeQL compiles the target; that step runs only with --codeql-allow-build and is otherwise skipped with a warning; the scan never blocks on a prompt.

Each language gets a time budget covering database create plus analyze — 600s by default. A target that exceeds it contributes nothing, so raise it for large repositories with --codeql-timeout <seconds> (or MCPXRAY_CODEQL_TIMEOUT); the flag wins when both are set. Exceeding the budget is reported as timed out after Ns, never as a clean zero.

Output Format

MCP X-Ray generates reports in SARIF (Static Analysis Results Interchange Format) format, which is widely supported by security tools and CI/CD platforms.

Uploading Results to Traceforce

Upload scan results to Traceforce Atlas for centralized security management, reporting, and tracking over time. Add the --upload flag to any scan command. Use --clean-up to remove generated files after successful upload.

Environment variables required:

  • TRACEFORCE_CLIENT_ID
  • TRACEFORCE_CLIENT_SECRET

These credentials can be downloaded from the settings page on the Atlas UI.

bash
# Upload config scan results
./mcpxray config-scan /path/to/mcp/config.json --upload

# Upload with cleanup
./mcpxray config-scan /path/xia-add-registry-imageto/mcp/config.json --upload --clean-up

# Upload pentest results
./mcpxray pentest /path/to/mcp/config.json --llm-model claude-sonnet-4-5 --upload

Atlas Report History

Examples

Example scan outputs are available in examples/findings/.

Example MCP configuration files are available in the examples/mcp_configs/ directory.

An example MCP Server is available in the examples/mcp_server/ directory:

  • mcp_server.py: FastMCP server using streamable-http transport
  • mcp.json: Configuration file for connecting to the server
  • README.md: Instructions for setting up and scanning the server

Configuration

Tool Analysis Methods

MCP X-Ray provides two methods for analyzing tool security:

Token Analyzer (Default)

The token analyzer uses rule-based pattern matching to quickly detect security issues in tool descriptions. It's fast, doesn't require API keys, and works offline. Token analyzer uses two types of rules:

  1. Token rules are defined in internal/configscan/tokenanalyzer/token_rules.yaml. Each rule specifies:
    • Pattern matching criteria (tokens and phrases)
    • Severity level (low, medium, high, critical)
    • Security category and reason
  2. YARA rules are defined in internal/yararules/unsafe_patterns.yar. These rules detect unsafe system command patterns.

Usage:

bash
mcpxray config-scan --analyzer-type token

LLM Analyzer

The LLM analyzer uses large language models for deep semantic analysis of tool descriptions, providing more comprehensive security insights.

Usage:

bash
mcpxray config-scan --analyzer-type llm --llm-model <model-name>

Pentest Configuration

By default, the pentest tool uses an LLM to automatically generate test plans based on the available tools from MCP servers. Test plans can also be customized and provided as YAML files. Test plans are YAML files containing test cases with input arguments and expected outputs.

Default behavior (LLM-generated test plan):

bash
./mcpxray pentest /path/to/mcp/config.json --llm-model claude-sonnet-4-5

Custom test plan:

bash
./mcpxray pentest /path/to/mcp/config.json --test-plan /path/to/test-plan.yaml --llm-model claude-sonnet-4-5

Supported Models

MCP X-Ray supports the following LLM providers for tool analysis:

Anthropic (Claude)

  • Examples: claude-sonnet-4-5
  • Requires: ANTHROPIC_API_KEY environment variable

OpenAI (GPT)

  • Examples: gpt-5
  • Requires: OPENAI_API_KEY environment variable

AWS Bedrock (Meta Llama)

  • Meta Llama inference profile ARNs starting with arn:aws:bedrock: and containing llama
  • Example: arn:aws:bedrock:<region>:<account-id>:inference-profile/us.meta.llama3-2-1b-instruct-v1:0
  • Requires: AWS credentials configured via AWS SDK (environment variables, IAM role, or credentials file)

Environment Variables

For LLM-based tool analysis, configure your LLM API credentials:

Anthropic

bash
export ANTHROPIC_API_KEY=your-api-key

OpenAI

bash
export OPENAI_API_KEY=your-api-key

Each provider requires its own specific environment variable. The tool automatically detects which provider to use based on the model name.

AWS Bedrock

For AWS Bedrock models, configure AWS credentials using one of the standard AWS SDK methods:

bash
# Option 1: Environment variables
export AWS_ACCESS_KEY_ID=your-access-key
export AWS_SECRET_ACCESS_KEY=your-secret-key
export AWS_REGION=us-east-1

# Option 2: AWS credentials file (~/.aws/credentials)
# Option 3: IAM role (when running on EC2/ECS/Lambda)

MCP X-Ray uses AWS SDK that will automatically load credentials from the environment, credentials file, or IAM role.

Contributing

Contributions are welcome! Please ensure that:

  1. Code follows Go best practices
  2. Tests and examples are included for new features
  3. Documentation is updated

References

Usa el MCP de MCP Xray con varios modelos de IA

TypingMind conecta las herramientas MCP a nivel del espacio de trabajo, por lo que, una vez conectado MCP Xray, puedes usarlo con distintos modelos de IA en TypingMind sin tener que configurarlo por separado para cada modelo. Esta integración MCP se ejecuta localmente en tu dispositivo a través del conector MCP de TypingMind.

Guía de configuración para usar el conector local

Usa esta opción si el servidor MCP necesita acceder a archivos locales, aplicaciones o recursos privados de tu ordenador.

1

Abre los ajustes de MCP

En TypingMind, ve a Ajustes, luego a Ajustes avanzados y a Model Context Protocol, y elige Configurar conector.

  1. Abre TypingMind en tu navegador.
  2. Haz clic en el icono de Ajustes.
  3. Ve a Ajustes avanzados.
  4. Abre la sección Model Context Protocol.
  5. Haz clic en Configurar conector y elige Este dispositivo.
Pantalla de configuración del conector MCP de TypingMind con «Este dispositivo» seleccionado
2

Ejecuta el comando del conector

Elige Este dispositivo, copia el comando de TypingMind y ejecútalo en Terminal. Mantén el proceso en ejecución mientras uses MCP.

  1. Copia el comando de configuración que muestra TypingMind.
  2. Abre Terminal en macOS o Windows Terminal en Windows.
  3. Pega y ejecuta el comando.
  4. Acepta la instalación del paquete si Terminal te pide confirmación para continuar.
  5. Mantén el proceso en ejecución en la ventana de Terminal mientras uses las herramientas MCP.
3

Añade MCP Xray como servidor

Cuando el estado del conector sea «Listo», haz clic en «Edita servidores» y pega la configuración del servidor MCP.

  1. Espera hasta que el estado del conector indique «Listo».
  2. Haz clic en Edita servidores.
  3. Pega la configuración del servidor MCP de MCP Xray.
  4. Guarda la lista de servidores.
  5. Actualiza para comprobar que el conector sigue listo.
Ajustes de MCP de TypingMind con un servidor activo y el botón «Edita servidores»
{
  "mcpServers": {
    "mcp-xray": {
      "command": "npx",
      "args": [
        "-y",
        "<mcp-server-package>"
      ]
    }
  }
}
4

Úsala con distintos modelos

Guarda la lista de servidores, abre Plugins, activa las herramientas MCP de MCP Xray y selecciona cualquier modelo de IA compatible en TypingMind para usar las herramientas en el chat o asignárselas a un agente de IA.

  1. Abre la página Plugins en TypingMind.
  2. Activa las herramientas MCP de MCP Xray.
  3. Inicia un chat y elige el modelo de IA que quieras usar.
  4. Usa las herramientas MCP en el chat o asígnalas a un agente de IA.
  5. Cambia a otro modelo de IA cuando lo necesites sin volver a conectar MCP.
Chat de TypingMind que usa herramientas MCP activadas con un modelo de IA seleccionado
¿Puedes usar MCP Xray para ayudarme con esta tarea?
MCP Xray
Claro. Lo he leído.
Esto he encontrado usando MCP Xray.

Preguntas frecuentes

¿Para qué sirve el servidor MCP MCP Xray?

MCP Xray es un servidor MCP que permite a los clientes de IA compatibles conectarse a herramientas y contexto externos. En TypingMind, basta con añadir este servidor MCP una vez para que sus herramientas estén disponibles en tu espacio de trabajo de IA.

¿Puedo usar el servidor MCP MCP Xray con varios modelos de IA en TypingMind?

Sí. TypingMind conecta las herramientas MCP a nivel del espacio de trabajo, por lo que puedes usar MCP Xray con distintos modelos de IA, como Claude, ChatGPT, Gemini u otros que hayas configurado en TypingMind, sin configurar el servidor MCP por separado para cada modelo.

¿Por qué usar el conector MCP de MCP Xray con TypingMind?

TypingMind es una de las mejores interfaces de chat con LLM porque reúne varios modelos de IA, prompts, plugins, agentes de IA, claves de API y herramientas MCP en un solo espacio de trabajo. Con MCP Xray conectado, puedes usar sus herramientas MCP con tus modelos preferidos y mantener organizado tu flujo de trabajo de chat en TypingMind.

¿Cómo conecto el servidor MCP MCP Xray a TypingMind?

MCP Xray funciona a través del conector MCP local de TypingMind. Es la mejor opción cuando el servidor MCP necesita acceder a archivos locales, aplicaciones de escritorio, herramientas de línea de comandos o recursos privados de tu ordenador.

¿Qué herramientas ofrece el servidor MCP MCP Xray en TypingMind?

MCP Xray ofrece funciones MCP que puedes activar desde la página Plugins de TypingMind y usar en el chat o asignar a agentes de IA.

¿Tengo que compartir mis claves de API con TypingMind para usar el servidor MCP MCP Xray?

No. TypingMind prioriza el funcionamiento local y te permite mantener el control de tus proveedores de modelos, claves de API, prompts y configuración MCP. Si MCP Xray requiere autenticación, añade las cabeceras, los ajustes de OAuth o la configuración local necesarios para ese servidor MCP al crear la conexión.

Servidores MCP relacionados

Ver todos

Crea ya tu propio espacio de trabajo IA

Suscríbete a nuestro boletín para recibir avisos sobre nuevas funciones y próximos sorteos 👇