Overview
This node acts as a client for interacting with an MCP (Model Context Protocol) server, allowing users to perform various operations such as reading resources, listing available tools or prompts, executing tools, and retrieving prompt templates. It supports two connection types: Command Line (STDIO) and Server-Sent Events (SSE), providing flexibility depending on the deployment environment.
A common use case is integrating AI or model-driven workflows where you need to dynamically fetch or manipulate resources managed by the MCP server. For example, you might read a specific resource by its URI to get up-to-date data or execute a tool that performs a specialized task within your automation pipeline.
Specifically, the Read Resource operation reads a resource from the MCP server given its URI, returning the resource's content in JSON format.
Properties
Name | Meaning |
---|---|
Connection Type | Choose the transport type to connect to the MCP server. Options: - Command Line (STDIO) - Server-Sent Events (SSE) |
Resource URI | The URI of the resource to read from the MCP server. This is required for the Read Resource operation. |
Output
The output JSON contains a single field:
resource
: An object representing the resource fetched from the MCP server corresponding to the provided URI. The exact structure depends on the resource but is returned as-is from the MCP server.
No binary data output is produced by this operation.
Example output JSON:
{
"resource": {
/* resource data fetched from MCP server */
}
}
Dependencies
- Requires connectivity to an MCP server.
- Depending on the chosen connection type:
- For Command Line (STDIO): Requires configuration of a command-line client executable with appropriate arguments and environment variables.
- For Server-Sent Events (SSE): Requires SSE endpoint URL and optional headers configured via credentials.
- Credentials must be set up in n8n to provide either the command line client details or SSE API access.
- Environment variables prefixed with
MCP_
can be used to pass additional environment settings to the command line client.
Troubleshooting
- Transport error: If the node throws a transport error, verify that the connection type is correctly configured and that the MCP server is reachable via the specified method.
- Failed to connect to MCP server: Check network connectivity, credentials validity, and ensure the MCP server is running and accessible.
- Resource not found or invalid URI: Ensure the
Resource URI
parameter is correct and that the resource exists on the MCP server. - Missing or invalid credentials: Make sure the required credentials for the selected connection type are properly configured in n8n.
- Unexpected errors during execution: Review debug logs if enabled; they provide detailed information about the connection setup and operations performed.