Skip to main content
Glama
safe-ssh-mcp

safe-ssh-mcp

by Areso

check_tcp_connect

Checks whether a remote Linux host can open a TCP connection to a target host and port via SSH, helping diagnose service reachability without sending data.

Instructions

Checks FROM a remote Linux host (reached via SSH) whether a TCP connection to target_host:target_port can be opened (nc -vz). USE THIS TOOL to tell whether a service (database, API, another server) is reachable from that host. target_host is a hostname or an IPv4/IPv6 address, target_port is 1-65535. Do not confuse them with host/port, which are the SSH connection to the machine the check runs on. Only the connection is opened and closed, no data is sent. One port per call. ok=True means the port accepted the connection. Otherwise nc's message tells why: 'Connection refused' - the target is reachable but nothing listens on the port; 'timed out' - no answer in 3 seconds, usually a firewall or a routing problem; a name resolution error - check the name with get_dns_lookup. Fails with exit code 127 if nc is not installed on the host.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "target_host": "<target_host>",
      "target_port": "<target_port>",
      "host": "<host>",
      "user": "<user>"
    },
    "name": "check_tcp_connect"
  }
}

Input Schema

NameRequiredDescriptionDefault
hostYes
portNo
userYes
timeoutNo
key_pathNo
passwordNo
target_hostYes
target_portYes
accept_new_hostkeyNo

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.2.0

TDQS

A4/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden and does most of it: it discloses that the check runs over SSH on a remote machine, that only a connection is opened and closed with no data sent, the 3-second timeout, and the exit code 127 case when nc is absent. It stops short of describing authentication behavior (password vs key_path) or what accept_new_hostkey does security-wise.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The content is front-loaded with purpose before parameter guidance and return-code semantics, and each block serves a purpose. It is long, and the multi-line error taxonomy could be tightened, but nothing is clearly wasteful for a tool with this many failure modes.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

An output schema exists, so the ok=True explanation is a bonus rather than a requirement, and the failure-mode taxonomy is genuinely useful. However, for a tool requiring an SSH session, the absence of any guidance on credentials (password vs key_path), the timeout parameter, and host key acceptance leaves an agent without what it needs to construct a successful call in restrictive environments.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0% across 9 parameters. The description compensates well for target_host, target_port, host, port and user (via the SSH framing), but user, timeout, key_path, password and accept_new_hostkey get no explanation at all, leaving roughly half the parameters undocumented.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description opens with a precise verb and resource (check whether a TCP connection can be opened from a remote Linux host via SSH) and explicitly scopes it ('nc -vz', 'one port per call'). It also draws the crucial distinction between target_host/target_port and host/port, which an agent could not infer from the names alone.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It gives an explicit selection rule: 'USE THIS TOOL to tell whether a service (database, API, another server) is reachable from that host,' and routes DNS failures to get_dns_lookup. What is missing is any statement of when not to use it (e.g., checking a local port, or probing service health rather than mere reachability).

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.