mcp-server-ssh 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- mcp_server_ssh-1.0.0/LICENSE +21 -0
- mcp_server_ssh-1.0.0/PKG-INFO +362 -0
- mcp_server_ssh-1.0.0/README.md +340 -0
- mcp_server_ssh-1.0.0/pyproject.toml +38 -0
- mcp_server_ssh-1.0.0/setup.cfg +4 -0
- mcp_server_ssh-1.0.0/src/mcp_server_ssh/__init__.py +6 -0
- mcp_server_ssh-1.0.0/src/mcp_server_ssh/__main__.py +38 -0
- mcp_server_ssh-1.0.0/src/mcp_server_ssh/server.py +1085 -0
- mcp_server_ssh-1.0.0/src/mcp_server_ssh.egg-info/PKG-INFO +362 -0
- mcp_server_ssh-1.0.0/src/mcp_server_ssh.egg-info/SOURCES.txt +12 -0
- mcp_server_ssh-1.0.0/src/mcp_server_ssh.egg-info/dependency_links.txt +1 -0
- mcp_server_ssh-1.0.0/src/mcp_server_ssh.egg-info/entry_points.txt +2 -0
- mcp_server_ssh-1.0.0/src/mcp_server_ssh.egg-info/requires.txt +3 -0
- mcp_server_ssh-1.0.0/src/mcp_server_ssh.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 mytsx
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,362 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: mcp-server-ssh
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: SSH MCP server for remote Linux command execution via Model Context Protocol
|
|
5
|
+
Author: mytsx
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/mytsx/mcp-servers
|
|
8
|
+
Project-URL: Repository, https://github.com/mytsx/mcp-servers
|
|
9
|
+
Project-URL: Issues, https://github.com/mytsx/mcp-servers/issues
|
|
10
|
+
Keywords: mcp,model-context-protocol,ssh,remote,linux,claude
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Requires-Python: >=3.10
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
License-File: LICENSE
|
|
18
|
+
Requires-Dist: mcp>=1.0.0
|
|
19
|
+
Requires-Dist: paramiko>=3.4.0
|
|
20
|
+
Requires-Dist: python-dotenv>=1.0.0
|
|
21
|
+
Dynamic: license-file
|
|
22
|
+
|
|
23
|
+
# SSH MCP Server
|
|
24
|
+
|
|
25
|
+
SSH üzerinden uzak Linux sunucularında komut çalıştırma ve sistem yönetimi için Claude Desktop MCP Server'ı.
|
|
26
|
+
|
|
27
|
+
## 🚀 Özellikler
|
|
28
|
+
|
|
29
|
+
### 🛠️ Araçlar (Tools)
|
|
30
|
+
- **execute_command**: Shell komutları çalıştırma
|
|
31
|
+
- **file_operations**: Dosya okuma/yazma/listeleme
|
|
32
|
+
- **system_monitor**: Sistem kaynaklarını izleme
|
|
33
|
+
- **process_manager**: Process yönetimi
|
|
34
|
+
- **sftp_download**: SFTP ile dosya indirme (text/base64)
|
|
35
|
+
- **sftp_upload**: SFTP ile dosya yükleme (overwrite/append)
|
|
36
|
+
|
|
37
|
+
### 📊 Kaynaklar (Resources)
|
|
38
|
+
- **ssh://system**: Sistem bilgileri
|
|
39
|
+
- **ssh://processes**: Çalışan processler
|
|
40
|
+
- **ssh://disk**: Disk kullanımı
|
|
41
|
+
- **ssh://network**: Ağ bilgileri
|
|
42
|
+
- **ssh://logs**: Sistem logları
|
|
43
|
+
|
|
44
|
+
### 🔒 Güvenlik
|
|
45
|
+
- Tehlikeli komutlar otomatik engellenir
|
|
46
|
+
- SSH key authentication desteği
|
|
47
|
+
- Timeout koruması
|
|
48
|
+
- Safe file operations (SFTP)
|
|
49
|
+
- Process kill sadece numeric PID ile
|
|
50
|
+
- Tüm işlemler loglanır
|
|
51
|
+
|
|
52
|
+
## 📦 Installation / Kurulum
|
|
53
|
+
|
|
54
|
+
### Option 1: Using uvx (Recommended / Önerilen)
|
|
55
|
+
|
|
56
|
+
No installation required! Just configure Claude Desktop:
|
|
57
|
+
|
|
58
|
+
```json
|
|
59
|
+
{
|
|
60
|
+
"mcpServers": {
|
|
61
|
+
"ssh": {
|
|
62
|
+
"command": "uvx",
|
|
63
|
+
"args": ["mcp-server-ssh"],
|
|
64
|
+
"env": {
|
|
65
|
+
"SSH_HOST": "your_server_ip",
|
|
66
|
+
"SSH_PORT": "22",
|
|
67
|
+
"SSH_USER": "your_username",
|
|
68
|
+
"SSH_PASSWORD": "your_password",
|
|
69
|
+
"SSH_KEY_FILE": "/path/to/private_key"
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Option 2: Install from PyPI
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
pip install mcp-server-ssh
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Option 3: Install from Source / Kaynak Koddan Kurulum
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
cd ssh-mcp-server
|
|
86
|
+
pip install -e .
|
|
87
|
+
# or
|
|
88
|
+
./install.sh
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Environment Variables
|
|
92
|
+
|
|
93
|
+
`.env` dosyasını düzenleyin:
|
|
94
|
+
```env
|
|
95
|
+
SSH_HOST=your_server_ip
|
|
96
|
+
SSH_PORT=22
|
|
97
|
+
SSH_USER=your_username
|
|
98
|
+
SSH_PASSWORD=your_password
|
|
99
|
+
SSH_TIMEOUT=30
|
|
100
|
+
|
|
101
|
+
# SSH Key Authentication (optional - preferred over password)
|
|
102
|
+
SSH_KEY_FILE=/path/to/your/private_key
|
|
103
|
+
SSH_KEY_PASSPHRASE=your_key_passphrase # Optional: only if key is encrypted
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
**Authentication Priority:**
|
|
107
|
+
1. `SSH_KEY_FILE` set ise -> Key authentication
|
|
108
|
+
2. `SSH_PASSWORD` set ise -> Password authentication
|
|
109
|
+
3. Hicbiri yoksa -> Default key lookup (~/.ssh/id_rsa) + SSH agent
|
|
110
|
+
|
|
111
|
+
### Test
|
|
112
|
+
```bash
|
|
113
|
+
python test_ssh.py
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## 🔧 Claude Desktop Configuration
|
|
117
|
+
|
|
118
|
+
**macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
119
|
+
|
|
120
|
+
**Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
|
|
121
|
+
|
|
122
|
+
```json
|
|
123
|
+
{
|
|
124
|
+
"mcpServers": {
|
|
125
|
+
"ssh-mcp-server": {
|
|
126
|
+
"command": "/path/to/ssh-mcp-server/venv/bin/python",
|
|
127
|
+
"args": ["/path/to/ssh-mcp-server/server.py"],
|
|
128
|
+
"cwd": "/path/to/ssh-mcp-server"
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## 🧪 Kullanım Örnekleri
|
|
135
|
+
|
|
136
|
+
### Sistem Bilgileri
|
|
137
|
+
```
|
|
138
|
+
"Linux sunucumda sistem bilgilerini göster"
|
|
139
|
+
"Sunucunun uptime'ını kontrol et"
|
|
140
|
+
"Disk kullanımını göster"
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### Dosya İşlemleri
|
|
144
|
+
```
|
|
145
|
+
"/etc/hosts dosyasını oku"
|
|
146
|
+
"/var/log/nginx/error.log dosyasının son 100 satırını göster"
|
|
147
|
+
"/home dizinini listele"
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### Process Yönetimi
|
|
151
|
+
```
|
|
152
|
+
"Nginx processlerini listele"
|
|
153
|
+
"Python processlerini bul"
|
|
154
|
+
"CPU kullanımını göster"
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### Komut Çalıştırma
|
|
158
|
+
```
|
|
159
|
+
"df -h komutunu çalıştır"
|
|
160
|
+
"ps aux | grep nginx"
|
|
161
|
+
"systemctl status docker"
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
## 🔐 Güvenlik Özellikleri
|
|
165
|
+
|
|
166
|
+
### Engellenen Komutlar
|
|
167
|
+
- `rm -rf /`
|
|
168
|
+
- `format`, `mkfs`
|
|
169
|
+
- `dd if=/dev/zero of=/dev/sda`
|
|
170
|
+
- Fork bomb patterns
|
|
171
|
+
- `shutdown`, `reboot`, `halt`
|
|
172
|
+
- User deletion commands
|
|
173
|
+
|
|
174
|
+
### Güvenlik Best Practices
|
|
175
|
+
1. Sadece güvendiğiniz sunucularda kullanın
|
|
176
|
+
2. Limited yetkili kullanıcı hesabı kullanın
|
|
177
|
+
3. SSH key authentication tercih edin
|
|
178
|
+
4. Logları düzenli kontrol edin
|
|
179
|
+
5. Firewall kurallarını gözden geçirin
|
|
180
|
+
|
|
181
|
+
## 📋 Mevcut Araçlar
|
|
182
|
+
|
|
183
|
+
### execute_command
|
|
184
|
+
```json
|
|
185
|
+
{
|
|
186
|
+
"command": "ls -la /home",
|
|
187
|
+
"timeout": 30
|
|
188
|
+
}
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
### file_operations
|
|
192
|
+
```json
|
|
193
|
+
{
|
|
194
|
+
"operation": "read",
|
|
195
|
+
"path": "/etc/hosts",
|
|
196
|
+
"limit": 100
|
|
197
|
+
}
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
### system_monitor
|
|
201
|
+
```json
|
|
202
|
+
{
|
|
203
|
+
"metric": "all",
|
|
204
|
+
"detailed": true
|
|
205
|
+
}
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
### process_manager
|
|
209
|
+
```json
|
|
210
|
+
{
|
|
211
|
+
"action": "search",
|
|
212
|
+
"target": "nginx"
|
|
213
|
+
}
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
### sftp_download
|
|
217
|
+
```json
|
|
218
|
+
{
|
|
219
|
+
"remote_path": "/etc/hosts",
|
|
220
|
+
"encoding": "utf-8"
|
|
221
|
+
}
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
### sftp_upload
|
|
225
|
+
```json
|
|
226
|
+
{
|
|
227
|
+
"remote_path": "/tmp/test.txt",
|
|
228
|
+
"content": "Hello World",
|
|
229
|
+
"mode": "overwrite"
|
|
230
|
+
}
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
## 🐛 Sorun Giderme
|
|
234
|
+
|
|
235
|
+
### SSH Bağlantısı Başarısız
|
|
236
|
+
```bash
|
|
237
|
+
# Test SSH bağlantısı
|
|
238
|
+
ssh -p 42922 root@31.210.36.85
|
|
239
|
+
|
|
240
|
+
# .env dosyasını kontrol edin
|
|
241
|
+
cat .env
|
|
242
|
+
|
|
243
|
+
# SSH client test
|
|
244
|
+
python test_ssh.py
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
### MCP Server Başlamıyor
|
|
248
|
+
```bash
|
|
249
|
+
# Virtual environment kontrol
|
|
250
|
+
source venv/bin/activate
|
|
251
|
+
python -c "import paramiko; print('OK')"
|
|
252
|
+
|
|
253
|
+
# Server test
|
|
254
|
+
python server.py
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
### Komutlar Çalışmıyor
|
|
258
|
+
1. SSH kullanıcısının yetkileri
|
|
259
|
+
2. Komutun path'te olması
|
|
260
|
+
3. Timeout değeri
|
|
261
|
+
4. Güvenlik kısıtlamaları
|
|
262
|
+
|
|
263
|
+
## 📊 Performans
|
|
264
|
+
|
|
265
|
+
### Optimizasyon
|
|
266
|
+
- Connection pooling (gelecek sürüm)
|
|
267
|
+
- Command caching
|
|
268
|
+
- Parallel execution
|
|
269
|
+
- Resource monitoring
|
|
270
|
+
|
|
271
|
+
### Limits
|
|
272
|
+
- Command timeout: 30s (varsayılan)
|
|
273
|
+
- File read limit: 100 lines (varsayılan)
|
|
274
|
+
- Connection timeout: 30s
|
|
275
|
+
- Memory usage monitoring
|
|
276
|
+
|
|
277
|
+
## 🔄 Güncellemeler
|
|
278
|
+
|
|
279
|
+
### v1.0.0
|
|
280
|
+
- Temel SSH komut çalıştırma
|
|
281
|
+
- Dosya operasyonları
|
|
282
|
+
- Sistem monitoring
|
|
283
|
+
- Process management
|
|
284
|
+
- Güvenlik kontrolleri
|
|
285
|
+
|
|
286
|
+
### Roadmap
|
|
287
|
+
- Connection pooling
|
|
288
|
+
- Interactive shell
|
|
289
|
+
- Multi-server support
|
|
290
|
+
|
|
291
|
+
## 📊 Activity Dashboard
|
|
292
|
+
|
|
293
|
+
SSH MCP server aktivitelerini izlemek için modern web dashboard:
|
|
294
|
+
|
|
295
|
+
### Dashboard Özellikleri
|
|
296
|
+
- 📈 Real-time aktivite izleme
|
|
297
|
+
- 📊 İstatistik ve grafikler
|
|
298
|
+
- 🔍 Detaylı arama ve filtreleme
|
|
299
|
+
- 📥 Export (JSON/CSV)
|
|
300
|
+
- 🎨 Modern responsive tasarım
|
|
301
|
+
|
|
302
|
+
### Dashboard Başlatma
|
|
303
|
+
```bash
|
|
304
|
+
cd ssh-mcp-server
|
|
305
|
+
./start_dashboard.sh
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
Dashboard http://localhost:5555 adresinde açılacaktır.
|
|
309
|
+
|
|
310
|
+
⚠️ **Production Uyarısı**: Development sunucusu sadece test için uygundur. Production ortamında güvenlik ve performans için profesyonel web sunucusu kullanın:
|
|
311
|
+
|
|
312
|
+
```bash
|
|
313
|
+
# Gunicorn ile production deployment
|
|
314
|
+
pip install gunicorn
|
|
315
|
+
gunicorn -w 4 -b 0.0.0.0:5555 ssh_log_dashboard:app
|
|
316
|
+
|
|
317
|
+
# Nginx reverse proxy önerisi
|
|
318
|
+
# nginx.conf:
|
|
319
|
+
# location /ssh-dashboard/ {
|
|
320
|
+
# proxy_pass http://127.0.0.1:5555/;
|
|
321
|
+
# proxy_set_header Host $host;
|
|
322
|
+
# proxy_set_header X-Real-IP $remote_addr;
|
|
323
|
+
# }
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
### Dashboard Sayfaları
|
|
327
|
+
1. **Overview**: Genel istatistikler ve timeline
|
|
328
|
+
2. **Activities**: Tüm aktivitelerin detaylı listesi
|
|
329
|
+
3. **Sessions**: SSH oturumları ve analizleri
|
|
330
|
+
4. **Commands**: En çok kullanılan komutlar
|
|
331
|
+
5. **Errors**: Hata analizi ve raporları
|
|
332
|
+
6. **Search**: Gelişmiş arama özellikleri
|
|
333
|
+
|
|
334
|
+
## 📞 Destek
|
|
335
|
+
|
|
336
|
+
### Loglar
|
|
337
|
+
```bash
|
|
338
|
+
tail -f ~/.local/share/Claude/logs/mcp-server-ssh.log
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
### Debug Mode
|
|
342
|
+
```bash
|
|
343
|
+
DEBUG=1 python server.py
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
### Common Issues
|
|
347
|
+
1. **Connection refused**: Firewall/port kontrol
|
|
348
|
+
2. **Authentication failed**: Username/password kontrol
|
|
349
|
+
3. **Command not found**: PATH ve package kurulumu
|
|
350
|
+
4. **Permission denied**: User permissions kontrol
|
|
351
|
+
|
|
352
|
+
## ⚖️ License
|
|
353
|
+
MIT License
|
|
354
|
+
|
|
355
|
+
## 🤝 Contributing
|
|
356
|
+
1. Fork repository
|
|
357
|
+
2. Create feature branch
|
|
358
|
+
3. Test thoroughly
|
|
359
|
+
4. Submit pull request
|
|
360
|
+
|
|
361
|
+
## ⚠️ Disclaimer
|
|
362
|
+
Bu tool sistem yönetimi içindir. Kötü amaçlı kullanımdan kullanıcı sorumludur. Production sistemlerde dikkatli kullanın.
|
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
# SSH MCP Server
|
|
2
|
+
|
|
3
|
+
SSH üzerinden uzak Linux sunucularında komut çalıştırma ve sistem yönetimi için Claude Desktop MCP Server'ı.
|
|
4
|
+
|
|
5
|
+
## 🚀 Özellikler
|
|
6
|
+
|
|
7
|
+
### 🛠️ Araçlar (Tools)
|
|
8
|
+
- **execute_command**: Shell komutları çalıştırma
|
|
9
|
+
- **file_operations**: Dosya okuma/yazma/listeleme
|
|
10
|
+
- **system_monitor**: Sistem kaynaklarını izleme
|
|
11
|
+
- **process_manager**: Process yönetimi
|
|
12
|
+
- **sftp_download**: SFTP ile dosya indirme (text/base64)
|
|
13
|
+
- **sftp_upload**: SFTP ile dosya yükleme (overwrite/append)
|
|
14
|
+
|
|
15
|
+
### 📊 Kaynaklar (Resources)
|
|
16
|
+
- **ssh://system**: Sistem bilgileri
|
|
17
|
+
- **ssh://processes**: Çalışan processler
|
|
18
|
+
- **ssh://disk**: Disk kullanımı
|
|
19
|
+
- **ssh://network**: Ağ bilgileri
|
|
20
|
+
- **ssh://logs**: Sistem logları
|
|
21
|
+
|
|
22
|
+
### 🔒 Güvenlik
|
|
23
|
+
- Tehlikeli komutlar otomatik engellenir
|
|
24
|
+
- SSH key authentication desteği
|
|
25
|
+
- Timeout koruması
|
|
26
|
+
- Safe file operations (SFTP)
|
|
27
|
+
- Process kill sadece numeric PID ile
|
|
28
|
+
- Tüm işlemler loglanır
|
|
29
|
+
|
|
30
|
+
## 📦 Installation / Kurulum
|
|
31
|
+
|
|
32
|
+
### Option 1: Using uvx (Recommended / Önerilen)
|
|
33
|
+
|
|
34
|
+
No installation required! Just configure Claude Desktop:
|
|
35
|
+
|
|
36
|
+
```json
|
|
37
|
+
{
|
|
38
|
+
"mcpServers": {
|
|
39
|
+
"ssh": {
|
|
40
|
+
"command": "uvx",
|
|
41
|
+
"args": ["mcp-server-ssh"],
|
|
42
|
+
"env": {
|
|
43
|
+
"SSH_HOST": "your_server_ip",
|
|
44
|
+
"SSH_PORT": "22",
|
|
45
|
+
"SSH_USER": "your_username",
|
|
46
|
+
"SSH_PASSWORD": "your_password",
|
|
47
|
+
"SSH_KEY_FILE": "/path/to/private_key"
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Option 2: Install from PyPI
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
pip install mcp-server-ssh
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Option 3: Install from Source / Kaynak Koddan Kurulum
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
cd ssh-mcp-server
|
|
64
|
+
pip install -e .
|
|
65
|
+
# or
|
|
66
|
+
./install.sh
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Environment Variables
|
|
70
|
+
|
|
71
|
+
`.env` dosyasını düzenleyin:
|
|
72
|
+
```env
|
|
73
|
+
SSH_HOST=your_server_ip
|
|
74
|
+
SSH_PORT=22
|
|
75
|
+
SSH_USER=your_username
|
|
76
|
+
SSH_PASSWORD=your_password
|
|
77
|
+
SSH_TIMEOUT=30
|
|
78
|
+
|
|
79
|
+
# SSH Key Authentication (optional - preferred over password)
|
|
80
|
+
SSH_KEY_FILE=/path/to/your/private_key
|
|
81
|
+
SSH_KEY_PASSPHRASE=your_key_passphrase # Optional: only if key is encrypted
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
**Authentication Priority:**
|
|
85
|
+
1. `SSH_KEY_FILE` set ise -> Key authentication
|
|
86
|
+
2. `SSH_PASSWORD` set ise -> Password authentication
|
|
87
|
+
3. Hicbiri yoksa -> Default key lookup (~/.ssh/id_rsa) + SSH agent
|
|
88
|
+
|
|
89
|
+
### Test
|
|
90
|
+
```bash
|
|
91
|
+
python test_ssh.py
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## 🔧 Claude Desktop Configuration
|
|
95
|
+
|
|
96
|
+
**macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
97
|
+
|
|
98
|
+
**Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
|
|
99
|
+
|
|
100
|
+
```json
|
|
101
|
+
{
|
|
102
|
+
"mcpServers": {
|
|
103
|
+
"ssh-mcp-server": {
|
|
104
|
+
"command": "/path/to/ssh-mcp-server/venv/bin/python",
|
|
105
|
+
"args": ["/path/to/ssh-mcp-server/server.py"],
|
|
106
|
+
"cwd": "/path/to/ssh-mcp-server"
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## 🧪 Kullanım Örnekleri
|
|
113
|
+
|
|
114
|
+
### Sistem Bilgileri
|
|
115
|
+
```
|
|
116
|
+
"Linux sunucumda sistem bilgilerini göster"
|
|
117
|
+
"Sunucunun uptime'ını kontrol et"
|
|
118
|
+
"Disk kullanımını göster"
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### Dosya İşlemleri
|
|
122
|
+
```
|
|
123
|
+
"/etc/hosts dosyasını oku"
|
|
124
|
+
"/var/log/nginx/error.log dosyasının son 100 satırını göster"
|
|
125
|
+
"/home dizinini listele"
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### Process Yönetimi
|
|
129
|
+
```
|
|
130
|
+
"Nginx processlerini listele"
|
|
131
|
+
"Python processlerini bul"
|
|
132
|
+
"CPU kullanımını göster"
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### Komut Çalıştırma
|
|
136
|
+
```
|
|
137
|
+
"df -h komutunu çalıştır"
|
|
138
|
+
"ps aux | grep nginx"
|
|
139
|
+
"systemctl status docker"
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## 🔐 Güvenlik Özellikleri
|
|
143
|
+
|
|
144
|
+
### Engellenen Komutlar
|
|
145
|
+
- `rm -rf /`
|
|
146
|
+
- `format`, `mkfs`
|
|
147
|
+
- `dd if=/dev/zero of=/dev/sda`
|
|
148
|
+
- Fork bomb patterns
|
|
149
|
+
- `shutdown`, `reboot`, `halt`
|
|
150
|
+
- User deletion commands
|
|
151
|
+
|
|
152
|
+
### Güvenlik Best Practices
|
|
153
|
+
1. Sadece güvendiğiniz sunucularda kullanın
|
|
154
|
+
2. Limited yetkili kullanıcı hesabı kullanın
|
|
155
|
+
3. SSH key authentication tercih edin
|
|
156
|
+
4. Logları düzenli kontrol edin
|
|
157
|
+
5. Firewall kurallarını gözden geçirin
|
|
158
|
+
|
|
159
|
+
## 📋 Mevcut Araçlar
|
|
160
|
+
|
|
161
|
+
### execute_command
|
|
162
|
+
```json
|
|
163
|
+
{
|
|
164
|
+
"command": "ls -la /home",
|
|
165
|
+
"timeout": 30
|
|
166
|
+
}
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
### file_operations
|
|
170
|
+
```json
|
|
171
|
+
{
|
|
172
|
+
"operation": "read",
|
|
173
|
+
"path": "/etc/hosts",
|
|
174
|
+
"limit": 100
|
|
175
|
+
}
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### system_monitor
|
|
179
|
+
```json
|
|
180
|
+
{
|
|
181
|
+
"metric": "all",
|
|
182
|
+
"detailed": true
|
|
183
|
+
}
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
### process_manager
|
|
187
|
+
```json
|
|
188
|
+
{
|
|
189
|
+
"action": "search",
|
|
190
|
+
"target": "nginx"
|
|
191
|
+
}
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
### sftp_download
|
|
195
|
+
```json
|
|
196
|
+
{
|
|
197
|
+
"remote_path": "/etc/hosts",
|
|
198
|
+
"encoding": "utf-8"
|
|
199
|
+
}
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
### sftp_upload
|
|
203
|
+
```json
|
|
204
|
+
{
|
|
205
|
+
"remote_path": "/tmp/test.txt",
|
|
206
|
+
"content": "Hello World",
|
|
207
|
+
"mode": "overwrite"
|
|
208
|
+
}
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
## 🐛 Sorun Giderme
|
|
212
|
+
|
|
213
|
+
### SSH Bağlantısı Başarısız
|
|
214
|
+
```bash
|
|
215
|
+
# Test SSH bağlantısı
|
|
216
|
+
ssh -p 42922 root@31.210.36.85
|
|
217
|
+
|
|
218
|
+
# .env dosyasını kontrol edin
|
|
219
|
+
cat .env
|
|
220
|
+
|
|
221
|
+
# SSH client test
|
|
222
|
+
python test_ssh.py
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
### MCP Server Başlamıyor
|
|
226
|
+
```bash
|
|
227
|
+
# Virtual environment kontrol
|
|
228
|
+
source venv/bin/activate
|
|
229
|
+
python -c "import paramiko; print('OK')"
|
|
230
|
+
|
|
231
|
+
# Server test
|
|
232
|
+
python server.py
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
### Komutlar Çalışmıyor
|
|
236
|
+
1. SSH kullanıcısının yetkileri
|
|
237
|
+
2. Komutun path'te olması
|
|
238
|
+
3. Timeout değeri
|
|
239
|
+
4. Güvenlik kısıtlamaları
|
|
240
|
+
|
|
241
|
+
## 📊 Performans
|
|
242
|
+
|
|
243
|
+
### Optimizasyon
|
|
244
|
+
- Connection pooling (gelecek sürüm)
|
|
245
|
+
- Command caching
|
|
246
|
+
- Parallel execution
|
|
247
|
+
- Resource monitoring
|
|
248
|
+
|
|
249
|
+
### Limits
|
|
250
|
+
- Command timeout: 30s (varsayılan)
|
|
251
|
+
- File read limit: 100 lines (varsayılan)
|
|
252
|
+
- Connection timeout: 30s
|
|
253
|
+
- Memory usage monitoring
|
|
254
|
+
|
|
255
|
+
## 🔄 Güncellemeler
|
|
256
|
+
|
|
257
|
+
### v1.0.0
|
|
258
|
+
- Temel SSH komut çalıştırma
|
|
259
|
+
- Dosya operasyonları
|
|
260
|
+
- Sistem monitoring
|
|
261
|
+
- Process management
|
|
262
|
+
- Güvenlik kontrolleri
|
|
263
|
+
|
|
264
|
+
### Roadmap
|
|
265
|
+
- Connection pooling
|
|
266
|
+
- Interactive shell
|
|
267
|
+
- Multi-server support
|
|
268
|
+
|
|
269
|
+
## 📊 Activity Dashboard
|
|
270
|
+
|
|
271
|
+
SSH MCP server aktivitelerini izlemek için modern web dashboard:
|
|
272
|
+
|
|
273
|
+
### Dashboard Özellikleri
|
|
274
|
+
- 📈 Real-time aktivite izleme
|
|
275
|
+
- 📊 İstatistik ve grafikler
|
|
276
|
+
- 🔍 Detaylı arama ve filtreleme
|
|
277
|
+
- 📥 Export (JSON/CSV)
|
|
278
|
+
- 🎨 Modern responsive tasarım
|
|
279
|
+
|
|
280
|
+
### Dashboard Başlatma
|
|
281
|
+
```bash
|
|
282
|
+
cd ssh-mcp-server
|
|
283
|
+
./start_dashboard.sh
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
Dashboard http://localhost:5555 adresinde açılacaktır.
|
|
287
|
+
|
|
288
|
+
⚠️ **Production Uyarısı**: Development sunucusu sadece test için uygundur. Production ortamında güvenlik ve performans için profesyonel web sunucusu kullanın:
|
|
289
|
+
|
|
290
|
+
```bash
|
|
291
|
+
# Gunicorn ile production deployment
|
|
292
|
+
pip install gunicorn
|
|
293
|
+
gunicorn -w 4 -b 0.0.0.0:5555 ssh_log_dashboard:app
|
|
294
|
+
|
|
295
|
+
# Nginx reverse proxy önerisi
|
|
296
|
+
# nginx.conf:
|
|
297
|
+
# location /ssh-dashboard/ {
|
|
298
|
+
# proxy_pass http://127.0.0.1:5555/;
|
|
299
|
+
# proxy_set_header Host $host;
|
|
300
|
+
# proxy_set_header X-Real-IP $remote_addr;
|
|
301
|
+
# }
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
### Dashboard Sayfaları
|
|
305
|
+
1. **Overview**: Genel istatistikler ve timeline
|
|
306
|
+
2. **Activities**: Tüm aktivitelerin detaylı listesi
|
|
307
|
+
3. **Sessions**: SSH oturumları ve analizleri
|
|
308
|
+
4. **Commands**: En çok kullanılan komutlar
|
|
309
|
+
5. **Errors**: Hata analizi ve raporları
|
|
310
|
+
6. **Search**: Gelişmiş arama özellikleri
|
|
311
|
+
|
|
312
|
+
## 📞 Destek
|
|
313
|
+
|
|
314
|
+
### Loglar
|
|
315
|
+
```bash
|
|
316
|
+
tail -f ~/.local/share/Claude/logs/mcp-server-ssh.log
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
### Debug Mode
|
|
320
|
+
```bash
|
|
321
|
+
DEBUG=1 python server.py
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
### Common Issues
|
|
325
|
+
1. **Connection refused**: Firewall/port kontrol
|
|
326
|
+
2. **Authentication failed**: Username/password kontrol
|
|
327
|
+
3. **Command not found**: PATH ve package kurulumu
|
|
328
|
+
4. **Permission denied**: User permissions kontrol
|
|
329
|
+
|
|
330
|
+
## ⚖️ License
|
|
331
|
+
MIT License
|
|
332
|
+
|
|
333
|
+
## 🤝 Contributing
|
|
334
|
+
1. Fork repository
|
|
335
|
+
2. Create feature branch
|
|
336
|
+
3. Test thoroughly
|
|
337
|
+
4. Submit pull request
|
|
338
|
+
|
|
339
|
+
## ⚠️ Disclaimer
|
|
340
|
+
Bu tool sistem yönetimi içindir. Kötü amaçlı kullanımdan kullanıcı sorumludur. Production sistemlerde dikkatli kullanın.
|