YouTube Deep SummaryYouTube Deep Summary

Star Extract content that makes a tangible impact on your life

Video thumbnail

FastMCP Quickstart: Build Remote MCP Servers w/ Python

Greg + Code (Greg Baugues) • 13:00 minutes • Published 2025-05-02 • YouTube

🤖 AI-Generated Summary:

How to Build a Remote MCP Server with Python and FastMCP: A Step-by-Step Guide

In the rapidly evolving world of AI and large language models (LLMs), new tools and integrations continue to push the boundaries of what’s possible. One of the most exciting recent developments is Enthropic’s announcement of remote MCP (Model Control Protocol) server support within Claude, an AI assistant platform. This breakthrough means that users can now connect to MCP servers simply by providing a URL—no complex local setup or developer-level skills required.

In this blog post, we’ll explore what remote MCP servers are, why they matter, and how you can build your own using Python and the FastMCP framework. Whether you’re a developer or an AI enthusiast, this guide will give you the knowledge and tools to create powerful, accessible AI integrations.


What is an MCP Server?

An MCP server serves as a bridge between large language models and external tools or data sources. This enables LLMs like Claude to perform tasks or fetch real-time information beyond their static knowledge base. Traditionally, MCP servers were local setups requiring developer expertise to configure and maintain, limiting their accessibility.


Why Remote MCP Servers are a Game-Changer

Remote MCP servers allow users to connect to MCP servers hosted anywhere via a simple URL. This innovation dramatically lowers the barrier to entry, making it easier for less technical users to enhance their AI assistants with custom tools. For example, a remote MCP server can provide up-to-the-minute data like the current time, weather, or stock prices—capabilities that standard LLMs often lack due to knowledge cutoffs.

Claude’s new integration support means you can now:

  • Add MCP servers by entering a URL in Claude’s settings.
  • Automatically discover available tools and their parameters.
  • Seamlessly invoke those tools during conversations with Claude.

This marks a significant step toward more interactive, capable AI assistants.


Demo: Adding a Current Time Tool to Claude

To illustrate the power of remote MCP servers, here’s a quick example:

  1. Problem: Claude cannot provide the current time because its knowledge is frozen at a cutoff date.
  2. Solution: Create a remote MCP server that returns the current date and time.
  3. Integration: Add the MCP server URL to Claude’s settings under “Integrations.”
  4. Usage: Ask Claude, “What is the current time?” Claude recognizes it has access to the time tool, invokes it with the correct parameters (like time zone), and returns an accurate, up-to-date answer.

This simple enhancement vastly improves Claude’s utility for real-world tasks.


Building Your Own Remote MCP Server in Python with FastMCP

Step 1: Set Up Your Environment

Begin by visiting gomcp.com or the FastMCP GitHub repository for documentation and code examples.

Install FastMCP via pip:

bash pip install fastmcp

Step 2: Create the MCP Server

Here’s a basic MCP server script that provides the current date and time:

```python
from fastmcp import MCPServer
from datetime import datetime
import pytz

server = MCPServer(name="DateTime Server", instructions="Provides the current date and time.")

@server.tool(name="current_datetime", description="Returns the current date and time given a timezone.")
def current_datetime(time_zone: str = "UTC") -> str:
try:
tz = pytz.timezone(time_zone)
now = datetime.now(tz)
return now.strftime("%Y-%m-%d %H:%M:%S %Z")
except Exception as e:
return f"Error: {str(e)}"

if name == "main":
server.run()
```

Step 3: Run Locally and Test with MCP Inspector

FastMCP offers an MCP Inspector tool for debugging and testing your server:

bash npx fastmcp inspector my_server.py

This GUI lets you invoke your tools and view responses directly, providing a deterministic way to debug interactions with your MCP server.

Step 4: Deploy as a Remote MCP Server

To make your MCP server accessible remotely, you need to use a transport protocol suitable for networking.

  • The default stdin/stdout transport works locally.
  • For remote access, use Server-Sent Events (SSE) transport or, soon, the more efficient streamable HTTP transport (currently in development).

Modify your server code to use SSE transport and deploy it on a cloud platform such as Render.com. Assign a custom domain (e.g., datetime.yourdomain.ai) pointing to your deployment.

Once deployed, add your server URL in Claude’s integrations, and it will be ready for use remotely.


The Future of MCP Servers

The adoption of remote MCP servers is poised to explode, as they become far easier to create and integrate with AI assistants like Claude. This will likely spur more companies to launch their own MCP servers, offering a diverse ecosystem of tools accessible via URLs.

For developers, this is an exciting time to dive into MCP and FastMCP development. Even those with limited coding experience can now build meaningful AI enhancements quickly.


