ssh-mcp AGENTS.md

A development guide for mcp-ssh, a server that lets approved tools run SSH commands and transfer files over SFTP. It documents the project structure, security model, testing, deployment, and conventions for adding tools.

In plain words
What is it for?
Use it when developing mcp-ssh, including adding SSH or SFTP tools, changing its Python server, testing it, or preparing deployments.
Why use it?
It gives coding agents a shared set of rules for changing and testing the SSH server without overlooking authorization, deployment, or file-touch requirements.

Instructions file for CodexOpenCode

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add instructions/gelse/ssh-mcp/agents-md
Clone the repo
git clone --depth 1 https://github.com/gelse/ssh-mcp

Made for: Codex, OpenCode.

Per session 3,265 This file is loaded in full into every session.
When invoked 3,265 The same file — it is already loaded in full.
Security scan B 2 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.03265 $0.03265
Opus 5 $0.01632 $0.01632
Sonnet 5 $0.00653 $0.00653
Haiku 4.5 $0.00327 $0.00327

Measured 2d ago against content hash 00cb4ba5f07e, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade B, and why

ssh-mcp AGENTS.md scanned grade B with 2 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Asks for rootmediumPrivilege escalation

A mod that escalates privileges can change anything on the machine, not only the project.

│ ├── sudo.py # SudoHandler — validate, wrap sudo command, password injection

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

- Health: `wget --spider http://localhost:8080/health`
AGENTS.md · 217 lines

How it starts

The opening of the file, as written. The whole thing — 217 lines — stays where its author put it; the contents beside it link to each section on GitHub.

AGENTS.md — AI Development Guide for mcp-ssh

Contents:

Project Overview

mcp-ssh is a Model Context Protocol server exposing SSH command execution and SFTP file transfer as MCP tools. Runs as Docker behind Traefik, speaking streamable HTTP on port 8080 at /mcp.

Stack: Python 3.13, FastMCP 3.4.x, paramiko 5.0, Starlette 1.4, Prometheus client, watchdog

Six tools: ssh_list_servers, ssh_list_allowed_commands, ssh_execute_command, ssh_check_connection, ssh_download_file, ssh_upload_file — see README.md.

Key patterns: App-factory (create_app(), zero I/O at import), closure DI for tools, thread-pool for SSH I/O, per-target connection pooling, layered auth chain, config hot-reload (15 s poll / 2 s debounce), circuit breaker + exponential-backoff, sliding-window rate limiter, JSONL logging with rotation/gzip.

Project Layout

mcp-ssh/
├── server.py                  # FastMCP app factory + CLI entry point
├── lib/                       # 25 modules (plus __init__.py re-exports)
│   ├── auth.py                # AuthorizationManager, layered allow-list chain
│   ├── circuit_breaker.py     # Per-target failure threshold + recovery timeout
│   ├── command_security.py    # Command segmentation, dangerous-pattern detection, redirector stripping
│   ├── config.py              # ConfigManager — JSON load/validate/hot-reload
│   ├── config_migration.py    # Config schema migration (v1→v2)
│   ├── config_watcher.py      # Filesystem watcher (polling or watchdog)
│   ├── connection_pool.py     # Per-target SSH connection pooling
│   ├── constants.py           # ALL magic numbers, strings, defaults (single source of truth)
│   ├── crypto.py              # PBKDF2-HMAC-SHA256 API-key hashing + constant-time verify
│   ├── exceptions.py          # MCPSSHError hierarchy
│   ├── file_transfer.py       # SFTP download/upload with 7-layer path validation
│   ├── health.py              # GET /health endpoint
│   ├── log_handler.py         # JSONLHandler — stdlib logging → FileLogger bridge
│   ├── loggers.py             # FileLogger (JSONL rotation/truncation/gzip)
│   ├── metrics.py             # Prometheus metrics + GET /metrics endpoint
│   ├── rate_limiter.py        # Sliding-window per-IP rate limiter
│   ├── redos_protection.py    # Safe regex compilation and ReDoS-resistant matching
│   ├── request_context.py     # Starlette middleware: request_id, client IP, API key
│   ├── sanitize.py            # Input sanitization helpers
│   ├── secrets.py             # SecretsManager for secrets.json + env var merging
│   ├── size_utils.py          # parse_size_bytes() for size-string settings
│   ├── ssh_client.py          # SSHClientManager — connect, retry, circuit-break, pool
│   ├── ssh_operations.py      # Standalone SSH functions (check, connect, execute)
│   ├── sudo.py                # SudoHandler — validate, wrap sudo command, password injection
│   └── types.py               # TypedDict models for tool results
├── config-api/                 # Config API + Web Dashboard (GUI)
│   ├── config_api/app.py, auth.py, config_service.py, models.py, routes.py
│   └── config_api/ui/index.html  # SPA dashboard (Tailwind CSS)
├── tests/
│   ├── test_*.py              # 29 unit-test files
│   └── integration/test_mcp_ssh_integration.py  # Real Docker containers
├── docs/SECURITY.md           # Full security model
├── Dockerfile, compose.yaml, Makefile
├── requirements{,-build,-dev}.{in,txt}
├── default-config.json, config.schema.json
└── README.md

Read the full file on GitHub · 217 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 217 lines · 3,265 tokens per session scan B 00cb4ba5f07e

Subscribe to this mod's changes

ssh-mcp AGENTS.md is an instructions file published in the GitHub repository gelse/ssh-mcp (4 stars, last pushed 2d ago), licensed MIT. It adds 3,265 tokens to every session, about $0.0163 per session on Opus 5. A static security scan graded it B with 2 findings (asks for root, makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other instructions, from other repositories

codex AGENTS.md

AGENTS.md instructions for openai/codex, covering rust/codex-rs, the codex-core crate, code review rules, crate api surface and model visible context.

openai/codex · 5,182 tokens

buildNext

Working notes and architecture documentation for the new esbuild-based build system in build/next. Use when making changes to the new build pipeline (transpile/bundle commands, NLS plugin, source-map handling, resource copying, or self-hosting watch tasks).

microsoft/vscode · 6,785 tokens

next.js AGENTS.md

Instructions for vercel/next.js, covering next.js development guide, codebase structure, monorepo overview, core package: packages/next and other important packages.

vercel/next.js · 7,296 tokens

vscode oss-third-party-notices.instructions.md

Instructions for microsoft/vscode, covering vs code oss third-party-notices pipeline, architecture, pipeline flow in ci, applying the notice (cutover) and fallback chain (never fail the build).

microsoft/vscode · 5,001 tokens

spec-kit AGENTS.md

Instructions for github/spec-kit, covering agents.md, about spec kit and specify, quickstart — add a new integration in 5 steps, integration architecture and integrationmanifest — file tracking.

github/spec-kit · 7,040 tokens

langchain AGENTS.md

Instructions for langchain-ai/langchain, covering global development guidelines for the langchain monorepo, corridor security analysis, project architecture and context, monorepo structure and development tools & commands.

langchain-ai/langchain · 4,345 tokens