Commit graph

13 commits

Author SHA1 Message Date
Snider
2458f87c8d fix(migrations): make all package migrations idempotent
Some checks are pending
CI / PHP 8.2 (push) Waiting to run
CI / PHP 8.3 (push) Waiting to run
CI / PHP 8.4 (push) Waiting to run
CI / Assets (push) Waiting to run
Guard every Schema::create() with hasTable() so migrations
coexist safely with the consolidated app-level migration in
host.uk.com. Prevents "table already exists" failures that
would block the entire migration batch.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-08 21:07:59 +00:00
Snider
8c2a532899 docs: add January 2026 completed items to changelog
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 19:51:57 +00:00
Snider
7e881f6565 test(mcp): add comprehensive Quota System tests (P2-016)
Add extensive Pest tests for the MCP quota system covering:
- Usage recording and tracking (tool calls, tokens)
- Quota enforcement per tier (free, starter, pro, business, enterprise)
- Token quota enforcement independently of tool calls
- Detailed quota check responses with reasons
- Remaining quota calculation
- Quota reset and monthly period management
- Usage history retrieval
- Quota HTTP headers (X-MCP-Quota-*)
- Quota limits retrieval and caching
- CheckMcpQuota middleware (429 responses, headers injection)
- Workspace-scoped quotas (isolation, independent limits)
- McpUsageQuota model (scopes, accessors, static methods)
- Edge cases (concurrent requests, cache invalidation, month boundaries)
- Cache management (performance caching, invalidation)

Replaces basic test coverage with ~100 test cases for thorough validation.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 19:48:21 +00:00
Snider
64ce1ee324 test(mcp): add comprehensive Tool Analytics tests (P2-015)
Add Pest tests for ToolAnalyticsService covering:
- Usage tracking (recording successful/failed executions)
- ToolStats DTO calculations and formatting
- Error rate calculations
- Daily trend aggregation
- Reporting functions (popular tools, error-prone tools, workspace stats)
- Tool combination tracking within sessions
- Date range filtering
- ToolMetric model methods and scopes

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 19:44:32 +00:00
Snider
ac7fe0ea7a test(mcp): add comprehensive Workspace Context tests (P2-014)
Add extensive Pest tests for workspace context security covering:
- WorkspaceContext resolution from headers and authentication
- Automatic workspace scoping for queries
- MissingWorkspaceContextException handling
- Workspace boundary enforcement
- Cross-workspace data isolation and query prevention
- Context injection via middleware
- Edge cases including concurrent contexts and request isolation

Also update Pest.php to include src/Mcp/Tests/Unit directory.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 19:39:24 +00:00
Snider
41b8568d5c test(mcp): add comprehensive SQL Query Validator tests (P2-013)
Add Pest tests for SqlQueryValidator covering:
- Allowed SELECT statements with WHERE, ORDER BY, LIMIT
- Blocked data modification (INSERT, UPDATE, DELETE, TRUNCATE)
- Blocked schema changes (DROP, ALTER, CREATE, RENAME)
- Blocked permissions/admin (GRANT, REVOKE, FLUSH, KILL, SET)
- Blocked execution (EXECUTE, PREPARE, CALL, DEALLOCATE)
- Blocked file operations (INTO OUTFILE/DUMPFILE, LOAD_FILE/DATA)
- SQL injection prevention: UNION attacks, stacked queries,
  time-based (SLEEP/BENCHMARK), encoding (hex/CHAR), subqueries,
  system table access, comment obfuscation
- Query structure validation and whitelist configuration
- Exception details and edge cases

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 19:38:40 +00:00
Snider
e536e4586f feat(mcp): add query security features (P1-007, P1-008, P1-009)
- P1-007: Tier-based query result size limits with truncation warnings
- P1-008: Per-tier query timeout enforcement (MySQL/PostgreSQL/SQLite)
- P1-009: Comprehensive audit logging for all query attempts

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 13:15:39 +00:00
Snider
1a95091b9c docs: add package documentation
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 10:47:52 +00:00
Snider
80ab88d330 docs: rewrite CLAUDE.md for core-mcp package specifics
Replace generic Core PHP Framework documentation with package-specific
guidance covering MCP tool architecture, security layers (SQL validation,
workspace context isolation), key services, and testing patterns.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 14:13:09 +00:00
Snider
fc1c2ef573 refactor: update namespaces for L1 package convention
- Mod\Mcp -> Core\Mcp
- Core\Mod\Tenant -> Core\Tenant

Part of namespace restructure to align with L1/L2 module conventions.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-27 17:34:35 +00:00
Snider
6f309979de 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>
2026-01-27 16:26:14 +00:00
Snider
afb3dacd98 monorepo sepration 2026-01-26 20:57:41 +00:00
Snider
3ac43d834b
Initial commit 2026-01-26 20:49:02 +00:00