MCP Client icon

MCP Client

Use MCP client

Overview

This node acts as a client for the Model Context Protocol (MCP) server, enabling interaction with MCP resources, tools, and prompts. It supports multiple connection types (Command Line via STDIO, Server-Sent Events, and HTTP Streamable) to communicate with the MCP server. The node is useful for scenarios where users want to list available tools, execute specific tools with parameters, retrieve prompts, or access resource templates and resources from the MCP server. For example, it can be used to dynamically fetch and execute AI tools or workflows defined on the MCP server within an n8n automation.

Use Case Examples

  1. Listing all available tools from the MCP server to display or use in subsequent workflow steps.
  2. Executing a specific tool by name with JSON parameters to perform a task or computation.
  3. Retrieving a prompt template to use in generating dynamic content or interactions.
  4. Listing available resource templates or resources for further processing or decision-making.

Properties

Name Meaning
Connection Type Selects the transport protocol to connect to the MCP server, such as Command Line (STDIO), Server-Sent Events (deprecated), or HTTP Streamable.
Uri Override Overrides the default URL from credentials with a custom URL for SSE or HTTP connection types.
Headers Override Additional HTTP headers to send with the request, merged with credential headers, for SSE or HTTP connection types.

Output

JSON

  • tools - An array of available tools with their name, description, and input schema returned by the MCP server when listing tools.

Dependencies

  • Requires credentials for MCP client connection depending on the connection type: command line credentials for 'cmd', SSE credentials for 'sse', or HTTP credentials for 'http'.
  • Uses MCP SDK client libraries for communication with the MCP server.

Troubleshooting

  • Common errors include connection failures to the MCP server due to invalid credentials or network issues.
  • Invalid URI override format will throw an error; ensure the URI is a valid URL.
  • If no tools are found in the response, the node throws an error indicating no tools are available.
  • Tool execution errors occur if the tool name does not exist or parameters are invalid JSON; ensure tool names and parameters are correct.
  • Timeouts can occur based on configured or default timeout values; adjust credentials or node settings accordingly.

Links

Discussion