Resource mentioned in this lesson: Python MCP Server: Connect LLMs to Your Data
Setting Up
00:00 You’re now ready to set up everything so you can start writing your MCP client. But an MCP client always connects to a server, so you need to have an MCP server to be able to check that everything is working as it’s supposed to be. The first step is downloading the accompanying MCP server, which is a slight modification of the MCP server you’ll develop in the Real Python tutorial linked before.
00:29
You’re going to download the code, and then, since this MCP server is managed as a uv project, you’re going to install it as a tool so that you get access to a command that you can use to run your server.
00:45 And then you’re going to initialize the project for the MCP client. Go ahead and open your terminal in a folder where you’re going to be working, and make sure you download the accompanying MCP server to this folder.
01:01
So you can see the mcp-data-tool directory, you’re going to cd into it, and if you take a look at the contents of the directory, you will find that it’s populated already with some code, with some data, and with a couple of files that are relevant to projects that are managed by tools such as uv. If you run the command uv run mcp-data, if this is the first time you run such a command, you should see some outputs from uv telling you the Python version that is being used and that the virtual environment is being set up, and then it will look like it’s hanging.
01:41 So you have no explicit error messages, but it feels like nothing is happening. But the truth is, if you get to this stage, your MCP server is running just fine, which is what you want.
01:53
Now you’re going to need to press Ctrl-C a couple of times to interrupt it, and then you’re going to want to install this as a tool, because right now the only way to run this server is through the command uv run mcp-data.
02:09
What you want is to be able to write the command mcp-data from anywhere and run this server. To do that, you’re going to write uv tool install. This is the subcommand that uv uses to install tools.
02:24
Then you’re going to use the dot to say that you want to install this project you’re on, and you’re going to add -e, which makes this installation editable, which has a couple of benefits and simplifies your life when dealing with the resources embedded in this project. It also means that if you update the code in the server, the tool that is installed will automatically pick up those changes.
02:49 You’re going to press Enter, you give it a second, and you should see a success message telling you that the executable was installed.
02:59
To check that this worked, you can move to a completely different working directory and try running the command mcp-data. If you press Enter, you will see that it looks like your terminal is hanging, but that’s because the server is running.
03:13 Again, press Ctrl-C a couple of times to interrupt it entirely.
03:18 Once the MCP server is installed,
03:22
cd back up into your workspace, and now you’re going to initialize the project for the client. And for that, you run the command uv init to initialize a project, --app --package. These are a couple of settings that are useful and that will allow uv to create your project with some boilerplates already in place.
03:43
And then you give it a name, for example, mcp-client. You press Enter, and you will instantaneously see a success message. Now if you ls to take a look at the contents of your current directory, you will see there is a new folder, mcp-client. You can cd into it, and if you list its contents, you will once again find some files and folders created for you. At this stage, you’re now ready to start developing your MCP client, which is what you’ll do in the next lesson.
Become a Member to join the conversation.
