Actions7
Overview
This node acts as a client interface to an MCP (Model Context Protocol) server, enabling interaction with various resources, prompts, and tools managed by the MCP system. 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 larger automation pipelines where template metadata is required.
- Auditing or synchronizing resource templates between MCP and other systems.
Properties
Name | Meaning |
---|---|
Connection Type | Choose the transport type to connect to the MCP server. Options: |
- Command Line (STDIO): Use local command line interface for communication | |
- Server-Sent Events (SSE): Deprecated, previously used for real-time event streaming | |
- HTTP Streamable: Use HTTP streamable protocol for real-time communication (recommended) |
Output
The output JSON contains a single field:
resourceTemplates
: An array listing the available resource templates retrieved from the MCP server. Each item represents a resource template object as defined by the MCP system.
Example output structure:
{
"resourceTemplates": [
{
"id": "template1",
"name": "Template One",
"description": "Description of template one",
...
},
{
"id": "template2",
"name": "Template Two",
"description": "Description of template two",
...
}
]
}
No binary data output is produced by this operation.
Dependencies
- Requires access to an MCP server endpoint.
- Depending on the selected connection type, appropriate credentials must be configured in n8n:
- For Command Line (STDIO): Credentials providing the command and arguments to run the MCP client locally.
- For HTTP Streamable: Credentials containing HTTP URLs and optional headers for connecting via HTTP streaming.
- For SSE (deprecated): Credentials with SSE URL and headers.
- The node uses several external libraries bundled within the MCP SDK for communication and schema validation.
- Environment variables prefixed with
MCP_
may influence the 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 is selected and that credentials are properly configured with valid endpoints or commands.
- Timeouts: The node has configurable timeouts depending on the connection type; ensure these are sufficient for your network conditions.
- Transport errors: Errors during communication will throw descriptive messages such as "Transport error: ...". Check network connectivity and credential correctness.
- Operation not supported: If an unsupported operation is specified, the node will throw an error indicating so.
- Empty or missing resource templates: If no resource templates are returned, confirm that the MCP server actually has templates available and that the user account has permission to list them.
Links and References
- Model Context Protocol (MCP) Documentation (hypothetical link)
- n8n Custom Node Development Guide
- Zod Schema Validation Library (used internally for input schema validation)