Actions7
Overview
This node acts as a client for interacting with an MCP (Model Context Protocol) server, enabling various operations such as reading resources, listing tools, prompts, and resource templates, and executing specific tools on the MCP server. It supports multiple connection types to communicate with the MCP server, including command line (STDIO), HTTP streamable protocol, and deprecated Server-Sent Events (SSE).
A common use case is integrating AI or model-driven workflows where you need to fetch or manipulate resources managed by the MCP server, execute specialized tools remotely, or retrieve prompt templates dynamically. For example, you might read a resource by its URI to get structured data or execute a tool that performs a complex transformation or analysis.
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 resource to read from the MCP server. Required when using the "Read Resource" operation. |
Output
The output JSON structure depends on the selected operation. For the Read Resource operation, the output contains:
{
"resource": { /* The resource object fetched from the MCP server by the specified URI */ }
}
- The
resourcefield holds the full data of the requested resource. - The node does not output binary data for this operation.
Dependencies
- Requires access to an MCP server endpoint supporting one of the connection types.
- Depending on the connection type, appropriate credentials must be configured in n8n:
- For Command Line (STDIO): Credentials providing the command and environment variables.
- For HTTP Streamable: Credentials with the HTTP stream URL, optional POST endpoint, headers, and timeout settings.
- For Server-Sent Events (SSE) (deprecated): Credentials with SSE URL, headers, and timeout.
- Environment variables starting with
MCP_can be used to pass additional environment configuration to the command line transport. - The node uses internal MCP SDK clients and transports but requires no additional external setup beyond credentials and MCP server availability.
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 MCP server: Indicates issues establishing the connection; check network connectivity, URLs, credentials, and any required headers or environment variables.
- No transport available: Means no valid transport could be created; ensure the chosen connection type has corresponding credentials set up.
- Resource not found or invalid URI: When reading a resource, ensure the
Resource URIis correct and accessible on the MCP server. - Timeouts: The node uses default timeouts (e.g., 60 seconds for HTTP/SSE). Adjust these in credentials if needed for slow responses.
- Deprecated SSE usage: SSE connection type is deprecated; prefer switching to HTTP Streamable for better support and future compatibility.
Links and References
- MCP Protocol Documentation (hypothetical link)
- n8n Documentation on Custom Nodes
- Zod Schema Validation Library (used internally for input validation)
- LangChain Tools (related to dynamic tool execution)