fix: address review comments for MCP stdio command allowlist

- Remove unused pytest import from test_stdio_config.py
- Strip file extension from base_command for Windows compatibility
  (e.g., python.exe -> python) using os.path.splitext

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Alex
2026-04-02 13:14:00 -07:00
parent 52c4e4a309
commit 7780565f1b
2 changed files with 2 additions and 2 deletions

View File

@@ -69,6 +69,8 @@ class StdioTransport(BaseTransport):
if allowed_commands is not None:
base_command = os.path.basename(command)
# Strip extension for Windows compatibility (e.g., python.exe -> python)
base_command = os.path.splitext(base_command)[0]
if base_command not in allowed_commands:
raise ValueError(
f"Command '{command}' is not in the allowed commands list: "

View File

@@ -1,7 +1,5 @@
"""Tests for MCPServerStdio allowed_commands config integration."""
import pytest
from crewai.mcp.config import MCPServerStdio
from crewai.mcp.transports.stdio import DEFAULT_ALLOWED_COMMANDS