You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
run_async() hardcoded "stdio" as the fallback when no transport was specified, which meant users running third-party servers (like AWS MCP servers in ECS containers) had no way to change the default transport without modifying source code. The CLI and fastmcp.json provided workarounds, but a bare mcp.run() call was locked to stdio.
This adds a transport field to Settings so that FASTMCP_TRANSPORT=http (or any valid transport) controls the default. run_async reads from the setting instead of hardcoding "stdio", while explicit transport= arguments and CLI --transport flags still override it. Fits naturally alongside the existing FASTMCP_HOST and FASTMCP_PORT settings.
# Third-party server code you can't modify:mcp.run() # reads FASTMCP_TRANSPORT from env# Or in your own code:importfastmcpfastmcp.settings.transport="http"
The changes add a configurable transport setting to the Settings model and update the TransportMixin to use this setting as the default when no transport is explicitly provided. A new public field transport with type Literal["stdio", "http", "sse", "streamable-http"] and default value "stdio" is introduced in the Settings class. The TransportMixin.run_async method is modified to retrieve the default transport from fastmcp.settings.transport instead of using a hard-coded "stdio" value. This allows the transport mechanism to be configured through the settings system rather than being fixed.
🚥 Pre-merge checks | ✅ 5 | ❌ 1
❌ Failed checks (1 warning)
Check name
Status
Explanation
Resolution
Description check
⚠️ Warning
The PR description clearly explains the problem, solution, and includes code examples, but is missing the required contributors and review checklists from the template.
Add the Contributors Checklist and Review Checklist sections from the template, and check off the appropriate items before marking ready for review.
✅ Passed checks (5 passed)
Check name
Status
Explanation
Title check
✅ Passed
The title clearly and concisely summarizes the primary change: adding a FASTMCP_TRANSPORT setting to the configuration system.
Linked Issues check
✅ Passed
The PR fully addresses issue #1795 by adding the FASTMCP_TRANSPORT environment variable configuration option, enabling transport control without modifying source code.
Out of Scope Changes check
✅ Passed
All changes are directly scoped to implementing the FASTMCP_TRANSPORT setting as specified in issue #1795, with no extraneous modifications.
Docstring Coverage
✅ Passed
Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Merge Conflict Detection
✅ Passed
✅ No merge conflicts detected when merging into main
✏️ Tip: You can configure your own custom pre-merge checks in the settings.
✨ 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/transport-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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enhancementImprovement to existing functionality. For issues and smaller PR improvements.serverRelated to FastMCP server implementation or server-side functionality.
1 participant
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
run_async()hardcoded"stdio"as the fallback when no transport was specified, which meant users running third-party servers (like AWS MCP servers in ECS containers) had no way to change the default transport without modifying source code. The CLI andfastmcp.jsonprovided workarounds, but a baremcp.run()call was locked to stdio.This adds a
transportfield toSettingsso thatFASTMCP_TRANSPORT=http(or any valid transport) controls the default.run_asyncreads from the setting instead of hardcoding"stdio", while explicittransport=arguments and CLI--transportflags still override it. Fits naturally alongside the existingFASTMCP_HOSTandFASTMCP_PORTsettings.Closes #1795
Supersedes #1796