Skip to main content
Glama
jsilvanus

deployment-mcp

by jsilvanus
README.md
# deployment-mcp

An MCP (Model Context Protocol) server that handles deployment operations over SSH.

## Features

- **`ssh_git_pull`** – SSH into a remote host and run `git pull` in a specified repository directory.
- **`ssh_run_command`** – Execute an arbitrary shell command on a remote host and return its stdout, stderr and exit code.
- **`ssh_run_script`** – Upload and execute a multi-line shell script on a remote host (piped to bash; no temporary files created locally).
- **`write_ssh_config`** – Write or update a `Host` entry in the local `~/.ssh/config` file.

All SSH tools support authentication via an **inline PEM private key**, a **path to a key file**, or a **password**.

## Installation

```bash
npm install
npm run build
```

## Usage

Run the MCP server over stdio (used by MCP-compatible AI clients):

```bash
node dist/index.js
```

### MCP client configuration example

```json
{
  "mcpServers": {
    "deployment": {
      "command": "node",
      "args": ["/path/to/deployment-mcp/dist/index.js"]
    }
  }
}
```

### Tool examples

#### `ssh_git_pull`

```json
{
  "host": "my-server.example.com",
  "username": "deploy",
  "privateKeyPath": "~/.ssh/id_rsa",
  "repoPath": "/var/www/myapp",
  "branch": "main"
}
```

#### `ssh_run_command`

```json
{
  "host": "my-server.example.com",
  "username": "deploy",
  "privateKeyPath": "~/.ssh/id_rsa",
  "command": "systemctl restart myapp"
}
```

#### `ssh_run_script`

```json
{
  "host": "my-server.example.com",
  "username": "deploy",
  "privateKeyPath": "~/.ssh/id_rsa",
  "workingDirectory": "/var/www/myapp",
  "script": "#!/bin/bash\nset -e\ngit pull\nnpm install --omit=dev\nnpm run build\npm2 restart myapp"
}
```

#### `write_ssh_config`

```json
{
  "alias": "my-server",
  "hostname": "my-server.example.com",
  "user": "deploy",
  "identityFile": "~/.ssh/deploy_key",
  "extraOptions": {
    "StrictHostKeyChecking": "no",
    "ServerAliveInterval": "60"
  }
}
```

## Development

```bash
npm run dev    # TypeScript watch mode
npm test       # Run tests
npm run build  # Compile TypeScript
```

TDQS

B3.4/5.0

Scored across 4 tools

Disambiguation4/5

Tools are mostly distinct: git pull, command execution, script execution, and SSH config writing each target different actions. Some overlap between run_command and run_script but descriptions clarify the difference.

Naming Consistency4/5

All tools use snake_case with ssh_ prefix, following a verb_noun pattern. `ssh_git_pull` is slightly inconsistent (compound verb) but overall pattern is predictable.

Tool Count4/5

Four tools is a reasonable scope for a focused deployment server covering SSH execution and config. Could be expanded but not overly sparse.

Completeness2/5

Lacks critical deployment operations like file transfer (scp/rsync), service management, or environment setup. The set is too limited for typical deployment workflows.

Maintenance

ActivityInactive
ResponsivenessNo issues