Claude Agent SDK for Laravel
Anthropic Claude Agent SDK for PHP & Laravel — build AI agents with tool use, sandboxing, MCP servers, subagents, hooks, and structured output via the Claude Code CLI
What is Claude Agent SDK for Laravel?
Claude Agent SDK for Laravel is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to anthropic claude agent sdk for php & laravel — build ai agents with tool use, sandboxing, mcp servers, subagents, hooks, and structured output via the claude code cli
Anthropic Claude Agent SDK for PHP & Laravel — build AI agents with tool use, sandboxing, MCP servers, subagents, hooks, and structured output via the Claude Code CLI
This server falls under the Coding Agents category on MCPgee, the world's largest MCP server directory with 33,000+ servers.
Features
- Anthropic Claude Agent SDK for PHP & Laravel — build AI agen
Use Cases
Maintainer
Works with
Installation
Manual Installation
npx claude-agent-sdk-laravelConfiguration
Configuration Details
claude_desktop_config.json
Performance
Response Metrics
Resource Usage
How to Set Up and Use Claude Agent SDK for Laravel
The Claude Agent SDK for Laravel is a PHP/Laravel package that wraps the Claude Code CLI to bring full agentic AI capabilities into Laravel applications. It supports file read/write/edit operations, Bash execution, streaming responses, session resumption, structured JSON output, subagent delegation, MCP server integration, fine-grained permission control with custom handlers, and 12 hook event types — all accessible via a clean Laravel facade.
Prerequisites
- PHP 8.1+ and Composer installed
- Laravel 10+ application
- Claude Code CLI installed and authenticated (npm install -g @anthropic-ai/claude-code)
- An Anthropic API key from https://console.anthropic.com
Install the package via Composer
Add the SDK to your Laravel project using Composer.
composer require mohamed-ashraf-elsaed/claude-agent-sdk-laravelPublish the configuration file
Publish the package config so you can customize model, permission mode, budget, and other settings.
php artisan vendor:publish --tag=claude-agent-configConfigure environment variables
Add the required and optional environment variables to your Laravel .env file.
ANTHROPIC_API_KEY=your-api-key-here
CLAUDE_AGENT_MODEL=claude-sonnet-4-5-20250929
CLAUDE_AGENT_PERMISSION_MODE=acceptEdits
CLAUDE_AGENT_MAX_TURNS=10
CLAUDE_AGENT_MAX_BUDGET_USD=10.00Run a basic agent query
Use the ClaudeAgent facade to send a query. The agent has access to Read, Write, Edit, Bash, Grep, Glob, WebFetch, Task, and any connected MCP tools.
<?php
use ClaudeAgentSDK\Facades\ClaudeAgent;
$result = ClaudeAgent::query('What files are in this directory?');
echo $result->text();
echo 'Cost: $' . $result->costUsd();Use streaming for real-time responses
For long-running tasks, stream the response with a callback to process output incrementally.
<?php
use ClaudeAgentSDK\Facades\ClaudeAgent;
ClaudeAgent::stream('Refactor the User model for better readability', function($chunk) {
echo $chunk;
ob_flush();
flush();
});Resume a previous session
Pass a session ID to continue a conversation with full context from a prior agent run.
<?php
$result = ClaudeAgent::query(
'Continue fixing the auth module',
sessionId: 'previous-session-id-here'
);
echo $result->text();Claude Agent SDK for Laravel Examples
Client configuration
The SDK is configured via your Laravel .env and the published config file. No external MCP client config is needed — the package talks to the Claude Code CLI directly.
{
"model": "claude-sonnet-4-5-20250929",
"permission_mode": "acceptEdits",
"max_turns": 10,
"max_budget_usd": 10.00
}Prompts to try
Example queries to run against the Claude Agent SDK from your Laravel application.
- "Find and fix the bug in app/Http/Controllers/AuthController.php"
- "Refactor the User model to use mass assignment protection correctly"
- "Create a REST API resource controller for the Product model with CRUD operations"
- "Review the authentication module for security vulnerabilities"
- "Generate a migration for an orders table with foreign keys to users and products"Troubleshooting Claude Agent SDK for Laravel
CliNotFoundException: Claude Code CLI not found
Install Claude Code CLI globally with 'npm install -g @anthropic-ai/claude-code' and ensure the 'claude' binary is in your system PATH. Run 'which claude' or 'claude --version' to verify.
API key errors or authentication failures
Ensure ANTHROPIC_API_KEY is set correctly in your .env file and that 'php artisan config:clear' has been run to invalidate the config cache. The key must have access to the model specified in CLAUDE_AGENT_MODEL.
Agent exceeds budget or max turns limit
Increase CLAUDE_AGENT_MAX_BUDGET_USD or CLAUDE_AGENT_MAX_TURNS in your .env file. For complex refactoring tasks, a budget of $1-5 and 20-50 turns is typical. Monitor costs with $result->costUsd() per query.
Frequently Asked Questions about Claude Agent SDK for Laravel
What is Claude Agent SDK for Laravel?
Claude Agent SDK for Laravel is a Model Context Protocol (MCP) server that anthropic claude agent sdk for php & laravel — build ai agents with tool use, sandboxing, mcp servers, subagents, hooks, and structured output via the claude code cli It connects AI assistants to external tools and data sources through a standardized interface.
How do I install Claude Agent SDK for Laravel?
Follow the installation instructions on the Claude Agent SDK for Laravel GitHub repository. Clone the repo, install dependencies, and add the server config to your AI client.
Which AI clients work with Claude Agent SDK for Laravel?
Claude Agent SDK for Laravel works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.
Is Claude Agent SDK for Laravel free to use?
Yes, Claude Agent SDK for Laravel is open source and available under the MIT license. You can use it freely in both personal and commercial projects.
Claude Agent SDK for Laravel Alternatives — Similar Coding Agents Servers
Looking for alternatives to Claude Agent SDK for Laravel? Here are other popular coding agents servers you can use with Claude, Cursor, and VS Code.
Dify
★ 142.2kProduction-ready platform for agentic workflow development.
Ruflo
★ 54.0k🌊 The leading agent orchestration platform for Claude. Deploy intelligent multi-agent swarms, coordinate autonomous workflows, and build conversational AI systems. Features enterprise-grade architecture, self-learning swarm intelligence, RAG integrat
Goose
★ 45.7kan open source, extensible AI agent that goes beyond code suggestions - install, execute, edit, and test with any LLM
Antigravity Awesome Skills
★ 38.3kInstallable GitHub library of 1,400+ agentic skills for Claude Code, Cursor, Codex CLI, Gemini CLI, Antigravity, and more. Includes installer CLI, bundles, workflows, and official/community skill collections.
AgentScope
★ 25.5kBuild and run agents you can see, understand and trust.
Serena
★ 24.5kA coding agent toolkit that provides IDE-like semantic code retrieval and editing tools, enabling LLMs to efficiently navigate and modify codebases using symbol-level operations instead of basic file reading and string replacements.
Browse More Coding Agents MCP Servers
Explore all coding agents servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.
Set Up Claude Agent SDK for Laravel in Your Editor
Choose your AI client for step-by-step setup instructions.
Quick Config Preview
Add this to your claude_desktop_config.json or .cursor/mcp.json
Ready to use Claude Agent SDK for Laravel?
Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.