MCP Client icon

MCP Client

Use MCP client

Overview

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

Common scenarios where this node is beneficial include:

  • Fetching a catalog of prompt templates to dynamically present options in an automation workflow.
  • Integrating with AI or language model systems that use predefined prompt templates for generating responses.
  • Managing and exploring available prompts before executing or customizing them in subsequent steps.

For example, a user might list all prompts to display them in a UI dropdown or to select one for further processing in an AI-driven content generation pipeline.

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 streaming protocol; replaced by HTTP Streamable.
- 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": "examplePrompt",
      "description": "Description of the prompt template",
      // other prompt-specific fields...
    },
    ...
  ]
}

No binary data output is produced by this operation.

Dependencies

  • Requires connection to an MCP server via one of the supported transport protocols (Command Line STDIO, SSE, or HTTP Streamable).
  • Requires appropriate credentials configured in n8n for the selected connection type, including URLs, commands, headers, or environment variables depending on the transport.
  • Uses external MCP SDK packages for client communication and protocol handling.
  • Environment variables starting with MCP_ can be used to pass additional environment settings when using the command line transport.

Troubleshooting

  • Connection errors: If the node fails to connect to the MCP server, verify that the correct connection type is selected and that credentials (URLs, commands, headers) are properly configured.
  • Timeouts: The node uses configurable timeouts for HTTP and SSE transports. Increase timeout values if operations take longer than expected.
  • Empty prompt list: If no prompts are returned, ensure the MCP server has prompt templates available and that the authenticated user has permission to access them.
  • Transport errors: Errors related to the underlying transport (e.g., command not found, network issues) will be surfaced as node operation errors. Check logs for detailed messages.
  • Deprecated SSE transport: Avoid using the SSE option as it is deprecated; prefer HTTP Streamable for streaming communications.

Links and References

Discussion