Laravel Forge
Connect Claude, ChatGPT or Cursor to Laravel Forge via MCP. Inspect servers, read deploy/Nginx logs, and trigger deployments securely.
Overview
Connect Laravel Forge to let AI clients inspect your servers, sites, and deployments — and trigger deploys when needed.
This integration uses the Forge API v2 (https://forge.laravel.com/api). The legacy API v1 is deprecated — create tokens from Account → API in the current Forge dashboard.
Prerequisites
- A Laravel Forge account with API access
- A stackgate.ai account
Getting credentials
- Sign in to Laravel Forge.
- Go to Account → API and create an API token. Copy it somewhere safe — Forge shows it only once.
- Note your organization slug from the Forge URL when viewing your organization (for example
forge.laravel.com/orgs/my-org→ slug ismy-org). Use list_organizations after connecting if you are unsure. - In stackgate.ai, open Integrations → Laravel Forge.
- Click Activate and enter your organization slug and API token.
See the Forge API documentation for token permissions and organization access.
Response format
Forge returns JSON:API payloads. MCP tools normalize them for AI clients:
- Lists:
{ "items": [...], "meta": { "per_page", "next_cursor", "prev_cursor" }, "links": {...} } - Single resources: flattened fields (
id,type, plus attributes such asname,status) - Logs:
{ "content": "..." }
Use meta.next_cursor with page_cursor on list tools for pagination. List tools also support optional filter and sort parameters — see each tool's description.
Using with AI clients
- Dedicated endpoint:
POST /mcp/forgewith a Sanctum bearer token - Private gateway: one config for all integrations — use
forge__*namespaced tools
Key tools:
- list_servers, list_sites, list_org_sites — browse infrastructure (supports filters)
- get_site — site details; only
site_idis required - list_deployments, get_deployment_log — deploy history and failures
- get_site_application_log, get_site_nginx_access_log, get_site_nginx_error_log — debugging
- trigger_deployment — deploy now (requires
site:manage-deploys)
See Documentation for HTTP authentication and private gateway setup.
Troubleshooting
- 422 integration not configured — complete the credential form in My Integrations with both API token and organization slug.
- 401 Unauthorized — regenerate the API token in Forge and update your integration credentials.
- 403 Forbidden — your Forge role may lack permission for the action (for example
trigger_deploymentrequiressite:manage-deploys). - 429 Too many requests — Forge limits API calls to 60 per minute; wait and use pagination cursors instead of rapid polling.
Available tools
-
list_organizations
List Laravel Forge organizations accessible to the connected API token.
-
get_current_user
Get the Laravel Forge user profile for the connected API token.
-
list_servers
List servers in the configured Forge organization. Supports filter[name], filter[ip_address], filter[region], filter[provider], filter[php_version], and sort.
-
get_server
Get details for a single Forge server by ID.
-
list_sites
List sites on a Forge server. Supports filter[name], sort, and include.
-
get_site
Get details for a single site in the configured Forge organization. Only site_id is required.
-
list_org_sites
List all sites across the configured Forge organization. Supports filter[name] and include.
-
list_deployments
List deployment history for a Forge site. Supports filter[commit_hash], filter[commit_message], filter[commit_author], and sort.
-
get_deployment
Get details for a single deployment on a Forge site.
-
get_deployment_log
Get the output log for a Forge site deployment.
-
get_deployment_script
Get the deployment script configured for a Forge site.
-
get_deployment_status
Get the current deployment status for a Forge site.
-
list_server_events
List recent events for a Forge server. Supports filter[initiated_by], filter[ran_as], sort, and include.
-
get_site_application_log
Get the application log for a Forge site.
-
get_site_nginx_access_log
Get the Nginx access log for a Forge site.
-
get_site_nginx_error_log
Get the Nginx error log for a Forge site.
-
trigger_deployment
Trigger a deployment for a Forge site (Deploy Now). Requires site:manage-deploys permission.
MCP endpoint:
https://stackgate.ai/mcp/forge
(HTTP) or via the
private gateway.
Related workflows
Multi-integration playbooks that use Laravel Forge to solve concrete business outcomes.