Actions7
Overview
The "MCP Client" node's Default resource with the Execute Tool operation allows you to execute a specific tool available on an MCP (Model Context Protocol) server. This is useful for integrating external tools or models into your n8n workflows, enabling automation of tasks such as data processing, model inference, or other custom operations provided by the MCP server.
Common scenarios:
- Running AI/ML models hosted via MCP from within n8n.
- Automating data transformation or enrichment using external tools.
- Orchestrating complex workflows that require invoking specialized tools remotely.
Example:
You could use this node to call a text summarization tool on an MCP server, passing in a document and receiving the summary as output.
Properties
Display Name | Type | Description |
---|---|---|
Connection Type | options | Choose the transport type to connect to MCP server. Options: - Command Line (STDIO): Connects via local command line. - Server-Sent Events (SSE): Connects via SSE endpoint. |
Tool Name | string | Name of the tool to execute. This must match a tool available on the MCP server. Required. |
Tool Parameters | json | Parameters to pass to the tool in JSON format. Must be a valid JSON object. Required. |
Output
The node outputs a single item with the following structure:
{
"result": { /* The result returned by the executed tool. Structure depends on the tool. */ }
}
- The
result
field contains the response from the tool execution. Its structure will vary depending on the tool invoked and its output schema.
Dependencies
- External Services: Requires access to an MCP server, either via command-line interface or SSE endpoint.
- Credentials:
- For STDIO:
mcpClientApi
credentials (may include command, args, environment variables). - For SSE:
mcpClientSseApi
credentials (includes SSE URL, optional headers, and POST endpoint).
- For STDIO:
- Environment Variables: May use system environment variables, especially those prefixed with
MCP_
. - n8n Configuration: Ensure the appropriate credentials are set up in n8n for the selected connection type.
Troubleshooting
Common Issues:
Invalid Tool Name:
Error:Tool '<name>' does not exist. Available tools: ...
Resolution: Double-check the tool name. Use the "List Tools" operation to see available tools.Malformed Tool Parameters:
Error:Failed to parse tool parameters: ... Make sure the parameters are valid JSON.
Resolution: Ensure the "Tool Parameters" input is a valid JSON object (not array or primitive).Connection Errors:
Error:Failed to connect to MCP server: ...
Resolution: Verify your credentials, endpoint URLs, and network connectivity.Transport Error:
Error:Transport error: ...
Resolution: Check the configuration of your connection type and ensure the MCP server is reachable.General Execution Failure:
Error:Failed to execute tool '<name>': ...
Resolution: Review the error message for details; check tool parameters and server logs if possible.
Links and References
- Model Context Protocol (MCP) Documentation
- n8n Credentials Documentation
- JSON Validator (for checking tool parameters)