> For the complete documentation index, see [llms.txt](https://help.sipgate.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.sipgate.com/documentation/en/connections-and-integrations/mcp-server-mit-n8n.md).

# MCP server with n8n

## How do I set up an MCP server with n8n?

n8n is a workflow automation platform that lets you build an MCP server without deep programming knowledge. Each tool call from your AI agent is represented as its own n8n workflow.

{% hint style="info" %}
**Prerequisite:** You need a running n8n instance (self-hosted or n8n Cloud) as well as basic knowledge of the n8n interface.
{% endhint %}

***

### Step 1: Create MCP server workflow

1. Open your n8n instance and create a new workflow.
2. Choose the **MCP Server Trigger**.
3. as the trigger node. n8n automatically generates a webhook URL for your MCP server—make a note of it, you will need it later in sipgate.

***

### Step 2: Define tools as workflows

Each tool your AI agent should use is created as a separate workflow:

1. Create a new workflow for each tool.
2. Also use the **MCP Server Trigger** as the starting point.
3. Build the desired logic behind it: database queries, API calls, calculations.
4. At the end of the workflow, return a structured result that the AI agent can use.

{% hint style="info" %}
**Tip:** Keep each workflow focused on a single, clearly defined task. Simple, deterministic workflows are more reliable than complex branching logic.
{% endhint %}

***

### Step 3: Store tool descriptions in n8n

So that the AI agent knows when to use which tool, you must store descriptions in n8n:

* **Tool name:** Choose a unique, descriptive name — maximum **28 characters**.
* **Tool description:** Explain in 1–2 sentences what the tool does and when it should be used.
* **Parameter descriptions:** Describe each parameter: what is expected, in what format, and whether it is optional.

**Example of a good tool description:**

> "Returns the customer's full name and customer number. Input: phone number in the format +49…"

***

### Step 4: Store the MCP server in sipgate

1. Copy the webhook URL of your n8n MCP workflow.
2. Open your AI agent in app.sipgate.com → **Integrations → Live call functions → Add**.
3. Enter the URL and save.
4. sipgate checks the connection and shows you the detected tools.

***

### Test the MCP server

Before using the AI agent in production, we recommend the following tests:

* **Check connection status:** Open the Live call functions overview in sipgate and refresh the connection to the MCP server. If all tools are loaded, the connection is successful.
* **Manual test calls:** Trigger the playbook manually and check in n8n whether the workflows are called correctly and the responses are accurate.
* **Check server logs:** Look in the n8n execution logs to see whether requests are coming in and whether any errors occurred.
* **Error handling:** Make sure your workflow returns a clear error message in case of failure — the AI agent uses this to adjust its behavior.

{% hint style="info" %}
**Tip:** Design your error messages so that the AI agent can infer what went wrong and whether it should try again.
{% endhint %}

***

### Best practices

* Use n8n for **deterministic tasks**: retrieve data, write data, calculate.
* Leave the **non-deterministic decisions**to the AI agent: what it does, in what order, how it responds.
* Validate all incoming parameters on the server side — the AI agent does not always pass exactly what you expect.
* Return clean, structured responses. अस्प? Unclear returns lead to unreliable agent behavior.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://help.sipgate.com/documentation/en/connections-and-integrations/mcp-server-mit-n8n.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
