Part 2 of our series on AI integrations with Liferay. Part 1 explained what MCP is and why it’s important. Today, we’re getting down to specifics.
In the first part, we laid the groundwork: what MCP is, how the Liferay MCP server works in principle, and why it’s more than just a demo feature. If you haven’t read that yet, you should catch up on it quickly—the following article assumes this basic understanding.
Now it’s time to get hands-on. This tutorial shows you step by step how to connect Cursor to the Liferay MCP server and create new web content directly from the chat. No poring over APIs, no piecing together tokens—just a natural-language request and an entry that appears in Liferay.
What you need
Before we begin, three prerequisites:
- Liferay DXP (running instance, accessible at
localhost:8080or another URL) - Feature flag LPD-63311 enabled (more on that in a moment)
- Cursor installed — available for free at cursor.com
For this tutorial, we’ll use localhost:8080 as the Liferay URL. If you are using a different environment, adjust the URL accordingly in the configuration steps.
Step 1: Enable the feature flag in Liferay
The Liferay MCP server is currently in the beta phase and must be explicitly enabled.
In the Liferay admin area:
- Open Control Panel → Instance Settings → Feature Flags
- Switch to the Beta tab
- Search for
LPD-63311— the entry is called “MCP Server” - Set the toggle to active
- Save
From this point on, the MCP endpoint is accessible at /o/mcp . No restart required.
Quick test in the browser: Open http://localhost:8080/o/mcp in the browser. You will receive an error message due to missing authentication — this is correct and indicates that the endpoint is active.
Step 2: Generate Authorization Header
The Liferay MCP server uses HTTP Basic Auth. To do this, the username and password must be base64-encoded.
In the terminal:
echo -n "admin@liferay.com:deinPasswort" | base64
The result looks something like this:
YWRtaW5AbGlmZXJheS5jb206ZGVpblBhc3N3b3Jk
You’ll need this value shortly for the Cursor configuration. Replace admin@liferay.com and deinPasswort with your actual login credentials.
Windows users can alternatively use PowerShell:
[Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes("admin@liferay.com:deinPasswort"))
Step 3: Configure Cursor
Cursor reads its MCP server configuration from a JSON file. Open this file in a text editor:
- macOS / Linux:
~/.cursor/mcp.json - Windows:
C:\Users\DeinName\.cursor\mcp.json
If the file does not yet exist, simply create a new one.
File contents:
{
"mcpServers": {
"liferay": {
"type": "http",
"url": "http://localhost:8080/o/mcp",
"headers": {
"Authorization": "Basic YWRtaW5AbGlmZXJheS5jb206ZGVpblBhc3N3b3Jk",
"Content-Type": "application/json"
}
}
}
}
Replace the Base64 string Basic with the value from Step 2. Then restart Cursor—the MCP configuration is read at startup.
Step 4: Check the connection
After restarting, Cursor displays which MCP servers are connected and which tools are available.
Here’s how to check:
- Open the chat in Cursor (
Cmd+Lon macOS,Ctrl+Lon Windows) - Click the tool icon in the chat area — there you’ll see all available MCP servers
- Liferay should appear as "connected" with a green dot
- Clicking on the entry displays the available tools — including tools for reading and writing web content
If the status shows "Error," the most common causes are: incorrect Base64 string, incorrect URL, or the feature flag has not yet been saved.
Step 5: Create web content — the first request
Open the Cursor chat and type:
“Create a new Basic Web Content on the Liferay website ‘Guest’. Title: ‘Welcome to our platform’. Content: ‘We are pleased to welcome you to our new website. Here you will find all the important information about our products and services.’”
What happens in the background:
- Resource call: Query sites. The model determines the site ID of the “Guest” website.
- Resource call: Query content structures. The model retrieves the fields and structure of “Basic Web Content.”
- Tool call: Create web content. The API call is assembled and executed using the site ID, structure ID, and your content.
- Confirmation. The cursor displays the title and ID of the newly created content.
Check the result in Liferay: Open Site Administration → Content & Data → Web Content. The new entry “Welcome to our platform” appears in the list.
Step 6: What else you can do directly in the chat
An overview of additional actions that work directly:
Read existing web content:
“Show me all web content on the guest website.”
Update an entry:
“Change the content of the web content ‘Welcome to our platform’—replace the second sentence with: ‘Our support team is available on weekdays from 9 a.m. to 5 p.m.’”
Search for content:
“Are there any web content entries on the Guest website that contain the word ‘Contact’ in the title?”
The model handles the translation between your intent and the API call. You don’t need to know any IDs or look up any endpoints.
Security note for production use
What works for the tutorial with an admin account should be set up differently in production. The MCP server inherits the permissions of the authenticated user—dedicated service accounts with minimal privileges are the right approach. Every MCP tool call appears in the Liferay audit log and is therefore fully traceable.
Conclusion
Activate the feature flag, create a JSON file, restart Cursor—these are the three steps to your first working connection. What comes next is the truly interesting part: a platform whose entire headless API layer can be accessed via natural language. Web content is the easiest place to start—the same connection provides access to objects, structures, assets, and more.
If you have a running Liferay instance: It’s worth testing, and it takes less than an hour.
