Loading video player…

Preparing to Create Your MCP Client

Resource mentioned in this lesson: MCP Python SDK

00:00 Now that everything is set up, you’re ready to start writing your MCP client that’s going to connect to MCP servers. Now remember that an MCP server exposes prompts, resources, and tools for LLMs and agents in general to use them.

00:16 But agents and these other tools can only connect to the server if they implement an MCP client. So it’s the client that establishes the connection to then request whatever is needed from the server.

00:28 And this is what you will develop, a client that can connect to arbitrary servers. To start off, you’re going to create a basic client scaffolding. And by basic, it doesn’t mean it’s going to be easy to understand. It just means it doesn’t have a lot of functionality.

00:43 You’re going to hardcode the commands to a functioning MCP server because you want the clients to be able to test different servers. But in the beginning, you’re going to use the MCP server from the previous lesson, which you know works, to check that your client is working.

00:59 And then you’re going to test that the actual connection can be made. A couple of notes are in order though. The code isn’t supposed to be immediately obvious.

01:09 So you’re going to encounter asyncio, which hopefully you already have a little bit of experience with. But you’re going to be using MCP, which is a library. And so you’re going to be using classes, methods, functions that are part of the library and that are likely to be new to you.

01:25 Together with that note, make sure you write the code yourself. Writing the code forces you to process the code you’re reading. It forces you to digest what you’re looking at. And it’s going to greatly improve your learning experience.

01:38 Finally, make sure you have the MCP documentation by your side because it’s going to be helpful to take a look at it when you’re using a new class or method.

01:50 Once you’re ready to start coding, move on to the next lesson.

Become a Member to join the conversation.