In this video, you will verify that your server correctly enforces the filesystem boundaries you defined. You will run a test client that attempts to read a “safe” file and then attempts a “jailbreak” to read a secret file.
First, start your secure server. Open your terminal and run the server script.
uv run --with mcp secure_server.py
Wait for the server to initialize on port 8000.
Now, open a second terminal window. This is where you will run the client script.
uv run --with mcp root_client.py
Watch the output carefully.
First, look at Test 1. The client requests hello.txt located inside the sandbox directory. Because this path is within the allowed root, the server permits the read operation, and you see the content: “This is safe to read.”
Now, look at Test 2. The client tries to access secret.txt, which sits one level above the sandbox.
Even though the Python script technically has permission to read that file on your OS, the MCP server intervenes. It detects that the target path is not relative to the sandbox root.
The result is a hard block: ACCESS DENIED. The server successfully prevented the “jailbreak,” keeping your secret data safe.