Mautic-cli - an open-source CLI to control Mautic from the terminal or any AI coding agent

Hey everyone!

Just released mautic-cli - an open-source CLI to control Mautic from the terminal or any AI coding agent.

What it does:

  • 17 resource groups (contacts, segments, emails, campaigns, forms, companies, and more)
  • 65 commands covering list, get, create, edit, delete, send, and more
  • Output as JSON, table, CSV, or auto-paginating NDJSON
  • Basic Auth and OAuth2, multiple profiles, Mautic 4-7 supported

Quick start:

  uv tool install mautic-cli
  mautic auth setup
  mautic contacts list --limit 5

AI agents (Claude Code, Cursor, Codex, Gemini, Windsurf, etc.) can use it as a skill:

npx skills add bloomidea/mautic-cli

Feedback and contributions welcome!

2 Likes

Thank you - what a nice idea! Will check in the next days…

1 Like

Hello introfini,

I’m looking at Mautic-CLI, which has an awesome feature set for managing Mautic from the terminal or integrating with AI tools.

I have a few questions about running it on a shared hosting account:

  • Has anyone tried installing it on shared hosting where Python needs to be installed first?

  • What other prerequisites are required for it to install and run?

  • Can it be installed manually, or do you have to follow the official installation exactly?

I’m new to Python, so I’m still learning how it works—apologies if some of these questions are basic. Any guidance would be really appreciated!

Thanks.

Hi @andrew_c3, thanks for the interest in Mautic-CLI!

I think there might be a misunderstanding about how it works - Mautic-CLI runs on your local computer (your laptop/desktop), not on the server where Mautic is hosted. It connects to your Mautic instance remotely via the API over HTTPS, just like your browser does.

So shared hosting compatibility doesn’t matter at all. You just need to enable Basic Auth or OAuth2 in your Mautic instance so the CLI can authenticate.

On the Mautic side:

  • Go to Mautic Settings > API Settings
  • Enable the API
  • Enable Basic Authentication (simplest option) or set up OAuth2 credentials

On your local machine:

You don’t need to know Python at all. The recommended installer, uv, handles everything for you - Python included. Just run:

Install uv (one-time)

curl -LsSf ``https://astral.sh/uv/install.sh`` | sh

Install Mautic-CLI (uv downloads the right Python automatically)

uv tool install mautic-cli

Connect to your Mautic instance

mautic auth setup

That’s it. uv will download and manage the correct Python version behind the scenes - you never have to touch Python directly.

On Windows, the uv install command is different - check Installation | uv for details.

Hope that clears things up!

1 Like

Hello introfini,

Thanks for your kind reply.

I initially missed the crucial detail that this is a remote Mautic CLI/API tool running on a desktop or workstation. Even so, it looks like a very powerful solution, and I can already imagine several use cases—I’m looking forward to trying it out soon.

I got particularly excited when I thought those commands might be available directly in a console on the Mautic server, as that would make it possible to call them programmatically from within a Mautic plugin or possibly in a C++ app on the same box.

Do you happen to know how feasible it would be to run this tool directly on the Mautic server in that way? Or are those command already available in the Mautic console on the server ?

Thanks for your great work.

@andrew_c3

Glad it’s clearer now!

To answer your questions:

Running mautic-cli on the server: Yes, it works fine on the server too. It’s just a Python CLI that makes HTTP calls, so it can run anywhere with network access to your Mautic instance, including the same machine. If running locally on the server, your base URL would just be http://localhost (or whatever our local Mautic address is). You’d install it the same way with uv, and you could call it from a PHP plugin via exec() / shell_exec() or from a C++ app via system() / popen(). The JSON output mode (the default) makes it straightforward to parse the results programmatically.

Mautic’s built-in console: Mautic does ship with its own console at bin/console (Symfony-based), but it serves a different purpose. Those commands are mostly for administration and background processing:

  • mautic:segments:update - rebuild segment membership
  • mautic:campaigns:trigger - process campaign events
  • mautic:emails:send - send queued emails
  • mautic:import - run CSV imports
  • cache:clear, doctrine:migrations:migrate, etc.

They don’t provide the CRUD API operations that mautic-cli offers (list/search/create/edit/delete contacts, send specific emails, manage forms, etc.). So the two tools complement each other rather than overlap: bin/console handles background jobs and maintenance, while mautic-cli handles data operations through the API.

Hello introfini

Thanks for your speedy and detailed help.

The Mautic CLI opens up a lot of possibilities—great work, and thank you for your contribution to the community! I will enjoy giving it a try soon.

Thanks

1 Like