Skip to content

Make FASTMCP_SHOW_SERVER_BANNER apply to all server startup methods#2771

Merged
jlowin merged 1 commit intomainfrom
feat/show-server-banner-setting
Dec 29, 2025
Merged

Make FASTMCP_SHOW_SERVER_BANNER apply to all server startup methods#2771
jlowin merged 1 commit intomainfrom
feat/show-server-banner-setting

Conversation

@jlowin
Copy link
Copy Markdown
Member

@jlowin jlowin commented Dec 28, 2025

The FASTMCP_SHOW_CLI_BANNER setting only worked when using fastmcp run. When running servers directly via python server.py (calling mcp.run()), the env var was ignored.

This PR renames the setting to FASTMCP_SHOW_SERVER_BANNER and makes run() / run_async() respect it. The show_banner parameter now defaults to None, which resolves to the setting value.

# Now works in all cases:
# FASTMCP_SHOW_SERVER_BANNER=false python server.py
# FASTMCP_SHOW_SERVER_BANNER=false fastmcp run server.py

# Explicit override still works:
mcp.run(show_banner=False)

Renamed from FASTMCP_SHOW_CLI_BANNER and now respected by server.run()
in addition to the CLI.
@marvin-context-protocol marvin-context-protocol Bot added enhancement Improvement to existing functionality. For issues and smaller PR improvements. breaking change Breaks backward compatibility. Requires minor version bump. Critical for maintainer attention. server Related to FastMCP server implementation or server-side functionality. cli Related to FastMCP CLI commands (run, dev, install) or CLI functionality. labels Dec 28, 2025
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Dec 28, 2025

Walkthrough

This pull request renames the environment variable and settings configuration field from show_cli_banner to show_server_banner, reflecting that banner suppression now applies across all server startup methods rather than just CLI invocations. The server's run() and run_async() methods are updated to accept an optional show_banner parameter that defaults to the global setting when not explicitly provided. Supporting updates are made to the CLI module and documentation to align with this terminology and behavior change.

Possibly related PRs

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the problem, solution, and usage examples clearly, but lacks the required Contributors Checklist items marked, which are mandatory per the template. Complete all checklist items from the Contributors Checklist section, including marking which issue this closes and confirming testing and documentation updates were performed.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and accurately summarizes the main objective: renaming the setting and making it apply universally to all server startup methods, not just the CLI.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/show-server-banner-setting

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ef84f84 and a763058.

⛔ Files ignored due to path filters (2)
  • tests/cli/test_cli.py is excluded by none and included by none
  • tests/server/test_server.py is excluded by none and included by none
