Bu rehber, FortiGate MCP HTTP Server'ının nasıl kurulacağını ve kullanılacağını açıklar.
- Python 3.8+
- pip veya uv
- FortiGate cihazına erişim
# Virtual environment oluştur
python -m venv .venv
source .venv/bin/activate # Linux/Mac
# veya
.venv\Scripts\activate # Windows
# Bağımlılıkları yükle
pip install -r requirements.txtconfig/config.json dosyasını düzenleyin:
{
"fortigate": {
"devices": {
"default": {
"host": "192.168.1.1",
"port": 443,
"username": "admin",
"password": "password",
"api_token": "your-api-token",
"vdom": "root",
"verify_ssl": false,
"timeout": 30
}
}
},
"logging": {
"level": "INFO",
"file": "./logs/fortigate_mcp.log"
}
}# Script ile başlat
./start_http_server.sh
# Veya manuel olarak
python -m src.fortigate_mcp.server_http \
--host 0.0.0.0 \
--port 8814 \
--path /fortigate-mcp \
--config config/config.json# Build ve başlat
docker-compose up -d
# Logları görüntüle
docker-compose logs -f fortigate-mcp-serverCursor'da ~/.cursor/mcp_servers.json dosyasını düzenleyin:
{
"mcpServers": {
"fortigate-mcp": {
"command": "python",
"args": [
"-m",
"src.fortigate_mcp.server_http",
"--host",
"0.0.0.0",
"--port",
"8814",
"--path",
"/fortigate-mcp",
"--config",
"/path/to/your/config.json"
],
"env": {
"FORTIGATE_MCP_CONFIG": "/path/to/your/config.json"
}
}
}
}Cursor'da FortiGate MCP'yi kullanmak için:
- Cursor'u yeniden başlatın
- MCP server'ın başladığından emin olun
- Cursor'da FortiGate komutlarını kullanın
GET /fortigate-mcp/health- Sağlık kontrolüPOST /fortigate-mcp- MCP komutları
list_devices- Kayıtlı cihazları listeleget_device_status- Cihaz durumunu altest_device_connection- Bağlantıyı test etadd_device- Yeni cihaz ekleremove_device- Cihaz kaldır
list_firewall_policies- Firewall kurallarını listelecreate_firewall_policy- Yeni kural oluşturupdate_firewall_policy- Kural güncelledelete_firewall_policy- Kural sil
list_address_objects- Adres nesnelerini listelecreate_address_object- Adres nesnesi oluşturlist_service_objects- Servis nesnelerini listelecreate_service_object- Servis nesnesi oluştur
list_static_routes- Statik rotaları listelecreate_static_route- Statik rota oluşturlist_interfaces- Arayüzleri listeleget_interface_status- Arayüz durumunu al
# Test script'ini çalıştır
python test_http_server.py# Health check
curl -X POST http://localhost:8814/fortigate-mcp \
-H "Content-Type: application/json" \
-d '{"jsonrpc": "2.0", "id": 1, "method": "health", "params": {}}'
# List devices
curl -X POST http://localhost:8814/fortigate-mcp \
-H "Content-Type: application/json" \
-d '{"jsonrpc": "2.0", "id": 1, "method": "list_devices", "params": {}}'-
Bağlantı Hatası
- FortiGate cihazının erişilebilir olduğundan emin olun
- API token veya kullanıcı adı/şifre doğru olmalı
- SSL sertifikası sorunları için
verify_ssl: falsekullanın
-
Port Çakışması
- 8814 portunun kullanılabilir olduğundan emin olun
- Farklı port kullanmak için
--portparametresini değiştirin
-
Konfigürasyon Hatası
config.jsondosyasının doğru formatta olduğundan emin olun- JSON syntax'ını kontrol edin
Logları kontrol etmek için:
# HTTP server logları
tail -f logs/fortigate_mcp.log
# Docker logları
docker-compose logs -f fortigate-mcp-server-
API Token Kullanın
- Kullanıcı adı/şifre yerine API token kullanın
- Token'ları güvenli şekilde saklayın
-
SSL Sertifikası
- Üretim ortamında SSL sertifikası kullanın
verify_ssl: trueyapın
-
Ağ Güvenliği
- MCP server'ı sadece güvenli ağlarda çalıştırın
- Firewall kuralları ile erişimi kısıtlayın
-
Rate Limiting
- Rate limiting'i etkinleştirin
- API çağrılarını sınırlayın
- Fork yapın
- Feature branch oluşturun
- Değişikliklerinizi commit edin
- Pull request gönderin
Bu proje MIT lisansı altında lisanslanmıştır.