Skip to main content

network-terminal-mcp

PyPI CI License: MIT

Локальный MCP-сервер для постоянных интерактивных терминалов. Модель открывает сессию привычной командой ssh, telnet или serial, затем пишет в живой поток команды, ?-подсказки, pager keys и вложенные ssh, а читает только новый вывод.

Статус: 0.3.0 — command-only API, настоящий OpenSSH/Telnet в POSIX PTY, локальный serial, конкретные ошибки, ограниченная по времени запись, метрики простоя и секреты без обязательного pass.

В 0.3.0 ответы MCP стали компактнее; клиенты, использующие удалённые поля ответов 0.2.1, необходимо адаптировать. Полные данные сессии — в session_status.

Открытие сессии

Единственный аргумент:

{"command": "ssh -J operator@bastion.example.net operator@192.0.2.10"}
{"command": "telnet 192.0.2.30 23"}
{"command": "serial /dev/ttyUSB0 115200"}

SSH использует локальные ~/.ssh/config, agent, ключи, ProxyJump, ProxyCommand и любые опции OpenSSH. Аргументы передаются клиенту без фильтрации; shell не используется. ready означает, что процесс запущен, а не что логин завершён: banner и prompt читаются через terminal_read.

Основной цикл

open_session("ssh operator@192.0.2.10")
terminal_read(session_id)                    # banner / login prompt
terminal_write(session_id, "show version")
terminal_read(session_id)
terminal_write(session_id, "show interface brief")
terminal_read(session_id)
close_session(session_id)
  • terminal_read возвращает только новый вывод и не повторяет историю.
  • При truncated=true продолжайте с next_output_offset через read_output.
  • terminal_write(..., enter=false) отправляет одиночные клавиши и control bytes.
  • Пароли и passphrase вводятся только через terminal_write_secret с одним источником: value, env или file.

Нестабильные соединения

ready означает, что жив локальный процесс клиента, а не что удалённая сторона отвечает. Для SSH добавляйте контроль связи:

ssh -o ConnectTimeout=10 -o ServerAliveInterval=15 -o ServerAliveCountMax=3 operator@192.0.2.10

После сна ноутбука, смены Wi-Fi/VPN или долгой паузы закройте и переоткройте подозрительные сессии: запись в полуразрушенное TCP-соединение может выглядеть успешной. terminal_read ограничен timeout, terminal_write — 10 секундами; session_status показывает last_output_at и idle_seconds. Подробнее: эксплуатация.

Для одноразового ssh host 'command' обычный shell остаётся проще. MCP нужен для живого терминала, pager, нескольких команд с сохранением состояния, password prompts, вложенных переходов и Serial.

Установка

uv tool install network-terminal-mcp
network-terminal-mcp check

Обновление:

uv tool upgrade network-terminal-mcp

Проверка показывает версию, наличие ssh/telnet, pyserial и доступность audit-каталога. Обязательных конфигурационных файлов нет.

OpenCode V2

{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "servers": {
      "network-terminal": {
        "type": "local",
        "command": ["/home/USER/.local/bin/network-terminal-mcp"],
        "codemode": false,
        "disabled": false
      }
    }
  }
}

codemode: false оставляет все инструменты, включая open_session, в native tool list. Если ~/.local/bin уже в PATH, достаточно ["network-terminal-mcp"].

Документация

Разработка

Требуются Python 3.12+, uv и POSIX/Linux.

uv sync
uv run ruff check .
uv run mypy src
uv run pytest

Не добавляйте в репозиторий реальные адреса, hostnames, usernames, fingerprints, секреты или production transcripts.

Metadata

Release files for network-terminal-mcp 0.3.0

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

Source distribution (sdist)

Source distribution for network-terminal-mcp 0.3.0
File Size Uploaded Provenance Actions
network_terminal_mcp-0.3.0.tar.gz 154.6 kB With provenance Details for network_terminal_mcp-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for network-terminal-mcp 0.3.0
File Interpreter ABI Platform Actions
network_terminal_mcp-0.3.0-py3-none-any.whl Python 3 none any Details for network_terminal_mcp-0.3.0-py3-none-any.whl

Total release size: 184.5 kB

Release files / network_terminal_mcp-0.3.0.tar.gz

Download URL network_terminal_mcp-0.3.0.tar.gz
Size 154.6 kB
Tags Source
SHA-256 checksum
How to use checksums
e64c3fbcb68faeac9d357d5d0be74a830fa707bc55458437d06a86758192039c
BLAKE2b-256 checksum
How to use checksums
c655458296f901f53cca9a29ce839a140cf03dcde280c555384a2fcfe0ce1f47
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 8, 2026.

Transparency log

Release files / network_terminal_mcp-0.3.0-py3-none-any.whl

Download URL network_terminal_mcp-0.3.0-py3-none-any.whl
Size 29.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d7e21cd34af53969d9e916ad554280c5520bf16dd4904d51e4502aa89489ea2a
BLAKE2b-256 checksum
How to use checksums
f70c8006c8d9bbda473f638fc969f5c8b0dc4b538440131634301f08e250263a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 8, 2026.

Transparency log

Security for network-terminal-mcp 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for network_terminal_mcp-0.3.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 8, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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