PythonAnywhere Model Context Protocol Server
以下摘录自该仓库的 README(片段) · 在 GitHub 读完整 README →
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:
GitHub Copilot in PyCharm:
Add it to your mcp.json.
Claude Desktop (manual setup) and Cursor:
Add it to claude_desktop_config.json (for Claude Desktop) or (mcp.json
for Cursor).
Caveats
Direct integration of an LLM with your PythonAnywhere account offers
significant capabilities, but also introduces risks. We strongly advise