MCP Client icon

MCP Client

Use MCP client

Overview

This node acts as a client interface to an MCP (Model Context Protocol) server, allowing users to interact with various resources, prompts, and tools provided by the MCP ecosystem. It supports multiple operations such as listing available tools, executing a specific tool, retrieving prompt templates, reading resources, and more.

A common use case is automating workflows that require dynamic access to AI model tools or resources managed by an MCP server. For example, you might list all available AI tools and then execute one with specific parameters to generate content or analyze data within an n8n workflow.

The "List Tools" operation specifically fetches and returns the available tools from the MCP server, including their names, descriptions, and input schemas, enabling users to understand what tools can be invoked programmatically.

Properties

Name Meaning
Connection Type Choose the transport type to connect to the MCP server. Options:
- Command Line (STDIO): Connect via a command line interface using standard input/output.
- Server-Sent Events (SSE): Connect via SSE protocol for event-driven communication.

Output

For the "List Tools" operation, the output JSON contains a tools array where each element represents a tool available on the MCP server. Each tool object includes:

  • name: The name of the tool.
  • description: A textual description of what the tool does.
  • schema: A JSON schema describing the expected input parameters for the tool.

Example output structure:

{
  "tools": [
    {
      "name": "toolName1",
      "description": "Description of tool 1",
      "schema": { /* JSON schema of input parameters */ }
    },
    {
      "name": "toolName2",
      "description": "Description of tool 2",
      "schema": { /* JSON schema of input parameters */ }
    }
  ]
}

The node does not output binary data.

Dependencies

  • Requires connection to an MCP server, which can be done either via:

    • A command line interface (STDIO) transport, requiring a command and optional arguments configured in credentials.
    • A Server-Sent Events (SSE) transport, requiring an SSE URL and optionally custom headers and POST endpoints configured in credentials.
  • The node depends on external MCP SDK packages for client communication and schema validation.

  • Environment variables starting with MCP_ are automatically passed to the command line environment when using the STDIO transport.

  • Proper API authentication credentials must be configured depending on the chosen connection type.

Troubleshooting

  • No tools found: If the MCP server returns no tools, the node throws an error stating "No tools found from MCP client". Verify the MCP server has tools registered and accessible.

  • Connection errors: Errors during connection setup (e.g., invalid credentials, unreachable server) will result in messages like "Failed to connect to MCP server". Check network connectivity and credential correctness.

  • Invalid tool parameters: When executing tools, if the parameters are not valid JSON objects, the node throws parsing errors. Ensure parameters are correctly formatted JSON.

  • Tool not found: Attempting to execute a non-existent tool results in an error listing available tools. Confirm the tool name matches exactly.

  • Transport errors: Any underlying transport issues (e.g., SSE connection drops) raise transport error messages. Review transport configuration and server status.

Links and References

Discussion