API Tool Server for AI Agents using MCP Trigger - n8n Workflow

An n8n workflow that sets up an MCP server endpoint, exposing the Polls API as tools for AI agents. Easily integrate external APIs into your LLM chain using this robust n8n template and the powerful n8n trigger node.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?


  • AI developers needing to provide external, structured tools to their LLMs.

  • Users looking for advanced examples of the MCP n8n node.

  • Automation specialists who want to use an n8n workflow to serve API functionality without custom coding.

  • Teams integrating third-party APIs into complex RAG or agent-based systems.

Overview

This specialized n8n workflow transforms a standard third-party API (the Polls API in this case) into a structured, discoverable set of tools consumable by modern AI agents. The complexity of API authentication and structure is abstracted away, allowing the AI to call simple function names via the Modular Component Protocol (MCP). This design is a key component of powerful n8n templates, enabling AI agents to list existing questions and create new questions via dedicated HTTP Request n8n node actions. The primary value lies in securely and efficiently bridging the gap between sophisticated AI models and traditional backend APIs using a high-performance n8n automation structure. Setting up this n8n workflow requires minimal configuration.

How it Works

This automation functions as a micro-service server, activated by a specialized n8n trigger:


  1. AI Agent Request: The n8n workflow is initiated when an external AI agent sends a request to the configured MCP webhook URL. This request is captured by the dedicated MCP n8n trigger node.

  2. Tool Selection: The MCP n8n trigger analyzes the incoming AI request (based on the user's prompt) and determines which registered tool (HTTP Request n8n node) should execute.

  3. Parameter Injection: If the AI selects the 'Create Question' tool, parameters such as question and choices are automatically populated using the $fromAI() expression within the HTTP Request n8n node, injecting the relevant data parsed from the agent's query.

  4. API Execution: The selected HTTP Request n8n node executes the API call (either listing resources via GET or creating resources via POST).

  5. Response Handling: The API response is captured by the n8n node and immediately routed back through the MCP n8n trigger to the originating AI agent, maintaining the original API structure for the model to interpret.

Installation Guide

To deploy this powerful n8n workflow, follow these steps:


  1. Import the n8n Template: Copy the provided JSON and import it directly into your n8n instance.

  2. No Credentials Required: This specific n8n workflow uses a publicly available test API (https://polls.apiblueprint.org), so no external service credentials are required for the HTTP Request n8n node configuration.

  3. Activate the n8n Workflow: Ensure the workflow is active. This action initializes the MCP n8n trigger and registers the webhook URL.

  4. Retrieve MCP URL: Copy the unique webhook URL generated by the 'topupsapi MCP Server' n8n trigger node (e.g., /webhook/topupsapi-mcp).

  5. Connect AI Agent: Configure your LLM or AI agent environment (like LangChain or custom agent frameworks) to use this URL as an external tool endpoint. The agent will then recognize the two available tools: 'List All Questions' and 'Create a New Question'.

Node Details

This n8n workflow utilizes core n8n node components specialized for AI agent integration:

topupsapi MCP Server (n8n trigger):
Function: Acts as the server endpoint, listening for requests from AI agents. This is the crucial n8n trigger that starts the automation.
Key Configuration: Path is set to topupsapi-mcp. It automatically publishes the connected HTTP Request Tools to the AI agent.

Get Questions 1 (HTTP Request Tool n8n node):
Function: Executes a GET request to list all available questions from the Polls API.
Key Configuration: URL is set to https://polls.apiblueprint.org/questions. Tool Description: 'List All Questions', allowing the AI to understand its purpose.

Create Question 1 (HTTP Request Tool n8n node):
Function: Executes a POST request to create a new question entry in the Polls API.
* Key Configuration: Method is POST. Parameters are configured using ={{ $fromAI('question', 'Question', 'string') }} and ={{ $fromAI('choices', 'Choices', 'json') }}, ensuring the AI can automatically supply the necessary body data for this n8n node action.

Related n8n Workflows

Free

Nodes: 3 Nodes
Updated: December 26 2025
View all
Created by

A hacker by nature, programmer by trade ⚒️ I'm looking to collaborate on things that save human labor 📫 How to reach me Github👇 -> Discord

Featured*