With Codex
OpenAI’s Codex starts MCP servers itself, so each person runs their own copy of the server on their computer. The Codex CLI and the Codex IDE extension read the same settings, ~/.codex/config.toml, so adding the server once covers both.
You need Docker, Codex, and a copy of the server’s credentials on your computer, as in the page for where your Liferay runs (Tomcat, Docker, PaaS), readable only by you.
- Step 1: Download the Image
- Step 2: Add the Server
- Step 3: Check That It Connects
- Step 4: Turn On Writes (Optional)
- Related Information
Step 1: Download the Image
Codex waits 30 seconds for a server to start, and the first start would also download the image. Download it first:
docker pull ghcr.io/liferay-community-apac/liferay-legacy-mcp:1.2.0-slim
Step 2: Add the Server
Run this once, with your Liferay’s address, your routes folder, and the site to work in by default:
codex mcp add liferay-legacy -- docker run -i --rm \
-v ~/liferay-mcp/routes:/run/liferay-routes:ro \
-v liferay-mcp-data:/data \
-e LIFERAY_URL=https://liferay.example.com \
-e LIFERAY_ROUTES_CLIENT_EXTENSION=/run/liferay-routes/liferay-mcp-oauth \
-e LIFERAY_DEFAULT_SITE=my-site \
ghcr.io/liferay-community-apac/liferay-legacy-mcp:1.2.0-slim
Everything after -- is the command Codex runs to start the server. ~/liferay-mcp/routes is the folder that holds the liferay-mcp-oauth folder.
The command adds the server to ~/.codex/config.toml. You can also add it there yourself:
[mcp_servers.liferay-legacy]
command = "docker"
args = [
"run", "-i", "--rm",
"-v", "/Users/me/liferay-mcp/routes:/run/liferay-routes:ro",
"-v", "liferay-mcp-data:/data",
"-e", "LIFERAY_URL=https://liferay.example.com",
"-e", "LIFERAY_ROUTES_CLIENT_EXTENSION=/run/liferay-routes/liferay-mcp-oauth",
"-e", "LIFERAY_DEFAULT_SITE=my-site",
"ghcr.io/liferay-community-apac/liferay-legacy-mcp:1.2.0-slim",
]
- In the file, give the routes folder’s full path:
~isn’t expanded there. - For the page inspection tools, use the
1.2.0-fullimage. liferay-legacyis the server’s name in Codex. To connect more than one Liferay, add one server for each, named after it, such asliferay-legacy-prodandliferay-legacy-test.- No password goes in these settings: the server reads the OAuth credentials from the routes folder when it starts.
- If the server still takes too long to start, add
startup_timeout_sec = 60under[mcp_servers.liferay-legacy].
Step 3: Check That It Connects
codex mcp list
It lists liferay-legacy. In a Codex session, /mcp shows the servers that started and their tools.
Then ask:
What Liferay server are you connected to?
Codex calls get_server_info, which names your Liferay’s release, the connection, the write mode, and which tools your Liferay supports.
Step 4: Turn On Writes (Optional)
Writes are off until the server runs with MCP_WRITE_MODE=confirm. Add this line to the args in ~/.codex/config.toml, before the image name:
"-e", "MCP_WRITE_MODE=confirm",
Start a new Codex session afterwards.
Each write is then shown to you as a preview, and runs only once you confirm it. See Writes and Previews.