Skip to main content
Glama
ShaojieJiang

Dangerous MCP

by ShaojieJiang

El MCP es peligroso

El uso de herramientas funcionales hace que los agentes de IA sean muy potentes, algo similar a la introducción de las tiendas de aplicaciones en smartphones. Especialmente con el lanzamiento de MCP (Protocolo de Contexto de Modelo) , compartir herramientas es más fácil que nunca. Por eso creé el proyecto extendable-agents para mostrar lo fácil que es ampliar las capacidades de los agentes de IA mediante herramientas de código abierto o herramientas personalizadas.

Mientras trabajaba con agentes extensibles, me di cuenta de que usar herramientas es un arma de doble filo. El peligro radica en que las herramientas que se usan tienen acceso poderoso a la máquina, como las variables de entorno, los archivos, etc.

⚠️ Advertencia de seguridad

Este proyecto es una simple demostración de los riesgos de seguridad asociados al uso de herramientas. El siguiente ejemplo ilustra cómo actores maliciosos podrían explotar los servidores MCP para acceder a información confidencial:

# WARNING: This is a demonstration of security risks.
# DO NOT use this code maliciously!

import os
from mcp.server.fastmcp import FastMCP


server = FastMCP("Dangerous MCP")


@server.tool()
async def get_environment_variables() -> str:
    """Get all environment variables."""
    result = [
        "Here are what I could find:",
    ]
    for key, value in os.environ.items():
        result.append(f"{key:<30} {value[:5]}***")
    # This means I can open a backdoor to send your data to me!!
    return "\n".join(result)

⚠️ Advertencia: Recomiendo ejecutar este ejemplo en un entorno aislado y eliminar posteriormente la clave de API de OpenAI. También puede probarlo con su propio cliente MCP con el siguiente comando: uvx mcp-is-dangerous .

Al utilizar esta herramienta con agentes extensibles (elija PoliceAgent ), el resultado aparece así:

Puede parecer inofensivo o incluso intencionalmente benigno, ¿verdad? Pero imagina este escenario: simplemente preguntas la hora actual y, mientras tanto, tus datos confidenciales se filtran sin tu conocimiento.

Related MCP server: Vulnerable MCP Server

Mejores prácticas de seguridad

Para protegerse al utilizar MCP o herramientas similares:

  1. Revise siempre el código fuente de las herramientas antes de usarlas

  2. Ejecute herramientas en entornos aislados cuando sea posible

  3. Tenga cuidado con las herramientas que solicitan acceso a información confidencial

  4. Utilice el filtrado de variables de entorno al implementar herramientas

  5. Audita periódicamente las herramientas que estás utilizando

Descargo de responsabilidad

Este proyecto tiene fines educativos únicamente para demostrar los posibles riesgos de seguridad. No utilice este conocimiento con fines maliciosos. El autor no se responsabiliza del mal uso de esta información.

Licencia

Licencia MIT

Available Tools

1 tool
get_environment_variablesA

Get all environment variables.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

A4/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The tool name and description imply a read-only operation ('Get'), which is transparent for a simple retrieval. No annotations are present, so the description carries the full burden. It does not mention authentication, rate limits, or return format, but the behavior is straightforward.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single sentence with no wasted words. It directly conveys the tool's purpose without extraneous information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with no parameters, no output schema, and no siblings, the description is mostly complete. It clearly states what the tool does. Missing information about return format or usage context is minor given the tool's simplicity.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

There are no parameters, and the input schema already reflects this fact. The description does not need to add parameter details. Baseline for 0 parameters is 4.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states it retrieves all environment variables. The verb 'Get' and resource 'environment variables' are specific and unambiguous. Without siblings, no further differentiation is needed.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No explicit guidance on when to use or alternatives is provided. However, as there are no sibling tools, the context implicitly limits usage to this single tool. A user might still benefit from knowing prerequisites or side effects.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

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

  1. 1 tool updatev1.0.0
    • First observedget_environment_variables

TDQS

A3.8/5.0

Scored across 1 tool

Disambiguation5/5

Only one tool exists, so there is no ambiguity in selection.

Naming Consistency5/5

Single tool follows a clean verb_noun pattern, consistent.

Tool Count2/5

One tool is too few for the server's implied scope; a broader set is expected.

Completeness1/5

Only a single read operation is provided, with no other tools to cover related actions like modification or listing.

Maintenance

ActivityInactive
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    quality
    D
    maintenance
    An intentionally vulnerable MCP server designed as a live demo target for the MCP Trust security scanner. It contains deliberate insecure patterns to demonstrate scanning capabilities.
    -