Skip to main content
Glama
Server Maintenance MCP Server

Server Maintenance MCP Server

Server Maintenance MCP Server

A Model Context Protocol (MCP) server designed for Google Antigravity to securely connect, inspect, and maintain remote Linux/Unix servers over SSH.


Features

  • šŸ–„ļø Configurable Server Registry: Manage multiple servers with custom IDs, hostnames/IPs, custom ports, usernames, and tags.

  • šŸ”‘ Flexible Authentication:

    • OpenSSH private keys (~/.ssh/id_rsa, ~/.ssh/id_ed25519, etc.)

    • Passphrase-protected private keys

    • Password authentication

    • Environment variable interpolation (e.g. "${PROD_PASSWORD}" or "${SSH_KEY_SECRET}")

  • šŸ›”ļø Credential Protection:

    • Passwords, passphrases, and private key contents are automatically scrubbed from tool outputs and agent responses.

    • config/servers.json is gitignored by default to prevent accidental credential commits.

  • ⚔ Native SSH & SFTP Engine: Powered by ssh2 without relying on host ssh.exe or terminal emulation quirks on Windows.

  • 🧰 Agent Toolset:

    • ssh_list_servers: View all configured servers and their metadata.

    • ssh_test_connection: Test connectivity and measure SSH ping/round-trip latency.

    • ssh_execute_command: Run any shell command with working directory, custom timeout, and sudo support.

    • ssh_system_info: Inspect real-time CPU model, cores, load averages, memory usage, disk mounts, and uptime.

    • ssh_read_file: Read remote files with line offsets and line counts over SFTP.

    • ssh_write_file: Upload/edit remote files over SFTP with automatic timestamped backup copies (.bak-...).

    • ssh_list_directory: Explore remote directories over SFTP with file types, sizes, permissions, and timestamps.

    • ssh_service_status: Convenience tool to check, inspect logs, start, stop, or restart systemd services or Docker containers.


Related MCP server: SSH MCP Server

Directory Structure

ServerMaintenanceMCP/
ā”œā”€ā”€ config/
│   ā”œā”€ā”€ servers.example.json  # Documented configuration template
│   └── servers.json          # Your actual server connections (gitignored)
ā”œā”€ā”€ src/
│   ā”œā”€ā”€ config.ts             # Configuration loader & env var expander
│   ā”œā”€ā”€ index.ts              # MCP Stdio Server entrypoint
│   ā”œā”€ā”€ ssh-manager.ts        # SSH & SFTP connection pool and handlers
│   ā”œā”€ā”€ types.ts              # Zod schemas & TypeScript types
│   └── tools/
│       └── index.ts          # Tool schemas and dispatcher
ā”œā”€ā”€ test/
│   └── config-and-tools.test.ts # Vitest unit test suite
ā”œā”€ā”€ dist/                     # Compiled executable output
ā”œā”€ā”€ mcp_config.json           # Antigravity MCP registration template
ā”œā”€ā”€ package.json
└── tsconfig.json

Quick Start

1. Configure Your Servers

Copy config/servers.example.json to config/servers.json:

cp config/servers.example.json config/servers.json

Edit config/servers.json with your actual server details:

{
  "defaultKeyPath": "~/.ssh/id_rsa",
  "servers": [
    {
      "id": "prod-web",
      "name": "Production Web & API Server",
      "host": "192.168.1.50",
      "port": 22,
      "username": "ubuntu",
      "privateKeyPath": "~/.ssh/id_rsa",
      "tags": ["production", "web", "docker"],
      "description": "Nginx reverse proxy and API services",
      "defaultCwd": "/var/www"
    },
    {
      "id": "staging-db",
      "name": "Staging Database Server",
      "host": "staging-db.internal",
      "port": 2222,
      "username": "deploy",
      "password": "${STAGING_DB_PASSWORD}",
      "tags": ["staging", "database"],
      "description": "PostgreSQL staging instance"
    }
  ]
}

2. Build the Server

npm run build

To run the automated test suite:

npm test

Antigravity Integration

The server has already been registered in your global Antigravity MCP configuration: ~/.gemini/config/mcp_config.json

