Tools & MCP

In the previous Interacting with API tutorial, we explored how to enable LLMs to call external APIs. To enhance the user experience, Flowise provides a list of prebuilt tools. Refer to the Tools section for the full list of available integrations.

In cases where the tool you need is not yet available, you can create a Custom Tool to suit your requirements.

Custom Tool

We are going to use the same Event Management Server, and create a custom tool which can call the HTTP POST request for /events.

  • Tool Name: create_event

  • Tool Description: Use this when you want to create a new event.

  • Input Schema: A JSON schema of the API request body which allows LLM to know how to automatically generate the correct JSON body. For instance:

  • Javascript Function: The actual function to execute once this tool is called

const fetch = require('node-fetch');
const url = 'http://localhost:5566/events';
const options = {
    method: 'POST',
    headers: {
        'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      name: $name,
      location: $location,
      date: $date
    })
};
try {
    const response = await fetch(url, options);
    const text = await response.text();
    return text;
} catch (error) {
    console.error(error);
    return '';
}

How to use function:

  • You can use any libraries imported in Flowise.

  • You can use properties specified in Input Schema as variables with prefix $:

    • Property from Input Schema = name

    • Variable to be used in Function = $name

  • You can get default flow config:

    • $flow.sessionId

    • $flow.chatId

    • $flow.chatflowId

    • $flow.input

    • $flow.state

  • You can get custom variables: $vars.<variable-name>

  • Must return a string value at the end of function

Use custom tool on Agent

After custom tool has been created, you can use it on the Agent node.

From the Tool dropdown, select the custom tool. You can also turn on Return Direct if you want to directly return the output from custom tool.

Use custom tool on Tool

It can also be used as a Tool Node in a determined workflow scenario. In this case, Tool Input Arguments must be explicitly defined and filled with values, because there is no LLM to automatically determine the values.

MCP

MCP (Model Context Protocol) provides a standardized way to connect AI models to different data sources and tools. In other words, instead of relying on Flowise built in tools or creating custom tool, one can uses MCP servers that have been created by others. MCP is widely considered an industry standard and is typically supported and maintained by the official providers. For example, the GitHub MCP is developed and maintained by the GitHub team, with similar support provided for Atlassian Jira, Brave Search, and others. You can find the list of supported servers here.

Custom MCP

Apart from the prebuilt MCP tools, the most powerful feature is Custom MCP, which allows users to connect to any MCP server of their choice.

MCP follows a client-server architecture where:

  • Hosts are LLM applications (like Flowise) that initiate connections

  • Clients maintain 1:1 connections with servers, inside the host application (like Custom MCP)

  • Servers provide context, tools, and prompts to clients (example servers)

To handle the actual communication between clients and servers. MCP supports multiple transport mechanisms:

  1. Stdio transport

    • Uses standard input/output for communication

    • Ideal for local processes

  2. Streamable HTTP transport

    • Uses HTTP with optional Server-Sent Events for streaming

    • HTTP POST for client-to-server messages

Stdio

Stdio transport enables communication through standard input and output streams. This is particularly useful for local integrations and command-line tools.

Only use this when using Flowise locally, not when deployed to cloud services. This is because running command like npx will install the MCP server package (ex: @modelcontextprotocol/server-sequential-thinking) locally, and it often takes long time for that.

It is more suited for desktop application like Claude Desktop, VS Code etc.

NPX command

{
  "command": "npx",
  "args": [
    "-y",
    "@modelcontextprotocol/server-sequential-thinking"
  ]
}

For Windows, refer to this guide.

Docker command

The Docker command is suitable when the machine running Flowise also has access to Docker. However, it is not suitable for deployments on cloud services where Docker access is restricted or unavailable.

{
  "command": "docker",
  "args": [
    "run",
    "-i",
    "--rm",
    "mcp/sequentialthinking"
  ]
}

Docker provides a list of MCP servers, which can be found here. Here's how it works:

  1. Make sure Docker is running.

  2. Locate the MCP server configuration and add it to Custom MCP. For example: https://hub.docker.com/r/mcp/sequentialthinking

  3. Refresh the Available Actions. If the image is not found locally, Docker will automatically pull the latest image. Once the image is pulled, you will see the list of available actions.

Unable to find image 'mcp/sequentialthinking:latest' locally
latest: Pulling from mcp/sequentialthinking
f18232174bc9: Already exists
cb2bde55f71f: Pull complete
9d0e0719fbe0: Pull complete
6f063dbd7a5d: Pull complete
93a0fbe48c24: Pull complete
e2e59f8d7891: Pull complete
96ec0bda7033: Pull complete
4f4fb700ef54: Pull complete
d0900e07408c: Pull complete
Digest: sha256:cd3174b2ecf37738654cf7671fb1b719a225c40a78274817da00c4241f465e5f
Status: Downloaded newer image for mcp/sequentialthinking:latest
Sequential Thinking MCP Server running on stdio

When to use

  • Building command-line tools

  • Implementing local integrations

  • Needing simple process communication

  • Working with shell scripts

We will use Github Remote MCP as an example. The beautiful part of Remote GitHub MCP server, you don’t need to install or run it locally, new updates are applied automatically.

Step 1: Create a variable for Github PAT

In order to access the MCP server, we need to create a Personal Access Token from Github. Refer to guide. Once PAT has been created, create a variable to store the token. This variable will be used in Custom MCP.

Step 2: Create Custom MCP

Create an Agent node, and add a new Custom MCP tool. For streamable HTTP, we just need to put in the URL and other necessary headers. You can use variables in the MCP Server Config with double curly braces {{ }} and prefix $vars.<variableName>.

{
  "url": "https://api.githubcopilot.com/mcp/",
  "headers": {
    "Authorization": "Bearer {{$vars.githubPAT}}",
  }
}

Step 3: Select the actions

If the MCP server configuration is working correctly, you can refresh the Available Actions, and Flowise will automatically pull in all available actions from the MCP server.

Example Interactions:

Give me the most recent issue

The agent is able to identify the appropriate actions from MCP and use them to answer the user's query.

When to use

Use Streamable HTTP when:

  • Building web-based integrations

  • Needing client-server communication over HTTP

  • Requiring stateful sessions

  • Supporting multiple concurrent clients

  • Implementing resumable connections

Video Tutorial

Last updated