feat: Add USER_GOOGLE_EMAIL to server instructions for single-user mode#423
feat: Add USER_GOOGLE_EMAIL to server instructions for single-user mode#423gpminsuk wants to merge 2 commits intotaylorwilsdon:mainfrom
Conversation
When USER_GOOGLE_EMAIL environment variable is set, include it in the MCP server instructions so that AI clients know which email to use for Google Workspace tools without asking the user. This improves the experience for desktop apps that handle OAuth externally and pass credentials via GOOGLE_MCP_CREDENTIALS_DIR + USER_GOOGLE_EMAIL. Co-Authored-By: Claude Opus 4.5 <[email protected]>
✅ Test ResultsTest 1: With
|
|
@coderabbitai ready |
|
✅ Actions performedReview triggered.
|
📝 WalkthroughWalkthroughThe change adds server instructions to the MCP server initialization in single-user mode by incorporating the Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@core/server.py`:
- Line 63: The current log call prints raw USER_GOOGLE_EMAIL which exposes PII;
change the logger.info call that references USER_GOOGLE_EMAIL to avoid writing
the full address (e.g., log a masked version or only the domain/confirmation
flag). Locate the logger.info(...) usage in core/server.py that references
USER_GOOGLE_EMAIL and replace it with a message that either masks the local part
(keep USER_GOOGLE_EMAIL but transform it before logging), logs only the domain
or a non-sensitive confirmation like "User instructions configured for an
authenticated user", or call a small helper (e.g., mask_email) to produce the
sanitized value before passing to logger.info.
| _server_instructions = f"""Connected Google account: {USER_GOOGLE_EMAIL} | ||
|
|
||
| When using Google Workspace tools, always use `{USER_GOOGLE_EMAIL}` as the `user_google_email` parameter. Do not ask the user for their email address.""" | ||
| logger.info(f"Server instructions configured for user: {USER_GOOGLE_EMAIL}") |
There was a problem hiding this comment.
Avoid logging raw email address (PII) in application logs.
Line 63 logs full USER_GOOGLE_EMAIL, which is unnecessary PII exposure. Prefer a non-sensitive confirmation log.
🔒 Proposed fix
- logger.info(f"Server instructions configured for user: {USER_GOOGLE_EMAIL}")
+ logger.info("Server instructions configured from USER_GOOGLE_EMAIL")📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| logger.info(f"Server instructions configured for user: {USER_GOOGLE_EMAIL}") | |
| logger.info("Server instructions configured from USER_GOOGLE_EMAIL") |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@core/server.py` at line 63, The current log call prints raw USER_GOOGLE_EMAIL
which exposes PII; change the logger.info call that references USER_GOOGLE_EMAIL
to avoid writing the full address (e.g., log a masked version or only the
domain/confirmation flag). Locate the logger.info(...) usage in core/server.py
that references USER_GOOGLE_EMAIL and replace it with a message that either
masks the local part (keep USER_GOOGLE_EMAIL but transform it before logging),
logs only the domain or a non-sensitive confirmation like "User instructions
configured for an authenticated user", or call a small helper (e.g., mask_email)
to produce the sanitized value before passing to logger.info.
Closes #424
Summary
When
USER_GOOGLE_EMAILenvironment variable is set, include it in the MCP server instructions so that AI clients (like Claude) know which email to use for Google Workspace tools without asking the user.Problem
In single-user mode with
USER_GOOGLE_EMAILset, Claude still asks for the user's email address when using Google Workspace tools because:user_google_emailparameter is required in all tool schemasUSER_GOOGLE_EMAILenv varSolution
When
USER_GOOGLE_EMAILis set, pass it as server instructions via the MCP protocol:Use Case
Desktop apps (like Gobi Desktop) that handle OAuth externally and pass credentials via
GOOGLE_MCP_CREDENTIALS_DIR+USER_GOOGLE_EMAIL. Currently users must tell Claude their email every time, even though the server already knows it.Test Plan
[email protected] uvx workspace-mcp --single-user🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Chores