MCPSafe.io
RegistryThreatsMethodologyDocsPricingScanSign in
MCPSafe.io

Security checks for MCP servers — public packages and private repos, fast or deep.

Legal

Privacy PolicyCookie PolicyTerms of ServiceSecurity disclosure

Resources

State of MCP SecuritySupportSystem statusMade in Germany 🇩🇪

© 2026 MCPSafe. All rights reserved.

GDPR — Privacy Policy
← Threat Catalog

Tool Definition & Lifecycle

MCP roots over-broadly scoped

HIGHCWE: CWE-276Rule: MCP-213

An MCP server declares `roots` that grant access to broad filesystem paths (`/`, `~`, `*`) instead of a narrow project directory, expanding the blast radius of any tool bug.

What it is

MCP's `roots` declaration is the server's contract with the client about which paths it intends to access. When the contract is wide open, a path-traversal bug or prompt-injected file read becomes a full-system read instead of a directory-scoped one. Roots like `file:///` or `file:///home` mean every readable file on the host is in scope.

Why it matters for MCP

Clients use `roots` to gate confirmation prompts and to decide what to permit. A server that requests `/` is requesting the maximum privilege the client knows how to grant. Writing the manifest narrowly (`file:///srv/notes`) is the cheapest defense in depth available — and the one most often skipped during early development.

Vulnerable example

example.py
1
from mcp.server.fastmcp import FastMCP
2
3
mcp = FastMCP(
4
    "notes-server",
5
    roots=["file:///"],  # Whole filesystem in scope
6
)

Secure example

example.py
1
from mcp.server.fastmcp import FastMCP
2
from pathlib import Path
3
4
NOTES_DIR = Path("~/notes").expanduser().resolve()
5
6
mcp = FastMCP(
7
    "notes-server",
8
    roots=[f"file://{NOTES_DIR}"],
9
)

How MCPSafe detects this

MCPSafe parses the `roots` argument to `FastMCP`, `McpServer`, or the equivalent SDK constructor and flags root URIs that resolve to `/`, `~`, `~/`, drive roots (`C:\\`), or contain glob characters. Roots scoped to a named subdirectory are accepted.

See the full threat catalog for every documented detection.

Further reading

  • MCP Spec — Roots
  • CWE-276: Incorrect Default Permissions

Scan an MCP server for this issue

MCPSafe runs this check — and every other rule in the catalog — on any MCP server you paste in.

Scan now