Download scripts/mcp-tmp-guard from Cnass/Claude: direct link, hf CLI and curl.
- Browser
- Download file 732 Bytes
-
https://huggingface.co/spaces/Cnass/Claude/resolve/main/scripts/mcp-tmp-guard
- Command line
-
hf download hf://spaces/Cnass/Claude/scripts/mcp-tmp-guard
-
curl -L -o mcp-tmp-guard https://huggingface.co/spaces/Cnass/Claude/resolve/main/scripts/mcp-tmp-guard
732 Bytes
| #!/bin/sh | |
| # Claude Code PreToolUse hook for the Bash tool, registered for every Claude in | |
| # this image by /etc/claude-code/managed-settings.json: refuses `claude mcp add` | |
| # when the MCP server would run from /tmp (wiped on every Space restart) or | |
| # straight from ~/mcp-servers on the bucket (use agentweb-install instead). | |
| # Commands without "mcp", "add" and a temp path never start node. | |
| # The Space variable AGENTWEB_MCP_GUARD=0 turns it off. | |
| case "${AGENTWEB_MCP_GUARD:-1}" in | |
| 0 | off | false | no) exit 0 ;; | |
| esac | |
| input=$(cat) | |
| case "$input" in | |
| *mcp*add*) ;; | |
| *) exit 0 ;; | |
| esac | |
| case "$input" in | |
| */tmp* | */dev/shm* | *mcp-servers*) ;; | |
| *) exit 0 ;; | |
| esac | |
| printf '%s' "$input" | exec node "$(dirname "$0")/mcp-tmp-guard.js" | |