Actions7
Overview
This node acts as a client interface to an MCP (Model Context Protocol) server, enabling users to interact with various tools, prompts, and resources provided by the MCP ecosystem. The primary focus here is the Execute Tool operation, which allows executing a specific tool on the MCP server by passing JSON-formatted parameters.
Common scenarios where this node is beneficial include:
- Automating complex workflows that require invoking external AI or processing tools exposed via MCP.
- Integrating custom or third-party tools into n8n workflows without manual API handling.
- Dynamically executing different tools based on workflow logic, with flexible parameter input.
Practical example:
- You want to run a text summarization tool hosted on the MCP server. Using this node, you select the summarization tool by name or ID, provide the text and any configuration options as JSON parameters, and receive the summarized output directly in your workflow.
Properties
| Name | Meaning |
|---|---|
| Connection Type | Choose the transport type to connect to the MCP server. Options: - Command Line (STDIO) - Server-Sent Events (SSE) (Deprecated) - HTTP Streamable (recommended for real-time communication) |
| Tool Name or ID | Select the tool to execute from a dynamically loaded list of available tools, or specify a custom tool name/ID using an expression. This identifies which tool on the MCP server to invoke. |
| Tool Parameters | JSON object containing parameters to pass to the selected tool. Must be valid JSON representing the tool's expected input schema. |
Output
The node outputs a JSON object under the json field with the following structure when executing a tool:
{
"result": { /* result returned by the executed tool */ }
}
- The
resultfield contains the output from the tool execution, which can be any JSON-serializable data depending on the tool. - No binary data output is indicated by the code; all results are returned as JSON.
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)
- Requires appropriate credentials configured in n8n for the chosen connection type, including:
- API URLs and endpoints for HTTP/SSE transports
- Command and environment variables for STDIO transport
- Uses the MCP SDK client libraries internally to manage connections and tool invocations.
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 is reachable. Check environment variables if using STDIO transport.
- Invalid tool parameters: The node expects valid JSON for tool parameters. Errors parsing JSON will prompt a clear message. Ensure parameters match the tool’s expected schema.
- Tool not found: If the specified tool name does not exist on the MCP server, the node lists available tools in the error message. Double-check the tool name or refresh the tool list.
- Transport errors: Any transport-level errors (e.g., network issues, command failures) will throw descriptive errors indicating the problem source.
- Timeouts: The node uses configurable timeouts for HTTP and SSE transports. Long-running tool executions may require adjusting these timeout settings.
Links and References
- n8n Expressions Documentation — For specifying dynamic values in properties.
- MCP SDK GitHub or documentation (not linked explicitly here) — For details on MCP client capabilities and tool schemas.
- MCP server setup and credential configuration guides (refer to your MCP provider).