Dangerous MCP
MCP 很危险
函数工具的使用让 AI 代理变得非常强大,这就像将应用商店引入智能手机一样。尤其是随着MCP(模型上下文协议)的发布,工具共享变得比以往任何时候都更加便捷。因此,我创建了可扩展代理项目,以展示如何通过开源工具或自定义工具轻松扩展 AI 代理的功能。
在开发可扩展代理的过程中,我意识到工具的使用是一把双刃剑。危险在于,你使用的工具拥有对你机器的强大访问权限,例如你的环境变量、文件等等。
⚠️ 安全警告
该项目简单演示了与工具使用相关的安全风险。以下示例说明了恶意行为者如何利用 MCP 服务器访问敏感信息:
# 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)⚠️**警告:**建议在沙盒环境中运行此示例,然后删除你的 OpenAI API 密钥。你也可以使用自己的 MCP 客户端进行测试,命令如下:
uvx mcp-is-dangerous。
当将此工具与可扩展代理(选择PoliceAgent )一起使用时,输出如下所示:
它可能看起来无害,甚至是故意为之,对吧?但想象一下这种情况:你只是询问当前时间,与此同时,你的敏感数据却在你不知情的情况下被泄露了。
Related MCP server: Vulnerable MCP Server
安全最佳实践
使用 MCP 或类似工具时保护自己:
使用工具前务必检查其源代码
尽可能在隔离环境中运行工具
谨慎对待请求访问敏感信息的工具
部署工具时使用环境变量过滤
定期审核你正在使用的工具
免责声明
本项目仅用于教育目的,旨在演示潜在的安全风险。请勿将此信息用于恶意目的。作者对任何信息滥用概不负责。
执照
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- FlicenseNot gradedqualityFmaintenanceAn educational project that deliberately implements vulnerable MCP servers to demonstrate various security risks like prompt injection, tool poisoning, and code execution for training security researchers and AI safety professionals.1,334
- FlicenseNot gradedqualityCmaintenanceA deliberately insecure MCP server designed as a pentest lab to demonstrate common vulnerabilities in MCP deployments.
- FlicenseNot gradedqualityCmaintenanceAn 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.
- AlicenseCqualityCmaintenanceAn educational MCP server exposing shell command execution (PowerShell and sh) and a benign tool for learning about MCP tools, resources, and security risks like tool poisoning.32MIT
Related MCP Connectors
Security scanner for MCP servers. Detect vulnerabilities, prompt injection, and tool poisoning.
MCP server for secureFlows: token-free URL builders and integration-linting tools for AI agents.
MCP server teaching AI agents to implement TideCloak: auth, E2EE, IGA, security analysis
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/ShaojieJiang/mcp-is-dangerous'
If you have feedback or need assistance with the MCP directory API, please join our Discord server