MCP.so
ログイン
A

A Better Mcp ssh Server

@zhangyc310

A Better Mcp ssh Server について

A Better Mcp ssh Server.

基本情報

カテゴリ

開発者ツール

トランスポート

stdio

公開者

zhangyc310

投稿者

yc z

設定

以下の設定を使って、このサーバーを MCP 対応クライアントに追加してください。

{
  "mcpServers": {
    "ssh": {
      "command": "/your_path_to_mcpssh/mcpssh",
      "args": []
    }
  }
}

ツール

3

Initiates a new SSH connection to a specified host using a PTY. Returns a `session_id`.

Sends input to and reads output from an active SSH session. This allows for interactive shell usage (e.g., handling prompts, running scripts).

Terminates an active SSH session and cleans up resources.

概要

What is A Better Mcp ssh Server?

A Better Mcp ssh Server is a Go-based MCP server that manages SSH sessions for AI agents. It enables an AI to interact with remote servers via SSH by creating persistent sessions, sending commands, and reading outputs through a pseudo-terminal (PTY) interface. It reads hosts from ~/.ssh/config, so users do not need to list every host in the MCP configuration file.

How to use A Better Mcp ssh Server?

Build the binary with go build -o mcpssh (requires Go 1.25.0+ and SSH installed). Then configure your MCP client (e.g., Codex or Gemini) to run the binary as a command server without arguments. After setup, the AI can connect to any host defined in ~/.ssh/config by name using the provided tools.

Key features of A Better Mcp ssh Server

  • Supports hosts in ~/.ssh/config automatically
  • AI can specify a host via natural language
  • Persistent SSH sessions with PTY interface
  • Three core tools: start, interact, and close session
  • Built with Go for performance and minimal dependencies

Use cases of A Better Mcp ssh Server

  • AI agent connects to a remote server and checks disk space
  • AI runs a multi-step script that requires interactive prompts
  • AI manages multiple persistent SSH sessions to different hosts
  • AI retrieves command outputs from remote servers for monitoring

FAQ from A Better Mcp ssh Server

What are the prerequisites for running A Better Mcp ssh Server?

Go 1.25.0 or later must be installed, along with SSH (tested on macOS). A ~/.ssh/config file is required to define host entries.

How does the server discover SSH hosts?

It reads host definitions from ~/.ssh/config. There is no need to add every host to the MCP configuration file; the AI can reference hosts by their config alias.

What tools does A Better Mcp ssh Server provide?

Three tools: start_session (initiates SSH connection and returns a session ID), interact_session (sends input to and reads output from the PTY), and close_session (terminates the session and cleans up resources).

What are the core dependencies of A Better Mcp ssh Server?

The server depends on github.com/mark3labs/mcp-go (MCP SDK), github.com/creack/pty (PTY management), and github.com/google/uuid (session ID generation).

How does session management work?

Each start_session call creates a persistent PTY-based SSH connection and returns a unique session ID. The AI uses interact_session to send commands and read outputs, and close_session to terminate the session.

コメント

「開発者ツール」の他のコンテンツ