Something went wrong. Try again.
mirror of github.com/PrefectHQ/fastmcp
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546---title: Client RootssidebarTitle: Rootsdescription: Provide local context and resource boundaries to MCP servers.icon: folder-tree---
import { VersionBadge } from '/snippets/version-badge.mdx'
<VersionBadge version="2.0.0" />
Use this when you need to tell servers what local resources the client has access to.
Roots inform servers about resources the client can provide. Servers can use this information to adjust behavior or provide more relevant responses.
## Static Roots
Provide a list of roots when creating the client:
```pythonfrom fastmcp import Client
client = Client( "my_mcp_server.py", roots=["/path/to/root1", "/path/to/root2"])```
## Dynamic Roots
Use a callback to compute roots dynamically when the server requests them:
```pythonfrom fastmcp import Clientfrom fastmcp.client.roots import RequestContext
async def roots_callback(context: RequestContext) -> list[str]: print(f"Server requested roots (Request ID: {context.request_id})") return ["/path/to/root1", "/path/to/root2"]
client = Client( "my_mcp_server.py", roots=roots_callback)```