fix: redact API key in deploy MCP config output#704
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe deploy CLI no longer prints live API keys. A DISPLAY_API_KEY_PLACEHOLDER and create_mcp_config_example(app_name, server_url) produce the MCP config example with a placeholder Authorization header; deploy output now uses that helper. Tests were added to verify no live key is emitted. ChangesAPI Key Redaction in Deploy Output
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 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.
🧹 Nitpick comments (1)
src/mcp_agent/cli/cloud/commands/deploy/main.py (1)
474-476: 💤 Low valueConsider clarifying which API key users should substitute.
The message instructs users to replace the placeholder "with your API key" but doesn't specify whether this should be:
- The same API key used for deployment authentication
- A new key they need to generate
- A project-specific key
Adding a brief clarification could reduce user confusion when copying the configuration.
📝 Suggested clarification
print_info( f"Use this app as an MCP server at {server_url}/sse\n\n" "MCP configuration example " - f"(replace {DISPLAY_API_KEY_PLACEHOLDER} with your API key):" + f"(replace {DISPLAY_API_KEY_PLACEHOLDER} with your authentication API key):" )🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/mcp_agent/cli/cloud/commands/deploy/main.py` around lines 474 - 476, Update the help message that prints the MCP configuration (the f-string containing server_url and DISPLAY_API_KEY_PLACEHOLDER) to clarify which API key to substitute: explicitly state that DISPLAY_API_KEY_PLACEHOLDER should be replaced with the API key for the MCP server (the project/service API key used to authenticate clients to this MCP instance), and indicate whether it must be the same key used for deployment or a separate project-specific key (e.g., "replace {DISPLAY_API_KEY_PLACEHOLDER} with your MCP server/project API key — not the deployment-only token"). Modify the string near where server_url and DISPLAY_API_KEY_PLACEHOLDER are formatted so users know which key to provide.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@src/mcp_agent/cli/cloud/commands/deploy/main.py`:
- Around line 474-476: Update the help message that prints the MCP configuration
(the f-string containing server_url and DISPLAY_API_KEY_PLACEHOLDER) to clarify
which API key to substitute: explicitly state that DISPLAY_API_KEY_PLACEHOLDER
should be replaced with the API key for the MCP server (the project/service API
key used to authenticate clients to this MCP instance), and indicate whether it
must be the same key used for deployment or a separate project-specific key
(e.g., "replace {DISPLAY_API_KEY_PLACEHOLDER} with your MCP server/project API
key — not the deployment-only token"). Modify the string near where server_url
and DISPLAY_API_KEY_PLACEHOLDER are formatted so users know which key to
provide.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: e7bf871a-9dac-4f38-b0dc-e4ea10043c06
📒 Files selected for processing (2)
src/mcp_agent/cli/cloud/commands/deploy/main.pytests/cli/commands/test_deploy_command.py
Summary
<YOUR_API_KEY>.Related Issue
Fixes #669
Verification
uv run ruff format src\mcp_agent\cli\cloud\commands\deploy\main.py tests\cli\commands\test_deploy_command.pyuv run ruff check src\mcp_agent\cli\cloud\commands\deploy\main.py tests\cli\commands\test_deploy_command.pyuv run pytest tests\cli\commands\test_deploy_command.py -q -k "redacts_api_key or placeholder or deploy_command_basic"git diff --checkNotes
3 passed, 13 deselected.tests\cli\commands\test_deploy_command.pyfile on native Windows produced an unrelated existing failure intest_deploy_uses_cwd_mcpacignore_when_config_dir_lacks_one: the test changes into aTemporaryDirectory, then Windows refuses to remove the current working directory during cleanup.Summary by CodeRabbit
Bug Fixes
Tests