Content
# Beget Hosting MCP
**Language:** English | [English](README.en.md)
[](https://github.com/BelyaevAD/beget-hosting-mcp/actions/workflows/ci.yml)
[](LICENSE)
[](pyproject.toml)
[](https://modelcontextprotocol.io/)
MCP server for the official Beget hosting API. It provides MCP-compatible clients and automation agents with operations to manage accounts, domains, DNS, sites, FTP, MySQL, mail, Cron, backups, and statistics.
The project provides MCP clients and agents with a controlled interface of tools to manage Beget hosting: account information, sites, domains, DNS, FTP, MySQL, mail, Cron, backups, and statistics.
The API documentation corpus is stored in `docs/`; the MCP server uses machine-readable metadata of methods based on it.
## Links
- Landing: https://belyaevad.github.io/beget-hosting-mcp/
- Repository: https://github.com/BelyaevAD/beget-hosting-mcp
- Releases: https://github.com/BelyaevAD/beget-hosting-mcp/releases
- Documentation corpus: [docs/README.md](docs/README.md)
- Operator guide: [docs/operator-guide.md](docs/operator-guide.md)
- Beget API settings: https://cp.beget.com/settings/security/api
- Official Beget API documentation: https://beget.com/en/kb/api/beget-api
## Status
Alpha version. Initially use read-only mode. Write operations are intentionally protected by additional restrictions.
## Installation
From a local copy of the repository:
```powershell
python -m pip install .
```
For global system installation of CLI via `pipx`:
```powershell
pipx install .
```
After installation, the command will be available:
```powershell
beget-hosting-mcp
```
No third-party Python dependencies are required.
## Credentials
MCP uses stdio transport. The MCP client launches the server as a local process and exchanges data with it through stdin/stdout.
Beget credentials relate to the process configuration, not to MCP transport authentication. Set them in the MCP client configuration or in the environment of the system account under which the server is launched:
```powershell
BEGET_LOGIN=your-login
BEGET_API_PASSWORD=your-api-password
```
In `BEGET_API_PASSWORD`, specify a separate Beget API password, not the main control panel password. Open the `https://cp.beget.com/settings/security/api` page in the Beget control panel, set the API password, and explicitly allow API authentication before using the server.
Do not add credentials to commits and do not send them to chats.
Write operations are disabled if not set:
```powershell
BEGET_ALLOW_WRITE=true
```
Even with write enabled, each call with a side effect requires `confirm_write=true`.
## MCP Client Configuration
Configuration for the installed command:
```json
{
"mcpServers": {
"beget-hosting": {
"type": "stdio",
"command": "beget-hosting-mcp",
"args": [],
"env": {
"BEGET_LOGIN": "your-login",
"BEGET_API_PASSWORD": "your-api-password"
}
}
}
}
```
For development from a local copy:
```powershell
python -m pip install -e .
```
For a profile with write enabled, add:
```json
{
"BEGET_ALLOW_WRITE": "true"
}
```
For write operations, it is recommended to use a separate MCP profile.
### Cursor in Windows
Cursor reads global MCP servers from `%USERPROFILE%\.cursor\mcp.json`. Graphical applications do not always get the same `PATH` as an interactive terminal, so the most reliable Windows configuration uses an absolute path to the Python interpreter in which this package is installed:
```powershell
py -0p
python -m pip install --upgrade .
```
```json
{
"mcpServers": {
"beget_hosting": {
"type": "stdio",
"command": "C:\\Path\\To\\python.exe",
"args": ["-u", "-m", "beget_mcp.server"],
"env": {
"BEGET_LOGIN": "your-login",
"BEGET_API_PASSWORD": "your-api-password"
}
}
}
}
```
Replace `command` with the path to the interpreter shown by the `py -0p` command and used during installation. The `-u` flag enables unbuffered stdio. No wrapper via `cmd.exe` or `run.cmd` is required: Cursor passes `env` values directly to the process, including passwords with special shell characters.
Version 0.1.1 fixes tool detection in Cursor by using the required MCP line-by-line JSON-RPC format in stdio. If Cursor still shows `Loading tools`, check the installed version and run protocol tests:
```powershell
python -m pip show beget-hosting-mcp
python -m unittest discover -s tests -v
```
The server trace should show `initialize`, then `tools/list`. Repeated `serve_stdio_start` and `serve_stdio_eof` events without requests between them usually mean that an outdated version before 0.1.1 is still installed.
## Tools
- `beget_list_methods`: returns a list of documented methods.
- `beget_get_method_docs`: returns saved documentation for one Beget API method.
- `beget_call`: calls any documented Beget API method.
- `beget_get_account_info`: a shortened call to `user.getAccountInfo`.
MCP clients must detect these tools through the standard `tools/list` request. To check tool metadata outside the client, such as Cursor, the server also supports the `beget-hosting-mcp --list-tools` command.
The stdio transport writes exactly one compact JSON-RPC message per line, as required by MCP. For compatibility with old user clients, the server also accepts incoming messages in `Content-Length` format and responds in the same format.
## Security Model
- Credentials are loaded only from environment variables.
- Requests are sent using the `POST` method.
- Secrets are hidden in dry-run results and error messages.
- Methods with side effects are blocked without `BEGET_ALLOW_WRITE=true`.
- For calls with side effects, `confirm_write=true` is additionally required.
- Before performing a write operation, it is recommended to run it in dry-run mode first.
- The server checks errors both at the top level of the Beget response and in the nested method result.
## Delays in Checking Changes
A successful response from some Beget methods means that the request is accepted, but related systems may still require time to apply or see the change. DNS changes may appear in Beget earlier than recursive DNS servers and browsers; before recognizing a public check as unsuccessful, wait for the authoritative DNS servers to reload and for normal propagation within the TTL. Backup restoration and loading create background jobs, so before checking restored data, query `backup.getLog`. Changes to sites, domain bindings, PHP, mail, MySQL, and Cron may also require a short delay or the occurrence of the next scheduled run.
## Quick Checks
```powershell
beget-hosting-mcp --check-docs
beget-hosting-mcp --list-tools
python -m unittest discover -s tests -v
```
Checking a request without contacting Beget:
```powershell
$env:BEGET_LOGIN = "demo-login"
$env:BEGET_API_PASSWORD = "demo-password"
beget-hosting-mcp --dry-run-account-info
```
## Documentation Corpus
- `docs/source-pages/`: full Markdown copies of Beget API documentation pages.
- `docs/beget-hosting-api.md`: normalized technical reference.
- `docs/method-index.md`: method index.
- `docs/operator-guide.md`: usage rules and typical scenarios.
- `docs/schema/methods.json`: machine-readable method information.
- `scripts/build_beget_docs.py`: documentation corpus generator.
## Ambiguity in Beget Documentation
The statistics page header specifies the `stat.getSiteListLoad` method, but the example endpoint uses `getSitesListLoad`. The server preserves this feature as `method=getSiteListLoad` and `endpoint_method=getSitesListLoad`.