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 all available prompt templates from the MCP server.

Common scenarios for this node include:

  • Fetching a list of predefined prompt templates to dynamically select or display in workflows.
  • Integrating with AI or language model systems that use prompt templates managed by MCP.
  • Automating workflows that require querying available prompts before executing further actions.

For example, a user might use this node to get all prompt templates and then iterate over them to choose one for generating text completions or other AI-driven tasks.

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 (use HTTP Streamable instead).
- HTTP Streamable: Use HTTP streamable protocol for real-time communication.

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",
      // additional prompt metadata...
    },
    {
      "name": "examplePrompt2",
      "description": "Description of prompt 2"
    }
  ]
}

No binary data is produced by this operation.

Dependencies

  • Requires connection to an MCP server via one of the supported transports:
    • Command Line interface (STDIO)
    • HTTP Streamable protocol (recommended for real-time communication)
    • Server-Sent Events (deprecated)
  • Appropriate credentials must be configured in n8n depending on the chosen connection type. These credentials typically include API URLs, commands, environment variables, or headers necessary to authenticate and communicate with the MCP server.
  • The node uses the MCP SDK client libraries internally to perform operations.

Troubleshooting

  • Connection errors: If the node fails to connect to the MCP server, verify that the correct connection type is selected and that the corresponding credentials are properly configured with valid endpoints, commands, or authentication tokens.
  • Timeouts: The node has configurable timeouts depending on the connection type. Long-running requests may fail if the timeout is too short; consider increasing it in credential settings.
  • Empty prompt list: If no prompts are returned, ensure that the MCP server actually has prompt templates available and that the authenticated user has permission to access them.
  • Transport errors: Errors related to the underlying transport (e.g., STDIO command not found, HTTP endpoint unreachable) will be surfaced as node operation errors. Check logs for detailed messages.
  • Deprecated SSE transport: Avoid using the SSE connection type as it is deprecated; prefer HTTP Streamable for better support and stability.

Links and References

Discussion