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 MCP resources, tools, and prompts. Specifically, the Get Prompt operation retrieves a named prompt template from the MCP server.

Common scenarios for this node include:

  • Fetching predefined prompt templates to use in AI or automation workflows.
  • Integrating dynamic prompt retrieval into larger automation pipelines.
  • Accessing MCP server resources programmatically without manual intervention.

For example, you might use this node to get a prompt template called "customerSupportResponse" and then feed that prompt into an AI model for generating customer support replies dynamically.

Properties

Name Meaning
Connection Type Choose the transport type to connect to the MCP server:
- Command Line (STDIO)
- Server-Sent Events (SSE) (Deprecated)
- HTTP Streamable (recommended for real-time communication)
Prompt Name The exact name of the prompt template to retrieve from the MCP server. This is required for the Get Prompt operation.

Output

The output JSON contains a single field:

  • prompt: An object representing the retrieved prompt template. This typically includes the prompt's content and metadata as defined on the MCP server.

Example output structure:

{
  "prompt": {
    // prompt template details here
  }
}

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 protocol, or deprecated SSE.
  • Needs appropriate credentials configured in n8n for the chosen connection type, including URLs, commands, headers, or environment variables depending on transport.
  • Uses external MCP SDK packages for client communication and transport handling.
  • Environment variable PATH may be used/modified 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 all required credentials (URLs, commands, headers) are properly configured.
  • Prompt not found: If the specified prompt name does not exist on the MCP server, the node will throw an error. Double-check the prompt name spelling and availability.
  • Invalid parameters: Ensure the prompt name is provided and is a non-empty string.
  • Transport errors: Errors during communication with the MCP server (e.g., network issues, invalid endpoints) will cause the node to fail with descriptive messages.
  • Deprecated SSE transport: Avoid using the SSE connection type as it is deprecated; prefer HTTP Streamable instead.

Links and References

Discussion