Setting Up an MCP Client
00:00 Now that you’ve created an MCP server, it’s time to test it. But in order to test the server, you need a client. You could implement your own custom client, but it’s much easier if you use a client from a program that already supports custom MCP servers, such as Cursor.
00:19 Cursor is an editor that has a free plan that allows you to play with custom MCP servers, and that’s what you’re going to use in this lesson. But note that tools like Codex CLI, Claude Code, and similar tools, those also support connecting to custom MCP servers.
00:38 Just check their documentation on how to do it. In this lesson, you’re going to use Cursor. So go ahead and open Cursor, and once you’ve opened Cursor, go to Cursor Settings.
00:53 Once you’ve opened the Cursor Settings, in the General tab, you’ll want to sign in with your free Cursor account. Clicking the Sign In button should open a web browser where you can type your email address, your password, and connect to Cursor.
01:11 So go ahead and do that. Once you’re in, you will see your email on the left. After logging in, still inside the settings, find the tab that says Tools & MCPs and click on that.
01:24 You will see a section, Installed MCP Servers. If you’re just using Cursor for the first time or if you’ve never installed a custom MCP server, this should be empty.
01:35 You’re going to go ahead and click the button that says Add Custom MCP, which should open a JSON file with a list of all your custom MCP servers. Installing your server really is just a matter of configuring the command that needs to run to start the MCP server.
01:55
To configure your MCP server, all you need to do is add an entry to the mcpServers dictionary. You’re going to do that by specifying the server name, the command that runs the server, and then the description of the server.
02:10 So you can call it the Sales Real Python server, perhaps, so you remember it’s the MCP server from this video course. And then you’re going to create a new JSON dictionary and you’re going to write the command that runs the server.
02:27
If you used uv, that should be uv run main.py. Now the thing is, this main.py file is in a specific directory and uv also needs to be able to pick up the dependencies. What you want to do is add the --directory option, which you’re then going to point uv to the directory in which the project lives. On this machine, that’s going to be /Users/rodrigogs/Documents /realpython/mcp-data.
03:00 For you, the path will be different. Once you set the command, you’re going to add a comma at the end of the string. That’s very important. Add the comma, change lines, and then you add a brief description of the MCP server. You can say something like, a set of tools that you can use to look up sales data. You close the string and you save the file.
03:26 Once you save the JSON file, if there are no errors in the syntax, you should be able to go back to your Cursor Settings and you should already see your Sales Real Python server with a green dot and a listing saying that one tool is enabled.
03:44 If this is green, it means that your MCP server is running just fine and Cursor was able to connect to it. You’ll also want to make sure that the toggle is on.
03:54
So by toggling it off and on, you can connect and disconnect your server. And if you click the listing, you will see the function get_sales_from_customer that you defined in the previous lesson.
04:06 If there are any issues here, double check the JSON syntax and double check your Python file for errors.
04:14 Both the JSON file and the Python file are provided as downloadable materials, so you can compare yours with the reference materials in case you cannot find the issue.
04:23 Once the MCP server is set up, move on to the next lesson where you’ll use an LLM to interact with your MCP server.
Become a Member to join the conversation.
