Skip to main content

PythonAnywhere Model Context Protocol Server

A Model Context Protocol (MCP) server acts as a bridge between AI-powered tools and your PythonAnywhere account, enabling secure, programmatic management of files, websites, webapps, and scheduled tasks. By exposing a standardized interface, it allows language models and automation clients to perform operations—such as editing files, deploying web apps, or scheduling jobs -- on your behalf, all while maintaining fine-grained control and auditability.

Features

  • File management: Read, upload, delete files and list directory trees. (also enables debugging with direct access to log files, which are just files on PythonAnywhere)
  • ASGI Web app management: Create, delete, reload, and list. (as described in the PythonAnywhere ASGI documentation)
  • WSGI Web app management: Create, delete, reload, patch, list, and get info.
  • Scheduled task management: List, create, update, and delete. (Note that this enables LLMs to execute arbitrary commands if a task is scheduled too soon after creation and deleted after execution. For that we would suggest running it with mcp-server-time as models easily get confused about time.)

Installation

The MCP protocol is well-defined and supported by various clients, but installation is different depending on the client you are using. We will cover cases that we tried and tested.

In all cases, you need to have uv installed and available in your PATH.

Have your PythonAnywhere API token and username ready. You can find (or generate) your API token in the API section of your PythonAnywhere account.

If your account is on eu.pythonanywhere.com, you also need to set PYTHONANYWHERE_SITE to eu.pythonanywhere.com (it defaults to www.pythonanywhere.com).

MCP Bundle - works with Claude Desktop

Probably the most straightforward way to install the MCP server is to use the MCP Bundle for Claude Desktop.

  1. Open Claude Desktop.
  2. Download the latest .mcpb file.
  3. Double-click on the downloaded .dxt file or drag the file into the window.
  4. Configure your PythonAnywhere API token and username.
  5. Restart Claude Desktop.

Claude Code

Run:

claude mcp add pythonanywhere-mcp-server \
-e API_TOKEN=yourpythonanywhereapitoken \
-e PYTHONANYWHERE_USERNAME=yourpythonanywhereusername \
-- uvx pythonanywhere-mcp-server

GitHub Copilot in PyCharm:

Add it to your mcp.json.

{
  "servers": {
    "pythonanywhere-mcp-server": {
      "type": "stdio",
      "command": "uvx",
      "args": ["pythonanywhere-mcp-server"],
      "env": {
        "API_TOKEN": "yourpythonanywhereapitoken",
        "PYTHONANYWHERE_USERNAME": "yourpythonanywhereusername"
      }
    }
  }
}

Claude Desktop (manual setup) and Cursor:

Add it to claude_desktop_config.json (for Claude Desktop) or (mcp.json for Cursor).

{
  "mcpServers": {
    "pythonanywhere-mcp-server": {
      "type": "stdio",
      "command": "uvx",
      "args": ["pythonanywhere-mcp-server"],
      "env": {
        "API_TOKEN": "yourpythonanywhereapitoken",
        "PYTHONANYWHERE_USERNAME": "yourpythonanywhereusername"
      }
    }
  }
}

Caveats

Direct integration of an LLM with your PythonAnywhere account offers significant capabilities, but also introduces risks. We strongly advise maintaining human oversight, especially for sensitive actions such as modifying or deleting files.

If you are running multiple MCP servers simultaneously, be cautious -- particularly if any server can access external resources you do not control, such as GitHub issues. These can become attack vectors. For more details, see this story.

Implementation

The server uses the python mcp sdk in connection with the pythonanywhere-core package (docs), which wraps a subset of the PythonAnywhere API and may be expanded in the future as needed.

Metadata

Release files for pythonanywhere-mcp-server 0.0.13

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pythonanywhere-mcp-server 0.0.13
File Size Uploaded
pythonanywhere_mcp_server-0.0.13.tar.gz 15.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pythonanywhere-mcp-server 0.0.13
File Interpreter ABI Platform
pythonanywhere_mcp_server-0.0.13-py3-none-any.whl Python 3 none any Details

Total release size: 28.1 kB

Release files / pythonanywhere_mcp_server-0.0.13.tar.gz

Download URL pythonanywhere_mcp_server-0.0.13.tar.gz
Size 15.4 kB
Tags Source
SHA-256 checksum
How to use checksums
aa2c25d88f049a2c8b482f38fd411e2e9c153d939bd858ac5b6433615b2980dd
BLAKE2b-256 checksum
How to use checksums
fc65ec5e07718ae48c874054ab8c088f7c94da1ef7a42b51c87c0e23216e837c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.13

Release files / pythonanywhere_mcp_server-0.0.13-py3-none-any.whl

Download URL pythonanywhere_mcp_server-0.0.13-py3-none-any.whl
Size 12.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
870e3bbe91515b2def847d035cacfe43ea54e3dfc8ecc6298b0dfe9fc07ce63a
BLAKE2b-256 checksum
How to use checksums
79fda9bcbf347f6ac6775fd8ad933def670ef02a746873e117762c0407b93311
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.13

Release history Release notifications | RSS feed

0.0.14

2 release files

This release

0.0.13 This release

2 release files

0.0.10

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page