MCP Client icon

MCP Client

Use MCP client

Overview

This node acts as a client interface to an MCP (Model Context Protocol) server, enabling interaction with various MCP resources such as prompts, tools, and resource templates. Specifically, the List Prompts operation retrieves a list of available prompt templates from the MCP server.

Common scenarios where this node is beneficial include:

  • Fetching predefined prompt templates for use in AI or automation workflows.
  • Dynamically listing prompts to allow users to select one for further processing.
  • Integrating with MCP-based systems to manage and utilize prompt templates programmatically.

For example, you might use this node to get all available prompts and then feed a selected prompt into another node that executes it or modifies it.

Properties

Name Meaning
Connection Type Choose the transport type to connect to the MCP server. Options:
- Command Line (STDIO): Use command line interface for communication.
- Server-Sent Events (SSE): Deprecated; previously used SSE protocol.
- HTTP Streamable: Use HTTP streamable protocol for real-time communication (recommended).

Output

The output JSON contains a single field:

  • prompts: An array of prompt template objects retrieved from the MCP server. Each object represents a prompt template available for use.

Example output structure:

{
  "prompts": [
    {
      "name": "examplePrompt1",
      "description": "Description of prompt 1",
      ...
    },
    {
      "name": "examplePrompt2",
      "description": "Description of prompt 2",
      ...
    }
  ]
}

No binary data output is produced by this operation.

Dependencies

  • Requires connection to an MCP server via one of the supported transports (Command Line STDIO, HTTP Streamable, or SSE).
  • Depending on the chosen connection type, appropriate credentials must be configured in n8n:
    • For Command Line: configuration includes command, arguments, and environment variables.
    • For HTTP Streamable: requires HTTP endpoint URL and optional headers.
    • For SSE: requires SSE endpoint URL and optional headers (deprecated, HTTP Streamable preferred).
  • The node uses the MCP SDK client libraries internally to communicate with the MCP server.

Troubleshooting

  • Transport errors: If the node fails to connect, verify that the MCP server is reachable and that credentials (command, URLs, headers) are correctly set.
  • Timeouts: The node has configurable timeouts depending on the transport. Long-running requests may require increasing timeout settings.
  • Empty prompt list: If no prompts are returned, ensure the MCP server actually has prompt templates available and that the user account has permission to access them.
  • Credential misconfiguration: Errors related to missing or invalid credentials will prevent connection. Double-check credential setup in n8n.
  • Deprecated SSE transport: Avoid using SSE transport as it is deprecated; prefer HTTP Streamable for better support and stability.

Links and References

Discussion