refactor: move MCP module from Core\Mod\Mcp to Core\Mcp namespace

Relocates the MCP module to a top-level namespace as part of the
monorepo separation, removing the intermediate Mod directory layer.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Snider 2026-01-27 16:26:14 +00:00
parent afb3dacd98
commit 6f309979de
101 changed files with 318 additions and 139 deletions

View file

@ -0,0 +1,179 @@
# Mcp Module Review
**Updated:** 2026-01-21 - Security improvements: DataRedactor service for sensitive data redaction in tool/API logs, UUID v4 for session IDs (~122 bits entropy). Previous: rate limiting, cache TTL config, input validation, database indexes, cleanup command, server consolidation, circuit breaker, tool call migrations
## Overview
The MCP (Model Context Protocol) module provides infrastructure for AI agent integration with the Host Hub platform. It offers:
1. **STDIO MCP Server** - Single command-based server (`mcp:agent-server`) for Claude/AI integration via JSON-RPC using registry pattern with extracted tools
2. **HTTP API** - API key authenticated access to MCP tools
3. **Agent Tooling** - Comprehensive tool suite for plan/phase/task management, session handling, and multi-agent handoff
4. **Monitoring** - Metrics collection, Prometheus export, health checks, and alerting
5. **Admin UI** - Livewire components for API key management, playground, and request logging
The module bridges Laravel's MCP package with a custom agent orchestration system (Agentic module) and provides extensive analytics/monitoring capabilities.
## Production Readiness Score: 94/100 (was 92/100 - Security hardening 2026-01-21)
**Breakdown:**
- Code Quality: 88/100 (clean patterns, good separation, single server)
- Test Coverage: 65/100 (core services covered, tools undertested)
- Security: 95/100 (solid auth, SQL injection fixed, rate limiting, data redaction, UUID session IDs)
- Documentation: 60/100 (good inline docs, missing user docs)
- Error Handling: 90/100 (workspace fallback fixed, input validation added, circuit breaker for fault tolerance)
- Production Hardening: 92/100 (rate limits, indexes, cleanup jobs, configurable TTLs, circuit breaker, all migrations present, PII redaction)
## Critical Issues (Must Fix)
- [x] **Missing migration for `mcp_tool_calls` and `mcp_tool_call_stats` tables** - FIXED 2026-01-21: Migration `2026_01_21_000002_create_mcp_tool_call_tables.php` now exists with both tables, proper indexes, and foreign keys.
- [x] **QueryDatabase SQL injection risk** - FIXED: Added comprehensive validation including semicolon check (prevents stacked queries), table allowlist (19 safe tables), 14 forbidden keywords (INSERT, UPDATE, DELETE, DROP, etc.), and UNION attack prevention.
- [x] **Server implementations consolidated** - FIXED: The monolithic V1 server (~2000 lines) has been removed and replaced by the clean V2 implementation using the registry pattern with extracted tools. Content generation tools were V1-only features not yet migrated to the tool pattern - out of scope for this consolidation.
- [x] **Hardcoded workspace_id fallback** - FIXED: `SessionStart.php` now returns error if workspace_id cannot be determined instead of falling back to ID 1. Validates workspace_id is required from context or plan.
## Recommended Improvements
- [x] **Add rate limiting to STDIO servers** - VERIFIED: `ToolRateLimiter` service at `Mcp/Services/ToolRateLimiter.php` provides cache-based rate limiting with configurable per-tool limits. `McpAgentServerCommand` uses `$rateLimiter->check()` and `$rateLimiter->hit()` before tool execution (lines 216-228).
- [x] **Implement scheduled cleanup for tool call logs** - VERIFIED: `CleanupToolCallLogsCommand` at `Mcp/Console/Commands/CleanupToolCallLogsCommand.php` prunes `mcp_tool_calls`, `mcp_api_requests`, and `mcp_tool_call_stats` with configurable retention (default 90 days for logs, 365 days for stats). Supports `--dry-run` and chunk-based deletion.
- [x] **Add input validation to agent tools** - VERIFIED: `AgentTool` base class at `Mcp/Tools/Agent/AgentTool.php` provides comprehensive validation helpers: `requireString()`, `requireInt()`, `requireArray()`, `requireEnum()`, `optionalString()`, `optionalInt()`, `optionalEnum()` with min/max bounds, length limits, and enum validation. Plan tools like `PlanCreate` use these (e.g., `$this->requireString($args, 'title', 255)`).
- [x] **Consolidate server implementations** - VERIFIED: Only `McpAgentServerCommand.php` exists (no V2 file). Uses `AgentToolRegistry` pattern with 22 extracted tool classes. Content generation tools out of scope.
- [x] **Add circuit breaker for external dependencies** - IMPLEMENTED 2026-01-21: `CircuitBreaker` service at `Mcp/Services/CircuitBreaker.php` provides fault tolerance with configurable thresholds, reset timeouts, and half-open state recovery. `AgentTool` base class exposes `withCircuitBreaker()` helper for wrapping external calls. Tools like `PlanGet` and `SessionStart` now use circuit breaker pattern with graceful fallbacks. Config in `mcp.circuit_breaker`.
- [x] **Add missing database indexes** - VERIFIED: Migration `2026_01_21_000003_add_indexes_to_agent_sessions.php` adds indexes on `agent_sessions` table:
- `last_active_at` (stale session cleanup)
- `agent_type` (filtering)
- `(workspace_id, last_active_at)` (active session queries)
- `(status, last_active_at)` (cleanup queries)
- [x] **Configuration extraction** - PARTIALLY COMPLETED: Created `config/mcp.php` with:
- Rate limit settings (moved from hardcoded values in `McpApiKeyAuth`)
- Cache TTL settings (moved from hardcoded 86400 in `AgentSessionService`)
- Protocol version setting
- Monitoring thresholds now configurable
- Note: Some values still hardcoded in V1 server pending deprecation
- [x] **Fix DEFAULT_TTL bug** - VERIFIED: `AgentSessionService` at lines 28-31 uses `getCacheTtl()` method that reads from `config('mcp.session.cache_ttl', 86400)` instead of hardcoded constant. Used in `setState()` and `cacheActiveSession()` methods.
- [ ] **Add OpenTelemetry/distributed tracing** - The monitoring service exports to Prometheus but lacks trace context propagation for debugging complex multi-agent flows.
## Missing Features (Future)
- [ ] **WebSocket support for real-time updates** - Currently all communication is request/response. Real-time session status would improve agent UX.
- [ ] **Tool execution audit log** - While `McpToolCall` logs calls, there's no immutable audit trail for compliance. Consider event sourcing for sensitive tools.
- [ ] **Multi-server federation** - The `HostHub` and `Marketing` servers are registered but there's no mechanism to route requests between them or aggregate tool listings.
- [ ] **Session recovery/replay** - No mechanism to replay a session from its work log. Would be valuable for debugging and resuming failed sessions.
- [ ] **Tool versioning** - No version tracking on tools. Breaking changes to tool schemas would affect running agents with no fallback.
- [ ] **Usage quotas per workspace** - API keys have rate limiting but no workspace-level quotas for tool calls or token consumption.
- [ ] **Tool dependency graph** - Some tools depend on others (e.g., `task_update` requires a valid plan). No validation that prerequisites are met.
## Test Coverage Assessment
**Current Coverage:**
| Area | Coverage | Notes |
|------|----------|-------|
| McpApiKeyAuth middleware | Good | Comprehensive tests for auth, rate limiting, server scopes |
| AgentToolRegistry | Good | Registration, permissions, execution tested |
| AgentSessionService | Good | Session lifecycle, handoff, statistics covered |
| McpMonitoringService | Good | Health status, Prometheus export, anomaly detection |
| Core MCP Tools | Partial | ListSites, GetStats, QueryDatabase tested |
| Agent Tools | Missing | 22 extracted tools have no direct tests |
| Server Command | Partial | Core server loop tested via integration, tool execution via registry tests |
| Admin Livewire Components | Missing | ApiKeyManager, Playground, RequestLog untested |
| Resources/Prompts | Missing | No tests for AppConfig, DatabaseSchema, ContentResource, or prompts |
**Test File Inventory:**
- `Tests/Feature/McpApiKeyAuthTest.php` - 370 lines, thorough
- `Tests/Feature/AgentToolRegistryTest.php` - 196 lines, good
- `Tests/Feature/AgentSessionServiceTest.php` - 203 lines, good
- `Tests/Feature/McpToolsTest.php` - 289 lines, partial
- `Tests/Feature/McpMonitoringServiceTest.php` - 171 lines, good
- `Tests/UseCase/ApiKeyManagerBasic.php` - Unclear purpose, possibly incomplete
**Estimated Coverage:** ~40% of module code is tested.
## Security Concerns
1. **SQL Injection via QueryDatabase** (Critical)
- Regex check insufficient
- Allows UNION attacks, stacked queries
- Recommendation: Use read-only database user + parameterised views or whitelist specific queries
2. **API Key exposure in error responses** (Low)
- The `toCurl()` method on `McpApiRequest` uses placeholder but could log actual keys if misused
3. **Session ID predictability** (Low) - FIXED 2026-01-21
- Session IDs now use UUID v4 (~122 bits entropy) via `Uuid::uuid4()` in `AgentSession::start()`
- Format: `sess_` prefix + UUID v4 (e.g., `sess_550e8400-e29b-41d4-a716-446655440000`)
4. **Missing CSRF protection on Livewire components** (Medium)
- Admin components could be vulnerable if session hijacked
- Verify Livewire's built-in CSRF is enabled
5. **No tool call signing** (Low)
- Tool calls aren't cryptographically signed
- Replay attacks possible within rate limit window
6. **Sensitive data in tool call logs** (Medium) - FIXED 2026-01-21
- New `DataRedactor` service at `Mcp/Services/DataRedactor.php` provides automatic redaction
- `McpToolCall::log()` now redacts `input_params` and summarizes `result_summary`
- `McpApiRequest::log()` now redacts `request_body` and summarizes `response_body`
- Redacts: passwords, tokens, API keys, credit cards, NI numbers, JWTs, PII fields
- Partially redacts PII like emails (shows `joh***@e***om`)
## Notes
### Architecture Observations
The module now uses a clean registry-based architecture:
1. Single server command (`mcp:agent-server`) using `AgentToolRegistry`
2. Tools are extracted classes implementing `AgentToolInterface`
3. Content generation tools were removed during consolidation (out of scope, can be added as extracted tools later)
The dependency on the `Agentic` module (`Mod\Agentic\Models\*`) is extensive. Consider:
- Moving shared models to a Core package
- Or defining interfaces in Mcp and having Agentic implement them
### Positive Patterns
- Clean use of PHP 8 features (enums, named arguments, union types)
- Consistent error response structure across tools
- Good use of Eloquent scopes for query building
- Prometheus metrics export is well-implemented
- Rate limiting with automatic clear on success
- Circuit breaker pattern for external module fault tolerance
- DataRedactor service for automatic PII/credential sanitisation in logs
- UUID v4 session IDs providing cryptographic-strength unpredictability
### Technical Debt
1. `onMcpTools` event handler in Boot.php is empty (commented as "once extracted")
2. The `UseCase/ApiKeyManagerBasic.php` test file appears incomplete
3. Content generation tools (content_status, content_brief_*, content_generate, etc.) were removed during consolidation - add as extracted tools if needed
### Dependencies
External module dependencies:
- `Mod\Agentic` - AgentPlan, AgentPhase, AgentSession, AgentWorkspaceState, PlanTemplateService
- `Mod\Api` - ApiKey, ApiKeyFactory
- `Mod\Tenant` - Workspace, User, EntitlementService
- `Mod\Content` - ContentBrief, AIUsage, GenerateContentJob, AIGatewayService
- `Mod\Web` - BioLink tools (BioResource, various Mcp\Tools)
- `Mod\Trust` - TrustHost tools
- `Laravel\Mcp` - Server, Tool, Request, Response
- `Website\Mcp` - Dashboard, McpRegistryController
This deep coupling may cause issues during module extraction or independent deployment.

