MCP Client icon

MCP Client

Use MCP client

Overview

This node acts as a client interface to an MCP (Model Context Protocol) server, allowing users to interact with various MCP resources, tools, and prompts. It supports two connection types: Command Line (STDIO) and Server-Sent Events (SSE). The node can list available resources, read specific resources by URI, list and execute tools, and manage prompt templates.

Common scenarios include:

  • Retrieving metadata or data from MCP resources.
  • Executing specialized tools provided by the MCP server with custom parameters.
  • Fetching and listing prompt templates for use in workflows.
  • Integrating MCP capabilities into automation pipelines via command line or SSE transport.

Example use cases:

  • Automating retrieval of resource lists for dynamic workflow branching.
  • Running a tool on the MCP server to process input data and returning results.
  • Fetching prompt templates to dynamically generate content or queries.

Properties

Name Meaning
Connection Type Choose the transport type to connect to MCP server. Options: "Command Line (STDIO)", "Server-Sent Events (SSE)"
Operation Select the operation to perform. Options: "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 of parameters to pass to the tool (required when Operation is "Execute Tool")
Prompt Name Name of the prompt template to get (required when Operation is "Get Prompt")

Output

The output JSON structure depends on the selected operation:

  • List Resources: Outputs { json: { resources: [...] } } where resources is an array of available MCP resources.
  • Read Resource: Outputs { json: { resource: {...} } } containing the data of the specified resource.
  • List Tools: Outputs { json: { tools: [...] } } where each tool includes its name, description, and input schema keys.
  • Execute Tool: Outputs { json: { result: <tool execution result> } } which contains the result returned by the executed tool.
  • List Prompts: Outputs { json: { prompts: [...] } } listing available prompt templates.
  • Get Prompt: Outputs { json: { prompt: {...} } } with details of the specified prompt template.

The node does not output binary data.

Dependencies

  • Requires access to an MCP server either via:
    • A command line interface (STDIO) with a configured command and environment variables.
    • Server-Sent Events (SSE) transport with URL and optional headers.
  • Requires credentials for authentication depending on the connection type:
    • An API key credential for the command line connection.
    • An API key credential for the SSE connection.
  • Environment variables prefixed with MCP_ are passed to the command line environment.
  • Uses external MCP SDK packages for client communication and transport handling.

Troubleshooting

  • Connection errors: If the node fails to connect to the MCP server, verify that the correct connection type is selected and that credentials and environment variables are properly configured.
  • Transport errors: Errors related to the underlying transport (command or SSE) will throw descriptive messages. Check network connectivity and endpoint URLs.
  • Invalid tool parameters: When executing a tool, ensure the parameters are valid JSON objects. Parsing errors will be reported with guidance.
  • Tool not found: Attempting to execute a non-existent tool will return an error listing available tools.
  • No tools found: If no tools are returned from the MCP server, the node throws an error indicating this.
  • Unsupported operations: Selecting an unsupported operation will cause an error.
  • JSON parsing issues: For tool parameters, invalid JSON strings will cause errors; ensure proper formatting.

Links and References

Discussion