This tutorial explains how to connect an AI assistant (OpenCode, Claude, Cursor, VS Code, Gemini CLI, etc.) to your Joomla/FLEXIcontent site. Once connected, the assistant can search content, create or update items, manage categories, tags, types and fields, and import files — always with the permissions of the Joomla account you choose.
The server uses the Model Context Protocol (MCP), an open standard: no client owns the server. The same setup therefore works across several AI tools.
Estimated time: 15 minutes. No changes to the Joomla or FLEXIcontent core are required.
The MCP server is a small Python program that acts as a translator:
AI assistant ──MCP──> FLEXIcontent MCP server ──JSON:API──> Your Joomla site
The assistant does not talk to Joomla directly. It calls tools such as flexi_search_items or flexi_update_item. The server checks the configuration, adds the Joomla token, calls the API, then returns a readable result.
| Need | Tool |
|---|---|
| Search items, filter by custom field | flexi_search_items |
| Read an item and its custom fields | flexi_get_item |
| List categories, types, fields and tags | flexi_list_taxonomies, flexi_get_taxonomy |
| Discover valid ids before writing | flexi_describe |
| Create or update content | flexi_create_item, flexi_update_item |
| Delete content (confirmation required) | flexi_delete_item |
| Create a category, type, field or tag | flexi_create_taxonomy, flexi_update_taxonomy |
| Import an image or document | flexi_upload_file |
Two transports are available:
https://your-domain/mcp. Useful for multiple clients or remote use.In the Joomla administrator area:
User – Joomla API Token;API Authentication – Joomla Token;Create a user reserved for automation, with the minimum rights: for example, create/edit in a single category only. The token will act with that Joomla user's permissions: the API grants no extra rights.
Grant that user the Web Services Login action (core.login.api) through System → Global Configuration → Permissions, or via the group permissions.
The FLEXIcontent API base URL is:
https://example.com/api/index.php/v1/flexicontent
Replace example.com with your domain, with no trailing slash.
Quick test from a terminal:
curl -H "Authorization: Bearer $FLEXI_API_TOKEN" \
"https://example.com/api/index.php/v1/flexicontent/items?limit=1"
You should receive JSON. A 401 error means an invalid or inactive token; a 403 error means a permissions problem.
The server requires Python 3.10 or newer. Get the mcp/ folder shipped with FLEXIcontent, then run:
cd mcp
python3 -m venv .venv
.venv/bin/python -m pip install -e .
The flexicontent-mcp command is now installed in .venv/bin/. Check it:
.venv/bin/flexicontent-mcp --help
All sensitive configuration stays on the server side. AI client config files never contain a token.
Create the profile file:
mkdir -p ~/.config/flexicontent-mcp
Paste this into ~/.config/flexicontent-mcp/config.toml:
default_profile = "production"
[profiles.production]
base_url = "https://example.com/api/index.php/v1/flexicontent"
token_file = "token.txt"
read_only = true
token.txt is looked up next to config.toml. Create it without leaving the token in your shell history:
read -rs -p "Joomla API token: " FLEXI_TOKEN; echo
printf '%s' "$FLEXI_TOKEN" > ~/.config/flexicontent-mcp/token.txt
chmod 600 ~/.config/flexicontent-mcp/token.txt
unset FLEXI_TOKEN
Other options, depending on your secret manager:
token_env = "FLEXI_API_TOKEN" # environment variable
token_command = "security find-generic-password -s flexicontent -w" # macOS keychain
Priority is always: CLI options > environment variables > TOML profile > built-in defaults.
read_only = true?With this setting, all write tools are disabled. Start in read-only mode, check that the assistant can see your content, then set read_only = false (or pass --no-read-only) when you want to allow changes. Deletions still require confirm: true.
Test the profile:
.venv/bin/flexicontent-mcp --profile production
The server waits for instructions on standard input: that is expected. In an AI client, it will start automatically.
In opencode.json:
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"servers": {
"flexicontent": {
"type": "local",
"command": [
"/path/to/mcp/.venv/bin/flexicontent-mcp",
"--profile", "production"
]
}
}
}
}
Check with:
opencode mcp list
You should see ✓ flexicontent connected.
In claude_desktop_config.json:
{
"mcpServers": {
"flexicontent": {
"command": "/path/to/mcp/.venv/bin/flexicontent-mcp",
"args": ["--profile", "production"]
}
}
}
Restart Claude Desktop after editing the file.
claude mcp add --transport stdio flexicontent -- \
/path/to/mcp/.venv/bin/flexicontent-mcp --profile production
Then run claude mcp list and /mcp in the session.
In ~/.cursor/mcp.json or the project's .cursor/mcp.json:
{
"mcpServers": {
"flexicontent": {
"type": "stdio",
"command": "/path/to/mcp/.venv/bin/flexicontent-mcp",
"args": ["--profile", "production"]
}
}
}
In .mcp.json at the root of the workspace:
{
"mcpServers": {
"flexicontent": {
"type": "stdio",
"command": "/path/to/mcp/.venv/bin/flexicontent-mcp",
"args": ["--profile", "production"],
"tools": ["*"]
}
}
}
In every case, replace /path/to/mcp/ with the real path to the mcp/ folder on your machine. The token never appears in these files.
Check the connection first by asking:
"Use
flexi_describeto tell me which types and categories are available on the site."
Then make concrete requests, for example:
"Find regulations published in 2025 and give me their title, id and category."
"Show me item 151 with all its custom fields."
"Create a draft titled 'Test decree' in the Regulations category, but do not publish it."
"Update item 151: change its title and set
type_de_loistoenvironnement. Show me the before and after.""Import this PDF and attach it to item 151."
Before any write, the assistant should call flexi_describe to learn the valid type, field and category ids. This avoids the common 422 errors.
"Delete item 151."
The server will refuse until confirmation is explicit. Then ask:
"Confirm deletion of item 151."
If several people or machines need to connect, run the server in HTTP mode:
.venv/bin/flexicontent-mcp \
--profile production \
--transport streamable-http \
--host 127.0.0.1 \
--port 8000 \
--allowed-host mcp.example.com:*
The endpoint is:
http://127.0.0.1:8000/mcp
Always put an authenticated HTTPS reverse proxy in front of this service: the Joomla token stays on the server, but access to the MCP server must be protected (Basic, Bearer or OAuth at the proxy). --allowed-host is required behind a proxy; otherwise the SDK's DNS-rebinding protection rejects requests.
On the OpenCode side:
{
"mcp": {
"servers": {
"flexicontent": {
"type": "remote",
"url": "https://mcp.example.com/mcp",
"oauth": false
}
}
}
}
oauth: false matters: authentication with Joomla is already handled by the MCP server.
| Symptom | Likely cause | Fix |
|---|---|---|
✓ flexicontent connected missing |
Wrong venv path or profile not found | Check command and --profile, then restart the client |
401 error |
Invalid, disabled or regenerated token | Copy the new Joomla API token and update token.txt |
403 error |
Insufficient ACL | Check the Joomla account rights and core.login.api |
404 error |
Wrong base URL or id | The URL must end in /v1/flexicontent, with no trailing slash |
422 error |
Invalid field or type | Call flexi_describe before writing |
Writes are disabled |
Profile is read-only | Remove read_only = true or pass --no-read-only |
| TLS error on a dev site | Self-signed certificate (DDEV) | Add --no-verify-ssl in development only |
HTTP request rejected (Invalid Host header) |
Proxy in front of localhost | Add --allowed-host your-domain:* |
| Client sees no tools | Bad stdio configuration | Use the absolute path to .venv/bin/flexicontent-mcp |
For finer diagnostics, start the server with --log-level DEBUG: logs go to stderr, so they do not pollute the MCP conversation.
0600 file, an environment variable or a keychain — never in an AI client config file.flexi_describe before creating or updating.The result: your AI assistant becomes a FLEXIcontent operator that respects the same rules as your Joomla users, while remaining replaceable by any other MCP-compatible client.