📒 Files selected for processing (4)
  • docs/development/upgrade-guide.mdx
  • src/fastmcp/cli/cli.py
  • src/fastmcp/server/server.py
  • src/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.py
  • src/fastmcp/settings.py
  • src/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_banner to show_server_banner accurately reflects the expanded scope. The description clearly documents the override mechanisms (CLI flag and server.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 = None with defaulting logic (lines 569-570) correctly implements the PR's intent. When None, it reads the global FASTMCP_SHOW_SERVER_BANNER setting; when explicitly provided, it honors the caller's choice. This preserves backward compatibility while extending control to programmatic server startup.


590-611: Consistent with run_async().

The run() method signature and docstring match run_async(), ensuring a consistent API. The parameter is correctly passed through to run_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-banner CLI flag over the global show_server_banner setting, and correctly handles the inverted semantics (no_banner vs show_banner). When the flag isn't provided, it defaults to the global setting's inverted value.

Comment on lines +182 to +189
### 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`.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

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.

Suggested change
### 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.

@marvin-context-protocol
Copy link
Copy Markdown
Contributor

Test Failure Analysis

Summary: 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 FASTMCP_SHOW_CLI_BANNER to FASTMCP_SHOW_SERVER_BANNER and make the show_banner parameter work with mcp.run(). These changes are unrelated to the GitHub API integration tests.

Recommendation: Re-run the integration tests. If rate limiting persists, consider:

  1. Adding retry logic with exponential backoff for GitHub API calls in integration tests
  2. Implementing test rate limit detection and automatic skip/xfail marking
  3. Reviewing GitHub API token permissions and rate limits
Detailed Analysis

The test failure occurs in tests/integration_tests/test_github_mcp_remote.py::TestGithubMCPRemote::test_call_tool_list_commits.

Error Details:

httpx.HTTPStatusError: Client error '429 Too Many Requests' for url 'https://api.githubcopilot.com/mcp/'
For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429

Test Timeout:

  • Test has a 30-second timeout
  • The HTTP request hangs indefinitely due to rate limiting
  • Test eventually times out: Failed: Timeout (>30.0s) from pytest-timeout.

Why This is Unrelated to PR Changes:
This PR modifies:

  • src/fastmcp/settings.py: Renames show_cli_banner to show_server_banner
  • src/fastmcp/server/server.py: Makes show_banner parameter default to None and read from settings
  • src/fastmcp/cli/cli.py: Updates reference to renamed setting

None of these changes affect:

  • HTTP client behavior
  • API authentication
  • Network requests to GitHub
  • Integration test logic
Related Files
  • Test file: tests/integration_tests/test_github_mcp_remote.py:99-124 - The failing test
  • Transport: fastmcp/client/client.py - Client HTTP transport handling
  • GitHub MCP URL: https://api.githubcopilot.com/mcp/ - The rate-limited endpoint

The test authenticates using FASTMCP_GITHUB_TOKEN and calls the list_commits tool on the GitHub MCP server. All other integration tests in this suite passed (13/14), suggesting this is a transient rate limit issue rather than a systematic problem.

@marvin-context-protocol
Copy link
Copy Markdown
Contributor

Test Failure Analysis

Summary: The integration test test_call_tool_list_commits 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 https://api.githubcopilot.com/mcp/ 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 FASTMCP_SHOW_CLI_BANNER to FASTMCP_SHOW_SERVER_BANNER and make the show_banner parameter work with mcp.run(). These changes are unrelated to the GitHub API integration tests.

Recommendation: Re-run the integration tests. If rate limiting persists, consider:

  1. Adding retry logic with exponential backoff for GitHub API calls in integration tests
  2. Implementing test rate limit detection and automatic skip/xfail marking
  3. Reviewing GitHub API token permissions and rate limits
Detailed Analysis

The test failure occurs in tests/integration_tests/test_github_mcp_remote.py::TestGithubMCPRemote::test_call_tool_list_commits.

Error Details:

httpx.HTTPStatusError: Client error '429 Too Many Requests' for url 'https://api.githubcopilot.com/mcp/'
For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429

Test Timeout:

  • Test has a 30-second timeout
  • The HTTP request hangs indefinitely due to rate limiting
  • Test eventually times out: Failed: Timeout (>30.0s) from pytest-timeout.

Why This is Unrelated to PR Changes:
This PR modifies:

  • src/fastmcp/settings.py: Renames show_cli_banner to show_server_banner
  • src/fastmcp/server/server.py: Makes show_banner parameter default to None and read from settings
  • src/fastmcp/cli/cli.py: Updates reference to renamed setting

None of these changes affect:

  • HTTP client behavior
  • API authentication
  • Network requests to GitHub
  • Integration test logic
Related Files
  • Test file: tests/integration_tests/test_github_mcp_remote.py:99-124 - The failing test
  • Transport: fastmcp/client/client.py - Client HTTP transport handling
  • GitHub MCP URL: https://api.githubcopilot.com/mcp/ - The rate-limited endpoint

The test authenticates using FASTMCP_GITHUB_TOKEN and calls the list_commits tool on the GitHub MCP server. All other integration tests in this suite passed (13/14), suggesting this is a transient rate limit issue rather than a systematic problem.

@jlowin jlowin merged commit 9c83482 into main Dec 29, 2025
14 of 15 checks passed
@jlowin jlowin deleted the feat/show-server-banner-setting branch December 29, 2025 13:29
@jlowin jlowin removed the breaking change Breaks backward compatibility. Requires minor version bump. Critical for maintainer attention. label Jan 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli Related to FastMCP CLI commands (run, dev, install) or CLI functionality. enhancement Improvement to existing functionality. For issues and smaller PR improvements. server Related to FastMCP server implementation or server-side functionality.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant