This Python-based MCP server for Laravel integrates with Cursor IDE to enhance your development workflow. It provides tools for log viewing, error searching, Artisan command execution, and model information display directly within your editor.
Clone the repository:
git clone https://github.com/your-username/laravel-mcp.git
cd laravel-mcp
Create a shell script wrapper (e.g., ~/bin/run-laravel-mcp
):
#!/bin/bash
# Point to your Laravel project path
export LARAVEL_PATH=/path/to/your/laravel/project
# Run the MCP server
mcp run /path/to/laravel-helpers-mcp/server.py
Make the script executable:
chmod +x ~/bin/run-laravel-mcp
Add to your PATH:
echo 'export PATH="$HOME/bin:$PATH"' >> ~/.zshrc # or ~/.bashrc
source ~/.zshrc # or source ~/.bashrc
The Laravel Helpers MCP provides the following tools that can be accessed through Cursor IDE's command palette:
View Log Files
tail_log_file
Displays the most recent entries in your Laravel log file directly in Cursor
Search for Errors
search_log_errors
Search through your log files for specific error patterns with integrated results
Run Artisan Commands
run_artisan_command
Execute Laravel artisan commands directly from Cursor without switching to the terminal
Model Information
show_model
Display model information and relationships in your editor for quick reference
The MCP server needs to know where your Laravel project is located. You can configure this by either:
LARAVEL_PATH
environment variable before running the serverFor projects with multiple Laravel applications, consider creating different wrapper scripts for each project.
⚠️ This package is currently in alpha stage. APIs and functionality may change without notice. Use in production at your own risk.
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"cursor-rules-mcp": {
"command": "npx",
"args": [
"-y",
"cursor-rules-mcp"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.