Repository navigation
feat(mcp)!: disable stdio MCP servers by default #44066
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
617758b
feat(mcp)!: disable stdio MCP servers by default
yuneng-berri b558340
Merge remote-tracking branch 'origin/main' into litellm_mcp-stdio-flag
yuneng-berri ac4a835
fix(mcp): ignore stdio flag from config file and read UI flag from th…
yuneng-berri 0a2b1c5
test(mcp): cover non-mapping payloads in the shared transport validator
yuneng-berri 0ceeec9
Merge remote-tracking branch 'origin/main' into litellm_mcp-stdio-flag
yuneng-berri 2a78134
fix(mcp): skip blocked stdio servers quietly in every listing and kee…
yuneng-berri 315fe64
fix(mcp): route blocked stdio tool calls to the flag error and warn o…
yuneng-berri 4351da2
fix(ui): explain on the server detail page why a stdio server is inert
yuneng-berri 94712b1
refactor(ui): name the stdio banner conditions on the server detail page
yuneng-berri 077e1df
fix(proxy): log the ignored DB-stored LITELLM_ENABLE_MCP_STDIO warnin…
yuneng-berri File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| import os | ||
| from typing import Final | ||
|
|
||
| from litellm._logging import verbose_logger | ||
| from litellm.types.mcp import MCPTransport | ||
|
|
||
| MCP_STDIO_ENABLED_ENV_VAR: Final = "LITELLM_ENABLE_MCP_STDIO" | ||
| MCP_STDIO_DISABLED_MESSAGE: Final = ( | ||
| f"stdio MCP servers are disabled on this proxy. " | ||
| f"Set {MCP_STDIO_ENABLED_ENV_VAR}=true on the proxy and restart to enable them" | ||
| ) | ||
|
|
||
|
|
||
| def is_mcp_stdio_enabled() -> bool: | ||
| return os.getenv(MCP_STDIO_ENABLED_ENV_VAR, "").strip().lower() == "true" | ||
|
|
||
|
|
||
| def is_mcp_stdio_flag_key(env_var_name: str) -> bool: | ||
| return env_var_name.upper() == MCP_STDIO_ENABLED_ENV_VAR | ||
|
|
||
|
|
||
| def is_mcp_stdio_blocked(transport: str | None) -> bool: | ||
| return transport == MCPTransport.stdio and not is_mcp_stdio_enabled() | ||
|
|
||
|
|
||
| def warn_if_mcp_stdio_blocked(server_name: str | None, transport: str | None) -> None: | ||
| if is_mcp_stdio_blocked(transport): | ||
| verbose_logger.warning("MCP server '%s' will not start: %s", server_name, MCP_STDIO_DISABLED_MESSAGE) | ||
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.