Overview
This node acts as a client interface to an MCP (Model Context Protocol) server, allowing users to interact with various MCP resources and tools. It supports multiple operations such as listing available tools, executing a specific tool with parameters, retrieving prompts, and reading resources by URI.
A common use case is automating interactions with AI or model-related tools exposed via the MCP server, enabling workflows that dynamically list or invoke these tools based on user input or other workflow data.
For example, you can use this node to:
- List all available tools on the MCP server to present options downstream.
- Execute a selected tool with custom JSON parameters and process its output.
- Retrieve prompt templates for further processing or display.
- Read specific resources identified by URIs.
The node supports two connection types to communicate with the MCP server: Command Line (STDIO) and 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) |
| Operation | The action to perform on the MCP server. Options include: - Execute Tool - Get Prompt - List Prompts - List Resources - List Tools - Read Resource |
| Resource URI | URI of the resource to read (required when operation is "Read Resource") |
| Tool Name | Name of the tool to execute (required when operation is "Execute Tool") |
| Tool Parameters | JSON object specifying parameters to pass to the tool (required when operation is "Execute Tool") |
| Prompt Name | Name of the prompt template to retrieve (required when operation is "Get Prompt") |
Output
The node outputs JSON data depending on the selected operation:
- List Tools: Outputs an array of tools, each with
name,description, and a list of input schema keys underschema. - Execute Tool: Outputs the result of the executed tool under the
resultfield. - List Prompts: Outputs an array of available prompts under
prompts. - Get Prompt: Outputs the requested prompt template under
prompt. - List Resources: Outputs an array of available resources under
resources. - Read Resource: Outputs the content of the specified resource under
resource.
The node does not output binary data; all outputs are JSON objects representing the requested data or results.
Dependencies
- Requires access to an MCP server endpoint.
- Supports two connection methods:
- Command Line (STDIO): Requires a command and arguments configured in credentials, plus environment variables optionally set for the subprocess.
- Server-Sent Events (SSE): Requires SSE URL and optional headers configured in credentials.
- Requires appropriate API authentication credentials depending on the connection type.
- Uses external libraries for schema validation and MCP client communication.
Troubleshooting
- Transport error: Indicates issues with the underlying connection to the MCP server. Check network connectivity, credentials, and configuration of the chosen connection type.
- Failed to connect to MCP server: Could be caused by incorrect endpoint URLs, missing or invalid credentials, or server downtime.
- No tools found from MCP client: The MCP server returned no tools; verify the server state and permissions.
- Tool does not exist: The specified tool name is not available on the MCP server. Use the "List Tools" operation to get valid tool names.
- Failed to parse tool parameters: The provided tool parameters JSON is invalid. Ensure it is well-formed JSON and represents an object.
- Invalid parameter type: Tool parameters must be a JSON object, not a string or array.
- Operation not supported: An unsupported operation was requested; verify the operation name.
Links and References
- MCP Protocol Documentation (example placeholder, replace with actual if known)
- n8n Documentation
- Zod Schema Validation Library
- LangChain Tools