Smart MCP Client icon

Smart MCP Client

Connects to and interacts with an MCP server, discovering capabilities for AI Agents.

Overview

This node connects to an MCP (Model Context Protocol) server to perform various operations such as reading resources by URI, discovering available tools, resources, prompts, and resource templates, executing tools, and retrieving prompt templates. It supports two connection types: Command Line (STDIO) and Server-Sent Events (SSE). A common use case is to integrate AI agents with MCP servers to dynamically discover and interact with AI tools and resources, for example, reading a file resource or executing a specific AI tool remotely.

Properties

Name Meaning
Connection Type Selects the transport method to connect to the MCP server, either via command line interface (STDIO) or server-sent events (SSE). This affects how the node communicates with the MCP server.
Resource URI The URI of the resource to read from the MCP server, such as a file path (file:///path/to/file) or database entry (db://table/ID). Required when performing the 'Read Resource' operation.

Output

JSON

  • tools - Array of discovered tools with their name, description, JSON schema, and metadata (only for 'discoverCapabilities' operation).
  • resources - List of available resources from the MCP server (for 'listResources' operation).
  • resourceTemplates - List of resource templates available on the MCP server (for 'listResourceTemplates' operation).
  • prompts - List of available prompt templates (for 'listPrompts' operation).
  • json - Result object from reading a resource, executing a tool, or getting a prompt, depending on the operation. Parsed JSON if possible, otherwise raw data.

Dependencies

  • An MCP server accessible via either a command line client or SSE endpoint.
  • Credentials for MCP client connection, including command, arguments, environment variables for 'cmd' connection, or SSE URL and headers for 'sse' connection.

Troubleshooting

  • Connection errors may occur if the MCP server is unreachable or credentials are incorrect. Verify connection parameters and credentials.
  • Parsing errors can happen if the resource content is not valid JSON when JSON parsing is attempted. The node falls back to returning raw content in such cases.
  • If required parameters like 'resourceUri' for reading a resource are missing or invalid, the node throws an error. Ensure all required inputs are provided and correctly formatted.
  • Errors during tool execution or resource reading are logged with detailed messages. Check logs for specific error details to diagnose issues.

Discussion