# Quickstart: let AI clients operate your API

Create a gateway for one of your APIs and connect an AI client to it. At the end, the client lists records from your API through the gateway, and the request is in the gateway's logs.

This is the short path, with the defaults. For each step explained on an example app, see [Publish your API as an MCP server](https://docs.faustine.ai/agent-gateway/publish-your-api-as-an-mcp-server/).

## Prerequisites

- An API in your workspace whose analysis has finished, with a connection that passes its test. See [Analyze your first API](https://docs.faustine.ai/apis/analyze-your-first-api/).
- Claude Code, or an account on claude.ai that can add custom connectors.

## 1. Create the gateway

1. In the portal, go to [**Agent Gateway**](https://auth.faustine.ai/go?to=%2Fintegrations%2Fagent-gateway) and select **New Gateway**.
2. Under **Who is this gateway for?**, select **People using chat and coding agents**.
3. Under **APIs**, select your API, then **Continue**.
4. Under **Name & URL**, enter a **Name** and select **Continue**.
5. Under **First credential**, select **A user**, enter a **Display name** and keep the generated password. Select **Continue**.
6. Select **Create gateway**.
7. Copy the username and the password from the dialog. The password is shown once.

The gateway exposes every operation of the API in its Production environment. The user can call all of them, and is asked to approve the ones that require confirmation.

## 2. Copy the MCP URL

In the gateway's **Connect** tab, copy the **MCP URL** from the **Endpoints** card. It has this form:

```text
https://gateway.faustine.ai/<workspace>/<gateway>/mcp
```

## 3. Connect a client

**Claude Code**

Add the gateway as an MCP server. `<GATEWAY>` is a name for the server and `<MCP_URL>` is the URL you copied.

```bash
claude mcp add --transport http <GATEWAY> <MCP_URL>
```

Start Claude Code and run `/mcp`. Select the server, then **Authenticate**. The browser opens the gateway's sign-in page. Enter the username and the password of the gateway user.

**claude.ai**

1. In claude.ai, go to **Settings** > **Connectors** and select **Add custom connector**.
2. Enter a name and paste the MCP URL. Leave the OAuth client ID and client secret fields empty.
3. Connect, and enter the username and the password of the gateway user on the sign-in page that opens.

The client lists three tools: `search_operations`, `get_operation` and `run_code`.

## 4. Make a call

Ask the client for something your API returns. With a CRM API:

```text
List the five most recent contacts.
```

The client searches the gateway's operations, writes a short script that calls the one it needs, and answers with the result.

> **Checkpoint:** The client shows records from your API. In the portal, the gateway's **Logs** tab has a `run_code` request with the status **OK**, and the **Overview** tab shows **First successful call** as done.

## Call the gateway from code

An automation uses an API key instead of a user. Create one in **Access** > **API keys** > **Create key**, then call an operation over REST. `<GATEWAY_KEY>` is the key, and `<API>` and `<OPERATION>` are the two parts of an operation key from the gateway's **Operations** tab, such as `crm` and `contacts.list`.

```bash
curl "https://gateway.faustine.ai/<workspace>/<gateway>/api/<API>/<OPERATION>" \
  -H "Authorization: Bearer <GATEWAY_KEY>"
```

`GET` works for read operations. A write takes `POST` with a JSON body. See [Gateway HTTP](https://docs.faustine.ai/reference/gateway-http/).

## Troubleshooting

| Symptom | Cause | Fix |
| --- | --- | --- |
| The sign-in page rejects the username and the password | The user belongs to another environment, or the password was mistyped. | Use the MCP URL from the **Connect** tab of the environment where you created the user. To set a new password, select **Reset password** on the user's page. |
| The client answers that an operation failed with `upstream_error` | Your API answered with an error or could not be reached. | Open the request in **Logs** to see the exchange with your API, and test the connection on the API's **Connections** tab. |
| A write is refused with `requires_confirmation` | The client cannot show a confirmation. | See [Confirmation](https://docs.faustine.ai/agent-gateway/confirmation/) for the clients that can. |

## Next steps

- [Choose which operations are exposed](https://docs.faustine.ai/agent-gateway/choose-operations/): hide what clients should not call.
- [Confirmation](https://docs.faustine.ai/agent-gateway/confirmation/): have a person approve writes in the client.
- [Create a gateway user](https://docs.faustine.ai/agent-gateway/gateway-users/): give each person their own user.
- [Connect clients](https://docs.faustine.ai/agent-gateway/connect-clients/): ChatGPT, Cursor, VS Code, n8n and the CLI.
