Connecting LLMs to MCP-servers using the MCP-client package
We recently implemented an MCP client package in Midio that allows you to easily connect LLMs to any MCP server, as long as it supports the SSE transport. In this guide we’ll see how we can use the package, and show an example of how you can set up a local MCP server with a tunnel that allows Midio to connect to it.
How to set up the package
First, add the mcp-client
package using the package manager.

The first thing we do is to add an instance of Connect to MCP Server
. This function accepts a name and version for our client, which we can choose ourselves, and the URL of the server we want to connect to.

This node takes care of the whole song and dance of connecting, initializing and setting up long-lived communication channels with the server.
Making tools accessible to the LLM
To give our LLM node (for example open-ai Chat Complete
, which can be added from the package manager by searching for “open-ai”) access to the tools in our server, we can use the Get LLM Compatible Tools List
function. It retrieves the list of available tools from the server, and creates a handler function for each of them, which is automatically set up to relay any request from our LLM to be handled by the MCP server.
Now, all we have to do is connect the tools
output to the tools
input of our Chat Complete
node, and we’re good to go.

Finally, we disconnect from the server using Disconnect from MCP Server
.

Testing with the Todo-MCP example
Let’s connect to an actual server. If you don’t have your own at hand, you can set one up in Midio by following this guide.
We give our agent a system prompt so it understands it should manipulate a todo list, and then we can ask it to do something.
Here is a simple system prompt you can use:
You are a Todo list agent. You have access to performing todo list operations through various tools. You act on the users behalf to satisfy their request.
Click the play button on the Connect to MCP Server
node to run the flow.

Connecting to a local MCP server using localtunnel and mcp-proxy
Most MCP-servers you'll find on the internet are programs you are expected to run locally on your machine, or host somewhere yourself. They are also usually designed for the STDIO transport, which is a kind of protocol which is typically only used when both the client and server are run on the same machine.
Since Midio is hosted in the cloud, it can’t directly access your machine. But for testing purposes there are simple tools you can use to make this possible (we’ll use a tool called local tunnel). We can also easily create a mapping from STDIO to SSE using a tool called mcp-proxy.
Install dependencies
You need the python tool uv
and node
to do the following. Please install them first.
Then, in one terminal, run the following:
uv tool install mcp-proxy
mcp-proxy --port 1337 uvx mcp-server-git
The first line installs the mcp-proxy
tool, and the next one starts it with the mcp-server-git
MCP server as a target. You should first navigate to a local git repository with which you want the server to interact.
You can then run:
npx localtunnel --port 1337
To set up a tunnel to your local MCP server which your Midio client will be able to reach.
You should see something like the following:
npx localtunnel --port 1337
Need to install the following packages:
[email protected]
Ok to proceed? (y) y
your url is: <https://puny-mammals-kick.loca.lt>
You can then copy that URL into the Connect to MCP Server
node in midio.

Make sure you append "/sse" to the URL:
https://puny-mammals-kick.loca.lt/sse
You’re all set. You can now run the flow from the Connect to MCP Server
node, and for example use the following system and user prompts for your Chat Complete
node.
Here is a simple system prompt for testing:
You are a Git agent. You have access to performing git commands on a repo through various tools. You act on the users behalf to satisfy their request.

Next steps
You now have a simple MCP client flow set up, but the only way to interact with it is by manually running flows in the editor. Midio makes it super simple to expose your flows as API endpoints using the HTTP Endpoint
node, which you can read about here.
You can also check out these guides for how to connect your flows to a frontend made with Lovable.
Last updated
Was this helpful?