Actions7
Overview
This node acts as a client interface to an MCP (Model Context Protocol) server, enabling interaction with various resources, prompts, and tools provided by the MCP ecosystem. It supports multiple connection types for communication, including command line (STDIO), HTTP streamable protocol, and deprecated Server-Sent Events (SSE).
The "List Resource Templates" operation specifically retrieves a list of available resource templates from the MCP server. This is useful when you want to discover or enumerate predefined resource templates that can be used or referenced in your workflows.
Practical examples:
- Automatically fetching all resource templates to dynamically generate UI options or validate inputs.
- Integrating MCP resource templates into a larger automation pipeline where template metadata is required.
- Auditing or synchronizing available resource templates between environments.
Properties
| Name | Meaning |
|---|---|
| Connection Type | Choose the transport type to connect to MCP server. Options: - Command Line (STDIO) - Server-Sent Events (SSE) (Deprecated) - HTTP Streamable (recommended for real-time communication) |
Output
The output JSON contains a single field:
resourceTemplates: An array of resource template objects retrieved from the MCP server. Each object represents a resource template available for use or reference.
Example output structure:
{
"resourceTemplates": [
{
// resource template details here
},
{
// another resource template
}
]
}
No binary data output is produced by this operation.
Dependencies
- Requires connectivity to an MCP server via one of the supported transport protocols.
- Depending on the chosen connection type, appropriate credentials must be configured in n8n:
- For Command Line (STDIO): Credentials providing the command and environment variables.
- For HTTP Streamable: Credentials including HTTP URLs, endpoints, headers, and timeout settings.
- For SSE (deprecated): Credentials including SSE URLs and headers.
- The node uses external MCP SDK packages for client communication and schema validation.
- Environment variables starting with
MCP_may be used to pass additional environment configuration for the command line transport.
Troubleshooting
- Connection errors: If the node fails to connect to the MCP server, verify that the credentials are correctly set up and that the MCP server is reachable using the specified transport method.
- Timeouts: The node has configurable timeouts depending on the connection type; ensure these are sufficient for your network conditions.
- No resource templates returned: If the output array is empty, confirm that the MCP server actually has resource templates available and that the user account has permission to list them.
- Transport error messages: Errors like "Transport error: ..." indicate issues with the underlying communication channel. Check network connectivity, credentials, and endpoint URLs.
- Deprecated SSE usage: Avoid using the SSE connection type as it is deprecated; prefer HTTP Streamable instead.
Links and References
- MCP Protocol Documentation
- n8n Custom Node Development
- Zod Schema Validation Library
- LangChain Tools (used internally for tool schema handling)