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, 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 prompt definitions stored centrally on an MCP server for reuse.

For example, you might use this node to get a prompt template called "CustomerSupportResponse" and then feed that prompt into an AI text generation tool downstream.

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.

Output

The node outputs a JSON object containing the retrieved prompt template under the prompt key. The structure is:

{
  "prompt": {
    // prompt template details as returned by the MCP server
  }
}

No binary data output is produced by this operation.

Dependencies

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

Troubleshooting

  • Connection errors: If the node fails to connect to the MCP server, verify that the credentials and connection parameters are correctly set and that the MCP server is reachable.
  • Prompt not found: If the specified prompt name does not exist on the MCP server, the node may return an error or empty result. Double-check the prompt name spelling and availability.
  • Timeouts: The node has configurable timeouts depending on the connection type; if operations take too long, consider increasing the timeout settings.
  • Invalid parameters: Ensure the prompt name is provided and is a non-empty string.
  • Deprecated SSE transport: Avoid using the SSE connection type as it is deprecated; prefer HTTP Streamable instead.

Links and References

Discussion