Skip to main content

MCP tools

The full list of tools that loch mcp offers to an AI assistant. To set it up, see Connect an AI assistant.

How the tools behave​

  • Every tool acts on the active endpoint of the loch configuration. Text results start with [endpoint: <name>].
  • Container tools act on the active namespace. No tool changes it: run loch ns <stack> in a terminal, or pass stack to stack_action.
  • An argument the tool does not declare is refused with an error.
  • Kind gives the MCP annotations: Read (read-only), Write (changes something, not destructive), Destructive (the client should ask for confirmation).
  • Tools that name a container by its service name also need containers:read, to find it.
  • Scopes are described in API key scopes. An admin tool fails for a restricted user, whatever the scopes of the key.

Endpoints and containers​

ToolDoesMain parametersKindScope
list_endpointsLists the configured endpoints and the active one.–ReadNone
switch_endpointSwitches the active endpoint.name (required)WriteNone
list_namespacesLists the Docker Compose namespaces of the active endpoint.–Readcontainers:read
list_containersLists the containers.showAll (default false: active namespace only)Readcontainers:read
inspect_containerShows the details of a container.container (required)Readcontainers:read
container_actionStarts, stops or restarts a container.container, action: start, stop, restart (required)Destructivecontainers:actions
stack_actionStarts, stops or restarts every container of a stack, in dependency order.action (required), stack (default: active namespace)Destructivecontainers:actions
get_logReturns the last lines of the container output, or of a file inside it.container (required), lines (default 10), filePathReadcontainers:logs
get_statsOne-shot CPU, memory, network and PID snapshot of the running containers of the namespace.container (default: all)Readcontainers:stats
get_domainsLists the Traefik domains and their routing.–ReadAdmin (profile only)

Scheduled jobs​

Not admin only. A restricted user can only target the containers it was granted. Scope cron for every tool.

ToolDoesMain parametersKind
cron_listLists the jobs. Last errors are hidden: see cron_get.–Read
cron_getShows a job: schedule, settings, last run.name (name or ID, required), reveal_secrets (HTTP header values and body, event of a function_invoke job), include_output (last output and error)Read
cron_createCreates a job. Names are unique.name, schedule, type (required); settings of the type (below); enabled (default true), once (default false)Write
cron_updateChanges the given settings of a job. Changing type needs the settings of the new type.name (required), new_name, any setting of cron_createDestructive
cron_toggleEnables or disables a job.name, enabled (required)Destructive
cron_runRuns a job now, in the background. Check the result with cron_get.name (required)Destructive
cron_deleteDeletes a job (irreversible).name (required)Destructive

Job settings:

ParameterApplies toValue
scheduleAll5-field cron expression (0 3 * * *) or descriptor (@hourly, @daily, @every 5m); at most once a minute
typeAlldocker_action, docker_exec or http (function_invoke jobs are created with the panel or loch cron create --function, not through MCP)
containerdocker_action, docker_execContainer name, as in list_containers (e.g. myapp-web-1)
actiondocker_actionstart, stop, restart, kill
commanddocker_execArray, run without shell, e.g. ["php", "bin/console", "app:sync"]; use ["sh", "-c", "..."] for shell syntax
working_dirdocker_execWorking directory in the container
urlhttphttp(s) URL; private and internal addresses are blocked by the server
methodhttpGET (default), POST, PUT, PATCH, DELETE, HEAD, OPTIONS
headershttpObject {Name: value}; replaces all the headers
bodyhttpRequest body
timeouthttpSeconds; 0 = server default; capped by the server (CRON_HTTP_TIMEOUT, 900 by default)

The settings of another type are refused.

Web hosting​

Admin only; the hosting module must be enabled. Reading needs hosting:read; changing needs hosting:read and hosting:write. Panel side: Web hosting.