{
  "mcpServers": {
    "server-maintenance": {
      "command": "node",
      "args": [
        "c:/Users/keesj/Documents/repos/ServerMaintenanceMCP/dist/index.js"
      ],
      "env": {
        "SERVERS_CONFIG_PATH": "c:/Users/keesj/Documents/repos/ServerMaintenanceMCP/config/servers.json"
      }
    }
  }
}

Once registered, restart Antigravity or refresh MCP tools. You can verify available tools under Additional Options (...) > MCP Servers.


Example Antigravity Prompts

Once configured, you can prompt Antigravity directly:

  • "List my configured servers and test connection to each one."

  • "Check the system health and disk space on prod-web."

  • "Inspect the last 50 lines of the Nginx error log on prod-web."

  • "Check the status of the docker service on staging-db."

  • "Edit /etc/nginx/sites-available/default on prod-web to update the proxy pass URL and test the configuration with nginx -t."

Available Tools

8 tools
ssh_execute_commandB

Execute a bash or shell command on a remote server over SSH. Supports working directory, timeouts, and sudo.

Inputs: command (required), serverId (required), cwd, sudo, +1 more.

ssh_list_directoryA

List remote directory contents via SFTP, returning filename, file type, file size, permissions, and modification timestamp.

Inputs: serverId (required), path.

ssh_list_serversA

List all configured remote servers available for SSH connections with their metadata, tags, and connection details (excluding sensitive credentials).

Inputs: tag.

ssh_read_fileA

Read the contents of a remote file over SFTP. Supports offset lines and line limits for inspecting log files and large config files.

Inputs: path (required), serverId (required), maxLines, offsetLines.

ssh_service_statusA

Check status, view logs, start, stop, or restart a systemd service or Docker container on the remote server.

Inputs: serverId (required), serviceName (required), lines, action.

ssh_system_infoA

Gather comprehensive diagnostic overview of a remote server: OS version, kernel, uptime, CPU cores/model, load averages, RAM usage, and disk mounts.

Inputs: serverId (required).

ssh_test_connectionA

Test SSH connectivity and measure round-trip latency to a specified server or all configured servers.

Inputs: serverId.

ssh_write_fileA

Create or update a remote file over SFTP. By default automatically creates a timestamped backup copy (.bak-...) of any existing file before overwriting.

Inputs: path (required), content (required), serverId (required), mode, +1 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.9/5.0

    Scored across 8 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose: listing servers, testing connectivity, executing commands, gathering system info, reading/writing files, listing directories, and managing services. No overlap in functionality, making agent selection straightforward.

    Naming Consistency4/5

    All tools share the 'ssh_' prefix and mostly follow a verb_noun pattern (e.g., ssh_list_servers, ssh_execute_command, ssh_read_file). However, ssh_system_info and ssh_service_status are noun_noun rather than verb_noun, creating a minor inconsistency.

    Tool Count5/5

    With 8 tools, the set is well-scoped for a server maintenance domain. Each tool covers a core operation without redundancy or bloat, appropriate for the server's purpose.

    Completeness4/5

    The toolset covers the main lifecycle for remote server management: listing, testing, executing, inspecting, file transfer, and service control. Minor gaps exist such as file deletion or rename, but agents can work around these with execute_command, so no dead ends.

    Maintenance

    ActivityStale
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      Enables remote server management through SSH and SFTP, supporting command execution, file transfers, and interactive shell sessions. It allows for multiple concurrent connections using either password or SSH key authentication.
      11
      31 npm
      5
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      Enables remote server administration via SSH, supporting command execution, SFTP file transfers, and multi-profile management. It features security safeguards like destructive command detection and audit logging to ensure safe interaction with remote Linux/Unix environments.
      17
      5 npm
      MIT
    • F
      license
      Not graded
      quality
      D
      maintenance
      Enables managing Linux servers via SSH with tools for command execution, file operations, service management, and log analysis.
      -
    • F
      license
      Not graded
      quality
      D
      maintenance
      Enables remote shell control of Linux and network devices via SSH/Telnet, with session management and file transfer capabilities.
      -