Fix local file access default for stdio transport
Some checks failed
Test Dashboard / test-and-dashboard (push) Has been cancelled
Some checks failed
Test Dashboard / test-and-dashboard (push) Has been cancelled
Local files now allowed by default when MCP_TRANSPORT=stdio (or unset). Only blocked by default for streamable-http transport.
This commit is contained in:
parent
b0477103d5
commit
367a9c58e5
@ -14,8 +14,20 @@ from .validation import OfficeFileError
|
|||||||
|
|
||||||
|
|
||||||
# Environment variable to control local file access
|
# Environment variable to control local file access
|
||||||
# Default to False (secure) - set to "true" for local stdio transport
|
# Default depends on transport mode:
|
||||||
MCP_ALLOW_LOCAL_FILES = os.environ.get("MCP_ALLOW_LOCAL_FILES", "false").lower() == "true"
|
# - stdio (local): allow local files by default
|
||||||
|
# - streamable-http (remote): block local files by default
|
||||||
|
def _get_allow_local_files() -> bool:
|
||||||
|
"""Determine if local file access is allowed based on transport mode."""
|
||||||
|
explicit = os.environ.get("MCP_ALLOW_LOCAL_FILES")
|
||||||
|
if explicit is not None:
|
||||||
|
return explicit.lower() == "true"
|
||||||
|
|
||||||
|
# If not explicitly set, default based on transport mode
|
||||||
|
transport = os.environ.get("MCP_TRANSPORT", "stdio").lower()
|
||||||
|
return transport == "stdio"
|
||||||
|
|
||||||
|
MCP_ALLOW_LOCAL_FILES = _get_allow_local_files()
|
||||||
|
|
||||||
|
|
||||||
class OfficeFileCache:
|
class OfficeFileCache:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user