Skip to content

Commit f2986dc

Browse files
committed
pr feedback & readme update
1 parent 1e90782 commit f2986dc

2 files changed

Lines changed: 39 additions & 2 deletions

File tree

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -560,6 +560,21 @@ Read-only mode provides secure, restricted access by:
560560
- Automatically filtering out tools that require write permissions at startup
561561
- Allowing read operations: list, get, search, and export across all services
562562

563+
**🔐 Granular Permissions**
564+
```bash
565+
# Per-service permission levels
566+
uv run main.py --permissions gmail:organize drive:readonly
567+
568+
# Combine permissions with tier filtering
569+
uv run main.py --permissions gmail:send drive:full --tool-tier core
570+
```
571+
Granular permissions mode provides service-by-service scope control:
572+
- Format: `service:level` (one entry per service)
573+
- Gmail levels: `readonly`, `organize`, `drafts`, `send`, `full` (cumulative)
574+
- Other services currently support: `readonly`, `full`
575+
- `--permissions` and `--read-only` are mutually exclusive
576+
- With `--tool-tier`, only tier-matched tools are enabled and only services with matching tier tools are imported
577+
563578
**★ Tool Tiers**
564579
```bash
565580
uv run main.py --tool-tier core # ● Essential tools only
@@ -738,6 +753,9 @@ uv run main.py --tool-tier complete # Enable all availabl
738753
uv run main.py --tools gmail drive --tool-tier core # Core tools for specific services
739754
uv run main.py --tools gmail --tool-tier extended # Extended Gmail functionality only
740755
uv run main.py --tools docs sheets --tool-tier complete # Full access to Docs and Sheets
756+
757+
# Combine tier selection with granular permission levels
758+
uv run main.py --permissions gmail:organize drive:full --tool-tier core
741759
```
742760

743761
## 📋 Credential Configuration

main.py

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,23 @@ def format(self, record):
9191
handler.setFormatter(safe_formatter)
9292

9393

94+
def resolve_permissions_mode_selection(
95+
permission_services: list[str], tool_tier: str | None
96+
) -> tuple[list[str], set[str] | None]:
97+
"""
98+
Resolve service imports and optional tool-name filtering for --permissions mode.
99+
100+
When a tier is specified, both:
101+
- imported services are narrowed to services with tier-matched tools
102+
- registered tools are narrowed to the resolved tool names
103+
"""
104+
if tool_tier is None:
105+
return permission_services, None
106+
107+
tier_tools, tier_services = resolve_tools_from_tier(tool_tier, permission_services)
108+
return tier_services, set(tier_tools)
109+
110+
94111
def main():
95112
"""
96113
Main entry point for the Google Workspace MCP server.
@@ -306,8 +323,10 @@ def main():
306323
if args.tool_tier is not None:
307324
# Combine with tier filtering within the permission-selected services
308325
try:
309-
tier_tools, _ = resolve_tools_from_tier(args.tool_tier, tools_to_import)
310-
set_enabled_tool_names(set(tier_tools))
326+
tools_to_import, tier_tool_filter = resolve_permissions_mode_selection(
327+
tools_to_import, args.tool_tier
328+
)
329+
set_enabled_tool_names(tier_tool_filter)
311330
except Exception as e:
312331
print(
313332
f"Error loading tools for tier '{args.tool_tier}': {e}",

0 commit comments

Comments
 (0)