> ## Documentation Index
> Fetch the complete documentation index at: https://docs.heylua.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# lua mcp

> List the agent's MCP servers and activate, deactivate, or delete one

`lua mcp` lists the [MCP servers](/concepts/mcp-servers) attached to the agent and turns each one on or off. An active server's tools are available to the model; a deactivated server's tools are not.

*Verified against lua-cli 3.33.0.*

## Synopsis

```bash theme={null}
lua mcp [list|activate|deactivate|delete] [<name>] [--server-name <name>]
```

## Description

With no action the command opens a menu covering every action. Every action runs against production.

`list` prints active servers first, then inactive ones, each with its transport, URL, and ID. It includes the servers [`lua integrations connect`](/reference/cli/integrations) creates for connected SaaS accounts as well as servers you define with [`LuaMCPServer`](/reference/sdk/luamcpserver).

`activate` and `deactivate` change whether the server's tools are offered to the model. Both are no-ops with exit `0` when the server is already in the requested state.

`delete` removes the server from the agent. The non-interactive form has no confirmation prompt; only the menu asks. To get the server back, push it again.

The server name can be given as the positional argument or with `--server-name`; matching is case-insensitive. Every form needs a project directory and a credential.

MCP servers are not versioned and are not a [`lua deploy`](/reference/cli/deploy) type. A server goes live when it is active: define it with `LuaMCPServer`, register it on the `LuaAgent`, and push it with [`lua push mcp --name <name>`](/reference/cli/push). That push asks whether to activate the server straight away (default No); `--auto-deploy` activates without asking, and `--force` alone skips the question and leaves the server inactive. `lua push all` pushes servers without activating them and ignores `--auto-deploy`, so follow it with `lua mcp activate <name>`.

## Arguments

| Argument | Values                                     | Description                                       |
| -------- | ------------------------------------------ | ------------------------------------------------- |
| `action` | `list`, `activate`, `deactivate`, `delete` | Omit it to open the menu.                         |
| `name`   | Server name                                | Alternative to `--server-name`; case-insensitive. |

Accepted spellings: `ls`, `l` → `list`; `on`, `enable` → `activate`; `off`, `disable` → `deactivate`; `rm`, `remove`, `del` → `delete`.

## Options

| Option                 | Description                                                                                      | Default |
| ---------------------- | ------------------------------------------------------------------------------------------------ | ------- |
| `--server-name <name>` | Server to act on. Required for `activate`, `deactivate`, and `delete` unless given positionally. | —       |
| `--ci`                 | Global flag. Refuse any prompt with exit `1` instead of waiting for input.                       | off     |

## Examples

List the servers; integration-created servers appear alongside your own.

```bash theme={null}
lua mcp list
```

```text Output theme={null}
============================================================
🔌 MCP Servers
============================================================

✅ Active Servers:

…

🟢 linear
   Transport: streamable-http
   URL: https://mcp-api.unified.to/mcp?connection=6aa3c41eecbe5884460c797c&aliases=task%3Aissue%2Cticket%2Cbug%2Cstory%3Btasks%3Aissues%2Ctickets%2Cbugs%2Cstories%3Bfile%3Aattachment%3Bemployee%3Aassignee%2Cteam%20member%3Bemployees%3Aassignees%2Cteam%20members&defer_tools=all
   ID: a7dc38a3-eeaf-4841-a2be-cdbaefa5040a

============================================================
```

Activate a server by positional name.

```bash theme={null}
lua mcp activate linear --ci
```

Deactivate a server with the flag form.

```bash theme={null}
lua mcp deactivate --server-name linear --ci
```

Delete a server from CI; nothing asks for confirmation.

```bash theme={null}
lua mcp delete --server-name linear --ci
```

Push a server you defined in code and activate it in one step.

```bash theme={null}
lua push mcp --name docs-server --force --auto-deploy
```

## Exit codes

| Code | Meaning     | When                                                                                                       |
| ---- | ----------- | ---------------------------------------------------------------------------------------------------------- |
| `0`  | OK          | The action completed, including an `activate` or `deactivate` that changed nothing.                        |
| `1`  | Error       | The server list could not be loaded, the platform refused the change, or a prompt was needed under `--ci`. |
| `2`  | Usage       | Unknown action, or `activate`, `deactivate`, or `delete` without a server name.                            |
| `3`  | Not found   | No server with that name is attached to the agent.                                                         |
| `9`  | Auth        | No valid credential.                                                                                       |
| `10` | Forbidden   | The credential cannot manage this agent.                                                                   |
| `11` | Unavailable | Network error or a server 5xx.                                                                             |

The full table is in [Errors and exit codes](/reference/cli/errors-and-exit-codes).

## See also

* [`LuaMCPServer`](/reference/sdk/luamcpserver) — transport, URL, and headers
* [Use an MCP server](/build/use-an-mcp-server)
* [`lua push`](/reference/cli/push) — `lua push mcp` and `--auto-deploy`
* [`lua integrations`](/reference/cli/integrations) — `lua integrations mcp` for integration-created servers
* [`lua logs`](/reference/cli/logs) — `--type mcp`
