# SSH-PowerShell MCP Server
π **Enterprise-grade Model Context Protocol (MCP) server** for secure SSH and PowerShell command execution with Claude Desktop.
[](https://opensource.org/licenses/MIT)
[](https://nodejs.org/)
[](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)