Skip to main content
Glama
GUEPARD98

SSH-PowerShell MCP Server

by GUEPARD98
README.md
# SSH-PowerShell MCP Server

๐Ÿš€ **Enterprise-grade Model Context Protocol (MCP) server** for secure SSH and PowerShell command execution with Claude Desktop.

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Node.js Version](https://img.shields.io/badge/node-%3E%3D18.0.0-brightgreen)](https://nodejs.org/)
[![MCP SDK](https://img.shields.io/badge/MCP%20SDK-0.5.0-blue)](https://github.com/modelcontextprotocol/sdk)

## โœจ Features

- ๏ฟฝ **Secure SSH command execution** on remote servers
- โšก **Local PowerShell integration** for Windows automation  
- ๐Ÿ›ก๏ธ **Enterprise security** with SSH key authentication
- ๐ŸŒ **Network scanning** and SSH port discovery
- ๐Ÿ” **SSH key verification** and host key scanning
- ๐Ÿ“Š **Comprehensive logging** and error handling
- ๐ŸŽฏ **Claude Desktop optimized** for seamless AI integration

## ๏ฟฝ๐Ÿš€ Quick Start

```powershell
# Clone repository
git clone https://github.com/GUEPARD98/MCP-POWERSHELL.git
cd MCP-POWERSHELL

# Install dependencies
npm install

# Configure environment
Copy-Item config\.env.example config\.env
# Edit config\.env with your SSH settings

# Start server
npm start
```

## ๐Ÿ“ Project Structure

```
MCP-POWERSHELL/
โ”œโ”€โ”€ ๐Ÿ“ config/           # Environment configurations
โ”‚   โ”œโ”€โ”€ .env.example     # Configuration template
โ”‚   โ”œโ”€โ”€ .env.development # Development settings
โ”‚   โ”œโ”€โ”€ .env.production  # Production settings
โ”‚   โ””โ”€โ”€ .env.test       # Test settings
โ”œโ”€โ”€ ๐Ÿ“ docs/            # Complete documentation
โ”‚   โ”œโ”€โ”€ README.md       # Detailed guide
โ”‚   โ”œโ”€โ”€ API.md          # API reference
โ”‚   โ”œโ”€โ”€ ARCHITECTURE.md # Technical architecture
โ”‚   โ””โ”€โ”€ SECURITY.md     # Security best practices
โ”œโ”€โ”€ ๐Ÿ“ scripts/         # PowerShell automation scripts
โ”‚   โ”œโ”€โ”€ start.ps1       # Start server
โ”‚   โ”œโ”€โ”€ stop.ps1        # Stop server
โ”‚   โ”œโ”€โ”€ setup.ps1       # Initial setup
โ”‚   โ””โ”€โ”€ test.ps1        # Run tests
โ”œโ”€โ”€ ๐Ÿ“ src/             # Source code
โ”‚   โ””โ”€โ”€ index.js        # Main MCP server
โ””โ”€โ”€ ๐Ÿ“ tests/           # Automated tests
```

## ๐Ÿ› ๏ธ Available Commands

| Command | Description |
|---------|-------------|
| `npm start` | Start MCP server |
| `npm test` | Run test suite |
| `npm run dev` | Development mode with PowerShell scripts |
| `npm run setup` | Initial configuration |

## โšก MCP Tools

### ๐Ÿ” ssh_execute
Execute commands on remote SSH servers
```javascript
// Example: Run 'ls -la' on remote server
{
  "name": "ssh_execute",
  "arguments": {
    "command": "ls -la",
    "host": "192.168.1.100", 
    "user": "root"
  }
}
```

### ๐Ÿ’ป powershell_execute  
Execute PowerShell commands locally
```javascript
// Example: Get Windows processes
{
  "name": "powershell_execute",
  "arguments": {
    "command": "Get-Process | Select-Object -First 10"
  }
}
```

### ๐ŸŒ ssh_scan
Scan network for SSH services
```javascript
// Example: Scan local network
{
  "name": "ssh_scan", 
  "arguments": {
    "target": "192.168.1.0/24"
  }
}
```

### ๐Ÿ” ssh_keyscan
Verify SSH host keys
```javascript
// Example: Get host key fingerprint
{
  "name": "ssh_keyscan",
  "arguments": {
    "host": "192.168.1.100"
  }
}
```

## ๐Ÿ”ง Configuration

### Environment Setup
1. Copy `config/.env.example` to `config/.env`
2. Configure your SSH settings:

```properties
# SSH Configuration
SSH_KEY_PATH=/path/to/your/ssh/key
SSH_DEFAULT_HOST=your.server.ip
SSH_DEFAULT_USER=your_username
SSH_DEFAULT_PORT=22

# Security Settings  
SSH_STRICT_HOST_KEY_CHECKING=no
COMMAND_TIMEOUT=30000
LOG_LEVEL=info
```

### Claude Desktop Integration
The server automatically configures Claude Desktop. Manual setup:

```json
{
  "mcpServers": {
    "ssh-powershell-mcp": {
      "command": "node",
      "args": ["path/to/MCP-POWERSHELL/src/index.js"],
      "env": {
        "NODE_ENV": "production"
      }
    }
  }
}
```

## ๏ฟฝ Security

- โœ… **SSH key authentication** only (no passwords)
- โœ… **Command sanitization** with shell-escape
- โœ… **Environment isolation** for different configurations
- โœ… **Comprehensive input validation**
- โœ… **Secure credential handling**

See [SECURITY.md](docs/SECURITY.md) for detailed security practices.

## ๐Ÿ“š Documentation

- **[Complete Guide](docs/README.md)** - Detailed installation and usage
- **[API Reference](docs/API.md)** - Full MCP API documentation  
- **[Architecture](docs/ARCHITECTURE.md)** - Technical design and diagrams
- **[Security Guide](docs/SECURITY.md)** - Security best practices

## ๐Ÿงช Testing

```powershell
# Run all tests
npm test

# Run specific test types
.\scripts\test.ps1 -TestType unit
.\scripts\test.ps1 -TestType integration
.\scripts\test.ps1 -TestType ssh
```

## ๐Ÿค Contributing

1. Fork the repository
2. Create feature branch (`git checkout -b feature/amazing-feature`)
3. Commit changes (`git commit -m 'Add amazing feature'`)
4. Push to branch (`git push origin feature/amazing-feature`)
5. Open Pull Request

## ๐Ÿ“„ License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

## ๐Ÿ™‹โ€โ™‚๏ธ Support

- ๐Ÿ“– Check the [documentation](docs/)
- ๐Ÿ› Report issues on [GitHub Issues](https://github.com/GUEPARD98/MCP-POWERSHELL/issues)
- ๐Ÿ’ฌ Join discussions in [GitHub Discussions](https://github.com/GUEPARD98/MCP-POWERSHELL/discussions)

## ๐Ÿ† Acknowledgments

- [Model Context Protocol](https://github.com/modelcontextprotocol) for the excellent SDK
- [Claude Desktop](https://claude.ai) for AI integration capabilities
- The open-source community for inspiration and tools

---

**๐Ÿข Enterprise Ready** | **๐Ÿ”’ Secure by Design** | **โšก Claude Optimized**

Made with โค๏ธ by [GUEPARD98](https://github.com/GUEPARD98)

TDQS

B3.4/5.0

Scored across 4 tools

Disambiguation5/5

Each tool has a clearly distinct purpose: powershell_execute is for local PowerShell commands, ssh_execute is for remote SSH command execution, ssh_keyscan retrieves SSH key fingerprints, and ssh_scan discovers SSH hosts on a network. There is no overlap or ambiguity between these functions.

Naming Consistency5/5

All tool names follow a consistent snake_case pattern with a clear verb_noun structure: powershell_execute, ssh_execute, ssh_keyscan, ssh_scan. The naming is uniform and predictable across all tools.

Tool Count4/5

With 4 tools, the count is reasonable for an SSH/PowerShell server, covering core remote execution and SSH management tasks. It might be slightly thin for advanced scenarios (e.g., missing file transfer or session management), but it's well-scoped for basic operations.

Completeness4/5

The toolset covers key SSH and PowerShell operations: remote command execution, host discovery, and key verification. Minor gaps exist, such as no file transfer (e.g., SCP/SFTP) or SSH configuration management, but agents can work around these with the provided tools for most workflows.

Maintenance

ActivityInactive
ResponsivenessNo issues