Actions7
Overview
This node acts as a client interface to an MCP (Model Context Protocol) server, allowing users to perform various operations such as executing tools, listing available resources, prompts, and tools, or reading specific resources. The "Execute Tool" operation enables running a specified tool on the MCP server with user-defined parameters.
Common scenarios include:
- Automating execution of AI or data processing tools exposed by the MCP server.
- Retrieving metadata about available tools, prompts, or resources for dynamic workflows.
- Integrating external model context capabilities into n8n workflows via command line or SSE transport.
Practical example:
- You want to run a text summarization tool hosted on the MCP server by specifying its name and passing JSON parameters like the input text. The node executes the tool and returns the summarized result.
Properties
Name | Meaning |
---|---|
Connection Type | Choose the transport type to connect to MCP server: "Command Line (STDIO)" or "Server-Sent Events (SSE)" |
Tool Name | Name of the tool to execute |
Tool Parameters | Parameters to pass to the tool in JSON format |
Output
The output JSON structure depends on the operation performed. For the "Execute Tool" operation, the output contains:
{
"result": { /* result object returned by the executed tool */ }
}
result
: The response from the executed tool, which can be any JSON-serializable object representing the tool's output.
For other operations (not requested here), outputs may include lists of resources, prompts, tools, or specific resource data under keys like resources
, prompts
, tools
, or resource
.
The node does not explicitly output binary data.
Dependencies
Requires connection to an MCP server accessible either via:
- Command Line interface using STDIO transport, configured with a command and optional arguments.
- Server-Sent Events (SSE) transport, configured with a URL and optional headers.
Requires appropriate credentials for the chosen connection type, including API URLs, commands, environment variables, or authentication headers.
Uses environment variables prefixed with
MCP_
to configure the command line environment if applicable.Depends on the MCP SDK packages for client communication and tool execution.
Troubleshooting
Connection errors: If the node fails to connect to the MCP server, verify that the connection type is correctly set and credentials are properly configured. Check network accessibility and authentication details.
Invalid tool parameters: The "Tool Parameters" must be valid JSON objects. Errors parsing these parameters will cause the node to throw an error. Ensure the JSON syntax is correct and the parameters match the expected schema of the tool.
Tool not found: If the specified tool name does not exist on the MCP server, the node will list available tools in the error message. Verify the tool name spelling and availability.
Transport errors: Errors during communication with the MCP server (e.g., SSE connection issues or command execution failures) will be reported. Review logs for detailed messages.
Unsupported operation: Selecting an unsupported operation will cause an error. Confirm the operation name is valid.