Actions7
Overview
This node acts as a client for the 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. This is useful when you want to dynamically fetch predefined prompt templates for use in AI workflows or other automation scenarios.
Common scenarios include:
- Fetching prompt templates to feed into language models or AI tools.
- Dynamically loading prompt configurations without hardcoding them.
- Integrating with MCP-based systems to leverage shared prompt resources.
Example: You might use this node to get a prompt template called "customerSupportResponse" and then pass it to an AI model node to generate customer support replies.
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 by the MCP server.
No binary data is output by this operation.
Example output structure:
{
"prompt": {
"name": "examplePrompt",
"description": "A sample prompt template",
"content": "...prompt text or structure..."
}
}
Dependencies
- Requires connection to an MCP server via one of the supported transports:
- Command Line interface (STDIO)
- HTTP Streamable protocol (recommended)
- Server-Sent Events (SSE) (deprecated)
- Appropriate credentials must be configured in n8n depending on the chosen connection type. These credentials provide necessary authentication and endpoint URLs.
- Environment variables may be used to configure command line environment if using STDIO transport.
Troubleshooting
- Connection errors: If the node fails to connect to the MCP server, verify that the correct connection type and credentials are set up properly. Check network connectivity and endpoint URLs.
- 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.
- Timeouts: The node uses default timeouts which can be overridden via credential settings. Increase timeout values if operations take longer than expected.
- Deprecated SSE transport: Avoid using the SSE connection type as it is deprecated; prefer HTTP Streamable instead.
Links and References
- MCP (Model Context Protocol) Documentation
- n8n Documentation on Custom Nodes
- LangChain Tools (related to tool execution in MCP client)