MCP Client Bearer icon

MCP Client Bearer

Use MCP client with Bearer Token Authentication

Overview

This node, named "MCP Client Bearer," connects to an MCP (Model Context Protocol) server using a Bearer Token for authentication. It supports two connection types: Command Line (STDIO) and Server-Sent Events (SSE). The node allows users to perform various operations such as listing available tools, executing a specific tool with parameters, retrieving prompts, reading resources, and listing resource templates.

The List Tools operation fetches the list of available tools from the MCP server. Each tool includes its name, description, and input schema, which describes the expected parameters for that tool.

Common scenarios where this node is beneficial:

  • Integrating with an MCP server to dynamically discover and use AI or automation tools.
  • Automating workflows by executing specific tools on the MCP server with custom parameters.
  • Fetching metadata about available tools to build user interfaces or validation logic.
  • Accessing prompt templates or resource data managed by the MCP server.

Practical example:

A user wants to automate document processing by invoking specialized tools hosted on an MCP server. First, they use this node's List Tools operation to retrieve all available tools and their input requirements. Then, they select a tool and execute it with appropriate parameters in subsequent workflow steps.


Properties

Name Meaning
Bearer Token Your API Bearer token for authentication, required especially when using the SSE connection type.
Connection Type Transport method to connect to the MCP server. Options:
- Command Line (STDIO): Runs a local command/process.
- Server-Sent Events (SSE): Connects via SSE endpoint over HTTP.
SSE URL Full URL for the Server-Sent Events endpoint (required if Connection Type is SSE).
SSE Timeout (Ms) Timeout in milliseconds for SSE requests (default 60000 ms).
SSE Messages POST Endpoint (Optional) Optional separate URL endpoint for posting messages if different from the SSE URL.
SSE Additional Headers (JSON) Additional HTTP headers to send with SSE requests, specified as a JSON object (e.g., {"X-Custom-Header": "value"}).
Command The command to execute for the MCP server process (required if Connection Type is Command Line).
Arguments (Space Separated) Arguments to pass to the command, separated by spaces (optional).
Environment Variables (Key=value Pairs, One per Line) Additional environment variables for the command process, each on a new line (optional).
Operation The action to perform. For this summary, the relevant value is listTools which retrieves available tools from the MCP server.

Output

The output JSON structure for the List Tools operation contains a tools array. Each element in this array represents a tool with the following fields:

  • name: The tool's name.
  • description: A textual description of what the tool does.
  • schema: A JSON Schema representation of the tool's input parameters, describing the expected inputs and their types.

Example output snippet:

{
  "tools": [
    {
      "name": "exampleTool",
      "description": "Executes example functionality",
      "schema": {
        "type": "object",
        "properties": {
          "param1": { "type": "string", "description": "First parameter" },
          "param2": { "type": "number", "description": "Second parameter" }
        },
        "required": ["param1"]
      }
    }
  ]
}

If no tools are found, the output will contain an empty tools array.

The node does not output binary data.


Dependencies

  • Requires an active MCP server accessible either via:
    • A local command-line executable (STDIO transport), or
    • An HTTP Server-Sent Events (SSE) endpoint.
  • Requires a valid Bearer Token for authentication, especially for SSE connections.
  • Uses internal MCP client SDK libraries for communication.
  • If using the command line connection, the specified command must be executable in the environment where n8n runs.
  • For SSE connection, the SSE URL and optionally additional headers must be correctly configured.

Troubleshooting

  • Missing Required Parameters:
    Errors occur if mandatory parameters like Bearer Token, SSE URL (for SSE), or Command (for CMD) are missing. Ensure these are provided.

  • Invalid JSON in Additional Headers:
    If the SSE Additional Headers property contains invalid JSON, the node throws an error. Validate JSON syntax before saving.

  • Connection Failures:
    Failure to connect to the MCP server may result from incorrect URLs, network issues, or invalid tokens. Check connectivity and credentials.

  • No Tools Found:
    If the MCP server returns no tools, the output will have an empty array. Confirm that the MCP server has tools registered.

  • Command Execution Issues:
    When using the command line connection, ensure the command path and arguments are correct and that the environment variables are properly set.

  • Tool Listing Errors:
    Unexpected errors during tool listing will throw descriptive errors. Review logs for details.


Links and References

Discussion