Skip to content

Commit fb556a9

Browse files
markomanninenclaude
andcommitted
fix: Remove problematic relative import in cli.py
The relative import 'from . import mcp_server' fails in CI because cli.py is not part of a package. Simplified to use direct import after adding src to sys.path. Fixes CI error: 'No parent module -- cannot perform relative import' 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 88f30bb commit fb556a9

1 file changed

Lines changed: 7 additions & 12 deletions

File tree

src/cli.py

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,13 @@
1111

1212
# Importing the module will register the MCP tools; use the server's
1313
# own entry behavior when run as a script.
14-
try:
15-
# Adjust sys.path to ensure `src` is importable when installed in editable mode
16-
project_root = Path(__file__).resolve().parents[1]
17-
if str(project_root / "src") not in sys.path:
18-
sys.path.insert(0, str(project_root / "src"))
19-
import mcp_server as server
20-
except Exception:
21-
# Fall back to relative import if the above failed (development installs)
22-
try:
23-
from . import mcp_server as server
24-
except Exception:
25-
import mcp_server as server
14+
15+
# Adjust sys.path to ensure `src` is importable when installed in editable mode
16+
project_root = Path(__file__).resolve().parents[1]
17+
if str(project_root / "src") not in sys.path:
18+
sys.path.insert(0, str(project_root / "src"))
19+
20+
import mcp_server as server # noqa: E402
2621

2722

2823
def main(argv=None):

0 commit comments

Comments
 (0)