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

Typical use cases include:

  • Fetching predefined prompt templates for use in AI or language model workflows.
  • Dynamically loading prompt content based on user input or workflow logic.
  • Integrating prompt retrieval into larger automation pipelines that require contextual or templated inputs.

For example, a user might configure this node to get a prompt template called "CustomerSupportResponse" and then feed that prompt into a language model node for generating customer support replies.

Properties

Name Meaning
Connection Type Choose the transport type to connect to the MCP server. Options:
- Command Line (STDIO)
- Server-Sent Events (SSE)
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 node outputs JSON data containing the retrieved prompt template under the prompt field. The structure is:

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

No binary data output is produced by this operation.

Dependencies

  • Requires connection to an MCP server via either:

    • A command line interface using STDIO transport, configured with a command and optional arguments.
    • A Server-Sent Events (SSE) transport, configured with a URL and optional headers.
  • Requires appropriate credentials for the chosen connection type:

    • For STDIO: credentials providing the command and environment variables.
    • For SSE: credentials providing the SSE URL and optional headers.
  • Environment variables starting with MCP_ can be used to pass additional environment settings to the STDIO transport.

  • The node depends on the MCP client SDK libraries for communication.

Troubleshooting

  • Connection errors: If the node fails to connect to the MCP server, verify that the connection type matches your setup and that credentials are correctly configured. Check network accessibility for SSE URLs or correct command paths for STDIO.

  • Prompt not found: If the specified prompt name does not exist on the MCP server, the node will throw an error. Confirm the prompt name spelling and availability.

  • Invalid credentials: Missing or incorrect credentials for the selected connection type will cause failures. Ensure credentials are set up properly in n8n.

  • Transport errors: Errors during communication with the MCP server (e.g., malformed headers, invalid endpoints) will result in transport errors. Review logs for detailed messages.

  • JSON parsing issues: Although not directly relevant to Get Prompt, other operations involving JSON parameters may fail if the JSON is malformed.

Links and References


If you need details on other operations or resources, feel free to ask!

Discussion