Adds comprehensive HTTP logging and token persistence
Introduces robust HTTP request and tool invocation logging with sensitive data sanitization and configurable file rotation. This improves debuggability and operational oversight. Implements token state persistence to disk, allowing the server to maintain authenticated sessions across restarts. Adds `_with_webhook` variants for alarm registration tools, enabling explicit webhook configuration. Corrects spelling inconsistencies in geographical alarm tools (e.g., 'neighbourhood' to 'neighborhood'). Includes a new build and packaging script.
This commit is contained in:
@@ -83,6 +83,12 @@ IKLIM_BASE_URL= # Opsiyonel. Tanımlıysa IKLIM_ENV'i override
|
||||
IKLIM_HMAC_SECRET=<secret> # Zorunlu. İstek imzalama için HMAC-SHA256 anahtarı
|
||||
IKLIM_USERNAME=<email> # Zorunlu. API kullanıcı e-postası
|
||||
IKLIM_PASSWORD=<password> # Zorunlu. API kullanıcı şifresi
|
||||
IKLIM_TOKEN_STORE_PATH=/home/murat/iklim-mcp-server/token-state.bin # Opsiyonel. Access/refresh token binary dosyası
|
||||
IKLIM_HTTP_LOG_PATH= # Opsiyonel. API istek log dosyası (örn: /var/log/iklim-mcp/http.log)
|
||||
IKLIM_HTTP_LOG_MAX_BYTES=5242880 # Opsiyonel. Rotate eşiği (byte), default: 5MB
|
||||
IKLIM_HTTP_LOG_MAX_FILES=5 # Opsiyonel. Tutulacak rotated dosya sayısı (0 = geçmiş dosya tutma)
|
||||
IKLIM_HTTP_LOG_REQUEST_BODY_MAX_BYTES=16384 # Opsiyonel. Request body log limiti (byte)
|
||||
IKLIM_HTTP_LOG_RESPONSE_BODY_MAX_BYTES=16384 # Opsiyonel. Response body log limiti (byte)
|
||||
```
|
||||
|
||||
**🌍 Ortama göre base URL:**
|
||||
@@ -93,6 +99,18 @@ IKLIM_PASSWORD=<password> # Zorunlu. API kullanıcı şifresi
|
||||
| `test` | `https://api-test.iklim.co` |
|
||||
| `local` | `http://localhost:8080` |
|
||||
|
||||
**📝 API istek logları (rotate):**
|
||||
|
||||
- `IKLIM_HTTP_LOG_PATH` tanımlıysa MCP server yaptığı tüm API çağrıları için tek satır JSON log yazar.
|
||||
- Her satırda istek header'ları da (`requestHeaders`) bulunur; hassas alanlar maskelenir (`Authorization`, `X-Signature`, `X-Idempotency-Key`, `X-Nonce`).
|
||||
- Request body (`requestBody`) loglanır; JSON ise hassas alanlar maskelenir (örn. `password`, `token`) ve değer `IKLIM_HTTP_LOG_REQUEST_BODY_MAX_BYTES` sınırında kırpılır.
|
||||
- Response header'ları (`responseHeaders`) loglanır; hassas alanlar maskelenir (`Set-Cookie`/`Cookie` dahil).
|
||||
- Response body (`responseBody`) loglanır; JSON ise hassas alanlar maskelenir (`password`, `secret`, `token` vb.) ve değer `IKLIM_HTTP_LOG_RESPONSE_BODY_MAX_BYTES` sınırında kırpılır.
|
||||
- Log dosyası `IKLIM_HTTP_LOG_MAX_BYTES` değerini aşınca rotate olur:
|
||||
- `http.log` → `http.log.1`
|
||||
- eski `http.log.1` → `http.log.2` ... `http.log.<N>`
|
||||
- `IKLIM_HTTP_LOG_MAX_FILES` kadar geçmiş dosya tutulur.
|
||||
|
||||
---
|
||||
|
||||
## ▶️ Build ve Çalıştırma
|
||||
@@ -452,8 +470,8 @@ Nokta alarmlarıyla aynı imza.
|
||||
| `geo_alarm_get_city` | `cityId` ile il detayı |
|
||||
| `geo_alarm_list_districts` | `cityId` ile ilçeleri listeler |
|
||||
| `geo_alarm_get_district` | `districtId` ile ilçe detayı |
|
||||
| `geo_alarm_list_neighbourhoods` | `districtId` ile mahalleleri listeler |
|
||||
| `geo_alarm_get_neighbourhood` | `neighbourhoodId` ile mahalle detayı |
|
||||
| `geo_alarm_list_neighborhoods` | `districtId` ile mahalleleri listeler |
|
||||
| `geo_alarm_get_neighborhood` | `neighborhoodId` ile mahalle detayı |
|
||||
|
||||
---
|
||||
|
||||
|
||||
Reference in New Issue
Block a user