Final Thoughts

  • MCP servers empower AI models to access real-time data and perform specialized tasks.
  • Remote MCP servers eliminate the technical hurdles of local setup.
  • FastMCP and Python provide a straightforward path to building your own MCP servers.
  • Claude’s new integrations make adding MCP servers as simple as entering a URL.
  • The future will see more widespread adoption and innovation in MCP technology.

If you want to stay ahead in AI tooling, start experimenting with FastMCP today. Build your own remote MCP server, connect it to Claude, and unlock new capabilities for your AI assistant.

Happy coding!


Resources


Have questions or want to share your MCP server projects? Drop a comment below or connect with me on Twitter!


📝 Transcript (317 entries):

Hey, what's up? My name is Greg and Enthropic just recently announced support for remote MCP servers uh in Claude. Uh remote MCP servers are super exciting because they allow folks to interact with an MCP server with just a URL. And if you played with local MCP servers, uh you know, they can be a little clunky to get set up. You sort of almost need to be a developer to do it. So, uh, this sort of remote MCP support or what Claude's calling integrations is just going to, uh, cause an even more meteoric rise of MCP servers than what we've seen over the last 6 months. So, in this video, what I want to do is show you how you can build a remote MCP server using Python. And we're going to be using the fast MCP framework. And let me show you a demo of what you'll be able to do after we complete this. If I come here to Claude and I ask what time is it, it's going to tell me that it doesn't have access to the time and it only has access to the date because Claude injects it into the system prompt. But of course, the knowledge cut off is probably about 12 months ago and uh you know the current up to the moment time is not included in the knowledge cutoff. That's just not how like large language models actually work. uh but what you can do is you can give this thing a tool so that it can uh access a Python script let's say to return the current time and the way that we can do that is by coming down here to settings and scrolling down to integrations and click add more and I built a remote MCP server uh it is at datetime.highhigh.ai/sse AI/SSE. Um I believe that stands for serverside events. Uh and then we click add. You can see that that MCP server is connected. Now if I click here, it says one tool. You can see current date time is a tool has a description of what that tool does. And then if I come back, start a new chat and I ask what is the current time? It's going to realize that it has access to that tool. Um, it asks for permission to use that tool. Uh, but you can see here that it's running the uh tool current date time. It passed in the time zone. It knew from the MCP server what parameters it needed to pass in for this to work. And this is saying that it is currently 11:40 or 10:40 Eastern on Thursday, May 1st. And uh let's see, you could check my clock here. Uh, that is accurate. Um so that is how we equip uh claude with a new capability that it did not have before and I will show you the code that is running for that. Uh it is this simple file server. py using fastmcp. We define the MCP server. Uh and then we define a tool and that tool quite simply is just called current datetime uh with that optional parameter on there. And then we have a dock string. And this dock string will uh describe how to use the tool, what happens when you use the tool and you know what arguments you need to pass to it. Uh and then it just uh grabs the current time zone. It grabs the current time, formats the time and returns it. And if it throws an error, then it kicks back an error message so that Claude can uh reformat its time zone. We're to make a small change here. You can sort of see uh what happens. Like if we could update the dock string. Yes, sure. That sounds great. If you're asked for the current time or date, call this function. We'll come here to my terminal. I'm just going to add that change. And then if I come over to my render dashboard, you can see that MCP time is currently deploying. I have a custom domain set up here, datetime.hihigh.ai, that points to this particular server. Um, and then once this deployment finishes, it will be about a minute, we could reload the tool via cloud, and you'd see that updated dock string. All right, so now you've seen the end state of how we got here. Let's take a look at building with fastmcp from scratch. All right, so I'm going to come here to gomcp.com or you can visit their GitHub page. Uh, you'll find very similar information on both. I generally have found uh the website to be a little bit more pleasant. Uh, so I'm just going to click copy here on their getting started. Um, so I liked this version here. So this is kind of the the hello world with a little bit of extra seasoning on it. Um, so we import the library and then we create a new MCP server and we name this thing. So in this case, I'm going to call this uh date and time. All right. And then um, so MCP with instructions. This is going to provide a little bit of additional detail to the model on how and when to use this. So we will add that in there and see if cursor uh there we go. The server provides the current date and time. Call current daytime to get the current date and time. So that's great. So we have uh now we just we have a server. It doesn't do anything yet, but we do have a server. Uh so the first thing you're going to want to do and probably you know the current state of affairs is that tools are the things that most people associate with MCP servers. Um though I suspect we'll start seeing a lot more use of resources and uh prompts but uh tools is probably what you're going to be working with right now. Uh so we're going to create a new tool. Uh we're going to call this tool uh it looks like actually cursor knows exactly what I want to do here. So uh we're going to create one called uh current date and time. And it filled in the dock string for me. Uh so that's fantastic. And it looks like cursor is just going to I have uh already done this before. Let's just here we'll do it the proper way. Uh please write the rest of this function which given a time zone passed in via the arguments will calculate the current time and date formatted in a string and return it. All right. Excellent. I believe that will work. Let's move these where I think they belong. Although I know some folks do the inline imports. Um, great. And so now we have our function. Super simple function really. We're just talking about three lines here uh with uh some error handling. Now we'll try this out. It does give you a couple different ways to test it. Um, you can use fast MCP as an MCP client. So, when you're talking about MCP, there's the client and the server. Typically, that client's going to either be enthropic or like the cloud app or say for instance, cursor is probably the most popular MCP client. Uh, an MCP client can interact with a MCP server. Um, and it doesn't an MCP client doesn't have to be a fully featured app. It can be a script. Uh, Pyantic AI uh, is one that I've used in the past to act as an MCP client to interact with MCP servers. You can also use FastMPP for this. Uh, I think there's a better way to do this. Uh, so for right now, I'm just going to do this to uh, run our script. And let's see if we can just simply get it to start. So, we can use this fast MCP run my server.py MCP command here. Uh, I can rename this because mine is actually called local server and my server starts up. Enthropic has launched a really useful tool for debugging MCP servers and building MCP servers called uh the MCP inspector. You can run this with just this npx command. You don't even have to uh do any installation ahead of time. And if we drop that command in there, the command is going to be fastmcp and the arguments are going to be everything that comes after it. Uh if I come up here to tools and click on tools, you can see a list of all the tools that are available. So my MCP inspector is realizing that there is a current date time uh tool and I have the option here just to very simply run it and it populates the argument here with whatever the default was. So, I click run tool and I get the current time and I see that a successful run. Uh, this tool is so useful. Sorry, the MCP inspector is so useful because when you're building MCP servers, uh, you're ultimately going to be using an LLM as the client and the driver for that. And LMS are is kind of like the worst mix of computer programming of being non-deterministic and opaque. Um, so this gives you a deterministic and transparent way to interact with your MCP servers. And I'm very glad that uh they shipped this. We could attach this MCP server to cursor or to uh claw desktop. Um, because it is a local MCP server. It's running locally on my machine. no one outside of my machine can use it, but the clients that are running locally on my machine can use it. Um, and so, you know, this is uh it's going to be hard for me to distribute this to other folks, right? And so, there's a whole host of advantages that come if we can take this local MCP server and turn it into a remote MCP server. So, let's see how we do that. Say two big differences here. Uh, first, we're going to go under transports. Standard IO is the default transport for transferring information from the MCP server to your MCP client. Um, this works locally. If you want it to work remotely, you need to use a different transport. Uh, and I'm recording this on May 1st. This is the day that the announcement of cloud integrations came out. So, I want to get this video out. Uh currently as of today the way of doing this remotely is with SSE transport which is called serverside events. This method though has been deprecated and we are waiting on streamable HTTP support in fastmcp. there's an issue open to support this and the creator of FastMPP said as soon as the low-level SDK uh as soon as it's available in the low-level SDK he will roll out support for it. Very possible by the time you're watching this video you're going to want to do everything that I do here except you're just going to want to use the streamable HTTP transport as opposed to the SSSE. But I don't think it's going to be a terribly big shift for you. And so the actual code that I used came from uh under fastmcp server under servers uh under SSE transport here. Uh and I used this code to run uh asynchronously. And I'm going to paste that there. And I knew that I would have to do some different configuration of uh the way that the server ran once I pushed it to render. So I wanted to have control over the host and port etc. Uh and in fact the way I'll do this is just to come here and say please modify this to work on render. All right. And there we go. Uh that is all it takes to get a remote MCP server up and running using fast MCP and Python. I'm super excited by these cloud integrations. So here's what we know about MCP. you know that they've been really popular over the last 6 months and yet to use them you needed to basically be a developer cuz you need to be able to clone a repository and then figure out how to set up maybe a virtual environment and mess with like a JSON file to point a claw desktop at that thing. So these things have been pretty clumsy to work with, but yet there's still been incredible hype around them. And Claude just announced that they're no longer going to be clumsy. you're just going to have to paste in that URL and you're going to have access to an MCP server. Uh, and that's a really big deal uh because now I think you're going to see a lot more adoption from uh less technical users. Uh, I think this will put more pressure on OpenAI. Not that they necessarily needed more pressure, but I suspect you'll see remote MCP support coming very soon there. Uh, and then because of that, there's going to be a whole lot more people who are uh using these MCP servers. So, I think you're going to start seeing a lot more companies launch remote MCP servers. Uh, and this is, uh, a very, very exciting time to know how to code. And I think if you're getting started now, you got a little bit of a head start. Cloud is just rolling this out to users on the Max plan or on the enterprise plan. It's coming to pro users soon, but there hasn't been a huge push just yet. So, I would encourage you to play with this. You can get your own MCP server up and running pretty quickly. And uh can't wait to see what you