Actions7
Overview
This node acts as a client for the MCP (Model Context Protocol) server, enabling interaction with various MCP resources and tools. Specifically, the Read Resource operation allows users to read a resource by specifying its URI. This is useful in scenarios where you want to fetch structured data or content from an MCP-managed resource repository.
Practical examples include:
- Retrieving configuration or metadata stored as MCP resources.
- Accessing real-time or static data exposed via MCP resource URIs.
- Integrating MCP resource data into workflows for further processing or decision-making.
The node supports multiple connection types to communicate with the MCP server, including command line (STDIO), HTTP streamable protocol, and deprecated Server-Sent Events (SSE).
Properties
| Name | Meaning |
|---|---|
| Connection Type | Choose the transport type to connect to 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 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 retrieved from the specified MCP resource URI. The exact structure depends on the resource content but generally includes all relevant properties and values of that resource.
The node does not output binary data for this operation.
Example output snippet:
{
"resource": {
/* resource data fetched from MCP server */
}
}
Dependencies
- Requires access to an MCP server endpoint.
- Depending on the selected connection type, the node requires appropriate credentials configured in n8n:
- For Command Line (STDIO): Credentials providing the command and environment variables to run the MCP client CLI.
- For HTTP Streamable: Credentials containing HTTP URLs and headers for streaming communication.
- For Server-Sent Events (SSE) (deprecated): Credentials with SSE URL and headers.
- Environment variables starting with
MCP_can be used to pass additional environment settings to the command line transport. - The node uses internal MCP SDK clients and transports to handle communication.
Troubleshooting
- Transport error: If the node throws a "Transport error" message, verify that the connection type and credentials are correctly configured and that the MCP server is reachable.
- Failed to connect to MCP server: Indicates issues establishing the connection; check network connectivity, credentials, and server availability.
- No transport available: Happens if credentials for the selected connection type are missing or invalid.
- Operation not supported: Occurs if an unsupported operation name is provided.
- Invalid Resource URI: Ensure the URI is correctly formatted and points to an existing resource on the MCP server.
- Timeouts: The node has configurable timeouts depending on the connection type; increase timeout values if operations take longer than expected.
- Deprecated SSE usage: SSE connection type is deprecated; prefer switching to HTTP Streamable for better support and stability.
Links and References
- Model Context Protocol (MCP) Documentation
- n8n Documentation
- LangChain Tools
- Zod Schema Validation (used internally for input validation)