@falzz1010/laravel-mcp-server 1.0.0

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 (76) hide show
  1. package/CHANGELOG.md +100 -0
  2. package/LICENSE +21 -0
  3. package/README.md +866 -0
  4. package/build/index.d.ts +2 -0
  5. package/build/index.d.ts.map +1 -0
  6. package/build/index.js +101 -0
  7. package/build/index.js.map +1 -0
  8. package/build/prompts/laravel-prompts.d.ts +4 -0
  9. package/build/prompts/laravel-prompts.d.ts.map +1 -0
  10. package/build/prompts/laravel-prompts.js +81 -0
  11. package/build/prompts/laravel-prompts.js.map +1 -0
  12. package/build/resources/laravel-info.d.ts +4 -0
  13. package/build/resources/laravel-info.d.ts.map +1 -0
  14. package/build/resources/laravel-info.js +99 -0
  15. package/build/resources/laravel-info.js.map +1 -0
  16. package/build/tests/full-security-audit.test.d.ts +2 -0
  17. package/build/tests/full-security-audit.test.d.ts.map +1 -0
  18. package/build/tests/full-security-audit.test.js +226 -0
  19. package/build/tests/full-security-audit.test.js.map +1 -0
  20. package/build/tests/security.test.d.ts +2 -0
  21. package/build/tests/security.test.d.ts.map +1 -0
  22. package/build/tests/security.test.js +124 -0
  23. package/build/tests/security.test.js.map +1 -0
  24. package/build/tools/list-routes.d.ts +4 -0
  25. package/build/tools/list-routes.d.ts.map +1 -0
  26. package/build/tools/list-routes.js +68 -0
  27. package/build/tools/list-routes.js.map +1 -0
  28. package/build/tools/read-env.d.ts +4 -0
  29. package/build/tools/read-env.d.ts.map +1 -0
  30. package/build/tools/read-env.js +51 -0
  31. package/build/tools/read-env.js.map +1 -0
  32. package/build/tools/read-file.d.ts +4 -0
  33. package/build/tools/read-file.d.ts.map +1 -0
  34. package/build/tools/read-file.js +60 -0
  35. package/build/tools/read-file.js.map +1 -0
  36. package/build/tools/read-logs.d.ts +4 -0
  37. package/build/tools/read-logs.d.ts.map +1 -0
  38. package/build/tools/read-logs.js +60 -0
  39. package/build/tools/read-logs.js.map +1 -0
  40. package/build/tools/run-artisan.d.ts +5 -0
  41. package/build/tools/run-artisan.d.ts.map +1 -0
  42. package/build/tools/run-artisan.js +130 -0
  43. package/build/tools/run-artisan.js.map +1 -0
  44. package/build/tools/run-tinker.d.ts +4 -0
  45. package/build/tools/run-tinker.d.ts.map +1 -0
  46. package/build/tools/run-tinker.js +75 -0
  47. package/build/tools/run-tinker.js.map +1 -0
  48. package/build/tools/write-file.d.ts +4 -0
  49. package/build/tools/write-file.d.ts.map +1 -0
  50. package/build/tools/write-file.js +103 -0
  51. package/build/tools/write-file.js.map +1 -0
  52. package/build/utils/audit.d.ts +23 -0
  53. package/build/utils/audit.d.ts.map +1 -0
  54. package/build/utils/audit.js +52 -0
  55. package/build/utils/audit.js.map +1 -0
  56. package/build/utils/config.d.ts +12 -0
  57. package/build/utils/config.d.ts.map +1 -0
  58. package/build/utils/config.js +63 -0
  59. package/build/utils/config.js.map +1 -0
  60. package/build/utils/file.d.ts +8 -0
  61. package/build/utils/file.d.ts.map +1 -0
  62. package/build/utils/file.js +96 -0
  63. package/build/utils/file.js.map +1 -0
  64. package/build/utils/process.d.ts +16 -0
  65. package/build/utils/process.d.ts.map +1 -0
  66. package/build/utils/process.js +78 -0
  67. package/build/utils/process.js.map +1 -0
  68. package/build/utils/rate-limiter.d.ts +19 -0
  69. package/build/utils/rate-limiter.d.ts.map +1 -0
  70. package/build/utils/rate-limiter.js +57 -0
  71. package/build/utils/rate-limiter.js.map +1 -0
  72. package/build/utils/security.d.ts +23 -0
  73. package/build/utils/security.d.ts.map +1 -0
  74. package/build/utils/security.js +282 -0
  75. package/build/utils/security.js.map +1 -0
  76. package/package.json +61 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,100 @@
