atabey-mcp 0.0.13 → 0.0.15

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.
Files changed (74) hide show
  1. package/README.md +307 -35
  2. package/dist/dashboard/assets/index-B_rK57vi.js +1221 -0
  3. package/dist/dashboard/index.html +1 -1
  4. package/dist/framework-mcp/src/index.js +988 -63
  5. package/dist/framework-mcp/src/tools/compliance/mask_pii.js +55 -0
  6. package/dist/framework-mcp/src/tools/definitions.js +10 -9
  7. package/dist/framework-mcp/src/tools/framework/run_tests.js +25 -0
  8. package/dist/framework-mcp/src/tools/index.js +7 -8
  9. package/dist/framework-mcp/src/tools/messaging/approve_operation.js +80 -0
  10. package/dist/framework-mcp/src/tools/messaging/ask_human.js +89 -20
  11. package/dist/framework-mcp/src/tools/observability/check_ports.js +24 -8
  12. package/dist/framework-mcp/src/tools/quality/analyze_code_quality.js +13 -64
  13. package/dist/framework-mcp/src/tools/schemas.js +18 -22
  14. package/dist/framework-mcp/src/tools/shell/run_command.js +146 -90
  15. package/dist/framework-mcp/src/tools/types.js +1 -0
  16. package/dist/framework-mcp/src/utils/auth.js +78 -0
  17. package/dist/framework-mcp/src/utils/auto-rollback.js +265 -0
  18. package/dist/framework-mcp/src/utils/compliance.js +12 -4
  19. package/dist/framework-mcp/src/utils/context-optimizer.js +156 -0
  20. package/dist/framework-mcp/src/utils/discipline.js +217 -0
  21. package/dist/framework-mcp/src/utils/finops.js +325 -0
  22. package/dist/framework-mcp/src/utils/human-in-loop.js +215 -0
  23. package/dist/framework-mcp/src/utils/license-scanner.js +283 -0
  24. package/dist/framework-mcp/src/utils/loop-detector.js +361 -0
  25. package/dist/framework-mcp/src/utils/quality.js +124 -0
  26. package/dist/framework-mcp/src/utils/rules-engine.js +231 -0
  27. package/dist/framework-mcp/src/utils/silent-router.js +154 -0
  28. package/dist/framework-mcp/src/utils/storage.js +2 -2
  29. package/dist/framework-mcp/src/utils/telemetry-streamer.js +396 -0
  30. package/dist/src/cli/platforms/core.js +72 -0
  31. package/dist/src/cli/platforms/index.js +5 -0
  32. package/dist/src/cli/platforms/paths.js +101 -0
  33. package/dist/src/cli/platforms/scaffold.js +72 -0
  34. package/dist/src/cli/platforms/utils.js +75 -0
  35. package/dist/src/cli/utils/claude.js +57 -0
  36. package/dist/src/cli/utils/compliance.js +12 -0
  37. package/dist/src/cli/utils/fs.js +138 -0
  38. package/dist/src/cli/utils/pkg.js +282 -0
  39. package/dist/src/cli/utils/quality.js +9 -0
  40. package/dist/src/modules/agents/definitions.js +563 -0
  41. package/dist/src/modules/agents/registry/analyst.js +39 -0
  42. package/dist/src/modules/agents/registry/architect.js +42 -0
  43. package/dist/src/modules/agents/registry/backend.js +50 -0
  44. package/dist/src/modules/agents/registry/database.js +45 -0
  45. package/dist/src/modules/agents/registry/devops.js +45 -0
  46. package/dist/src/modules/agents/registry/explorer.js +37 -0
  47. package/dist/src/modules/agents/registry/frontend.js +52 -0
  48. package/dist/src/modules/agents/registry/git.js +36 -0
  49. package/dist/src/modules/agents/registry/manager.js +64 -0
  50. package/dist/src/modules/agents/registry/mobile.js +41 -0
  51. package/dist/src/modules/agents/registry/native.js +41 -0
  52. package/dist/src/modules/agents/registry/quality.js +43 -0
  53. package/dist/src/modules/agents/registry/security.js +42 -0
  54. package/dist/src/modules/agents/types.js +1 -0
  55. package/dist/src/modules/engines/evaluation-engine.js +169 -0
  56. package/dist/src/modules/engines/quality-gate.js +92 -0
  57. package/dist/src/modules/engines/risk-engine.js +105 -0
  58. package/dist/src/modules/engines/routing-engine.js +408 -0
  59. package/dist/src/modules/engines/types.js +1 -0
  60. package/dist/src/modules/providers/definitions.js +140 -0
  61. package/dist/src/modules/providers/registry.js +18 -0
  62. package/dist/src/modules/providers/shared.js +104 -0
  63. package/dist/src/modules/providers/types.js +1 -0
  64. package/dist/src/modules/skills/adapter-skills.js +449 -0
  65. package/dist/src/modules/skills/definitions.js +70 -0
  66. package/dist/src/shared/audit.js +220 -0
  67. package/dist/src/shared/errors.js +68 -0
  68. package/dist/src/shared/lock.js +159 -0
  69. package/dist/src/shared/pii.js +122 -31
  70. package/dist/src/shared/retention.js +170 -0
  71. package/dist/src/shared/storage.js +47 -7
  72. package/dist/src/shared/string.js +29 -0
  73. package/package.json +8 -2
  74. package/dist/dashboard/assets/index-BAPGLiWE.js +0 -267
