Actions7
Overview
This node acts as a client interface to an MCP (Model Context Protocol) server, enabling interaction with various MCP resources, tools, and prompts. It supports multiple connection types for communication, including command line (STDIO), HTTP streamable protocol, and deprecated Server-Sent Events (SSE). The node is useful in scenarios where you want to programmatically list available resource templates, execute specific tools, retrieve prompt templates, or read resources from the MCP server.
Practical examples:
- Listing all available resource templates to understand what data structures or models are accessible.
- Executing a tool on the MCP server by providing its name and parameters, useful for automation workflows.
- Fetching a specific prompt template to use in downstream processing or AI interactions.
- Reading a resource by its URI to obtain detailed information.
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) |
Output
The output JSON structure depends on the selected operation:
- listResourceTemplates: Outputs
{ resourceTemplates: [...] }— an array of available resource templates from the MCP server. - listResources: Outputs
{ resources: [...] }— an array of available resources. - readResource: Outputs
{ resource: {...} }— details of a specific resource identified by its URI. - listTools: Outputs
{ tools: [...] }— an array of tools with their names, descriptions, and input schemas. - executeTool: Outputs
{ result: ... }— the result returned by executing the specified tool with given parameters. - listPrompts: Outputs
{ prompts: [...] }— an array of available prompt templates. - getPrompt: Outputs
{ prompt: {...} }— details of a specific prompt template.
The node does not output binary data; all outputs are JSON objects representing the requested data or execution results.
Dependencies
- Requires an MCP server accessible via one of the supported connection types.
- Needs appropriate credentials configured in n8n for the chosen connection type:
- For Command Line (STDIO): a command with optional arguments and environment variables.
- For HTTP Streamable: URL endpoint and optional headers.
- For SSE (deprecated): URL endpoint and optional headers.
- Uses external MCP SDK packages internally to manage connections and operations.
- Environment variables prefixed with
MCP_can be used to pass additional environment settings when using the command line transport.
Troubleshooting
- Connection errors: If the node fails to connect to the MCP server, verify that the credentials and connection parameters (command, URLs, headers) are correctly set and reachable.
- No transport available: This error indicates missing or misconfigured credentials for the selected connection type.
- Tool not found: When executing a tool, if the specified tool name does not exist, ensure the tool name matches exactly one of the available tools listed by the node.
- Invalid tool parameters: Tool parameters must be valid JSON objects. Errors parsing parameters usually mean malformed JSON or incorrect parameter structure.
- Timeouts: The node uses default timeouts which can be overridden by credential settings. Long-running operations might require increasing these timeout values.
- Deprecated SSE transport: SSE connection type is deprecated; prefer using HTTP Streamable for real-time communication.
Links and References
- MCP Protocol Documentation (hypothetical link for reference)
- n8n Documentation on Custom Nodes
- LangChain Tools (related to dynamic tool creation)
- Zod Schema Validation (used internally for input schema validation)