# Connect n8n

n8n reaches a gateway in two ways. The MCP Client Tool node gives an AI Agent node every operation of the gateway as tools. The HTTP Request node calls one operation over REST from any workflow. Both send an API key.

## Before you begin

- A gateway that serves at least one API. See [Create a gateway](https://docs.faustine.ai/agent-gateway/create-a-gateway/).
- An API key for the environment you connect to. See [Create an API key](https://docs.faustine.ai/agent-gateway/api-keys/).

The values on this page are in the gateway's **Connect** tab, under **n8n · MCP Client** and **n8n · HTTP Request**, with your gateway's URLs filled in.

## Create the credential

Both nodes use the same n8n credential.

1. In n8n, create a credential of type **Header Auth**.
2. Set the name to `Authorization`.
3. Set the value to `Bearer <GATEWAY_KEY>`, with the key you saved when you created it.

## Give an AI Agent the gateway's tools

1. Add an **MCP Client Tool** to the tools of your **AI Agent** node.
2. Set the fields in the table.

| Field | Value |
| --- | --- |
| Endpoint | `https://gateway.faustine.ai/<workspace>/<gateway>/mcp` |
| Server transport | HTTP Streamable |
| Authentication | Header Auth, with the credential you created |

The same node as JSON parameters:

```json
{
  "type": "@n8n/n8n-nodes-langchain.mcpClientTool",
  "parameters": {
    "endpointUrl": "https://gateway.faustine.ai/<workspace>/<gateway>/mcp",
    "serverTransport": "httpStreamable",
    "authentication": "headerAuth",
    "include": "all"
  }
}
```

Run the agent with a prompt that needs the API, such as "list the contacts". For the node's own options, see [MCP Client Tool node](https://docs.n8n.io/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.toolmcp/) in the n8n docs.

## Call one operation over REST

1. Add an **HTTP Request** node.
2. Set the fields in the table.

| Field | Value |
| --- | --- |
| Method | POST |
| URL | `https://gateway.faustine.ai/<workspace>/<gateway>/api/<namespace>/<operation>` |
| Authentication | Generic Credential Type, then Header Auth, with the credential you created |
| Send Body | JSON, with the operation's input |

The same node as JSON parameters:

```json
{
  "type": "n8n-nodes-base.httpRequest",
  "parameters": {
    "method": "POST",
    "url": "https://gateway.faustine.ai/<workspace>/<gateway>/api/<namespace>/<operation>",
    "authentication": "genericCredentialType",
    "genericAuthType": "httpHeaderAuth",
    "sendBody": true,
    "specifyBody": "json",
    "jsonBody": "{}"
  }
}
```

Execute the node once. The response body has the status and the body your API returned:

```json
{ "status": 200, "body": { } }
```

The **Connect** tab fills in a sample operation and its input. Every operation and its input schema is in the gateway's OpenAPI document, at `https://gateway.faustine.ai/<workspace>/<gateway>/openapi.json`. For the node's own options, see [HTTP Request node](https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.httprequest/) in the n8n docs.

## What you see after the first call

In the portal, the request appears in the gateway's **Logs** tab, and the n8n card in the **Connect** tab shows when the client was last seen.

A call to an operation that requires confirmation is refused by default for an API key, because a workflow has no person to ask. To change this for a supervised workflow, see [Set how a credential confirms writes](https://docs.faustine.ai/agent-gateway/set-confirmation/).

## Next steps

- [Call a gateway over REST and OpenAPI](https://docs.faustine.ai/technologies/rest/): the REST rules the HTTP Request node follows.
- [Scope a key or user](https://docs.faustine.ai/agent-gateway/scope-a-credential/): limit the key to the operations the workflow needs.
- [Limits and quotas](https://docs.faustine.ai/agent-gateway/limits/): the rate limits a workflow can reach.
