Overview
This node acts as a client interface to an MCP (Model Context Protocol) server, allowing users to interact 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 language model workflows.
- Integrating dynamic prompt retrieval into automation pipelines.
- Accessing MCP server resources and tools programmatically within n8n workflows.
For example, you might use this node to get a prompt template by name and then feed that prompt into a language model node for text generation.
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 output JSON contains a single field:
prompt: An object representing the retrieved prompt template from the MCP server. The structure of this object depends on the MCP server's prompt definition but typically includes fields such as the prompt content, metadata, and any associated parameters.
No binary data output is produced by this operation.
Example output snippet:
{
"prompt": {
"name": "examplePrompt",
"content": "Your prompt text here...",
"description": "Description of the prompt",
...
}
}
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, optional POST endpoint, and headers.
Environment variables starting with
MCP_can be used to pass additional environment settings to the STDIO transport.
Troubleshooting
Connection errors: If the node fails to connect to the MCP server, verify that the credentials are correct and that the MCP server is reachable via the specified transport method.
Transport errors: Errors related to the transport layer (e.g., SSE connection issues or command execution failures) will throw descriptive errors. Check network connectivity and command availability.
Prompt not found: If the specified prompt name does not exist on the MCP server, the node may return an error or empty result. Verify the prompt name spelling and availability.
Invalid parameters: Ensure that all required properties, especially the prompt name, are provided and correctly formatted.
JSON parsing errors: Although not directly relevant to "Get Prompt," other operations involving JSON parameters require valid JSON input.