Actions7
Overview
This node acts as a client interface to an MCP (Model Context Protocol) server, enabling interaction with various resources, tools, and prompts managed by the MCP system. It supports multiple connection types for communication, including command line (STDIO), HTTP streamable protocol, and a deprecated Server-Sent Events (SSE) method.
Common scenarios where this node is beneficial include:
- Listing available computational or data resources from the MCP server.
- Executing specific tools remotely with custom parameters.
- Retrieving prompt templates for use in AI or automation workflows.
- Reading detailed information about a particular resource by its URI.
Practical examples:
- Automating the retrieval of all available resources to dynamically adjust workflow behavior.
- Running a tool that processes input data and returns results directly within an n8n workflow.
- Fetching a prompt template to customize AI-driven content generation steps.
Properties
Name | Meaning |
---|---|
Connection Type | Choose the transport type to connect to MCP server: - Command Line (STDIO) - Server-Sent Events (SSE) (Deprecated) - HTTP Streamable (recommended for real-time communication) |
Operation | Select the action to perform: - Execute Tool - Get Prompt - List Prompts - List Resource Templates - List Resources - List Tools - Read Resource |
Resource URI | URI of the resource to read (required only when operation is "Read Resource") |
Tool Name | Name of the tool to execute (required only when operation is "Execute Tool") |
Tool Parameters | JSON object specifying parameters to pass to the tool (required only when operation is "Execute Tool") |
Prompt Name | Name of the prompt template to retrieve (required only when operation is "Get Prompt") |
Output
The output JSON structure varies depending on the selected operation:
List Resources:
{ "resources": [ /* array of resource objects */ ] }
Contains a list of available resources from the MCP server.
List Resource Templates:
{ "resourceTemplates": [ /* array of resource template objects */ ] }
Provides available resource templates.
Read Resource:
{ "resource": { /* detailed resource object */ } }
Returns detailed information about a specific resource identified by its URI.
List Tools:
{ "tools": [ { "name": "toolName", "description": "Tool description", "schema": { /* input schema object */ } }, ... ] }
Lists available tools with their descriptions and input schemas.
Execute Tool:
{ "result": { /* result returned by the executed tool */ } }
Outputs the execution result of the specified tool.
List Prompts:
{ "prompts": [ /* array of prompt templates */ ] }
Lists available prompt templates.
Get Prompt:
{ "prompt": { /* prompt template object */ } }
Retrieves a specific prompt template by name.
The node does not output binary data.
Dependencies
Requires connectivity to an MCP server via one of the supported transport protocols:
- Command Line (STDIO): Requires a configured command and environment variables.
- HTTP Streamable: Requires HTTP endpoint URLs and optional headers.
- Server-Sent Events (SSE): Deprecated; requires SSE endpoint URLs and headers.
Credentials must be configured accordingly in n8n for the chosen connection type, including API URLs, commands, authentication headers, and environment variables.
Uses external libraries from the MCP SDK and LangChain tools for client communication and dynamic tool execution.
Troubleshooting
Connection Errors:
If the node fails to connect to the MCP server, verify that the credentials are correctly set up and that the server endpoints or command-line tools are accessible from the n8n environment.Invalid Tool Parameters:
When executing a tool, ensure that theTool Parameters
field contains valid JSON representing an object. Invalid JSON or incorrect parameter types will cause errors.Tool Not Found:
Attempting to execute a non-existent tool will throw an error listing available tools. Double-check the tool name spelling and availability.Operation Not Supported:
Selecting an unsupported operation will result in an error. Confirm that the operation name matches one of the supported options.Timeouts:
The node uses configurable timeouts for HTTP and SSE connections. Long-running operations may require adjusting these timeout settings in credentials.
Links and References
- MCP Protocol and SDK documentation (refer to your MCP provider's official docs)
- LangChain Tools: https://js.langchain.com/docs/modules/tools/overview/
- n8n Documentation: https://docs.n8n.io/