Make FASTMCP_SHOW_SERVER_BANNER apply to all server startup methods#2771
Make FASTMCP_SHOW_SERVER_BANNER apply to all server startup methods#2771
Conversation
Renamed from FASTMCP_SHOW_CLI_BANNER and now respected by server.run() in addition to the CLI.
WalkthroughThis pull request renames the environment variable and settings configuration field from Possibly related PRs
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ 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
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (2)
tests/cli/test_cli.pyis excluded by none and included by nonetests/server/test_server.pyis excluded by none and included by none
📒 Files selected for processing (4)
docs/development/upgrade-guide.mdxsrc/fastmcp/cli/cli.pysrc/fastmcp/server/server.pysrc/fastmcp/settings.py
🧰 Additional context used
📓 Path-based instructions (4)
src/fastmcp/**/*.py
📄 CodeRabbit inference engine (AGENTS.md)
src/fastmcp/**/*.py: Python ≥ 3.10 with full type annotations required
Prioritize readable, understandable code - clarity over cleverness. Avoid obfuscated or confusing patterns even if shorter
Follow existing patterns and maintain consistency in code implementation
Be intentional about re-exports - don't blindly re-export everything to parent namespaces. Core types defining a module's purpose should be exported. Specialized features can live in submodules. Only re-export to fastmcp.* for most fundamental types
Never use bare except - be specific with exception types
Files:
src/fastmcp/server/server.pysrc/fastmcp/settings.pysrc/fastmcp/cli/cli.py
docs/**/*.mdx
📄 CodeRabbit inference engine (docs/.cursor/rules/mintlify.mdc)
docs/**/*.mdx: Use clear, direct language appropriate for technical audiences
Write in second person ('you') for instructions and procedures in MDX documentation
Use active voice over passive voice in MDX technical documentation
Employ present tense for current states and future tense for outcomes in MDX documentation
Maintain consistent terminology throughout all MDX documentation
Keep sentences concise while providing necessary context in MDX documentation
Use parallel structure in lists, headings, and procedures in MDX documentation
Lead with the most important information using inverted pyramid structure in MDX documentation
Use progressive disclosure in MDX documentation: present basic concepts before advanced ones
Break complex procedures into numbered steps in MDX documentation
Include prerequisites and context before instructions in MDX documentation
Provide expected outcomes for each major step in MDX documentation
End sections with next steps or related information in MDX documentation
Use descriptive, keyword-rich headings for navigation and SEO in MDX documentation
Focus on user goals and outcomes rather than system features in MDX documentation
Anticipate common questions and address them proactively in MDX documentation
Include troubleshooting for likely failure points in MDX documentation
Provide multiple pathways (beginner vs advanced) but offer an opinionated path to avoid overwhelming users in MDX documentation
Always include complete, runnable code examples that users can copy and execute in MDX documentation
Show proper error handling and edge case management in MDX code examples
Use realistic data instead of placeholder values in MDX code examples
Include expected outputs and results for verification in MDX code examples
Test all code examples thoroughly before publishing in MDX documentation
Specify language and include filename when relevant in MDX code examples
Add explanatory comments for complex logic in MDX code examples
Document all API...
Files:
docs/development/upgrade-guide.mdx
docs/**/*.{md,mdx,json}
📄 CodeRabbit inference engine (AGENTS.md)
Documentation uses Mintlify framework. Files must be in docs.json to be included. Never modify docs/python-sdk/** (auto-generated)
Files:
docs/development/upgrade-guide.mdx
docs/**/*.{md,mdx}
📄 CodeRabbit inference engine (AGENTS.md)
docs/**/*.{md,mdx}: Code examples in documentation must explain before showing code and make blocks fully runnable (include imports)
Documentation structure: Headers form navigation guide with logical H2/H3 hierarchy. Content should be user-focused with sections motivating features (why) before mechanics (how). Use prose over code comments for important information
Never use 'This isn't...' or 'not just...' constructions in writing - state what something IS directly. Avoid defensive writing patterns
Files:
docs/development/upgrade-guide.mdx
🧠 Learnings (2)
📚 Learning: 2025-12-25T15:53:07.646Z
Learnt from: CR
Repo: jlowin/fastmcp PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-25T15:53:07.646Z
Learning: Applies to tests/**/*.py : Pass FastMCP servers directly to clients for testing without network complexity; only use HTTP transport when explicitly testing network features
Applied to files:
src/fastmcp/server/server.py
📚 Learning: 2025-12-25T15:53:07.646Z
Learnt from: CR
Repo: jlowin/fastmcp PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-25T15:53:07.646Z
Learning: Applies to src/fastmcp/**/*.py : Python ≥ 3.10 with full type annotations required
Applied to files:
docs/development/upgrade-guide.mdx
🧬 Code graph analysis (2)
src/fastmcp/server/server.py (2)
src/fastmcp/server/low_level.py (2)
fastmcp(45-50)fastmcp(146-151)src/fastmcp/server/context.py (1)
fastmcp(169-174)
src/fastmcp/cli/cli.py (3)
src/fastmcp/server/low_level.py (2)
fastmcp(45-50)fastmcp(146-151)src/fastmcp/server/context.py (1)
fastmcp(169-174)src/fastmcp/server/server.py (1)
settings(408-416)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
- GitHub Check: Run tests: Python 3.10 on windows-latest
- GitHub Check: Run tests: Python 3.10 on ubuntu-latest
- GitHub Check: Run tests: Python 3.13 on ubuntu-latest
- GitHub Check: Run tests with lowest-direct dependencies
🔇 Additional comments (4)
src/fastmcp/settings.py (1)
323-335: LGTM!The field rename from
show_cli_bannertoshow_server_banneraccurately reflects the expanded scope. The description clearly documents the override mechanisms (CLI flag andserver.run()parameter) and references the correct environment variable.src/fastmcp/server/server.py (2)
556-588: LGTM! Clean defaulting pattern.The signature change to
show_banner: bool | None = Nonewith defaulting logic (lines 569-570) correctly implements the PR's intent. WhenNone, it reads the globalFASTMCP_SHOW_SERVER_BANNERsetting; when explicitly provided, it honors the caller's choice. This preserves backward compatibility while extending control to programmatic server startup.
590-611: Consistent withrun_async().The
run()method signature and docstring matchrun_async(), ensuring a consistent API. The parameter is correctly passed through torun_async()where the defaulting logic resides.src/fastmcp/cli/cli.py (1)
426-429: Correct CLI flag and setting integration.The logic properly prioritizes the
--no-bannerCLI flag over the globalshow_server_bannersetting, and correctly handles the inverted semantics (no_bannervsshow_banner). When the flag isn't provided, it defaults to the global setting's inverted value.
| ### Server Banner Environment Variable Renamed | ||
|
|
||
| The environment variable for controlling the server banner has been renamed: | ||
|
|
||
| - **Before:** `FASTMCP_SHOW_CLI_BANNER` | ||
| - **After:** `FASTMCP_SHOW_SERVER_BANNER` | ||
|
|
||
| This change reflects that the setting now applies to all server startup methods, not just the CLI. The banner is now suppressed when running `python server.py` directly, not just when using `fastmcp run`. |
There was a problem hiding this comment.
Clarify the banner behavior description.
Line 189 states "The banner is now suppressed when running python server.py directly," which is imprecise. The setting controls whether the banner is shown or hidden—it's not necessarily suppressed. When FASTMCP_SHOW_SERVER_BANNER=true (the default), the banner displays for all startup methods including direct Python runs.
Consider revising to something like: "This change reflects that the setting now controls banner display for all server startup methods (both CLI and direct Python execution), not just CLI invocations."
🔎 Suggested revision
-The environment variable for controlling the server banner has been renamed:
-
-- **Before:** `FASTMCP_SHOW_CLI_BANNER`
-- **After:** `FASTMCP_SHOW_SERVER_BANNER`
-
-This change reflects that the setting now applies to all server startup methods, not just the CLI. The banner is now suppressed when running `python server.py` directly, not just when using `fastmcp run`.
+The environment variable for controlling the server banner has been renamed:
+
+- **Before:** `FASTMCP_SHOW_CLI_BANNER`
+- **After:** `FASTMCP_SHOW_SERVER_BANNER`
+
+This change reflects that the setting now controls banner display for all server startup methods (both CLI and direct Python execution), not just CLI invocations. Set `FASTMCP_SHOW_SERVER_BANNER=false` to suppress the banner across all startup methods.📝 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.
| ### Server Banner Environment Variable Renamed | |
| The environment variable for controlling the server banner has been renamed: | |
| - **Before:** `FASTMCP_SHOW_CLI_BANNER` | |
| - **After:** `FASTMCP_SHOW_SERVER_BANNER` | |
| This change reflects that the setting now applies to all server startup methods, not just the CLI. The banner is now suppressed when running `python server.py` directly, not just when using `fastmcp run`. | |
| ### Server Banner Environment Variable Renamed | |
| The environment variable for controlling the server banner has been renamed: | |
| - **Before:** `FASTMCP_SHOW_CLI_BANNER` | |
| - **After:** `FASTMCP_SHOW_SERVER_BANNER` | |
| This change reflects that the setting now controls banner display for all server startup methods (both CLI and direct Python execution), not just CLI invocations. Set `FASTMCP_SHOW_SERVER_BANNER=false` to suppress the banner across all startup methods. |
Test Failure AnalysisSummary: The integration test is failing due to GitHub API rate limiting (HTTP 429), not due to the changes in this PR. Root Cause: The test is hitting the GitHub Copilot MCP API at and receiving a 429 Too Many Requests error. The test times out after 30 seconds waiting for a response that never comes because the API request is rate limited. Suggested Solution: This is a transient infrastructure issue, not a code issue. The PR changes only rename the banner setting from Recommendation: Re-run the integration tests. If rate limiting persists, consider:
Detailed AnalysisThe test failure occurs in Error Details: Test Timeout:
Why This is Unrelated to PR Changes:
None of these changes affect:
Related Files
The test authenticates using |
Test Failure AnalysisSummary: The integration test Root Cause: The test is hitting the GitHub Copilot MCP API at Suggested Solution: This is a transient infrastructure issue, not a code issue. The PR changes only rename the banner setting from Recommendation: Re-run the integration tests. If rate limiting persists, consider:
Detailed AnalysisThe test failure occurs in Error Details: Test Timeout:
Why This is Unrelated to PR Changes:
None of these changes affect:
Related Files
The test authenticates using |
The
FASTMCP_SHOW_CLI_BANNERsetting only worked when usingfastmcp run. When running servers directly viapython server.py(callingmcp.run()), the env var was ignored.This PR renames the setting to
FASTMCP_SHOW_SERVER_BANNERand makesrun()/run_async()respect it. Theshow_bannerparameter now defaults toNone, which resolves to the setting value.