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, and reading resources by URI.

The "List Tools" operation specifically fetches and returns the list of available tools from the MCP server. This is useful when you want to discover what tools are accessible for further automation or integration within your workflows.

Common scenarios:

  • Discovering available tools dynamically before executing them.
  • Building dynamic user interfaces or decision logic based on available tools.
  • Validating tool availability in automated pipelines.

Example:
You might use this node to list all tools exposed by the MCP server, then select one tool to execute based on the returned list, enabling flexible and adaptive workflow designs.

Properties

Name Meaning
Connection Type Choose the transport type to connect to MCP server. Options:
- Command Line (STDIO)
- Server-Sent Events (SSE)

Output

The output JSON structure for the "List Tools" operation contains a tools field which is an array of objects. Each object represents a tool with the following properties:

  • name: The name of the tool.
  • description: A textual description of what the tool does.
  • schema: An array of strings representing the input parameter names that the tool accepts.

Example output snippet:

{
  "tools": [
    {
      "name": "toolA",
      "description": "Description of toolA",
      "schema": ["param1", "param2"]
    },
    {
      "name": "toolB",
      "description": "Description of toolB",
      "schema": ["input"]
    }
  ]
}

The node does not output binary data.

Dependencies

  • Requires connection to an MCP server via either:

    • Command Line interface using STDIO transport.
    • Server-Sent Events (SSE) transport.
  • Requires appropriate credentials configured in n8n for the selected connection type:

    • For STDIO: an API key credential with command and arguments.
    • For SSE: an API key credential with SSE URL and optional headers.
  • Uses environment variables for process environment configuration, especially for the STDIO transport.

Troubleshooting

  • Transport error: If the node throws a "Transport error," it indicates issues establishing communication with the MCP server. Check network connectivity, credentials, and correct configuration of the connection type.

  • Failed to connect to MCP server: This error suggests the client could not establish a session with the MCP server. Verify the server URL, credentials, and that the server is running and accessible.

  • No tools found from MCP client: Indicates that the MCP server returned no tools. Confirm that the server has tools registered and that the connection is correctly established.

  • Invalid JSON in tool parameters (for executeTool operation): When executing a tool, if parameters are malformed or not a valid JSON object, the node will throw an error. Ensure parameters are properly formatted JSON.

  • Tool does not exist: When trying to execute a tool that is not listed by the MCP server, the node will report this. Use the "List Tools" operation first to verify available tools.

Links and References

Discussion