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

# Manage Servflow from an AI agent

> Connect Claude Code, Codex, or another MCP client to the Servflow MCP server, so it can list, create, validate, and enable your team's agents and support agents

Connect an AI coding agent, such as Claude Code or Codex, to the Servflow MCP server, and then ask it to build and enable your team's agents and support agents for you. Every tool it can call is listed on [The Servflow MCP server](https://docs.servflow.io/references/mcp-server.md).

## Before you begin

* A Servflow Cloud team. Sign up at [dash.servflow.io](https://dash.servflow.io). A self-hosted instance has no MCP server; manage it with the [`servflowai resource` CLI](https://docs.servflow.io/references/cli).
* An MCP client that supports the streamable HTTP transport, such as Claude Code.
* Your team's API key. In the dashboard, open **Settings** > **MCP connection** and copy **Your API key**.

The API key gives full control of your team's agents, integrations, and secrets. Keep it out of files you commit.

## Connect your MCP client

### Claude Code

Add the server, with your key in place of `<key>`:

```bash theme={null}
claude mcp add --transport http servflow https://server.servflow.io/api/mcp \
  --header "Authorization: Bearer <key>"
```

To confirm Claude Code reaches the server, run `claude mcp list`. It checks each server and shows `servflow` as connected.

### Another client

Add a server that uses the streamable HTTP transport, with:

* **URL**: `https://server.servflow.io/api/mcp`.
* **Header**: `Authorization` set to `Bearer <key>`.

## Check the connection

Ask the AI agent:

```text theme={null}
List my Servflow agents.
```

It calls `list_configs` and answers with each agent's name, `config_id`, and whether it is enabled. An empty list on a new team is a working connection. If the call fails with `unauthorized` or `invalid auth token`, copy the key again from **Settings** > **MCP connection** and add the server again.

## Create an agent

Describe the agent you want, and ask the AI agent to build it with the Servflow tools. For example:

```text theme={null}
Create a Servflow agent called "Shop questions" that answers POST requests on
/shop-questions. It reads the question from the "question" field of the JSON
body and answers in two sentences. Validate it, create it, and enable it.
```

The AI agent works through these steps. You can ask for each one by name.

**1. Start from the example and the schema**

`config_example` returns a small valid agent, and `config_schema` returns the shape every agent must have. The fields are described in [The shape of an agent](https://docs.servflow.io/references/cli.md#the-shape-of-an-agent).

**2. Find the pieces**

`list_entry_handlers` and `describe_entry_handler` describe the triggers, `list_actions` and `describe_action` the actions, and `list_template_functions` what a prompt can read. `list_providers` and `list_integrations` give the ids the agent can name. A sub agent can use the built-in provider, `native`, with no provider of your own.

**3. Validate**

`validate_config` checks the agent without saving it, and says what is wrong. The AI agent fixes the body and validates again until it answers `"valid": true`.

**4. Create**

`create_config` saves the agent and returns its `config_id`. The agent is saved disabled, so it does not run yet.

**5. Enable**

`set_config_enabled` with `enabled: true` builds the agent and runs it. If it cannot run, for example because a provider or integration it names does not exist, the tool says why and the agent stays disabled.

To change an agent later, ask for the change. The AI agent calls `update_config` with the whole agent, then `set_config_enabled` again: an enabled agent keeps running its previous version until it is enabled again.

### Verify

Ask the AI agent to list your agents again. The new agent shows `enabled: true`, and it appears on the **Agents** page of the dashboard. Send a request to the agent's path on your team's agents address to see it answer.

## Create a support agent

A support agent answers your customers on a channel such as the live chat. To create one, describe it and ask the AI agent to build it. For example:

```text theme={null}
Create a Servflow support agent called "Shop help" that answers on our live
chat with the native provider and answers questions about orders and returns.
Enable it, then point our live chat at it for shop.example.com.
```

The AI agent works through these steps.

**1. Create**

`create_support_agent` saves the support agent and returns its `id`. It is saved disabled, so it does not answer customers yet. With no guardrails in the request, it gets `answers_from_business`.

**2. Enable**

`set_support_agent_enabled` with `enabled: true` checks your plan and builds the support agent. If it cannot start, the tool says why and the support agent stays disabled.

**3. Connect the live chat**

`set_livechat` saves the live chat with `agent_id` set to the support agent and `websites` set to your site. `get_livechat` returns what is saved.

To change a support agent later, ask for the change. The AI agent calls `update_support_agent`, then `set_support_agent_enabled` again: an enabled support agent keeps answering with its previous version until it is enabled again.

Ask the AI agent to change support agents only with these tools. `list_configs` lists support agents too, as kind `support`, but the agent tools do not keep a support agent's channels, guardrails, and handoffs in step.

### Verify

Ask the AI agent to list your support agents. The new support agent shows `enabled: true`, and it appears on the **Support agents** page of the dashboard.

## Related

> [card] [The Servflow MCP server](https://docs.servflow.io/references/mcp-server.md)
>
> Every tool, with its inputs and what it returns.

> [card] [CLI reference](https://docs.servflow.io/references/cli.md)
>
> The shape of an agent, and the same operations from the command line.

> [card] [Create an agent](https://docs.servflow.io/guides/create-an-agent.md)
>
> Build an agent in the dashboard instead.

> [card] [Available entry handlers](https://docs.servflow.io/references/entry-handlers.md)
>
> Every trigger an agent can have.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.