feat: add Portainer Edge MCP server
- Implement comprehensive edge computing functionality - Add edge environment management (list, get, status, generate keys) - Add edge stack operations (list, get, create, update, delete) - Add edge group management (list, get, create, update, delete) - Add edge job scheduling (list, get, create, delete) - Add edge settings configuration (get, update) - Create test scripts for edge API validation - Add comprehensive README documentation for edge server - Include nginx stack creation script from earlier testing 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -2,12 +2,12 @@ Metadata-Version: 2.4
|
||||
Name: portainer-core-mcp
|
||||
Version: 0.1.0
|
||||
Summary: Portainer Core MCP Server - Authentication and User Management
|
||||
Author-email: Your Name <your.email@example.com>
|
||||
Author-email: Portainer MCP Team <support@portainer.io>
|
||||
License: MIT
|
||||
Project-URL: Homepage, https://github.com/yourusername/portainer-core-mcp
|
||||
Project-URL: Documentation, https://github.com/yourusername/portainer-core-mcp#readme
|
||||
Project-URL: Repository, https://github.com/yourusername/portainer-core-mcp
|
||||
Project-URL: Issues, https://github.com/yourusername/portainer-core-mcp/issues
|
||||
Project-URL: Homepage, https://github.com/portainer/portainer-mcp-core
|
||||
Project-URL: Documentation, https://github.com/portainer/portainer-mcp-core#readme
|
||||
Project-URL: Repository, https://github.com/portainer/portainer-mcp-core
|
||||
Project-URL: Issues, https://github.com/portainer/portainer-mcp-core/issues
|
||||
Classifier: Development Status :: 3 - Alpha
|
||||
Classifier: Intended Audience :: Developers
|
||||
Classifier: License :: OSI Approved :: MIT License
|
||||
@@ -41,62 +41,145 @@ Requires-Dist: pre-commit>=3.0.0; extra == "dev"
|
||||
|
||||
# Portainer Core MCP Server
|
||||
|
||||
A Model Context Protocol (MCP) server for Portainer Business Edition authentication and user management.
|
||||
A Model Context Protocol (MCP) server that provides authentication and user management functionality for Portainer Business Edition.
|
||||
|
||||
## Features
|
||||
|
||||
- **Authentication & Session Management**: JWT token handling and user authentication
|
||||
- **User Management**: Create, read, update, and delete users
|
||||
- **Settings Management**: Retrieve and update Portainer settings
|
||||
- **Secure Token Handling**: Automatic token refresh and secure storage
|
||||
- **Error Handling**: Comprehensive error handling with retry logic
|
||||
- **Circuit Breaker**: Fault tolerance for external API calls
|
||||
- **Authentication**: JWT token-based authentication with Portainer API
|
||||
- **User Management**: Complete CRUD operations for users
|
||||
- **Settings Management**: Portainer instance configuration
|
||||
- **Health Monitoring**: Server and service health checks
|
||||
- **Fault Tolerance**: Circuit breaker pattern with automatic recovery
|
||||
- **Structured Logging**: JSON-formatted logs with correlation IDs
|
||||
|
||||
## Requirements
|
||||
|
||||
- Python 3.8+
|
||||
- Portainer Business Edition instance
|
||||
- Valid Portainer API key
|
||||
|
||||
## Installation
|
||||
|
||||
### Using pip
|
||||
|
||||
```bash
|
||||
pip install portainer-core-mcp
|
||||
pip install -e .
|
||||
```
|
||||
|
||||
### Using uv (recommended)
|
||||
|
||||
```bash
|
||||
uv pip install -e .
|
||||
```
|
||||
|
||||
### Using uvx (run without installing)
|
||||
|
||||
```bash
|
||||
# No installation needed - runs directly
|
||||
uvx --from . portainer-core-mcp
|
||||
```
|
||||
|
||||
### Using npm/npx
|
||||
|
||||
```bash
|
||||
npm install -g portainer-core-mcp
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
Set the following environment variables:
|
||||
### Environment Variables
|
||||
|
||||
Create a `.env` file or set environment variables:
|
||||
|
||||
```bash
|
||||
# Required
|
||||
PORTAINER_URL=https://your-portainer-instance.com
|
||||
PORTAINER_API_KEY=your-api-token # Optional, for API key authentication
|
||||
PORTAINER_USERNAME=admin # For username/password authentication
|
||||
PORTAINER_PASSWORD=your-password # For username/password authentication
|
||||
PORTAINER_API_KEY=your-api-key-here
|
||||
|
||||
# Optional
|
||||
HTTP_TIMEOUT=30
|
||||
MAX_RETRIES=3
|
||||
LOG_LEVEL=INFO
|
||||
DEBUG=false
|
||||
```
|
||||
|
||||
### Generate API Key
|
||||
|
||||
1. Log in to your Portainer instance
|
||||
2. Go to **User Settings** > **API Tokens**
|
||||
3. Click **Add API Token**
|
||||
4. Copy the generated token
|
||||
|
||||
## Usage
|
||||
|
||||
### As MCP Server
|
||||
### Start the Server
|
||||
|
||||
#### Using Python
|
||||
|
||||
```bash
|
||||
portainer-core-mcp
|
||||
python run_server.py
|
||||
```
|
||||
|
||||
### Programmatic Usage
|
||||
#### Using uv
|
||||
|
||||
```python
|
||||
from portainer_core.server import PortainerCoreMCPServer
|
||||
|
||||
server = PortainerCoreMCPServer()
|
||||
# Use server instance
|
||||
```bash
|
||||
uv run python run_server.py
|
||||
```
|
||||
|
||||
## Available MCP Tools
|
||||
#### Using uvx
|
||||
|
||||
```bash
|
||||
uvx --from . portainer-core-mcp
|
||||
```
|
||||
|
||||
#### Using npm/npx
|
||||
|
||||
```bash
|
||||
npx portainer-core-mcp
|
||||
```
|
||||
|
||||
### Environment Setup
|
||||
|
||||
```bash
|
||||
# Copy example environment file
|
||||
cp .env.example .env
|
||||
|
||||
# Edit configuration
|
||||
nano .env
|
||||
|
||||
# Start server (choose your preferred method)
|
||||
python run_server.py
|
||||
# OR
|
||||
uvx --from . portainer-core-mcp
|
||||
```
|
||||
|
||||
## Available Tools
|
||||
|
||||
The MCP server provides the following tools:
|
||||
|
||||
### Authentication
|
||||
- `authenticate` - Login with username/password
|
||||
- `generate_token` - Generate API token
|
||||
- `get_current_user` - Get authenticated user info
|
||||
- `generate_token` - Generate API tokens
|
||||
- `get_current_user` - Get current user info
|
||||
|
||||
### User Management
|
||||
- `list_users` - List all users
|
||||
- `create_user` - Create new user
|
||||
- `update_user` - Update user details
|
||||
- `delete_user` - Delete user
|
||||
|
||||
### Settings
|
||||
- `get_settings` - Get Portainer settings
|
||||
- `update_settings` - Update settings
|
||||
- `update_settings` - Update configuration
|
||||
|
||||
### Health
|
||||
- `health_check` - Server health status
|
||||
|
||||
## Available Resources
|
||||
|
||||
- `portainer://users` - User management data
|
||||
- `portainer://settings` - Configuration settings
|
||||
- `portainer://health` - Server health status
|
||||
|
||||
## Development
|
||||
|
||||
|
@@ -4,11 +4,18 @@ src/portainer_core/__init__.py
|
||||
src/portainer_core/config.py
|
||||
src/portainer_core/server.py
|
||||
src/portainer_core/models/__init__.py
|
||||
src/portainer_core/models/auth.py
|
||||
src/portainer_core/models/settings.py
|
||||
src/portainer_core/models/users.py
|
||||
src/portainer_core/services/__init__.py
|
||||
src/portainer_core/services/auth.py
|
||||
src/portainer_core/services/base.py
|
||||
src/portainer_core/services/settings.py
|
||||
src/portainer_core/services/users.py
|
||||
src/portainer_core/utils/__init__.py
|
||||
src/portainer_core/utils/errors.py
|
||||
src/portainer_core/utils/logging.py
|
||||
src/portainer_core/utils/tokens.py
|
||||
src/portainer_core_mcp.egg-info/PKG-INFO
|
||||
src/portainer_core_mcp.egg-info/SOURCES.txt
|
||||
src/portainer_core_mcp.egg-info/dependency_links.txt
|
||||
|
@@ -1,2 +1,2 @@
|
||||
[console_scripts]
|
||||
portainer-core-mcp = portainer_core.server:main
|
||||
portainer-core-mcp = portainer_core.server:main_sync
|
||||
|
Reference in New Issue
Block a user