package/README.md CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  The **Model Context Protocol (MCP)** server for [Agent Atabey](https://www.npmjs.com/package/atabey).
8
8
 
9
- This package bridges AI assistants (Claude Code, Gemini CLI, Cursor, Codex, Antigravity) with your local project environment. Provides **30+ secure, audited, type-safe tools** across 10 categories. Includes the **Hermes Control Center** dashboard with 8 live modules.
9
+ This package bridges AI assistants (Claude Code, Gemini CLI, Cursor, Codex, Antigravity) with your local project environment. Provides **34+ secure, audited, type-safe tools** across 10 categories + **5 Invisible AI Governance Layers** that run transparently behind every tool call. Includes the **Hermes Control Center** dashboard with 12+ live modules.
10
10
 
11
11
  > **Main Package:** [`atabey`](https://www.npmjs.com/package/atabey) (CLI + Framework)
12
12
 
@@ -16,11 +16,15 @@ This package bridges AI assistants (Claude Code, Gemini CLI, Cursor, Codex, Anti
16
16
 
17
17
  - [Installation](#installation)
18
18
  - [How It Works](#how-it-works)
19
+ - [Invisible AI Governance Layer](#-invisible-ai-governance-layer)
19
20
  - [Hermes Control Center Dashboard](#hermes-control-center-dashboard)
20
- - [Provided Tools (30+)](#provided-tools-30)
21
+ - [Provided Tools (34)](#provided-tools-34)
22
+ - [API Endpoints](#-api-endpoints)
21
23
  - [MCP Configuration](#mcp-configuration)
24
+ - [Environment Variables](#-environment-variables)
22
25
  - [Development](#development)
23
26
  - [Testing](#testing)
27
+ - [Enterprise Governance Checklist](#-enterprise-governance-checklist)
24
28
 
25
29
  ---
26
30
 
@@ -41,44 +45,66 @@ npm install atabey-mcp
41
45
 
42
46
  ## How It Works
43
47
 
44
- Atabey MCP Server connects your AI assistant to your project via the **Model Context Protocol**:
48
+ Atabey MCP Server operates as an **Invisible AI Governance Middleware** between your AI assistant and your project. The developer never writes `@agent` commands — Atabey silently detects intent, injects governance rules, and enforces enterprise policies at the tool level.
45
49
 
46
50
  ```
47
- AI Assistant (Claude/Gemini/Cursor)
51
+ AI Assistant (Claude Code / Gemini CLI / Cursor)
48
52
 
49
- ▼ MCP Protocol (stdio transport)
53
+ ▼ MCP Protocol (Surgical Tool Calls & Interception)
50
54
 
51
- Atabey MCP Server (30+ tools)
55
+ ┌──────────────────────────────────────────────────────────────┐
56
+ │ Atabey MCP Server (Invisible AI Governance Middleware) │
57
+ │ │
58
+ │ ├── 1. Silent Semantic Router (Intent Detection & │
59
+ │ │ Rules Injection — no @agent needed) │
60
+ │ ├── 2. Token Circuit Breaker + FinOps Budget (Cost & │
61
+ │ │ Context Window Governance) │
62
+ │ ├── 3. Loop Detector (6 Pattern Prevention — Cooldown) │
63
+ │ ├── 4. License Scanner (SPDX / Copyleft Blocking) │
64
+ │ ├── 5. Pre-Write Snapshot + Post-Execution AST Scan │
65
+ │ │ (Auto-Rollback + Regenerate Instruction) │
66
+ │ └── 6. Asynchronous Telemetry Streamer (Edge → Cloud) │
67
+ └──────────────────────────────────────────────────────────────┘
52
68
 
53
-
54
- Your Project (files, database, git, shell)
69
+ Approved, Audited & Compliant Operations
70
+
71
+ Your Local Project Environment (Files, Git, Sandboxed Shell)
55
72
  ```
56
73
 
57
- When you type `@backend Create login API` in your AI chat:
58
- 1. The AI calls `send_agent_message` tool via MCP
59
- 2. Atabey routes it through `RoutingEngine`
60
- 3. The `@backend` agent executes the task
61
- 4. `QualityGate` validates the output
62
- 5. Result is stored in `Vector Memory`
74
+ When you type `Create login API` (without any `@agent` command):
75
+ 1. **Silent Semantic Router** detects the intent from natural language
76
+ 2. **Token Circuit Breaker** checks context window budget
77
+ 3. **FinOps** verifies team/agent budget is not exceeded
78
+ 4. **Loop Detector** ensures no infinite loop pattern
79
+ 5. **License Scanner** validates generated code for copyleft
80
+ 6. **Auto-Rollback** captures pre-write snapshot
81
+ 7. **Risk Gate** blocks destructive operations (DROP, DELETE)
82
+ 8. Tool executes → **Post-Execution AST Scan** validates output
83
+ 9. If violation found → **auto-rollback + regenerate instruction** sent to AI
84
+ 10. **Telemetry Streamer** asynchronously sends masked events to enterprise
63
85
 
64
- **No separate terminal needed. No CLI commands for daily use.**
86
+ **No @agent commands. No separate terminal. No CLI commands for daily use.**
65
87
 
66
88
  ---
67
89
 
68
90
  ## Hermes Control Center Dashboard
69
91
 
70
- The MCP package includes a real-time WebSocket dashboard with 8 live modules:
92
+ The MCP package includes a real-time WebSocket dashboard with 12 live modules:
71
93
 
72
94
  | Module | Description | Update |
73
95
  |--------|-------------|--------|
74
96
  | 🤖 **Agent Monitor** | 13 AI agent status + live tasks | WS (5s) |
75
- | 📨 **Hermes Messages** | Agent message queue + filtering | WS (5s) |
97
+ | 📨 **Hermes Stats** | Message queue statistics | WS (5s) |
98
+ | 💬 **Hermes Messages** | Agent message queue + filtering | WS (5s) |
76
99
  | 🔐 **Approval Center** | Human-in-the-Loop approvals | WS |
77
100
  | 📋 **Task Planner** | Task DAG + progress tracking | REST (5s) |
78
101
  | 📝 **Agent Logs** | Execution logs + agent filter | WS (5s) |
79
102
  | ⚠️ **Error Tracker** | Lint/compliance/security errors | WS |
80
103
  | 🧠 **Memory Insights** | Vector memory search | REST |
81
104
  | 🛡️ **Compliance** | Quality gate violations | REST (15s) |
105
+ | ✅ **Quality Panel** | Code quality analysis | REST |
106
+ | 🔌 **Adapters** | Adapter-skill mapping | REST |
107
+ | 📊 **Dashboard** | System overview | Mixed |
82
108
 
83
109
  ```bash
84
110
  # Start dashboard (default port: 5858)
@@ -99,13 +125,17 @@ framework-mcp/dashboard/src/
99
125
  │ ├── ApprovalCenter.tsx # Approval center
100
126
  │ ├── CompliancePanel.tsx # Compliance control panel
101
127
  │ ├── ErrorTracker.tsx # Error tracking
128
+ │ ├── FinOpsPanel.tsx # Team & Agent budget management (New)
102
129
  │ ├── GatewayPanel.tsx # LLM Gateway management
103
130
  │ ├── HermesBrokerView.tsx # Hermes message queue
104
131
  │ ├── HermesStats.tsx # Hermes statistics
132
+ │ ├── LicensePanel.tsx # SPDX license compliance tracker (New)
105
133
  │ ├── LogViewer.tsx # Log viewer
134
+ │ ├── LoopDetectorPanel.tsx # Multi-pattern loop prevention & cooldowns (New)
106
135
  │ ├── MemoryInsights.tsx # Memory insights
107
136
  │ ├── PlanViewer.tsx # Plan viewer
108
- └── QualityPanel.tsx # Quality panel
137
+ ├── QualityPanel.tsx # Quality panel
138
+ │ └── TelemetryPanel.tsx # Edge-to-Cloud sync monitoring (New)
109
139
  └── hooks/
110
140
  ├── useApi.ts # REST API hook
111
141
  └── useWS.ts # WebSocket hook
@@ -113,7 +143,7 @@ framework-mcp/dashboard/src/
113
143
 
114
144
  ---
115
145
 
116
- ## Provided Tools (30+)
146
+ ## Provided Tools (34)
117
147
 
118
148
  ### File System
119
149
 
@@ -175,14 +205,6 @@ framework-mcp/dashboard/src/
175
205
  | `get_system_health` | CPU/RAM metrics |
176
206
  | `check_active_ports` | Port monitoring |
177
207
 
178
- ### Quality
179
-
180
- | Tool | Description |
181
- |------|-------------|
182
- | `analyze_code_quality` | Code quality analysis |
183
- | `check_architecture_compliance` | Architecture compliance check |
184
- | `check_lint` | ESLint validation |
185
-
186
208
  ### Observability
187
209
 
188
210
  | Tool | Description |
@@ -275,6 +297,251 @@ gemini config set mcpServers.atabey.args "[\"atabey-mcp\"]"
275
297
  }
276
298
  ```
277
299
 
300
+ ## 🔮 Invisible AI Governance Layer
301
+
302
+ Atabey MCP Server includes **5 invisible governance layers** that run transparently behind every tool call. The developer's AI CLI never sees them — they operate silently at the MCP middleware layer.
303
+
304
+ ```
305
+ [ AI CLI Sohbet Akışı ]
306
+
307
+ ├──> [1. Token Circuit Breaker] ──> Budget & File Size Limits
308
+ ├──> [2. Silent Semantic Router] ──> Background Agent Selection & Prompt Injection
309
+ ├──> [3. CLI Human-in-the-Loop] ──> In-Chat Risk Approval
310
+ ├──> [4. Post-Execution AST Scanner] ──> Governance Scan + Auto-Rollback
311
+ └──> [5. Asynchronous Telemetry Streamer] ──> Local SQLite → Enterprise Server
312
+ ```
313
+
314
+ | Layer | Component | What It Does |
315
+ |-------|-----------|-------------|
316
+ | **1. Token Circuit Breaker** | `context-optimizer.ts` | Scans context window in real-time. Truncates oversized files (>100KB). Enforces `MAX_TOKENS_PER_CALL`, per-minute/hour budgets. Prevents context poisoning. |
317
+ | **2. Silent Semantic Router** | `silent-router.ts` | Analyzes natural language WITHOUT requiring `@agent` commands. Silently injects the right agent's system prompt (e.g., @security rules when you type "make this secure"). |
318
+ | **3. CLI Human-in-the-Loop** | `human-in-loop.ts` | Blocks destructive operations (DROP, DELETE, deploy scripts). Creates in-chat `[Onaylıyor musunuz? Y/N]` approval requests — no browser/terminal switch needed. |
319
+ | **4. Post-Execution AST Scanner** | `discipline.ts` + `rules-engine.ts` + `auto-rollback.ts` | Scans AI-generated code via AST before saving. Blocks `any` types, console.log, hardcoded secrets. **Auto-rollback + regenerate** instruction sent back to AI. |
320
+ | **5. License/Copyright Scanner** | `license-scanner.ts` | Detects GPL/AGPL copyleft licenses in AI output. Blocks code with restricted licenses, warns about attribution requirements. |
321
+ | **6. Loop Detector** | `loop-detector.ts` | Detects 6 loop patterns: consecutive same tool, file churn, oscillation (A→B→A→B), content identity, rate limits. Automatic cooldown. |
322
+ | **7. FinOps Budget Enforcement** | `finops.ts` | Team/agent-based monthly budget in USD. Auto-blocks when budget exceeded. Syncs with enterprise server for centralized policy. |
323
+ | **8. Asynchronous Telemetry** | `telemetry-streamer.ts` | Streams masked governance events to enterprise server via HTTPS/WS. Batch processing, retry with backoff, PII masking before transmission. |
324
+
325
+ ### Enforcement Pipeline (Per Tool Call) — 13 Aşama
326
+
327
+ Every tool call passes through this **13-stage invisible pipeline**. The critical insight is **when** code is scanned relative to disk writes:
328
+
329
+ ```
330
+ TOOL CALL FLOW
331
+ ──────────────────────►
332
+
333
+ ┌─────────────────────────────────────────────────────────────────────────┐
334
+ │ PRE-EXECUTION (Validation Gates — No Disk Access) │
335
+ │ │
336
+ │ ┌─ 1. PII Arg Masking ────────────────────────────────────────────┐ │
337
+ │ │ maskToolArgs() → TC Kimlik, email, kredi kartı maskelenir │ │
338
+ │ ├─ 2. Token Economy ──────────────────────────────────────────────┤ │
339
+ │ │ Metrics.logUsage() → tahmini maliyet hesaplanır │ │
340
+ │ ├─ 3. Governance Pre-check ───────────────────────────────────────┤ │
341
+ │ │ validateArgsAgainstRules() → any type, console.log kontrolü │ │
342
+ │ ├─ 4. Loop Detection ─────────────────────────────────────────────┤ │
343
+ │ │ recordAndCheck() → 6 pattern (consecutive, oscillation, vb.) │ │
344
+ │ ├─ 5. FinOps Budget ──────────────────────────────────────────────┤ │
345
+ │ │ budgetManager.recordUsage() → bütçe aşımı kontrolü │ │
346
+ │ ├─ 6. License Scan ───────────────────────────────────────────────┤ │
347
+ │ │ validateLicenseCompliance() → GPL/AGPL copyleft blocking │ │
348
+ │ ├─ 7. Auto-Rollback Snapshot ─────────────────────────────────────┤ │
349
+ │ │ prepareWrite() → ★ DİSK OKUMA: dosyanın mevcut hali yedeklenir │ │
350
+ │ ├─ 8. Risk Gate (Human-in-Loop) ──────────────────────────────────┤ │
351
+ │ │ assessTaskRisk() → DROP/DELETE varsa in-chat onay beklenir │ │
352
+ │ └─────────────────────────────────────────────────────────────────┘ │
353
+ │ │
354
+ │ ★ TOOL EXECUTION ★ ──────────────────────────────────────────────► │
355
+ │ handler() → ★ DİSK YAZMA: AI kodu diske yazar │ │
356
+ │ │
357
+ │ POST-EXECUTION (Validation Gates — Disk Already Written) │
358
+ │ │
359
+ │ ┌─ 9. Post-Execution Rollback ────────────────────────────────────┐ │
360
+ │ │ scanFileForViolations() → ★ DİSK TARAMA: yazılan dosyada │ │
361
+ │ │ any, console.log, hardcoded secret var mı? │ │
362
+ │ │ ┌─ İhlal Yok → devam │ │
363
+ │ │ └─ İhlal Var → ★ DİSK GERİ AL: snapshot'a dön + AI'ya │ │
364
+ │ │ regenerate talimatı gönder (tool response olarak) │ │
365
+ │ ├─10. Discipline + Governance Post-check ─────────────────────────┤ │
366
+ │ │ validateResponse() → response boyutu, binary içerik kontrolü │ │
367
+ │ ├─11. Context Optimizer ──────────────────────────────────────────┤ │
368
+ │ │ checkTokenBudget() → token limit aşımı uyarısı │ │
369
+ │ ├─12. Silent Router Injection ────────────────────────────────────┤ │
370
+ │ │ buildSilentContext() → governance kuralları response'a eklenir │ │
371
+ │ ├─13. PII Result Masking ────────────────────────────────────────┤ │
372
+ │ │ maskToolResult() → AI'ya dönen response maskelenir │ │
373
+ │ └─────────────────────────────────────────────────────────────────┘ │
374
+ └─────────────────────────────────────────────────────────────────────────┘
375
+ ```
376
+
377
+ **Kritik Zamanlama Notları:**
378
+ - **Adım 7 (Snapshot):** Diskten OKUMA yapar, dosyanın mevcut halini yedekler. Henüz yazma yok.
379
+ - **Adım ★ (Execution):** AI kodu diske YAZAR. Bu noktada dosya değişmiştir.
380
+ - **Adım 9 (Rollback):** Diskteki yeni içeriği TARAR. İhlal varsa → snapshot'a geri döner (tekrar DİSK YAZMA).
381
+ - **Adım 12 (Injection):** Governance kuralları response'a enjekte edilir, AI bir sonraki adımda kurallara uyar.
382
+ - **Adım 13 (Masking):** AI'ya dönen son response PII maskelenir — pipeline'ın son adımı.
383
+
384
+ ---
385
+
386
+ ## 📡 API Endpoints
387
+
388
+ The unified server exposes these REST API endpoints (all under `http://localhost:{PORT}/api/`):
389
+
390
+ ### Core Governance Endpoints
391
+
392
+ | Endpoint | Method | Description |
393
+ |----------|--------|-------------|
394
+ | `/api/governance` | GET | Combined governance stats (discipline, budget, loops, rollback, telemetry) |
395
+ | `/api/discipline` | GET | AI discipline stats per agent |
396
+ | `/api/metrics` | GET | Token economy — cost by agent/action, total spend |
397
+ | `/api/compliance` | GET | Corporate compliance scan results (any, console) |
398
+ | `/api/quality` | GET | Code quality analysis |
399
+
400
+ ### New Enterprise Governance Endpoints
401
+
402
+ | Endpoint | Method | Description |
403
+ |----------|--------|-------------|
404
+ | `/api/telemetry` | GET | Telemetry streamer status + config |
405
+ | `/api/loop-detector` | GET | Loop detection stats (all agents) |
406
+ | `/api/loop-detector?agent=NAME` | GET | Loop stats for specific agent |
407
+ | `/api/loop-detector/clear/{agent}` | POST | Clear cooldown for an agent |
408
+ | `/api/finops` | GET | Budget state (team spend, period, blocked status) |
409
+ | `/api/finops/check?agent=NAME` | GET | Check budget for an agent |
410
+ | `/api/finops/reset` | POST | Reset budget period |
411
+ | `/api/license?path=PATH&content=CODE` | GET | Scan code for license violations |
412
+ | `/api/rollback` | GET | Auto-rollback snapshot stats |
413
+
414
+ ### Legacy Endpoints
415
+
416
+ | Endpoint | Method | Description |
417
+ |----------|--------|-------------|
418
+ | `/api/health` | GET | Server health check |
419
+ | `/api/status` | GET | Framework status |
420
+ | `/api/memory` | GET | Project memory |
421
+ | `/api/memory/search?q=QUERY` | GET | Vector memory search |
422
+ | `/api/agents` | GET | Agent list |
423
+ | `/api/messages` | GET | Pending Hermes messages |
424
+ | `/api/hermes/stats` | GET | Message queue stats |
425
+ | `/api/tasks` | GET | Task planner |
426
+ | `/api/logs` | GET | Execution logs |
427
+ | `/api/approvals` | GET | Pending approvals |
428
+ | `/api/approve/{traceId}` | POST | Approve operation |
429
+ | `/api/reject/{traceId}` | POST | Reject operation |
430
+ | `/api/audit` | GET | Audit log (GDPR/KVKK) |
431
+ | `/api/audit/erase` | POST | Right to erasure |
432
+ | `/api/mcp/sessions` | GET | Active MCP sessions |
433
+ | `/api/adapters/skills` | GET | Adapter-skill mapping |
434
+
435
+ ---
436
+
437
+ ## 🌍 Environment Variables
438
+
439
+ ### Core Configuration
440
+
441
+ | Variable | Description | Default |
442
+ |----------|-------------|---------|
443
+ | `ATABEY_PROJECT_ROOT` | Project root directory | `process.cwd()` |
444
+ | `ATABEY_FRAMEWORK_DIR` | Framework directory | `.atabey` |
445
+ | `MCP_PORT` | Server port | `5858` |
446
+ | `MCP_HOST` | Server host | `0.0.0.0` |
447
+ | `MCP_TRANSPORT` | Transport mode (`unified` / `stdio`) | `unified` |
448
+
449
+ ### Security & Authentication
450
+
451
+ | Variable | Description | Default |
452
+ |----------|-------------|---------|
453
+ | `MCP_AUTH_TOKEN` | API key for authentication | (open access) |
454
+ | `MCP_AUTH_USERS` | Comma-separated user:token pairs | (none) |
455
+
456
+ ### Token Budget & Rate Limiting
457
+
458
+ | Variable | Description | Default |
459
+ |----------|-------------|---------|
460
+ | `MCP_MAX_TOKENS_PER_CALL` | Max tokens per response | `4000` |
461
+ | `MCP_MAX_TOKENS_PER_MINUTE` | Max tokens per minute | `20000` |
462
+ | `MCP_MAX_TOKENS_PER_HOUR` | Max tokens per hour | `100000` |
463
+ | `MCP_MAX_FILE_READ_SIZE` | Max file read size (bytes) | `102400` (100KB) |
464
+ | `MCP_MAX_CALLS_PER_MINUTE` | Max tool calls per minute | `60` |
465
+ | `MCP_MAX_TOTAL_CALLS` | Max total calls per session | `500` |
466
+
467
+ ### AI Discipline & Loop Detection
468
+
469
+ | Variable | Description | Default |
470
+ |----------|-------------|---------|
471
+ | `MCP_RESTRICTED_TOOLS` | Blacklisted tools | `run_shell_command,check_active_ports` |
472
+ | `MCP_AGENT_TOOL_WHITELIST` | Per-agent tool whitelist | (none) |
473
+ | `MCP_LOOP_MAX_CONSECUTIVE` | Max consecutive same tool calls | `10` |
474
+ | `MCP_LOOP_MAX_FILE_CHURN` | Max writes to same file | `5` |
475
+ | `MCP_LOOP_COOLDOWN_MS` | Loop cooldown duration | `30000` (30s) |
476
+
477
+ ### FinOps (Budget Management)
478
+
479
+ | Variable | Description | Default |
480
+ |----------|-------------|---------|
481
+ | `ATABEY_BUDGET_ENABLED` | Enable budget enforcement | `false` |
482
+ | `ATABEY_BUDGET_TEAM` | Team name for budget grouping | `default` |
483
+ | `ATABEY_BUDGET_MONTHLY` | Monthly budget in USD | `0` (unlimited) |
484
+ | `ATABEY_BUDGET_AGENT_MAX` | Max spend per agent in USD | `0` (unlimited) |
485
+ | `ATABEY_BUDGET_SYNC_URL` | Enterprise server URL for budget sync | (none) |
486
+ | `ATABEY_COST_PER_1K_TOKENS` | Cost per 1K tokens (USD) | `0.003` |
487
+
488
+ ### Telemetry & Enterprise Streaming
489
+
490
+ | Variable | Description | Default |
491
+ |----------|-------------|---------|
492
+ | `ATABEY_TELEMETRY_ENABLED` | Enable telemetry streaming | `false` |
493
+ | `ATABEY_SERVER_URL` | Enterprise server URL | (none) |
494
+ | `ATABEY_SERVER_TOKEN` | Auth token for enterprise server | (none) |
495
+ | `ATABEY_TELEMETRY_BATCH_SIZE` | Events per batch | `50` |
496
+ | `ATABEY_TELEMETRY_RATE_LIMIT` | Max events per minute | `200` |
497
+ | `ATABEY_TELEMETRY_WS` | Use WebSocket for streaming | `false` |
498
+ | `ATABEY_TELEMETRY_FALLBACK_DIR` | Local fallback directory for offline queue | `.atabey/telemetry/` |
499
+
500
+ ### License Scanner
501
+
502
+ | Variable | Description | Default |
503
+ |----------|-------------|---------|
504
+ | `ATABEY_LICENSE_SCAN` | Enable license scanning | `true` |
505
+ | `ATABEY_BLOCK_COPYLEFT` | Block copyleft licenses | `true` |
506
+ | `ATABEY_LICENSE_BLOCKLIST` | Blocked SPDX identifiers | `GPL-3.0,AGPL-3.0,GPL-2.0` |
507
+ | `ATABEY_LICENSE_ALLOWLIST` | Allowed SPDX identifiers | `MIT,Apache-2.0,BSD-*,ISC,CC0-1.0,Unlicense` |
508
+
509
+ ### Human-in-the-Loop
510
+
511
+ | Variable | Description | Default |
512
+ |----------|-------------|---------|
513
+ | `MCP_HIGH_RISK_THRESHOLD` | Risk score for blocking (0-100) | `60` |
514
+ | `MCP_MEDIUM_RISK_THRESHOLD` | Risk score for warning (0-100) | `30` |
515
+ | `MCP_APPROVAL_TIMEOUT` | Approval timeout in seconds | `300` (5 min) |
516
+
517
+ ---
518
+
519
+ ## 🏢 Enterprise Governance Checklist
520
+
521
+ This checklist maps to the complete operational framework for running Atabey as an **Invisible AI Governance Platform** in enterprise environments.
522
+
523
+ ### 🔲 Local (Developer Machine)
524
+
525
+ | # | Check | Component | How to Test |
526
+ |---|-------|-----------|-------------|
527
+ | `[ ]` | **1. CLI Entegrasyon Sağlığı** | `index.ts` (stdio) | Start Claude Code / Gemini CLI → verify `mcp.json` auto-connects via stdio transport |
528
+ | `[ ]` | **2. Dosya Okuma Boyut Sınırı** | `context-optimizer.ts` | Try reading a >100KB file → verify auto-truncation with `[TRUNCATED]` header |
529
+ | `[ ]` | **3. Döngü Kilidi** | `loop-detector.ts` | Call same tool 10× consecutively → verify cooldown message |
530
+ | `[ ]` | **4. Eşzamanlı Çalışma Kilidi** | `src/shared/lock.ts` | Two terminals, same file → second gets `DistributedLock` block |
531
+ | `[ ]` | **5. Yerel Veri Katılığı** | `storage.ts` + SQLite | Check `.atabey/memory/` and `atabey.db` for real data (no mocks) |
532
+ | `[ ]` | **6. Hata Yutma Denetimi** | All `catch {}` blocks | Run `atabey check` → verify no silent errors |
533
+
534
+ ### 🔲 Server (Enterprise / Central Governance)
535
+
536
+ | # | Check | Component | How to Test |
537
+ |---|-------|-----------|-------------|
538
+ | `[ ]` | **1. Kimlik Doğrulama** | `auth.ts` | Request without `Authorization: Bearer` → verify `401 Unauthorized` |
539
+ | `[ ]` | **2. Katı Bütçe Sınırlandırması** | `finops.ts` | Set `ATABEY_BUDGET_MONTHLY=10` → spend $10 → verify auto-block |
540
+ | `[ ]` | **3. KVKK/GDPR Maskeleme** | `pii.ts` | Send TC Kimlik No in chat → verify `***********` in logs |
541
+ | `[ ]` | **4. Unutulma Hakkı** | `audit.ts` | POST `/api/audit/erase` with `KVKK-RIGHT-TO-ERASURE` → verify data deletion |
542
+ | `[ ]` | **5. Merkezi Raporlama** | `telemetry-streamer.ts` | 5 developers working → verify consolidated dashboard via WebSocket |
543
+ | `[ ]` | **6. Lisans Denetimi** | `license-scanner.ts` | AI generates GPL code → verify block + regenerate instruction |
544
+
278
545
  ---
279
546
 
280
547
  ## Development
@@ -336,14 +603,19 @@ npx vitest run tests/tools/file_system/file_system_tools.test.ts
336
603
 
337
604
  ### Current Test Files
338
605
 
339
- | Test File | Scope |
340
- |-----------|-------|
341
- | `file_system/file_system_tools.test.ts` | Basic file system tools |
342
- | `file_system/compliance-risk.test.ts` | Compliance risk analysis |
343
- | `file_system/permissions.test.ts` | Permission controls |
344
- | `messaging/send_message.test.ts` | Hermes messaging |
345
- | `quality/check_lint.test.ts` | ESLint validation |
346
- | `shell/run_command.test.ts` | Shell commands |
606
+ | Test File | Scope | Status |
607
+ |-----------|-------|--------|
608
+ | `file_system/file_system_tools.test.ts` | Basic file system tools | ✅ |
609
+ | `file_system/compliance-risk.test.ts` | Compliance risk analysis | ✅ |
610
+ | `file_system/permissions.test.ts` | Permission controls | ✅ |
611
+ | `messaging/send_message.test.ts` | Hermes messaging | ✅ |
612
+ | `quality/check_lint.test.ts` | ESLint validation | ✅ |
613
+ | `shell/run_command.test.ts` | Shell commands | ✅ |
614
+ | `utils/telemetry-streamer.test.ts` | Batch processing, exponential backoff, PII masking | ✅ 12 passed |
615
+ | `utils/license-scanner.test.ts` | SPDX validation, copyleft (GPL) blocking | ✅ 11 passed |
616
+ | `utils/finops.test.ts` | Team/Agent hard-cap budget enforcement | ✅ 12 passed |
617
+ | `utils/auto-rollback.test.ts` | Pre-write snapshot, violation detection, auto-rollback | ✅ 12 passed |
618
+ | `utils/loop-detector.test.ts` | 6 loop patterns, file churn, oscillation detection | ✅ 14 passed |
347
619
 
348
620
  > **Note:** Gateway module tests are in the main package: `tests/modules/gateway/`
349
621