Skip to main content

Add your description here

Project description

MCP is Dangerous

Function tool usage makes AI Agents very powerful, which is akin to introducing app stores to smartphones. Especially with the release of MCP (Model Context Protocol), tool sharing has become easier than ever. That's why I've created the extendable-agents project to showcase how easy you can extend the capabilities of AI Agents through open-source tools or your custom tools.

While working on extendable-agents, I've realized that tool usage is a double-edged sword. The danger is that the tools you use have powerful access to your machine, such as your environment variables, files, etc.

⚠️ Security Warning

This project is a simple demonstration of the security risks associated with tool usage. The example below illustrates how malicious actors could potentially exploit MCP servers to access sensitive information:

# 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)

Best Practices for Security

To protect yourself when using MCP or similar tools:

  1. Always review the source code of tools before using them
  2. Run tools in isolated environments when possible
  3. Be cautious of tools requesting access to sensitive information
  4. Use environment variable filtering when deploying tools
  5. Regularly audit the tools you're using

Disclaimer

This project is meant for educational purposes only to demonstrate potential security risks. Do not use this knowledge for malicious purposes. The author is not responsible for any misuse of this information.

License

MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mcp_is_dangerous-0.0.3.tar.gz (62.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mcp_is_dangerous-0.0.3-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

Details for the file mcp_is_dangerous-0.0.3.tar.gz.

File metadata

  • Download URL: mcp_is_dangerous-0.0.3.tar.gz
  • Upload date:
  • Size: 62.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for mcp_is_dangerous-0.0.3.tar.gz
Algorithm Hash digest
SHA256 132c90db073c490a33bdbe9e7f8d89bf16e76e202636f4b648d2aca9a044b0ca
MD5 a7618ffc8dd3eb864c331a55af930623
BLAKE2b-256 6e1350810ba7faeb5061ed135d3cd17a9641791f9be87fb614455955f2e30bd7

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcp_is_dangerous-0.0.3.tar.gz:

Publisher: release.yml on ShaojieJiang/mcp-is-dangerous

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mcp_is_dangerous-0.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for mcp_is_dangerous-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 c72388e436f2357b02bc10c819e06b266d6a97a9713c020baff58f912d4af250
MD5 fbe87778766f0d9ebfd56f7156b6f8db
BLAKE2b-256 57b747026e580e7dff3469d5c0943b05dcb19048c15391fc4a4cf5aef2393efc

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcp_is_dangerous-0.0.3-py3-none-any.whl:

Publisher: release.yml on ShaojieJiang/mcp-is-dangerous

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page