# Portainer MCP Server Suite Environment Configuration # ===================================================== # This file contains all environment variables used by the Portainer MCP servers. # Copy this file to .env and update with your actual values. # # IMPORTANT: Never commit the .env file to version control as it contains sensitive credentials. # REQUIRED CONFIGURATION # ---------------------- # Your Portainer instance URL (must be accessible from Docker containers) # Example: https://portainer.example.com # Example: http://192.168.1.100:9000 PORTAINER_URL=https://your-portainer-instance.com # Your Portainer API key (also called Access Token) # To generate an API key: # 1. Log in to your Portainer instance # 2. Click on your username in the top right # 3. Go to "My account" → "Access tokens" # 4. Click "Add access token" # 5. Give it a name (e.g., "MCP Servers") # 6. Copy the generated token and paste it here PORTAINER_API_KEY=ptr_your-api-key-here # OPTIONAL CONFIGURATION # ---------------------- # Set to true if using self-signed SSL certificates # This disables SSL certificate verification (use with caution) # Default: false PORTAINER_INSECURE=false # HTTP request timeout in seconds # Increase this value if you have slow network connections or large operations # Default: 30 HTTP_TIMEOUT=30 # Maximum number of retry attempts for failed API calls # The servers will retry with exponential backoff # Default: 3 MAX_RETRIES=3 # ADVANCED CONFIGURATION (rarely needed) # -------------------------------------- # Log level for debugging (DEBUG, INFO, WARNING, ERROR) # Default: INFO # LOG_LEVEL=INFO # Enable debug mode for verbose output # Default: false # DEBUG=false # DOCKER COMPOSE SPECIFIC # ----------------------- # These variables are used by docker-compose.yml but not by the MCP servers # Docker registry to pull images from (if using private registry) # Default uses the GitLab registry where images are hosted # DOCKER_REGISTRY=git.oe74.net/adelorenzo/portainer-mcp # Image tag to use for all services # Default: latest # IMAGE_TAG=latest # NETWORK CONFIGURATION # --------------------- # If your Portainer instance is running in Docker on the same host, # you might need to use the Docker bridge network IP or container name # Example: http://portainer:9000 (if Portainer container is named 'portainer') # Example: http://172.17.0.1:9000 (Docker bridge IP on Linux) # TROUBLESHOOTING TIPS # -------------------- # # 1. Connection refused errors: # - Ensure PORTAINER_URL is accessible from within Docker containers # - Try using the Docker host IP instead of localhost # - Check if Portainer is running and accessible # # 2. Authentication errors: # - Verify your API key is valid and not expired # - Ensure the API key has the necessary permissions # - Check if your Portainer user has the required role (Administrator/Operator) # # 3. SSL certificate errors: # - Set PORTAINER_INSECURE=true for self-signed certificates # - Ensure your Portainer instance has valid SSL certificates # # 4. Timeout errors: # - Increase HTTP_TIMEOUT for slow connections # - Check network connectivity between containers and Portainer # # 5. To test your configuration: # docker-compose run --rm portainer-core python -c "import os; print('URL:', os.getenv('PORTAINER_URL'))"