Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jun 26, 2025

Overview

This PR addresses Windows compatibility issues in the Docker setup for the Port MCP Server. The changes ensure seamless operation across both Windows and Linux containers while maintaining full backward compatibility.

Key Issues Fixed

  1. Cross-platform virtual environment support: The entrypoint script now detects both Unix (.venv/bin/activate) and Windows (.venv/Scripts/activate) virtual environment paths
  2. Flexible log path configuration: Added PORT_LOG_PATH environment variable support for custom log file locations with Windows path compatibility
  3. Enhanced environment variable handling: Implemented robust fallback patterns for legacy environment variables
  4. Windows container build support: Added windows/amd64 platform to the Docker build pipeline

Changes Made

🐳 Docker & Build Improvements

  • Enhanced entrypoint.sh: Cross-platform virtual environment detection with graceful fallbacks
  • Updated Docker workflow: Added Windows container support (windows/amd64) while maintaining Linux compatibility
  • Improved error handling: Robust log directory creation and file handling

⚙️ Configuration Updates

  • Flexible log paths: Updated McpServerConfig to support custom log paths via PORT_LOG_PATH
  • Environment variable precedence: Proper handling of PORT_* variables with legacy fallbacks
  • Cross-platform path support: Accepts both Windows (C:\temp\logs) and Unix (/tmp/logs) path formats

📚 Documentation Enhancements

  • Windows-specific instructions: Added PowerShell and CMD examples for Docker usage
  • Comprehensive troubleshooting: Detailed Windows troubleshooting section covering common issues
  • Environment variable guide: Updated configuration table with new PORT_LOG_PATH option

🧪 Test Coverage

  • Docker setup tests: Comprehensive test suite validating cross-platform functionality
  • Environment variable tests: Validation of precedence and fallback patterns
  • Windows compatibility tests: Specific test cases for Windows path handling and container scenarios

Example Usage

PowerShell (Windows):

$env:PORT_CLIENT_ID="your_client_id"
$env:PORT_CLIENT_SECRET="your_client_secret"  
$env:PORT_LOG_PATH="C:\temp\port-mcp.log"

docker run -i --rm -e PORT_CLIENT_ID -e PORT_CLIENT_SECRET -e PORT_LOG_PATH ghcr.io/port-labs/port-mcp-server:latest

Bash (Linux/macOS):

export PORT_CLIENT_ID="your_client_id"
export PORT_CLIENT_SECRET="your_client_secret"
export PORT_LOG_PATH="/tmp/port-mcp.log"

docker run -i --rm -e PORT_CLIENT_ID -e PORT_CLIENT_SECRET -e PORT_LOG_PATH ghcr.io/port-labs/port-mcp-server:latest

Validation

  • ✅ All shell script syntax validation passed
  • ✅ Cross-platform virtual environment detection tested
  • ✅ Environment variable fallback patterns validated
  • ✅ Docker build configuration verified
  • ✅ Windows documentation and troubleshooting added
  • ✅ Comprehensive test coverage implemented

Backward Compatibility

All changes maintain 100% backward compatibility with existing deployments. Existing environment variables and configurations continue to work without modification.

Fixes #55.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Docker Setup Optimization for Windows in MCP Server Optimize Docker Setup for Windows Compatibility in MCP Server Jun 26, 2025
Copilot AI requested a review from Matanga1-2 June 26, 2025 14:15
Copilot finished work on behalf of Matanga1-2 June 26, 2025 14:15
Copy link
Collaborator

@Matanga1-2 Matanga1-2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a bit long, maybe we can improve it?

Copy link
Contributor Author

Copilot AI commented Jul 1, 2025

It's a bit long, maybe we can improve it?

Agreed! I've streamlined the README significantly - reduced it from 709 to 228 lines (68% reduction). Consolidated repetitive client configurations using collapsible sections while keeping all essential information accessible. The new structure makes it much more scannable and concise. See commit c624ddb.

Copilot AI requested a review from Matanga1-2 July 1, 2025 10:00
Copilot finished work on behalf of Matanga1-2 July 1, 2025 10:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Docker Setup Optimization for Windows in MCP Server

2 participants