Skip to content

Instantly share code, notes, and snippets.

@KyMidd
Created December 4, 2025 03:20
Show Gist options
  • Select an option

  • Save KyMidd/fbb6263fa03a1db37cf2c891d647d12f to your computer and use it in GitHub Desktop.

Select an option

Save KyMidd/fbb6263fa03a1db37cf2c891d647d12f to your computer and use it in GitHub Desktop.
After: MCPClient tool_filters parameter
# MCPClient filters declaratively
TOOLS_PREFIX = "github"
READ_ONLY_PREFIXES = ["download_", "get_", "list_", "search_"]
github_mcp_client = MCPClient(
lambda: streamablehttp_client(...),
tool_filters={
"allowed": [lambda tool: tool.tool_name.startswith(tuple(
f"{TOOLS_PREFIX}_{p}" for p in READ_ONLY_PREFIXES
))]
},
prefix=TOOLS_PREFIX,
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment