MCP Client Tool (Patched) icon

MCP Client Tool (Patched)

Connect tools from an MCP Server

Overview

This node connects to an MCP (Model Context Protocol) server via a Server-Sent Events (SSE) endpoint and exposes tools from that server to an AI agent within n8n. It acts as a bridge, allowing users to integrate external AI tools hosted on an MCP server into their workflows.

Common scenarios where this node is beneficial include:

  • Integrating custom AI tools or models hosted externally into n8n automations.
  • Dynamically loading and exposing AI capabilities managed on an MCP server.
  • Selectively including or excluding specific tools from the MCP server for use in AI workflows.

Practical example:

  • A user has an MCP server hosting various AI tools such as text summarizers, translators, or data extractors. By configuring this node with the SSE endpoint and authentication, they can expose these tools to an AI agent in n8n and orchestrate complex AI-driven workflows using those tools.

Properties

Name Meaning
This node must be connected to an AI agent. Insert one Notice indicating that this node requires connection to an AI agent node to function properly.
SSE Endpoint The URL of your MCP server's SSE endpoint to which the node will connect to receive tool information and events. Example: https://my-mcp-server.ai/sse. This is required.
Authentication Method used to authenticate with the SSE endpoint. Options are: Bearer Auth, Header Auth, or None.
Credentials API credentials used for authentication when Bearer Auth or Header Auth is selected.
Tools to Include How to select which tools to expose to the AI agent. Options: All (include all tools), Selected (include only specified tools), All Except (include all except specified tools).
Tools to Include (selected) When "Selected" is chosen above, specify which tools to include by selecting from a dynamically loaded list or using expressions.
Tools to Exclude When "All Except" is chosen above, specify which tools to exclude by selecting from a dynamically loaded list or using expressions.

Output

The node outputs a special type of data labeled "ai_tool" containing the tools fetched from the MCP server, transformed into dynamic tools usable by the AI agent in n8n. Each tool includes its name and execution logic wrapped to handle errors gracefully.

  • The output JSON contains metadata about each tool.
  • If any tool fails during execution, the node logs the error and throws a descriptive error.
  • No binary data output is produced by this node.

Dependencies

  • Requires access to an MCP server SSE endpoint.
  • May require an API key or token depending on the selected authentication method.
  • Uses internal utility functions to connect, authenticate, and fetch tools from the MCP server.
  • Requires proper configuration of credentials in n8n if authentication is enabled.

Troubleshooting

  • Connection failures:

    • Error message: "Could not connect to your MCP server. The provided URL is invalid."
      Cause: The SSE endpoint URL is malformed or unreachable.
      Resolution: Verify the URL is correct and accessible from the n8n environment.

    • Error message: "Could not connect to your MCP server"
      Cause: Network issues or server down.
      Resolution: Check network connectivity and ensure the MCP server is running.

  • Empty tool list:

    • Error message: "MCP Server returned no tools"
      Cause: The MCP server responded successfully but did not provide any tools.
      Resolution: Confirm that the MCP server has tools configured and available.
  • Tool execution errors:

    • Errors logged when a specific tool fails to execute.
      Resolution: Review the tool implementation on the MCP server and check logs for detailed error messages.
  • Authentication issues:

    • Ensure credentials are correctly set up in n8n and match the authentication method selected.

Links and References

Discussion