1. Tubelator AI
  2. >
  3. Videos
  4. >
  5. Science & Technology
  6. >
  7. Step-by-Step Guide to Setting Up MCP Servers and Tools for Agents

Step-by-Step Guide to Setting Up MCP Servers and Tools for Agents

Available In Following Subtitles
English
Variant 1
Posted on:
Learn how to create and run MCP servers with tools in Cloud Desktop, using a simple example of a tool that counts R's in a word. Follow a step-by-step process from opening your IDE, creating a new folder, setting up the environment, and activating it.
tubelator logo

Instantly generate YouTube summary, transcript and subtitles!

chrome-icon Install Tubelator On Chrome

Video Summary & Chapters

No chapters for this video generated yet.

Video Transcript

0:00
Let me show you how to set up a simple MCP server with a tool and get it running in
0:06
Cloud Desktop. If you're not familiar with what an MCP server is, you can think of it like
0:10
exposing a tool or set of tools to your AI assistant or agent.
0:15
So I created a tool that counts the number of R's in a given word.
0:19
And so here in Cloud Desktop, I say use the count R tool to count the R's in
0:24
strawberry. Here it says, I'll use the count R tool to count the number of R letters in
0:29
the word strawberry. There it is. The word strawberry contains three letter R's. Very simple,
0:35
but it should give you the basis to build any tool that you want. Let me show you how I did it now.
0:41
So the first thing you're going to do is open up your IDE of preference. Today I'm going to be
0:45
using Windsurf. Then you're going to open up the terminal. So the first thing you're going to do
0:49
is create a new folder. So you can create it anywhere and you just type MKDIR and then the
0:54
folder name. So count our
0:56
server. From there, hit enter. I already have that folder created, so then I'm just going
1:01
to cd into it. So count our server. Then the next thing you're going to do is spin up a
1:06
new environment. So to do that, you type python-m venv.vnv and then hit enter. Then you activate
1:14
the environment. And if you're on Windows, this is how you do it. .vnv backslash scripts
1:19
backslash activate hit enter. And you can see it is activated right there. Now, if you're
1:25
on a Mac, this is how you do it.
1:27
Source.vmv.bin.activate.
1:31
But now you can see there is our environment and there we are in the right folder.
1:37
The next thing you're going to do is install the MCP library.
1:41
So pip install MCP and then hit enter.
1:44
And then it should install everything you need.
1:45
And now you're ready to write your actual server.
1:47
Create a new file, server.py.
1:50
And it's going to be a Python file, obviously.
1:51
Now, this is a.
1:53
slightly more complex version of an MCP server than what is absolutely necessary.
1:59
I just put some error handling around it and just a little bit more robustness.
2:02
So let me walk you through what it is.
2:04
First thing you're going to do is import.
2:06
So from MCP.server.fastmcp import fastmcp.
2:11
I also decided to make it a little bit more robust.
2:14
Import time, import signal, import sys.
2:16
The number of lines you really need to get an MCP server up and running is pretty minimal,
2:21
probably about less than a dozen.
2:23
But again, I decided to make it a little bit more robust.
2:26
Here we have the signal handler just giving us some nice output
2:30
and handling the control C gracefully.
2:32
This is where the MCP server starts.
2:34
So you want to declare a new variable and it equals fast MCP.
2:39
And here are the parameters you need.
2:40
First, you need a name.
2:41
We're going to count it the count R.
2:42
This is what you're going to reference when you're calling the tool.
2:45
So you can in a prompt explicitly say use the count R.
2:49
tool to do this. Then you're going to give it the host URL.
2:53
So if you're hosting this on a server somewhere, this would be different.
2:56
But since I'm running everything locally,
2:57
I'm giving it our local host address, 127.0.0.1.
shape-icon

Download extension to view full transcript.

chrome-icon Install Tubelator On Chrome