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

# n8n

> Integrate real-time context to your n8n AI workflows via Membit MCP.

<img src="https://mintcdn.com/membit/4JB7OCBLDkpjkRT-/images/cover/n8n.png?fit=max&auto=format&n=4JB7OCBLDkpjkRT-&q=85&s=1e27436d16a2bf84561e2c58d36fc6fb" alt="Cover Image" className="rounded-lg" noZoom width="1402" height="463" data-path="images/cover/n8n.png" />

n8n is a powerful workflow automation tool that allows you to connect different services and build sophisticated automation. By integrating Membit with n8n, you can enhance your AI agents with real-time social context, enabling them to provide up-to-date insights about trending topics, news, and conversations happening across the web.

## Prerequisites

Before you begin, make sure you have:

* An active n8n instance (cloud or self-hosted)
* A Membit account with an API key [get your API key](/access-and-auth)
* Basic familiarity with n8n workflows and AI agents

## Setting Up Membit MCP Client

Follow these steps to integrate Membit with your n8n workflows:

<Steps>
  <Step title="Open the Node Panel">
    In your n8n workflow editor, open the node panel to add a new node to your workflow.

    <Frame>
      <img src="https://mintcdn.com/membit/X3g2jASQcla7cFkX/images/n8n/node-panel.png?fit=max&auto=format&n=X3g2jASQcla7cFkX&q=85&s=bb08c520e82289cae99e5abc8ba433d4" alt="n8n node panel interface showing available nodes" width="922" height="448" data-path="images/n8n/node-panel.png" />
    </Frame>
  </Step>

  <Step title="Search for MCP Client">
    In the node search bar, type "MCP client" to find the Model Context Protocol client tool.

    <Frame>
      <img src="https://mintcdn.com/membit/X3g2jASQcla7cFkX/images/n8n/search-mcp-clinet.png?fit=max&auto=format&n=X3g2jASQcla7cFkX&q=85&s=ea9865a437b4211b895a81b89ab783c5" alt="Searching for MCP client in n8n node panel" width="1000" height="526" data-path="images/n8n/search-mcp-clinet.png" />
    </Frame>

    <Check>
      The MCP Client Tool should appear in the search results. This tool enables n8n to communicate with external MCP servers like Membit.
    </Check>
  </Step>

  <Step title="Configure Membit MCP Client">
    Add the MCP Client Tool to your workflow and configure it with the following settings:

    ```
    Endpoint: https://mcp.membit.ai/mcp
    Server Transport: HTTP Streamable
    Authentication: Header Auth
      - Name: X-Membit-Api-Key
      - Value: <your-api-key>
    Tools to Include: All
    ```

    <Warning>
      Replace `<your-api-key>` with your actual Membit API key.
    </Warning>
  </Step>
</Steps>

## Building Your First Workflow

Now that your Membit MCP client is configured, let's create a complete workflow that uses real-time context:

<Steps>
  <Step title="Add Required Nodes">
    Create a complete workflow by adding and connecting the following nodes:

    1. **Chat Trigger** - To receive user input
    2. **AI Agent** - To process requests and coordinate responses
    3. **Google Gemini Chat Model** - For natural language processing
    4. **Membit MCP Client** - For real-time context
  </Step>

  <Step title="Connect the Nodes">
    Connect them in this order:

    * Chat Trigger → AI Agent
    * Google Gemini Chat Model → AI Agent
    * Membit MCP Client → AI Agent

    <Frame>
      <img src="https://mintcdn.com/membit/X3g2jASQcla7cFkX/images/n8n/example-workflow.png?fit=max&auto=format&n=X3g2jASQcla7cFkX&q=85&s=a36f65106fe7da43e566b3849e66d886" alt="Complete n8n workflow showing connected nodes for Membit integration" width="1666" height="1034" data-path="images/n8n/example-workflow.png" />
    </Frame>

    <Check>
      The visual connections show the data flow - the AI Agent receives input from the Chat Trigger, uses the Gemini model for processing, and accesses Membit for real-time context.
    </Check>
  </Step>

  <Step title="Test Your Workflow">
    Use the chat interface to send a test message like:

    ```
    "Tell me about crypto news"
    ```

    or

    ```
    "What's trending in AI today?"
    ```

    Your AI agent should now respond with current, contextual information pulled from Membit's real-time data feed.

    <Frame caption="Example response showing real-time context from Membit">
      <img src="https://mintcdn.com/membit/X3g2jASQcla7cFkX/images/n8n/example-result.png?fit=max&auto=format&n=X3g2jASQcla7cFkX&q=85&s=ab2d906116663880622ab169bb5f60e9" alt="n8n workflow execution result showing AI response with real-time context" width="1346" height="876" data-path="images/n8n/example-result.png" />
    </Frame>

    <Check>
      If successful, you'll see responses that include recent trends, discussions, and insights that wouldn't be available in static training data.
    </Check>
  </Step>
</Steps>

## Troubleshooting

<AccordionGroup>
  <Accordion title="MCP Client Connection Issues">
    **Problem**: Cannot connect to Membit MCP server in n8n

    **Solutions**:

    Verify the endpoint URL is correct: `https://mcp.membit.ai/mcp`

    Ensure "Server Transport" is set to "HTTP Streamable"

    Check that "Authentication" is set to "Header Auth"

    Verify header name is exactly `X-Membit-Api-Key` (case-sensitive)

    Test the connection with a simple request first
  </Accordion>

  <Accordion title="Authentication Header Configuration">
    **Problem**: API key authentication is failing

    **Solutions**:

    Confirm the header name is `X-Membit-Api-Key` (not `Authorization`)

    Ensure there are no extra spaces or characters in the API key value

    Verify your Membit API key is active and valid

    Check that the header value contains only the API key (no "Bearer " prefix)

    Try regenerating your API key if authentication continues to fail
  </Accordion>

  <Accordion title="AI Agent Tool Integration">
    **Problem**: AI Agent doesn't use MCP Client tools

    **Solutions**:

    Ensure MCP Client is properly connected to the AI Agent node

    Verify "Tools to Include" is set to "All" in MCP Client configuration

    Check that the AI model (Google Gemini) supports function calling

    Make prompts more explicit: "Use available tools to search for current information about..."

    Test the MCP Client connection independently before connecting to AI Agent
  </Accordion>

  <Accordion title="Workflow Node Connection Errors">
    **Problem**: Nodes won't connect or show connection issues

    **Solutions**:

    Verify the connection order: Chat Trigger → AI Agent, MCP Client → AI Agent

    Ensure all required node inputs are satisfied

    Check that node versions are compatible with each other

    Try disconnecting and reconnecting nodes in the correct sequence

    Restart the n8n workflow editor if connections appear broken
  </Accordion>

  <Accordion title="Chat Trigger Not Responding">
    **Problem**: Chat interface doesn't respond or process messages

    **Solutions**:

    Verify the Chat Trigger node is properly configured and activated

    Ensure the workflow is saved and deployed

    Check that all nodes in the workflow are properly connected

    Test with simple messages first to verify basic functionality

    Review workflow execution logs for error messages
  </Accordion>
</AccordionGroup>
