Skip to main content

network-terminal-mcp

PyPI CI License: MIT

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

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

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

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

{"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.2.1

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.2.1
File Size Uploaded Provenance Actions
network_terminal_mcp-0.2.1.tar.gz 153.0 kB With provenance Details for network_terminal_mcp-0.2.1.tar.gz

Built distribution (wheel)

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

Total release size: 183.4 kB

Release files / network_terminal_mcp-0.2.1.tar.gz

Download URL network_terminal_mcp-0.2.1.tar.gz
Size 153.0 kB
Tags Source
SHA-256 checksum
How to use checksums
f3126a7851a3a5cf8c1fd7a3e5df6b7314810fb2ab6d8d55ce0ed47a14fc951f
BLAKE2b-256 checksum
How to use checksums
ab63fb6c3e272266ec32c348b7f2c1c8bb6dbe3fa5c3f9661c0037aa27238d24
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 Oct 31, 2026.

Transparency log

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

Download URL network_terminal_mcp-0.2.1-py3-none-any.whl
Size 30.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a42b603390404e0a613cc16552cf58b85909f76eee60116e468e71384036ee7b
BLAKE2b-256 checksum
How to use checksums
6152cee002f0dd43ec103a5ba8db6bfd561656eba6aed5cb7dfeeb3b83886149
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 Oct 31, 2026.

Transparency log

Security for network-terminal-mcp 0.2.1

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.2.1.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 Oct 31, 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