Skip to main content

PythonAnywhere Model Context Protocol Server

Project description

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: Reload only (at the moment).
  • 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.

Desktop Extension - works with Claude Desktop

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

  1. Open Claude Desktop.
  2. Download the latest .dxt 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 LOGNAME=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",
        "LOGNAME": "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",
        "LOGNAME": "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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file iflow_mcp_pythonanywhere_pythonanywhere_mcp_server-0.0.8.tar.gz.

File metadata

  • Download URL: iflow_mcp_pythonanywhere_pythonanywhere_mcp_server-0.0.8.tar.gz
  • Upload date:
  • Size: 12.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for iflow_mcp_pythonanywhere_pythonanywhere_mcp_server-0.0.8.tar.gz
Algorithm Hash digest
SHA256 3d5a8854c892a4bcb413ef6e395d6460f6950956f929b712b5418362ede05ea8
MD5 f47c472af5d40a2adfea67fdd21d820c
BLAKE2b-256 36d62417b818cbaa7ab06f318ee8e9552863ef141b13ef9291c020ae5ea83620

See more details on using hashes here.

File details

Details for the file iflow_mcp_pythonanywhere_pythonanywhere_mcp_server-0.0.8-py3-none-any.whl.

File metadata

  • Download URL: iflow_mcp_pythonanywhere_pythonanywhere_mcp_server-0.0.8-py3-none-any.whl
  • Upload date:
  • Size: 12.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for iflow_mcp_pythonanywhere_pythonanywhere_mcp_server-0.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 cfc97c7814098c1c10b5f3fea602cf548ffcec2acd3a49a3dcbd923fea912da6
MD5 4169999f4d04aef8d2a00d59ce82cec4
BLAKE2b-256 0e9339a02e4f8a231cdd53dc80981418fb806585b971cedf1769bf74e17d8b80

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page