Actions7
Overview
This node acts as a client interface to an MCP (Model Context Protocol) server, enabling various operations such as listing available tools, prompts, resources, and resource templates, reading specific resources by URI, retrieving prompt templates, and executing specific tools with parameters. It supports multiple connection types to communicate with the MCP server, including command line (STDIO), HTTP streamable protocol, and deprecated Server-Sent Events (SSE).
Common scenarios for this node include:
- Automating interactions with AI or model context services by executing predefined tools.
- Fetching and managing prompt templates and resources dynamically.
- Integrating external model context resources into workflows.
- Real-time communication with MCP servers using different transport protocols.
Practical examples:
- Executing a text generation tool with custom parameters to generate content.
- Listing all available AI tools and selecting one based on workflow logic.
- Retrieving a prompt template to customize user interactions.
- Reading a resource by its URI to fetch metadata or content for further processing.
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:
- listResources: Outputs
{ "resources": [...] }— an array of available resources. - listResourceTemplates: Outputs
{ "resourceTemplates": [...] }— an array of resource templates. - readResource: Outputs
{ "resource": {...} }— details of the specified resource. - listTools: Outputs
{ "tools": [...] }— an array of tools with their name, description, and input schema. - executeTool: Outputs
{ "result": ... }— the result returned from executing the specified tool. - listPrompts: Outputs
{ "prompts": [...] }— an array of available prompt templates. - getPrompt: Outputs
{ "prompt": {...} }— details of the specified prompt template.
The node does not output binary data; all outputs are JSON objects representing the requested data or execution results.
Dependencies
- Requires connection to an MCP server via one of the supported transport protocols.
- Needs appropriate credentials configured in n8n for the chosen connection type:
- An API key or authentication token for HTTP Streamable or SSE transports.
- Command and environment variables for the Command Line (STDIO) transport.
- Uses external MCP SDK packages internally to manage communication and operations.
Troubleshooting
- Connection errors: If the node fails to connect to the MCP server, verify that the correct connection type is selected and that credentials or command configurations are properly set.
- Invalid tool parameters: When executing a tool, ensure the parameters are valid JSON objects. Parsing errors will cause execution failure.
- Tool not found: Attempting to execute a non-existent tool will throw an error listing available tools.
- No tools found: If the MCP server returns no tools, the node will warn and error out; check server configuration.
- Timeouts: The node uses configurable timeouts depending on the connection type; long-running operations may require adjusting these settings.
- Deprecated SSE transport: Avoid using SSE as it is deprecated; prefer HTTP Streamable for real-time communication.
Links and References
- Model Context Protocol (MCP) Documentation (hypothetical link for reference)
- n8n Custom Node Development
- Zod Schema Validation Library
- LangChain Tools
If you need details about other operations or resources, please provide their names.