MCP Client Enhanced
Actions7
Overview
This node acts as an enhanced client for interacting with an MCP (Model Context Protocol) server, supporting multiple connection types and operations related to resources, prompts, and tools. It is designed for scenarios where users need to programmatically list, read, or manipulate AI model resources, prompts, and tools in a multi-tenant or single-tenant environment.
Common use cases include:
- Listing available AI resources or resource templates on the MCP server.
- Reading detailed information about a specific resource by its URI.
- Listing and executing tools provided by the MCP server.
- Retrieving prompt templates and generating prompts dynamically.
- Supporting different transport protocols (command line, HTTP streaming, SSE) for flexible integration.
For example, a user might list all available resources to discover what AI models or datasets are accessible, then read a specific resource's details, or execute a tool that performs a particular AI task using custom parameters.
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) |
| Operation | The action to perform on the MCP server. Options include: - Execute Tool - Get Prompt - List Prompts - List Resource Templates - List Resources - List Tools - Read Resource |
| Resource URI | URI of the resource to read (required when operation is "Read Resource") |
| Tool Name | Name of the tool to execute (required when operation is "Execute Tool") |
| Tool Parameters | JSON object with parameters to pass to the tool (required when operation is "Execute Tool") |
| Prompt Name | Name of the prompt template to get (required when operation is "Get Prompt") |
| Prompt Parameters | JSON object with parameters to pass to the prompt (optional, used with "Get Prompt") |
| Tenant ID | Tenant identifier for multi-tenant MCP servers (optional, used with "Get Prompt") |
Output
The output JSON structure depends on the selected operation:
- List Resources: Outputs
{ resources: [...] }β an array of available resources from the MCP server. - List Resource Templates: Outputs
{ resourceTemplates: [...] }β an array of resource templates. - Read Resource: Outputs
{ resource: {...} }β detailed data of a specific resource identified by URI. - List Tools: Outputs
{ tools: [...] }β an array of tools with their name, description, and input schema. - Execute Tool: Outputs
{ result: ... }β the result returned by executing the specified tool. - List Prompts: Outputs
{ prompts: [...] }β an array of available prompt templates. - Get Prompt: Outputs
{ prompt: ... }β the generated prompt content based on the template and parameters.
The node does not output binary data; all outputs are JSON objects representing structured data from the MCP server.
Dependencies
- Requires connectivity to an MCP server via one of the supported transports:
- Command Line interface (STDIO)
- HTTP Streamable protocol (recommended for real-time)
- Server-Sent Events (SSE) (deprecated)
- Requires appropriate credentials configured in n8n for the chosen connection type, including API URLs, commands, headers, and environment variables as needed.
- Uses external SDK packages for MCP client communication and schema validation.
- Environment variables may be used to configure command-line transport environments.
Troubleshooting
- Connection errors: If the node fails to connect to the MCP server, verify that the correct connection type and credentials are configured, including URLs, commands, and headers.
- Invalid JSON parameters: When providing tool or prompt parameters, ensure they are valid JSON objects. Errors parsing JSON will cause execution failure.
- Tool not found: Executing a tool that does not exist on the MCP server will throw an error listing available tools.
- No tools found: If the MCP server returns no tools, the node will warn and error out.
- Transport errors: Any transport-level errors (e.g., network issues, command failures) will be surfaced as node operation errors.
- Deprecated SSE transport: Avoid using SSE transport as it is deprecated; prefer HTTP streamable instead.