View file

@ -9,13 +9,13 @@
}, },
"autoload": { "autoload": {
"psr-4": { "psr-4": {
"Core\\Mod\\Mcp\\": "src/Mod/Mcp/", "Core\\Mcp\\": "src/Mcp/",
"Core\\Website\\Mcp\\": "src/Website/Mcp/" "Core\\Website\\Mcp\\": "src/Website/Mcp/"
} }
}, },
"autoload-dev": { "autoload-dev": {
"psr-4": { "psr-4": {
"Core\\Mod\\Mcp\\Tests\\": "tests/" "Core\\Mcp\\Tests\\": "tests/"
} }
}, },
"extra": { "extra": {

View file

@ -2,19 +2,19 @@
declare(strict_types=1); declare(strict_types=1);
namespace Core\Mod\Mcp; namespace Core\Mcp;
use Core\Events\AdminPanelBooting; use Core\Events\AdminPanelBooting;
use Core\Events\ConsoleBooting; use Core\Events\ConsoleBooting;
use Core\Events\McpToolsRegistering; use Core\Events\McpToolsRegistering;
use Core\Mod\Mcp\Events\ToolExecuted; use Core\Mcp\Events\ToolExecuted;
use Core\Mod\Mcp\Listeners\RecordToolExecution; use Core\Mcp\Listeners\RecordToolExecution;
use Core\Mod\Mcp\Services\AuditLogService; use Core\Mcp\Services\AuditLogService;
use Core\Mod\Mcp\Services\McpQuotaService; use Core\Mcp\Services\McpQuotaService;
use Core\Mod\Mcp\Services\ToolAnalyticsService; use Core\Mcp\Services\ToolAnalyticsService;
use Core\Mod\Mcp\Services\ToolDependencyService; use Core\Mcp\Services\ToolDependencyService;
use Core\Mod\Mcp\Services\ToolRegistry; use Core\Mcp\Services\ToolRegistry;
use Core\Mod\Mcp\Services\ToolVersionService; use Core\Mcp\Services\ToolVersionService;
use Illuminate\Support\Facades\Event; use Illuminate\Support\Facades\Event;
use Illuminate\Support\ServiceProvider; use Illuminate\Support\ServiceProvider;

View file

@ -2,7 +2,7 @@
declare(strict_types=1); declare(strict_types=1);
namespace Core\Mod\Mcp\Console\Commands; namespace Core\Mcp\Console\Commands;
use Illuminate\Console\Command; use Illuminate\Console\Command;
use Mod\Mcp\Models\McpApiRequest; use Mod\Mcp\Models\McpApiRequest;

View file

@ -2,7 +2,7 @@
declare(strict_types=1); declare(strict_types=1);
namespace Core\Mod\Mcp\Console\Commands; namespace Core\Mcp\Console\Commands;
use Illuminate\Console\Command; use Illuminate\Console\Command;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
@ -16,7 +16,7 @@ use Core\Mod\Content\Jobs\GenerateContentJob;
use Core\Mod\Content\Models\AIUsage; use Core\Mod\Content\Models\AIUsage;
use Core\Mod\Content\Models\ContentBrief; use Core\Mod\Content\Models\ContentBrief;
use Core\Mod\Content\Services\AIGatewayService; use Core\Mod\Content\Services\AIGatewayService;
use Core\Mod\Mcp\Models\McpToolCall; use Core\Mcp\Models\McpToolCall;
use Throwable; use Throwable;
/** /**

View file

@ -2,7 +2,7 @@
declare(strict_types=1); declare(strict_types=1);
namespace Core\Mod\Mcp\Console\Commands; namespace Core\Mcp\Console\Commands;
use Illuminate\Console\Command; use Illuminate\Console\Command;
use Mod\Mcp\Services\McpMetricsService; use Mod\Mcp\Services\McpMetricsService;

View file

@ -2,9 +2,9 @@
declare(strict_types=1); declare(strict_types=1);
namespace Core\Mod\Mcp\Console\Commands; namespace Core\Mcp\Console\Commands;
use Core\Mod\Mcp\Models\ToolMetric; use Core\Mcp\Models\ToolMetric;
use Illuminate\Console\Command; use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;

View file

@ -2,9 +2,9 @@
declare(strict_types=1); declare(strict_types=1);
namespace Core\Mod\Mcp\Console\Commands; namespace Core\Mcp\Console\Commands;
use Core\Mod\Mcp\Services\AuditLogService; use Core\Mcp\Services\AuditLogService;
use Illuminate\Console\Command; use Illuminate\Console\Command;
/** /**

View file

@ -5,7 +5,7 @@ declare(strict_types=1);
namespace Mod\Api\Controllers; namespace Mod\Api\Controllers;
use Core\Front\Controller; use Core\Front\Controller;
use Core\Mod\Mcp\Services\McpQuotaService; use Core\Mcp\Services\McpQuotaService;
use Illuminate\Http\JsonResponse; use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Facades\Cache; use Illuminate\Support\Facades\Cache;

View file

@ -2,7 +2,7 @@
declare(strict_types=1); declare(strict_types=1);
namespace Core\Mod\Mcp\DTO; namespace Core\Mcp\DTO;
/** /**
* Tool Statistics Data Transfer Object. * Tool Statistics Data Transfer Object.

View file

@ -2,9 +2,9 @@
declare(strict_types=1); declare(strict_types=1);
namespace Core\Mod\Mcp\Database\Seeders; namespace Core\Mcp\Database\Seeders;
use Core\Mod\Mcp\Models\McpSensitiveTool; use Core\Mcp\Models\McpSensitiveTool;
use Illuminate\Database\Seeder; use Illuminate\Database\Seeder;
/** /**

View file

@ -2,7 +2,7 @@
declare(strict_types=1); declare(strict_types=1);
namespace Core\Mod\Mcp\Dependencies; namespace Core\Mcp\Dependencies;
/** /**
* Types of tool dependencies. * Types of tool dependencies.

View file

@ -2,7 +2,7 @@
declare(strict_types=1); declare(strict_types=1);
namespace Core\Mod\Mcp\Dependencies; namespace Core\Mcp\Dependencies;
/** /**
* Interface for tools that declare dependencies. * Interface for tools that declare dependencies.

View file

@ -2,7 +2,7 @@
declare(strict_types=1); declare(strict_types=1);
namespace Core\Mod\Mcp\Dependencies; namespace Core\Mcp\Dependencies;
/** /**
* Represents a single tool dependency. * Represents a single tool dependency.

View file

@ -2,7 +2,7 @@
declare(strict_types=1); declare(strict_types=1);
namespace Core\Mod\Mcp\Events; namespace Core\Mcp\Events;
use Illuminate\Foundation\Events\Dispatchable; use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels; use Illuminate\Queue\SerializesModels;

View file

@ -2,7 +2,7 @@
declare(strict_types=1); declare(strict_types=1);
namespace Core\Mod\Mcp\Exceptions; namespace Core\Mcp\Exceptions;
use RuntimeException; use RuntimeException;

View file

@ -2,9 +2,9 @@
declare(strict_types=1); declare(strict_types=1);
namespace Core\Mod\Mcp\Exceptions; namespace Core\Mcp\Exceptions;
use Core\Mod\Mcp\Dependencies\ToolDependency; use Core\Mcp\Dependencies\ToolDependency;
use RuntimeException; use RuntimeException;
/** /**

View file

@ -2,9 +2,9 @@
declare(strict_types=1); declare(strict_types=1);
namespace Core\Mod\Mcp\Listeners; namespace Core\Mcp\Listeners;
use Core\Mod\Mcp\Services\ToolAnalyticsService; use Core\Mcp\Services\ToolAnalyticsService;
/** /**
* Listener to record MCP tool executions for analytics. * Listener to record MCP tool executions for analytics.

View file

@ -2,10 +2,10 @@
declare(strict_types=1); declare(strict_types=1);
namespace Core\Mod\Mcp\Middleware; namespace Core\Mcp\Middleware;
use Closure; use Closure;
use Core\Mod\Mcp\Services\McpQuotaService; use Core\Mcp\Services\McpQuotaService;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;

View file

@ -2,7 +2,7 @@
declare(strict_types=1); declare(strict_types=1);
namespace Core\Mod\Mcp\Middleware; namespace Core\Mcp\Middleware;
use Core\Mod\Api\Models\ApiKey; use Core\Mod\Api\Models\ApiKey;
use Closure; use Closure;

View file

@ -2,7 +2,7 @@
declare(strict_types=1); declare(strict_types=1);
namespace Core\Mod\Mcp\Middleware; namespace Core\Mcp\Middleware;
use Core\Mod\Tenant\Models\Workspace; use Core\Mod\Tenant\Models\Workspace;
use Core\Mod\Tenant\Services\EntitlementService; use Core\Mod\Tenant\Services\EntitlementService;

View file

@ -2,11 +2,11 @@
declare(strict_types=1); declare(strict_types=1);
namespace Core\Mod\Mcp\Middleware; namespace Core\Mcp\Middleware;
use Closure; use Closure;
use Core\Mod\Mcp\Exceptions\MissingDependencyException; use Core\Mcp\Exceptions\MissingDependencyException;
use Core\Mod\Mcp\Services\ToolDependencyService; use Core\Mcp\Services\ToolDependencyService;
use Illuminate\Http\JsonResponse; use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request; use Illuminate\Http\Request;

View file

@ -2,7 +2,7 @@
declare(strict_types=1); declare(strict_types=1);
namespace Core\Mod\Mcp\Models; namespace Core\Mcp\Models;
use Core\Mod\Tenant\Models\Workspace; use Core\Mod\Tenant\Models\Workspace;
use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Builder;

View file

@ -2,7 +2,7 @@
declare(strict_types=1); declare(strict_types=1);
namespace Core\Mod\Mcp\Models; namespace Core\Mcp\Models;
use Core\Mod\Tenant\Concerns\BelongsToWorkspace; use Core\Mod\Tenant\Concerns\BelongsToWorkspace;
use Core\Mod\Tenant\Models\Workspace; use Core\Mod\Tenant\Models\Workspace;

View file

@ -2,7 +2,7 @@
declare(strict_types=1); declare(strict_types=1);
namespace Core\Mod\Mcp\Models; namespace Core\Mcp\Models;
use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;

View file

@ -2,7 +2,7 @@
declare(strict_types=1); declare(strict_types=1);
namespace Core\Mod\Mcp\Models; namespace Core\Mcp\Models;
use Core\Mod\Tenant\Concerns\BelongsToWorkspace; use Core\Mod\Tenant\Concerns\BelongsToWorkspace;
use Core\Mod\Tenant\Models\Workspace; use Core\Mod\Tenant\Models\Workspace;

View file

@ -2,7 +2,7 @@
declare(strict_types=1); declare(strict_types=1);
namespace Core\Mod\Mcp\Models; namespace Core\Mcp\Models;
use Core\Mod\Tenant\Concerns\BelongsToWorkspace; use Core\Mod\Tenant\Concerns\BelongsToWorkspace;
use Core\Mod\Tenant\Models\Workspace; use Core\Mod\Tenant\Models\Workspace;

View file

@ -2,7 +2,7 @@
declare(strict_types=1); declare(strict_types=1);
namespace Core\Mod\Mcp\Models; namespace Core\Mcp\Models;
use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;

View file

@ -2,7 +2,7 @@
declare(strict_types=1); declare(strict_types=1);
namespace Core\Mod\Mcp\Models; namespace Core\Mcp\Models;
use Core\Mod\Tenant\Concerns\BelongsToWorkspace; use Core\Mod\Tenant\Concerns\BelongsToWorkspace;
use Core\Mod\Tenant\Models\Workspace; use Core\Mod\Tenant\Models\Workspace;

View file

@ -2,7 +2,7 @@
declare(strict_types=1); declare(strict_types=1);
namespace Core\Mod\Mcp\Models; namespace Core\Mcp\Models;
use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;

View file

@ -1,6 +1,6 @@
<?php <?php
namespace Core\Mod\Mcp\Resources; namespace Core\Mcp\Resources;
use Laravel\Mcp\Request; use Laravel\Mcp\Request;
use Laravel\Mcp\Response; use Laravel\Mcp\Response;

View file

@ -1,6 +1,6 @@
<?php <?php
namespace Core\Mod\Mcp\Resources; namespace Core\Mcp\Resources;
use Core\Mod\Content\Models\ContentItem; use Core\Mod\Content\Models\ContentItem;
use Core\Mod\Tenant\Models\Workspace; use Core\Mod\Tenant\Models\Workspace;

View file

@ -1,6 +1,6 @@
<?php <?php
namespace Core\Mod\Mcp\Resources; namespace Core\Mcp\Resources;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
use Laravel\Mcp\Request; use Laravel\Mcp\Request;

View file

@ -1,14 +1,14 @@
<?php <?php
use Core\Mod\Mcp\View\Modal\Admin\ApiKeyManager; use Core\Mcp\View\Modal\Admin\ApiKeyManager;
use Core\Mod\Mcp\View\Modal\Admin\AuditLogViewer; use Core\Mcp\View\Modal\Admin\AuditLogViewer;
use Core\Mod\Mcp\View\Modal\Admin\McpPlayground; use Core\Mcp\View\Modal\Admin\McpPlayground;
use Core\Mod\Mcp\View\Modal\Admin\Playground; use Core\Mcp\View\Modal\Admin\Playground;
use Core\Mod\Mcp\View\Modal\Admin\QuotaUsage; use Core\Mcp\View\Modal\Admin\QuotaUsage;
use Core\Mod\Mcp\View\Modal\Admin\RequestLog; use Core\Mcp\View\Modal\Admin\RequestLog;
use Core\Mod\Mcp\View\Modal\Admin\ToolAnalyticsDashboard; use Core\Mcp\View\Modal\Admin\ToolAnalyticsDashboard;
use Core\Mod\Mcp\View\Modal\Admin\ToolAnalyticsDetail; use Core\Mcp\View\Modal\Admin\ToolAnalyticsDetail;
use Core\Mod\Mcp\View\Modal\Admin\ToolVersionManager; use Core\Mcp\View\Modal\Admin\ToolVersionManager;
use Core\Website\Mcp\Controllers\McpRegistryController; use Core\Website\Mcp\Controllers\McpRegistryController;
use Core\Website\Mcp\View\Modal\Dashboard; use Core\Website\Mcp\View\Modal\Dashboard;
use Illuminate\Support\Facades\Route; use Illuminate\Support\Facades\Route;

View file

@ -4,8 +4,8 @@ declare(strict_types=1);
namespace Mod\Mcp\Services; namespace Mod\Mcp\Services;
use Core\Mod\Mcp\Dependencies\HasDependencies; use Core\Mcp\Dependencies\HasDependencies;
use Core\Mod\Mcp\Services\ToolDependencyService; use Core\Mcp\Services\ToolDependencyService;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use Mod\Api\Models\ApiKey; use Mod\Api\Models\ApiKey;
use Mod\Mcp\Tools\Agent\Contracts\AgentToolInterface; use Mod\Mcp\Tools\Agent\Contracts\AgentToolInterface;
@ -145,7 +145,7 @@ class AgentToolRegistry
* *
* @throws \InvalidArgumentException If tool not found * @throws \InvalidArgumentException If tool not found
* @throws \RuntimeException If permission denied * @throws \RuntimeException If permission denied
* @throws \Core\Mod\Mcp\Exceptions\MissingDependencyException If dependencies not met * @throws \Core\Mcp\Exceptions\MissingDependencyException If dependencies not met
*/ */
public function execute( public function execute(
string $name, string $name,

View file

@ -2,10 +2,10 @@
declare(strict_types=1); declare(strict_types=1);
namespace Core\Mod\Mcp\Services; namespace Core\Mcp\Services;
use Core\Mod\Mcp\Models\McpAuditLog; use Core\Mcp\Models\McpAuditLog;
use Core\Mod\Mcp\Models\McpSensitiveTool; use Core\Mcp\Models\McpSensitiveTool;
use Illuminate\Support\Carbon; use Illuminate\Support\Carbon;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Cache; use Illuminate\Support\Facades\Cache;

View file

@ -2,7 +2,7 @@
declare(strict_types=1); declare(strict_types=1);
namespace Core\Mod\Mcp\Services; namespace Core\Mcp\Services;
use Closure; use Closure;
use Illuminate\Support\Facades\Cache; use Illuminate\Support\Facades\Cache;

View file

@ -2,7 +2,7 @@
declare(strict_types=1); declare(strict_types=1);
namespace Core\Mod\Mcp\Services; namespace Core\Mcp\Services;
/** /**
* Data Redactor - redacts sensitive information from tool call logs. * Data Redactor - redacts sensitive information from tool call logs.

View file

@ -2,7 +2,7 @@
declare(strict_types=1); declare(strict_types=1);
namespace Core\Mod\Mcp\Services; namespace Core\Mcp\Services;
use Illuminate\Support\Facades\Cache; use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;

View file

@ -2,10 +2,10 @@
declare(strict_types=1); declare(strict_types=1);
namespace Core\Mod\Mcp\Services; namespace Core\Mcp\Services;
use Core\Mod\Mcp\Models\McpToolCall; use Core\Mcp\Models\McpToolCall;
use Core\Mod\Mcp\Models\McpToolCallStat; use Core\Mcp\Models\McpToolCallStat;
use Illuminate\Support\Carbon; use Illuminate\Support\Carbon;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;

View file

@ -2,9 +2,9 @@
declare(strict_types=1); declare(strict_types=1);
namespace Core\Mod\Mcp\Services; namespace Core\Mcp\Services;
use Core\Mod\Mcp\Models\McpUsageQuota; use Core\Mcp\Models\McpUsageQuota;
use Core\Mod\Tenant\Models\Workspace; use Core\Mod\Tenant\Models\Workspace;
use Core\Mod\Tenant\Services\EntitlementService; use Core\Mod\Tenant\Services\EntitlementService;
use Illuminate\Support\Facades\Cache; use Illuminate\Support\Facades\Cache;

View file

@ -2,7 +2,7 @@
declare(strict_types=1); declare(strict_types=1);
namespace Core\Mod\Mcp\Services; namespace Core\Mcp\Services;
use Core\Mod\Api\Models\WebhookDelivery; use Core\Mod\Api\Models\WebhookDelivery;
use Core\Mod\Api\Models\WebhookEndpoint; use Core\Mod\Api\Models\WebhookEndpoint;

View file

@ -2,7 +2,7 @@
declare(strict_types=1); declare(strict_types=1);
namespace Core\Mod\Mcp\Services; namespace Core\Mcp\Services;
use Symfony\Component\Yaml\Yaml; use Symfony\Component\Yaml\Yaml;

View file

@ -2,9 +2,9 @@
declare(strict_types=1); declare(strict_types=1);
namespace Core\Mod\Mcp\Services; namespace Core\Mcp\Services;
use Core\Mod\Mcp\Exceptions\ForbiddenQueryException; use Core\Mcp\Exceptions\ForbiddenQueryException;
/** /**
* Validates SQL queries for security before execution. * Validates SQL queries for security before execution.

View file

@ -2,10 +2,10 @@
declare(strict_types=1); declare(strict_types=1);
namespace Core\Mod\Mcp\Services; namespace Core\Mcp\Services;
use Core\Mod\Mcp\DTO\ToolStats; use Core\Mcp\DTO\ToolStats;
use Core\Mod\Mcp\Models\ToolMetric; use Core\Mcp\Models\ToolMetric;
use Illuminate\Support\Carbon; use Illuminate\Support\Carbon;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;

View file

@ -2,11 +2,11 @@
declare(strict_types=1); declare(strict_types=1);
namespace Core\Mod\Mcp\Services; namespace Core\Mcp\Services;
use Core\Mod\Mcp\Dependencies\DependencyType; use Core\Mcp\Dependencies\DependencyType;
use Core\Mod\Mcp\Dependencies\ToolDependency; use Core\Mcp\Dependencies\ToolDependency;
use Core\Mod\Mcp\Exceptions\MissingDependencyException; use Core\Mcp\Exceptions\MissingDependencyException;
use Illuminate\Support\Facades\Cache; use Illuminate\Support\Facades\Cache;
/** /**

View file

@ -2,7 +2,7 @@
declare(strict_types=1); declare(strict_types=1);
namespace Core\Mod\Mcp\Services; namespace Core\Mcp\Services;
use Illuminate\Support\Facades\Cache; use Illuminate\Support\Facades\Cache;

View file

@ -2,9 +2,9 @@
declare(strict_types=1); declare(strict_types=1);
namespace Core\Mod\Mcp\Services; namespace Core\Mcp\Services;
use Core\Mod\Mcp\Models\McpToolVersion; use Core\Mcp\Models\McpToolVersion;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Cache; use Illuminate\Support\Facades\Cache;
use Symfony\Component\Yaml\Yaml; use Symfony\Component\Yaml\Yaml;

View file

@ -2,9 +2,9 @@
declare(strict_types=1); declare(strict_types=1);
namespace Core\Mod\Mcp\Services; namespace Core\Mcp\Services;
use Core\Mod\Mcp\Models\McpToolVersion; use Core\Mcp\Models\McpToolVersion;
use Illuminate\Support\Carbon; use Illuminate\Support\Carbon;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Cache; use Illuminate\Support\Facades\Cache;

View file

@ -2,10 +2,10 @@
declare(strict_types=1); declare(strict_types=1);
namespace Core\Mod\Mcp\Tests\Unit; namespace Core\Mcp\Tests\Unit;
use Core\Mod\Mcp\Models\McpUsageQuota; use Core\Mcp\Models\McpUsageQuota;
use Core\Mod\Mcp\Services\McpQuotaService; use Core\Mcp\Services\McpQuotaService;
use Core\Mod\Tenant\Models\Workspace; use Core\Mod\Tenant\Models\Workspace;
use Core\Mod\Tenant\Services\EntitlementResult; use Core\Mod\Tenant\Services\EntitlementResult;
use Core\Mod\Tenant\Services\EntitlementService; use Core\Mod\Tenant\Services\EntitlementService;

View file

@ -2,12 +2,12 @@
declare(strict_types=1); declare(strict_types=1);
namespace Core\Mod\Mcp\Tests\Unit; namespace Core\Mcp\Tests\Unit;
use Core\Mod\Mcp\Dependencies\DependencyType; use Core\Mcp\Dependencies\DependencyType;
use Core\Mod\Mcp\Dependencies\ToolDependency; use Core\Mcp\Dependencies\ToolDependency;
use Core\Mod\Mcp\Exceptions\MissingDependencyException; use Core\Mcp\Exceptions\MissingDependencyException;
use Core\Mod\Mcp\Services\ToolDependencyService; use Core\Mcp\Services\ToolDependencyService;
use Illuminate\Support\Facades\Cache; use Illuminate\Support\Facades\Cache;
use Tests\TestCase; use Tests\TestCase;

View file

@ -2,9 +2,9 @@
declare(strict_types=1); declare(strict_types=1);
namespace Core\Mod\Mcp\Tests\Unit; namespace Core\Mcp\Tests\Unit;
use Core\Mod\Mcp\Services\ToolVersionService; use Core\Mcp\Services\ToolVersionService;
use Illuminate\Foundation\Testing\RefreshDatabase; use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Carbon; use Illuminate\Support\Carbon;
use Tests\TestCase; use Tests\TestCase;

View file

@ -1,6 +1,6 @@
<?php <?php
namespace Core\Mod\Mcp\Tools\Commerce; namespace Core\Mcp\Tools\Commerce;
use Core\Mod\Commerce\Models\Coupon; use Core\Mod\Commerce\Models\Coupon;
use Illuminate\Contracts\JsonSchema\JsonSchema; use Illuminate\Contracts\JsonSchema\JsonSchema;

View file

@ -2,7 +2,7 @@
declare(strict_types=1); declare(strict_types=1);
namespace Core\Mod\Mcp\Tools\Commerce; namespace Core\Mcp\Tools\Commerce;
use Core\Mod\Commerce\Models\Subscription; use Core\Mod\Commerce\Models\Subscription;
use Illuminate\Contracts\JsonSchema\JsonSchema; use Illuminate\Contracts\JsonSchema\JsonSchema;

View file

@ -2,7 +2,7 @@
declare(strict_types=1); declare(strict_types=1);
namespace Core\Mod\Mcp\Tools\Commerce; namespace Core\Mcp\Tools\Commerce;
use Core\Mod\Commerce\Models\Invoice; use Core\Mod\Commerce\Models\Invoice;
use Illuminate\Contracts\JsonSchema\JsonSchema; use Illuminate\Contracts\JsonSchema\JsonSchema;

View file

@ -2,7 +2,7 @@
declare(strict_types=1); declare(strict_types=1);
namespace Core\Mod\Mcp\Tools\Commerce; namespace Core\Mcp\Tools\Commerce;
use Core\Mod\Commerce\Models\Subscription; use Core\Mod\Commerce\Models\Subscription;
use Core\Mod\Commerce\Services\SubscriptionService; use Core\Mod\Commerce\Services\SubscriptionService;

View file

@ -2,11 +2,11 @@
declare(strict_types=1); declare(strict_types=1);
namespace Core\Mod\Mcp\Tools\Concerns; namespace Core\Mcp\Tools\Concerns;
use Core\Mod\Mcp\Dependencies\ToolDependency; use Core\Mcp\Dependencies\ToolDependency;
use Core\Mod\Mcp\Exceptions\MissingDependencyException; use Core\Mcp\Exceptions\MissingDependencyException;
use Core\Mod\Mcp\Services\ToolDependencyService; use Core\Mcp\Services\ToolDependencyService;
/** /**
* Trait for tools that validate dependencies before execution. * Trait for tools that validate dependencies before execution.

View file

@ -1,6 +1,6 @@
<?php <?php
namespace Core\Mod\Mcp\Tools; namespace Core\Mcp\Tools;
use Core\Mod\Content\Enums\ContentType; use Core\Mod\Content\Enums\ContentType;
use Core\Mod\Content\Models\ContentItem; use Core\Mod\Content\Models\ContentItem;

View file

@ -1,6 +1,6 @@
<?php <?php
namespace Core\Mod\Mcp\Tools; namespace Core\Mcp\Tools;
use Illuminate\Contracts\JsonSchema\JsonSchema; use Illuminate\Contracts\JsonSchema\JsonSchema;
use Laravel\Mcp\Request; use Laravel\Mcp\Request;

View file

@ -1,6 +1,6 @@
<?php <?php
namespace Core\Mod\Mcp\Tools; namespace Core\Mcp\Tools;
use Illuminate\Contracts\JsonSchema\JsonSchema; use Illuminate\Contracts\JsonSchema\JsonSchema;
use Laravel\Mcp\Request; use Laravel\Mcp\Request;

View file

@ -1,6 +1,6 @@
<?php <?php
namespace Core\Mod\Mcp\Tools; namespace Core\Mcp\Tools;
use Illuminate\Contracts\JsonSchema\JsonSchema; use Illuminate\Contracts\JsonSchema\JsonSchema;
use Laravel\Mcp\Request; use Laravel\Mcp\Request;

View file

@ -1,6 +1,6 @@
<?php <?php
namespace Core\Mod\Mcp\Tools; namespace Core\Mcp\Tools;
use Illuminate\Contracts\JsonSchema\JsonSchema; use Illuminate\Contracts\JsonSchema\JsonSchema;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;

View file

@ -2,10 +2,10 @@
declare(strict_types=1); declare(strict_types=1);
namespace Core\Mod\Mcp\Tools; namespace Core\Mcp\Tools;
use Core\Mod\Mcp\Exceptions\ForbiddenQueryException; use Core\Mcp\Exceptions\ForbiddenQueryException;
use Core\Mod\Mcp\Services\SqlQueryValidator; use Core\Mcp\Services\SqlQueryValidator;
use Illuminate\Contracts\JsonSchema\JsonSchema; use Illuminate\Contracts\JsonSchema\JsonSchema;
use Illuminate\Support\Facades\Config; use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;

View file

@ -398,7 +398,7 @@ viewing schema changes between versions, and setting deprecation schedules.
{{-- Deprecate Modal --}} {{-- Deprecate Modal --}}
@if($showDeprecateModal) @if($showDeprecateModal)
@php $deprecateVersion = \Core\Mod\Mcp\Models\McpToolVersion::find($deprecateVersionId) @endphp @php $deprecateVersion = \Core\Mcp\Models\McpToolVersion::find($deprecateVersionId) @endphp
@if($deprecateVersion) @if($deprecateVersion)
<flux:modal wire:model="showDeprecateModal" name="deprecate-modal" class="max-w-md"> <flux:modal wire:model="showDeprecateModal" name="deprecate-modal" class="max-w-md">
<div class="space-y-6"> <div class="space-y-6">

View file

@ -2,7 +2,7 @@
declare(strict_types=1); declare(strict_types=1);
namespace Core\Mod\Mcp\View\Modal\Admin; namespace Core\Mcp\View\Modal\Admin;
use Core\Mod\Api\Models\ApiKey; use Core\Mod\Api\Models\ApiKey;
use Core\Mod\Tenant\Models\Workspace; use Core\Mod\Tenant\Models\Workspace;

View file

@ -2,10 +2,10 @@
declare(strict_types=1); declare(strict_types=1);
namespace Core\Mod\Mcp\View\Modal\Admin; namespace Core\Mcp\View\Modal\Admin;
use Core\Mod\Mcp\Models\McpAuditLog; use Core\Mcp\Models\McpAuditLog;
use Core\Mod\Mcp\Services\AuditLogService; use Core\Mcp\Services\AuditLogService;
use Core\Mod\Tenant\Models\Workspace; use Core\Mod\Tenant\Models\Workspace;
use Illuminate\Contracts\Pagination\LengthAwarePaginator; use Illuminate\Contracts\Pagination\LengthAwarePaginator;
use Illuminate\Support\Carbon; use Illuminate\Support\Carbon;

View file

@ -2,10 +2,10 @@
declare(strict_types=1); declare(strict_types=1);
namespace Core\Mod\Mcp\View\Modal\Admin; namespace Core\Mcp\View\Modal\Admin;
use Core\Mod\Api\Models\ApiKey; use Core\Mod\Api\Models\ApiKey;
use Core\Mod\Mcp\Services\ToolRegistry; use Core\Mcp\Services\ToolRegistry;
use Illuminate\Support\Facades\Http; use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\RateLimiter; use Illuminate\Support\Facades\RateLimiter;
use Illuminate\Support\Facades\Session; use Illuminate\Support\Facades\Session;

View file

@ -2,7 +2,7 @@
declare(strict_types=1); declare(strict_types=1);
namespace Core\Mod\Mcp\View\Modal\Admin; namespace Core\Mcp\View\Modal\Admin;
use Core\Mod\Api\Models\ApiKey; use Core\Mod\Api\Models\ApiKey;
use Illuminate\Support\Facades\Http; use Illuminate\Support\Facades\Http;

View file

@ -2,9 +2,9 @@
declare(strict_types=1); declare(strict_types=1);
namespace Core\Mod\Mcp\View\Modal\Admin; namespace Core\Mcp\View\Modal\Admin;
use Core\Mod\Mcp\Services\McpQuotaService; use Core\Mcp\Services\McpQuotaService;
use Core\Mod\Tenant\Models\Workspace; use Core\Mod\Tenant\Models\Workspace;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use Livewire\Component; use Livewire\Component;

View file

@ -2,9 +2,9 @@
declare(strict_types=1); declare(strict_types=1);
namespace Core\Mod\Mcp\View\Modal\Admin; namespace Core\Mcp\View\Modal\Admin;
use Core\Mod\Mcp\Models\McpApiRequest; use Core\Mcp\Models\McpApiRequest;
use Livewire\Attributes\Layout; use Livewire\Attributes\Layout;
use Livewire\Component; use Livewire\Component;
use Livewire\WithPagination; use Livewire\WithPagination;

View file

@ -2,10 +2,10 @@
declare(strict_types=1); declare(strict_types=1);
namespace Core\Mod\Mcp\View\Modal\Admin; namespace Core\Mcp\View\Modal\Admin;
use Core\Mod\Mcp\DTO\ToolStats; use Core\Mcp\DTO\ToolStats;
use Core\Mod\Mcp\Services\ToolAnalyticsService; use Core\Mcp\Services\ToolAnalyticsService;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use Livewire\Attributes\Layout; use Livewire\Attributes\Layout;
use Livewire\Attributes\Url; use Livewire\Attributes\Url;

View file

@ -2,10 +2,10 @@
declare(strict_types=1); declare(strict_types=1);
namespace Core\Mod\Mcp\View\Modal\Admin; namespace Core\Mcp\View\Modal\Admin;
use Core\Mod\Mcp\DTO\ToolStats; use Core\Mcp\DTO\ToolStats;
use Core\Mod\Mcp\Services\ToolAnalyticsService; use Core\Mcp\Services\ToolAnalyticsService;
use Livewire\Attributes\Layout; use Livewire\Attributes\Layout;
use Livewire\Attributes\Url; use Livewire\Attributes\Url;
use Livewire\Component; use Livewire\Component;

View file

@ -2,10 +2,10 @@
declare(strict_types=1); declare(strict_types=1);
namespace Core\Mod\Mcp\View\Modal\Admin; namespace Core\Mcp\View\Modal\Admin;
use Core\Mod\Mcp\Models\McpToolVersion; use Core\Mcp\Models\McpToolVersion;
use Core\Mod\Mcp\Services\ToolVersionService; use Core\Mcp\Services\ToolVersionService;
use Illuminate\Contracts\Pagination\LengthAwarePaginator; use Illuminate\Contracts\Pagination\LengthAwarePaginator;
use Illuminate\Support\Carbon; use Illuminate\Support\Carbon;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;

View file

@ -6,7 +6,7 @@ namespace Core\Website\Mcp\View\Modal;
use Livewire\Attributes\Layout; use Livewire\Attributes\Layout;
use Livewire\Component; use Livewire\Component;
use Core\Mod\Mcp\Services\McpMetricsService; use Core\Mcp\Services\McpMetricsService;
/** /**
* MCP Metrics Dashboard * MCP Metrics Dashboard

View file

@ -8,7 +8,7 @@ use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\RateLimiter; use Illuminate\Support\Facades\RateLimiter;
use Livewire\Attributes\Layout; use Livewire\Attributes\Layout;
use Livewire\Component; use Livewire\Component;
use Core\Mod\Mcp\Models\McpToolCall; use Core\Mcp\Models\McpToolCall;
use Symfony\Component\Process\Process; use Symfony\Component\Process\Process;
use Symfony\Component\Yaml\Yaml; use Symfony\Component\Yaml\Yaml;

Some files were not shown because too many files have changed in this diff Show more