1
+ # Changelog
2
+
3
+ All notable changes to Laravel MCP Server will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [1.0.0] - 2026-08-01
9
+
10
+ ### 🎉 Initial Release
11
+
12
+ #### Added
13
+ - **7 Core Tools**
14
+ - `run_artisan` - Execute safe Laravel artisan commands
15
+ - `read_logs` - Read Laravel application logs with filtering
16
+ - `list_routes` - View all application routes
17
+ - `read_env` - View environment variables with credential masking
18
+ - `read_file` - Read project source code
19
+ - `write_file` - Write/edit files with strict safety controls (opt-in)
20
+ - `run_tinker` - Execute PHP code in sandboxed Tinker environment (opt-in)
21
+
22
+ - **3 Laravel Resources**
23
+ - `laravel://env` - Static view of masked environment variables
24
+ - `laravel://routes` - JSON view of all routes
25
+ - `laravel://config/{key}` - Dynamic configuration value reader
26
+
27
+ - **3 Smart Prompts**
28
+ - `debug-error` - Auto-read logs and request AI diagnosis
29
+ - `create-crud` - Template for generating complete CRUD resources
30
+ - `review-code` - Laravel-focused code review prompt
31
+
32
+ - **10-Layer Security System**
33
+ - Environment gate (refuses to run in production)
34
+ - 3-tier command risk classification (READ_ONLY/CAUTIOUS/DANGEROUS)
35
+ - 20+ permanently blocked destructive commands
36
+ - Input sanitization against shell injection
37
+ - Path traversal protection
38
+ - File write whitelist (directories & extensions)
39
+ - Automatic backup before file modifications
40
+ - Tinker sandbox (blocks 15+ dangerous PHP functions)
41
+ - Rate limiting (30 req/min, 500 req/hour)
42
+ - Full audit logging to `.laravel-mcp-audit.jsonl`
43
+
44
+ - **CLI Options**
45
+ - `--allow-write` - Enable file writing capability
46
+ - `--allow-tinker` - Enable Tinker code execution
47
+ - `--dry-run` - Preview mode without actual execution
48
+ - `--php [path]` - Custom PHP binary path
49
+ - `--timeout [ms]` - Custom command timeout
50
+ - `--rate-limit [n]` - Custom rate limit
51
+
52
+ #### Security
53
+ - **3-Tier Command Classification**
54
+ - 🟢 READ_ONLY: Safe commands executed immediately
55
+ - 🟡 CAUTIOUS: Logged and rate-limited commands
56
+ - 🔴 DANGEROUS: Permanently blocked destructive commands
57
+
58
+ - **Path Traversal Protection**
59
+ - All file operations validate paths stay within project root
60
+ - Symlinks checked to prevent escaping project directory
61
+ - Special protection for `.env` and system files
62
+
63
+ - **Rate Limiting**
64
+ - 30 requests per minute default
65
+ - 500 requests per hour default
66
+ - 2-second cooldown between CAUTIOUS commands
67
+ - READ_ONLY commands excluded from limits
68
+
69
+ - **Audit Trail**
70
+ - Every operation logged to `.laravel-mcp-audit.jsonl`
71
+ - Includes timestamp, tool, command, args, exit code, duration
72
+ - Logs preserved with SHA-256 hashes for file writes
73
+ - Auto-rotation when log exceeds 10MB
74
+
75
+ - **Auto-Backup System**
76
+ - Files backed up to `.laravel-mcp-backup/` before overwrite
77
+ - Timestamp-based backup naming
78
+ - Enables safe rollback of AI-made changes
79
+
80
+ #### Documentation
81
+ - Comprehensive README with installation, configuration, usage examples
82
+ - Detailed implementation plan with security architecture
83
+ - Troubleshooting guide for common issues
84
+ - Tool reference with parameters and examples
85
+
86
+ #### Testing
87
+ - 40+ security-focused unit tests
88
+ - Command classification validation
89
+ - Input sanitization tests
90
+ - Path security tests
91
+ - Rate limiter tests
92
+ - Environment safety checks
93
+
94
+ ### Notes
95
+ - Designed for **local development only** - refuses to run in production
96
+ - Default mode is read-only for maximum safety
97
+ - Requires Node.js 18+ and PHP 8.0+
98
+ - Compatible with Laravel 8+
99
+
100
+ [1.0.0]: https://github.com/your-username/laravel-mcp-server/releases/tag/v1.0.0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Laravel MCP Server Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.