Build, iterate, inspect, and deploy full-stack web apps through Lovable's MCP server — without ever opening the Lovable UI.
Lovable's agent handles the heavy lifting: you describe what you want in plain language, and it builds a working app (React + Vite + Tailwind + shadcn/ui + Supabase when needed). The MCP server exposes this capability programmatically, so you can drive the entire workflow from any agent that supports skills.
Lovable provides a Model Context Protocol (MCP) server at https://mcp.lovable.dev that gives AI agents direct access to:
Authentication is OAuth 2.1+PKCE. The MCP server supports the standard MCP OAuth flow:
WWW-Authenticate: Bearer challengehttps://lovable.dev/oauth/.well-known/oauth-authorization-serverAuthorization: Bearer in all subsequent callscurl (should be available on any system)python3 (for scripts, should be available on any system)Contact Lovable support ( support@lovable.dev) and request MCP OAuth client credentials. They will provide a CLIENT_ID (a hex string like 0123456789abcdef0123456789abcdef).
This CLIENT_ID is registered with a specific redirect URI. The skill scripts use this redirect URI during the OAuth flow.
bash
# Make the scripts executable
chmod +x scripts/*.sh
# Run the OAuth setup — this will generate a PKCE authorization URL for you
bash scripts/lovable-oauth-setup.sh
The script will:
?code= parameterconfig/lovable-tokens.jsonbash
# Get the access token (auto-refreshes if expired)
TOKEN=$(bash scripts/lovable-get-token.sh)
# Test: list your profile and workspaces
curl -s -X POST https://mcp.lovable.dev/ \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-H "Authorization: Bearer $TOKEN" \
-d '{"jsonrpc":"2.0","method":"tools/call","params":{"name":"get_me","arguments":{}},"id":1}'
Add the Lovable MCP server to your openclaw.json:
json
{
"mcp": {
"servers": {
"lovable": {
"url": "https://mcp.lovable.dev",
"type": "http",
"auth": {
"CLIENT_ID": "<your-client-id>"
}
}
}
}
}
Then restart the gateway:
bash
openclaw gateway restart
The OAuth flow uses PKCE (Proof Key for Code Exchange) as required by the MCP OAuth 2.1 specification.
ParameterValueresponse_type``code``client_idYour CLIENT_IDcode_challenge_method``S256``code_challengeBase64URL(SHA256(code_verifier))scope``offline projects:read projects:write projects:create workspaces:read workspaces:write``stateRandom anti-CSRF token
Exchange the authorization code at https://lovable.dev/oauth/token:
ParameterValuegrant_type``authorization_code``codeThe authorization code from the redirectredirect_uriThe registered redirect URI for your clientclient_idYour CLIENT_IDcode_verifierThe PKCE verifier you generated
When the access token expires (after 8 hours), use the refresh token:
bash
curl -s -X POST https://lovable.dev/oauth/token \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "grant_type=refresh_token" \
-d "refresh_token=<your-refresh-token>" \
-d "client_id=<your-client-id>" \
-d "redirect_uri=<your-registered-redirect-uri>"
bash
TOKEN=$(bash scripts/lovable-get-token.sh)
curl -s -X POST https://mcp.lovable.dev/ \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-H "Authorization: Bearer $TOKEN" \
-d '{"jsonrpc":"2.0","method":"tools/call","params":{"name":"list_workspaces","arguments":{}},"id":1}'
bash
TOKEN=$(bash scripts/lovable-get-token.sh)
WORKSPACE_ID="<your-workspace-id>"
curl -s -X POST https://mcp.lovable.dev/ \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-H "Authorization: Bearer $TOKEN" \
-d "{\"jsonrpc\":\"2.0\",\"method\":\"tools/call\",\"params\":{\"name\":\"list_projects\",\"arguments\":{\"workspace_id\":\"$WORKSPACE_ID\"}},\"id\":1}"
bash
TOKEN=$(bash scripts/lovable-get-token.sh)
PROJECT_ID="<your-project-id>"
curl -s -X POST https://mcp.lovable.dev/ \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-H "Authorization: Bearer $TOKEN" \
-d "{\"jsonrpc\":\"2.0\",\"method\":\"tools/call\",\"params\":{\"name\":\"deploy_project\",\"arguments\":{\"project_id\":\"$PROJECT_ID\"}},\"id\":1}"
bash
TOKEN=$(bash scripts/lovable-get-token.sh)
PROJECT_ID="<your-project-id>"
curl -s -X POST https://mcp.lovable.dev/ \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-H "Authorization: Bearer $TOKEN" \
-d "{\"jsonrpc\":\"2.0\",\"method\":\"tools/call\",\"params\":{\"name\":\"send_message\",\"arguments\":{\"project_id\":\"$PROJECT_ID\",\"message\":\"Add a dark mode toggle to the header\"}},\"id\":1}"
Combine this skill with a CI/CD or agent workflow:
main in your git repolist_projectsdeploy_project(project_id)ToolParametersDescriptioncreate_project``workspace_id (required), description (required), initial_message, tech_stack, visibility, template_project_id, selected_librariesCreate a new Lovable projectsend_message``project_id (required), message (required), wait, timeout_seconds, plan_modeSend a prompt to the Lovable agentget_project``project_id (required)Get project details (URLs, latest commit, status)list_projects``workspace_id (required), query, visibility, sort_by, limitList/search all workspace projectsdeploy_project``project_id (required), name (optional slug)Publish current build to production
ToolParametersDescriptionlist_files``project_id, refList files at a git refread_file``project_id, ref, pathRead full file contentsget_diff``project_id, message_idView diff for a specific editlist_edits``project_idFull edit history (reverse chronological)get_message``project_id, message_idCheck status of a send_message
ToolParametersDescriptionlist_workspaces(none)List all workspacesget_workspace``workspace_id (required)Workspace details: plan, credits, membersget_me(none)Auth user profile
ToolParametersDescriptionget_database_status``project_id (required)Check if DB is enabledenable_database``project_id (required)Provision PostgreSQLquery_database``project_id (required), query (required)Run SQL
ToolParametersDescriptionget_project_analytics``project_id, start_date, end_dateHistorical metricsget_project_analytics_trend``project_idReal-time visitors
ToolParametersDescriptionget_workspace_knowledge``workspace_idRead AI governance policiesset_workspace_knowledge``workspace_id, textSet workspace-wide AI rules
ToolParametersDescriptionlist_connectors``workspace_idList connected serviceslist_available_connectors``workspace_idBrowse available connectorsadd_connector``connector_idGet URL to add a connector via dashboardremove_connector``workspace_id, connector_idRemove a connector
list_workspaces() → get workspace_idcreate_project(workspace_id, description, initial_message) → get project_idget_project(project_id) → confirm it's built, get preview_urlsend_message(project_id, message) → iterate if neededget_diff(project_id, message_id) → review changesdeploy_project(project_id) → ship itlist_workspaces() → get workspace_idlist_projects(workspace_id) → see all projectslist_edits(), read_file(), get_database_status()Run the token refresh script:
bash
bash scripts/lovable-refresh-token.sh
If the refresh token no longer works, run the OAuth setup again:
bash
bash scripts/lovable-oauth-setup.sh
The Lovable MCP server uses OAuth 2.0 Bearer tokens, NOT the Lovable-API-Key header. The API key from Lovable support only works for tools/list (discovery). For tools/call you MUST use an OAuth Bearer token obtained through the PKCE flow.
Verify the MCP server is reachable:
bash
curl -s -o /dev/null -w "%{http_code}" https://mcp.lovable.dev/.well-known/oauth-protected-resource
Should return HTTP 200.
config/lovable-tokens.json file should be in your .gitignore.