MCP Client icon

MCP Client

Use MCP client

Overview

This node acts as a client for the MCP (Model Context Protocol) server, enabling interaction with various MCP resources, tools, and prompts. It supports multiple connection types to communicate with the MCP server, including command line (STDIO), HTTP streamable protocol, and deprecated Server-Sent Events (SSE).

The "Read Resource" operation specifically allows users to read a resource from the MCP server by providing its URI. This is useful when you want to fetch detailed data or metadata about a particular resource managed by the MCP system.

Practical examples:

  • Fetching configuration or data files stored as MCP resources.
  • Retrieving templates or documents identified by their URIs for further processing.
  • Integrating MCP-managed content into workflows that require dynamic resource access.

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)
Resource URI The URI of the specific resource you want to read from the MCP server. This must be provided when using the "Read Resource" operation.

Output

The output JSON contains a single field:

  • resource: An object representing the data of the requested resource fetched from the MCP server. The exact structure depends on the resource but typically includes all relevant properties and content associated with the resource URI.

No binary data output is indicated for this operation.

Example output snippet:

{
  "resource": {
    /* resource data fields */
  }
}

Dependencies

  • Requires connectivity to an MCP server via one of the supported transports:
    • Command Line interface (STDIO) with a configured command and environment.
    • HTTP Streamable protocol endpoint with optional custom headers and timeout.
    • Deprecated SSE transport (not recommended).
  • Appropriate credentials must be configured in n8n for the chosen connection type, including API URLs, commands, authentication headers, and environment variables.
  • Environment variables starting with MCP_ can be passed to the command line transport environment.

Troubleshooting

  • Connection errors: If the node fails to connect to the MCP server, verify that the correct connection type is selected and that credentials (API URLs, commands, headers) are properly configured.
  • Timeouts: The HTTP and SSE transports have configurable timeouts; increase these if operations take longer than expected.
  • Invalid Resource URI: Ensure the resource URI is correctly formatted and exists on the MCP server.
  • Transport errors: Errors reported as "Transport error" indicate issues with the underlying communication channel; check network connectivity and server availability.
  • Operation not supported: Using an unsupported operation value will throw an error; ensure "readResource" is selected for reading resources.
  • Credential missing: If credentials for the selected connection type are not set, the node will fail to initialize the transport.

Links and References

Discussion