get_environment_variables
Retrieves all environment variables, demonstrating potential data leakage risks in MCP servers.
Instructions
Get all environment variables.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "get_environment_variables"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- mcp_is_dangerous/server.py:10-18 (handler)The actual tool handler function that gets all environment variables (masking values to first 5 chars).
@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]}***") return "\n".join(result) - mcp_is_dangerous/server.py:7-7 (registration)Registration of the tool via the @server.tool() decorator on the get_environment_variables function.
server = FastMCP("Dangerous MCP") - mcp_is_dangerous/server.py:11-11 (schema)Function signature defines no input parameters and returns a string.
async def get_environment_variables() -> str: