Skip to main content
Glama
PythonAnywhere MCP Server

PythonAnywhere MCP Server

by Billibukun
README.md
# PythonAnywhere MCP Server

An MCP (Model Context Protocol) server that provides full access to the PythonAnywhere API. Manage your webapps, files, consoles, scheduled tasks, and more directly from Claude.

## Features

- **Webapps**: Create, configure, reload, enable/disable web applications
- **Files**: Upload, download, delete, list, and share files
- **Consoles**: Create, manage, and interact with consoles
- **Scheduled Tasks**: Create and manage scheduled (cron) tasks
- **Always-On Tasks**: Manage always-on background processes
- **Static Files**: Configure static file mappings for webapps
- **SSL/TLS**: Setup Let's Encrypt certificates
- **System**: View CPU usage, Python versions, system images

## Installation

```bash
pip install pythonanywhere-mcp
```

Or install from source:

```bash
git clone https://github.com/yourusername/druid_mcps.git
cd druid_mcps
pip install -e .
```

## Configuration

### Get Your API Token

1. Log in to [PythonAnywhere](https://www.pythonanywhere.com)
2. Go to **Account** → **API Token** tab
3. Copy your API token

### Claude Desktop Configuration

Add to your Claude Desktop config file:

**macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
**Windows**: `%APPDATA%\Claude\claude_desktop_config.json`

```json
{
  "mcpServers": {
    "pythonanywhere": {
      "command": "pythonanywhere-mcp",
      "env": {
        "PYTHONANYWHERE_API_TOKEN": "your-api-token-here",
        "PYTHONANYWHERE_USERNAME": "your-username",
        "PYTHONANYWHERE_HOST": "www.pythonanywhere.com"
      }
    }
  }
}
```

> **Note**: Use `eu.pythonanywhere.com` for `PYTHONANYWHERE_HOST` if your account is on the EU servers.

### Claude Code Configuration

Add to your Claude Code settings:

```json
{
  "mcpServers": {
    "pythonanywhere": {
      "command": "pythonanywhere-mcp",
      "env": {
        "PYTHONANYWHERE_API_TOKEN": "your-api-token-here",
        "PYTHONANYWHERE_USERNAME": "your-username",
        "PYTHONANYWHERE_HOST": "www.pythonanywhere.com"
      }
    }
  }
}
```

## Available Tools

### CPU & System
| Tool | Description |
|------|-------------|
| `get_cpu_usage` | Get CPU quota info (limit, usage, reset time) |
| `get_system_image` | Get current and available system images |
| `set_system_image` | Change your system image |
| `get_python_versions` | Get default Python version info |

### Consoles
| Tool | Description |
|------|-------------|
| `list_consoles` | List all consoles |
| `create_console` | Create a new console (bash, python, etc.) |
| `get_console` | Get console details |
| `kill_console` | Kill/delete a console |
| `get_console_output` | Get latest output (~500 chars) |
| `send_console_input` | Send commands to a console |

### Files
| Tool | Description |
|------|-------------|
| `list_directory` | List directory contents |
| `get_file` | Download a file |
| `upload_file` | Upload a file |
| `delete_file` | Delete a file |
| `share_file` | Share a file publicly |
| `get_sharing_status` | Check if file is shared |
| `stop_sharing` | Stop sharing a file |

### Web Applications
| Tool | Description |
|------|-------------|
| `list_webapps` | List all web applications |
| `create_webapp` | Create a new webapp |
| `get_webapp` | Get webapp configuration |
| `update_webapp` | Update webapp settings |
| `delete_webapp` | Delete a webapp |
| `reload_webapp` | Reload webapp (apply changes) |
| `enable_webapp` | Enable a webapp |
| `disable_webapp` | Disable a webapp |
| `setup_ssl` | Setup Let's Encrypt SSL |

### Static Files
| Tool | Description |
|------|-------------|
| `list_static_files` | List static file mappings |
| `add_static_file` | Add a static file mapping |
| `delete_static_file` | Delete a static file mapping |

### Scheduled Tasks
| Tool | Description |
|------|-------------|
| `list_scheduled_tasks` | List all scheduled tasks |
| `create_scheduled_task` | Create a scheduled task |
| `get_scheduled_task` | Get task details |
| `update_scheduled_task` | Update a task |
| `delete_scheduled_task` | Delete a task |

### Always-On Tasks
| Tool | Description |
|------|-------------|
| `list_always_on_tasks` | List always-on tasks |
| `create_always_on_task` | Create an always-on task |
| `get_always_on_task` | Get task details |
| `restart_always_on_task` | Restart a task |
| `delete_always_on_task` | Delete a task |

## Example Usage

Once configured, you can ask Claude things like:

- "List my PythonAnywhere webapps"
- "Reload my webapp at mydomain.pythonanywhere.com"
- "Upload this Python script to /home/myuser/scripts/app.py"
- "Create a scheduled task to run backup.py every day at 3am"
- "Show me my CPU usage"
- "Create a new bash console"
- "What files are in my home directory?"

## Rate Limits

PythonAnywhere API has the following rate limits:
- 40 requests per minute per endpoint
- 120 requests per minute for console `send_input`

## License

MIT