Simplify authentication to require URL and API key only

Major configuration and tooling updates:

Authentication Changes:
- Remove username/password authentication support
- Require PORTAINER_URL and PORTAINER_API_KEY (both mandatory)
- Simplify PortainerConfig class and validation logic
- Update all documentation to reflect API key requirement

Multiple Runtime Support:
- Add uvx support for running without installation
- Add uv support with dedicated wrapper script
- Add npx support with Node.js wrapper script
- Maintain backward compatibility with direct Python execution

Documentation Updates:
- Comprehensive README.md with all execution methods
- Detailed USAGE.md with step-by-step instructions
- Updated .env.example with clear required vs optional sections
- Enhanced docstrings in server.py and config.py

Tooling Support:
- package.json for npm/npx support with cross-platform wrapper
- scripts/run-with-uv.py for uv integration
- bin/portainer-core-mcp Node.js wrapper for npx
- test_uvx.py for uvx functionality testing

Configuration Improvements:
- Clear separation of required vs optional environment variables
- Better validation error messages
- Simplified authentication flow
- Enhanced project metadata in pyproject.toml

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-07-18 07:48:23 -06:00
parent 84ca8aee99
commit be1e05c382
14 changed files with 1727 additions and 123 deletions

View File

@@ -1,15 +1,24 @@
# Portainer Core MCP Server Configuration
# Portainer connection settings
PORTAINER_URL=https://your-portainer-instance.com
# =============================================================================
# REQUIRED CONFIGURATION
# =============================================================================
# Authentication settings (choose one method)
# Method 1: API Key authentication (recommended)
# Portainer instance URL (required)
# Examples:
# - https://portainer.example.com
# - https://portainer.company.com:9443
# - http://localhost:9000
PORTAINER_URL=https://portainer.example.com
# Portainer API key for authentication (required)
# Generate this from Portainer UI: User settings > API tokens
# Example: ptr_XYZ123abc456def789
PORTAINER_API_KEY=your-api-key-here
# Method 2: Username/Password authentication
# PORTAINER_USERNAME=admin
# PORTAINER_PASSWORD=your-password-here
# =============================================================================
# OPTIONAL CONFIGURATION
# =============================================================================
# HTTP client settings
HTTP_TIMEOUT=30
@@ -31,6 +40,3 @@ LOG_FORMAT=json
# Development settings
DEBUG=false
# Server settings
SERVER_HOST=localhost
SERVER_PORT=8000