ToolDoesMain parametersKindScope
hosting_listLists the sites with their status.–Readhosting:read
hosting_getShows a site: settings, containers, routing, last operation and its compose output. Secrets are hidden by default.name (required), reveal_env (environment values, snippets, routing rules), include_composeReadhosting:read
hosting_templatesLists the templates, PHP versions with support dates, defaults and limits.–Readhosting:read
hosting_sitesLists the site directories and the site using each.–Readhosting:read
hosting_php_modulesLists the PHP modules of an image (pulls it on first use, may take a minute).template: php-nginx, php-apache; php_version (required)Readhosting:read
hosting_check_nameChecks whether a name is free.name (required)Readhosting:read
hosting_createCreates and deploys a site. Unset settings take the server defaults.name, template: php-nginx, php-apache, nginx, apache (required); site; settings (below)Writehosting:write
hosting_updateChanges the given settings and redeploys. Rolled back on failure.name (required), template, force; settings (below); add_domains, remove_domains, set_env, unset_env, disable_modules, enable_modulesDestructivehosting:write
hosting_deployRedeploys the site as it is on disk (recreates its container).name (required), pull, force, waitDestructivehosting:write
hosting_actionStarts, stops or restarts the containers of a site.name, action: start, stop, restart (required)Destructivehosting:read and containers:actions
hosting_deleteDeletes the site (containers and compose project). Files are kept unless purge_data.name (required), purge_data, waitDestructivehosting:write

Site settings of hosting_create and hosting_update:

ParameterValue
php_versionPHP version tag (see hosting_templates); PHP templates only
document_rootWeb root relative to the site directory, e.g. web/public; empty = site root
domainsDomains served (on update, replaces the list: prefer add_domains / remove_domains)
https, redirect_httpsServe over HTTPS (once DNS points to the server); redirect HTTP to HTTPS (needs https)
networksNetworks the site joins (replaces the list). Default at creation: the server default (["services"] when the services module is enabled); [] joins none
routingdefault, symfony, laravel (PHP templates) or custom
routing_rulesCustom rules (implies routing=custom): Nginx rules replacing location /, or Apache directives
asset_dirsSymfony routing: directories served without front controller fallback (default [bundles])
memory_limit, web_memory_limitPHP memory_limit of the CLI (also the web default), and of web requests only
upload_max_filesize, post_max_sizePHP upload limits (post_max_size ≥ upload_max_filesize)
max_execution_timePHP web request time limit in seconds (0–3600); the PHP CLI is never limited
display_errors, timezonePHP display_errors and date.timezone
disabled_modulesPHP modules to disable (on update, replaces the list); ioncube is disabled by default
memory_mb, cpusContainer memory (MB) and CPU limits; 0 = unlimited
envEnvironment variables {NAME: value} (on update, replaces them all: prefer set_env / unset_env)
php_ini, vhostExtra php.ini directives and vhost directives (replace the snippet)
waitWait for the deployment (default true, at most 5 minutes)

PHP settings are refused on the nginx and apache templates. When files were edited outside the panel, the tools fail: check them with hosting_get, then retry with force=true if overwriting them is acceptable.

SFTP users​

Admin only; the SFTP module must be enabled. Panel side: SFTP.

ToolDoesMain parametersKindScope
sftp_sitesLists the sites with their user count and used space.–Readsftp:read
sftp_usersLists the users: site, sub-directory, status, quotas, last login. Passwords are never returned.siteReadsftp:read
sftp_createCreates a user in a site. The site directory is created with its first user.username, site (required); sub_path (cannot change later), password (8 characters min; omit to generate one), initialize_dirs (default true), limits (below)Writesftp:write
sftp_updateChanges the given limits of a user.username (required), limits (below)Destructivesftp:write
sftp_reset_passwordSets a new password.username (required), password (omit to generate one)Destructivesftp:write
sftp_set_enabledEnables or disables a user. A disabled user cannot log in.username, enabled (required)Writesftp:write
sftp_deleteDeletes the account. The files of its home directory are kept.username (required)Destructivesftp:write

