Overview
This node acts as a client for the Model Context Protocol (MCP) server, enabling interaction with various MCP resources, tools, and prompts. Specifically, the List Prompts operation retrieves all available prompt templates from the MCP server.
Common scenarios where this node is beneficial include:
- Discovering which prompt templates are available for use in automated workflows.
- Dynamically fetching prompt options to present to users or to select programmatically.
- Integrating with AI or language model workflows that rely on predefined prompt templates managed by an MCP server.
For example, a user might want to list all prompts to display them in a UI dropdown or to select a prompt dynamically before executing a tool or generating text.
Properties
Name | Meaning |
---|---|
Connection Type | Choose the transport type to connect to MCP server. Options: - Command Line (STDIO) - Server-Sent Events (SSE) |
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",
...
},
{
"name": "examplePrompt2",
"description": "Description of prompt 2",
...
}
]
}
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.
- Server-Sent Events (SSE) transport, configured with an SSE 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 endpoint URL and headers.
The node depends on the MCP SDK client libraries and the n8n workflow utilities.
Troubleshooting
Connection errors: If the node fails to connect to the MCP server, verify that the connection type is correctly set and that the credentials contain valid endpoints or commands. Check network connectivity and permissions.
Empty prompt list: If no prompts are returned, ensure that the MCP server actually has prompt templates available and that the authenticated user has access rights.
Transport errors: Errors related to the transport layer (e.g., STDIO or SSE) will be reported as transport errors. Verify that the command or SSE URL is reachable and correctly configured.
Credential issues: Missing or invalid credentials for the selected connection type will cause failures. Make sure the required API keys or tokens are properly set up in n8n.
Unexpected errors: Any other errors during execution will be wrapped and reported as node operation errors with descriptive messages.