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:
- Problem: Claude cannot provide the current time because its knowledge is frozen at a cutoff date.
- Solution: Create a remote MCP server that returns the current date and time.
- Integration: Add the MCP server URL to Claude’s settings under “Integrations.”
- 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!