Limits: public_key (a single SSH key, replacing all of them; empty removes them on update), quota_size_mb, quota_files, bandwidth_kbps (0 = unlimited), require_password_change.

A generated password is returned once as generatedPassword and enters the conversation transcript. Pass a password instead if that is not acceptable. A given password is never echoed.

Databases and services​

Admin only; the services module must be enabled. Panel side: Services.

ToolDoesMain parametersKindScope
services_enginesLists the engines, their options and versions, with their end of support.–Readservices:read
services_instancesLists the instances: state, networks, published port, end of support, available update (dedicated ones).–Readservices:read
services_databasesLists the resources of an instance. Passwords are never returned.instance (required, e.g. postgres-17)Readservices:read
services_create_databaseCreates a database or RabbitMQ vhost with its user (shared engines), or a dedicated instance.engine, version, name (required); options (key=value,..., dedicated engines), legacy_auth, networksWriteservices:write
services_update_instanceChanges the options of a dedicated instance, e.g. its memory. The instance is recreated; data kept.instance, options (required)Writeservices:write
services_upgrade_instanceUpdates a dedicated instance to the latest image of its current version. The instance is recreated; data kept.instance (required)Writeservices:write

Engines: mysql, mariadb, postgres, mongodb, rabbitmq (shared) and redis, valkey, nats, s3, elasticmq, mosquitto (dedicated). ElasticMQ has no authentication: it is refused on the services network, so pass a private network in networks.

Passwords are never returned to the assistant. The user runs loch services reset-password <instance> <name> in a terminal.

Private networks​

Admin only. Panel side: Networks.

ToolDoesMain parametersKindScope
networks_listLists the private networks: members, state, reserved range overlap.–Readnetworks:read
networks_getShows a network and its members.name (required)Readnetworks:read
networks_configShows the creation rules: count and max, subnet sizes, private and reserved ranges.–Readnetworks:read
networks_docker_listLists the Docker networks the panel did not create.–Readnetworks:read
networks_docker_getShows one of those networks and its containers.network (name, ID or unique ID prefix, required)Readnetworks:read
networks_createCreates a private network.name (required), description, subnet (cannot change later)Writenetworks:write
networks_attachConnects a site or an instance. Its container is recreated.network, kind: site, instance, name (required); wait (sites, default true)Writenetworks:write
networks_detachDisconnects a site or an instance. An instance keeps at least one network.same as networks_attachDestructivenetworks:write

Functions​

Admin only; the functions module must be enabled (work in progress). Panel side: Functions.

ToolDoesMain parametersKindScope
functions_listLists the functions: runtime, handler, limits, state, active deployment, networks, egress.–Readfunctions:read
functions_getShows a function: configuration, image, variable and secret names (never their values), deployments, endpoint, sigv4, mcpInvocable. Credentials are never returned.name (required)Readfunctions:read
functions_invokeInvokes a function with a JSON event and returns its response. Only for the functions marked mcpInvocable.name (required), event (JSON text, at most 6 MiB, default {})Destructivefunctions:invoke (and functions:read)
  • mcpInvocable is off by default. A human turns it on with loch functions update <name> --mcp-invocable or Invocable by MCP clients in the panel. It is a guard-rail of the MCP client, not an access control: to forbid invocations, use a key without functions:invoke.
  • The payload and the logs of an invocation are returned under untrusted, cut at 64 KiB: the assistant must treat them as data.

CLI only​

These actions have no MCP tool, on purpose or because they need a terminal:

DomainCommands
Files and shellloch cp, loch shell, loch proxy, loch logs -f
Containersloch kill, loch rm, loch stats (live; get_stats gives a snapshot)
Servicesloch services delete, reset-password, expose, unexpose, retire, purge, upgrade --version
Networksloch networks update, delete, disconnect
Functionsloch functions create, deploy, activate, update, secrets, credentials, networks, egress, start, stop, restart, delete, logs, dev
Usersloch users …
Namespacesloch ns <stack>