How to Build Your First MCP Server in 5 Minutes
Step-by-step guide to building your first MCP server using FastMCP (Python) or the TypeScript SDK.
Building an MCP server is easier than you think. In this tutorial, we'll create a working MCP server in under 5 minutes using FastMCP.
Prerequisites
- Python 3.10+ installed
- An MCP client (Claude Desktop, Cursor, or VS Code with MCP extension)
Step 1: Install FastMCP
pip install fastmcpStep 2: Create Your Server
Create a file called my_server.py:
from fastmcp import FastMCP
mcp = FastMCP("My First Server")
@mcp.tool()
def greet(name: str) -> str:
"""Greet someone by name."""
return f"Hello, {name}! 👋"
@mcp.tool()
def add(a: int, b: int) -> int:
"""Add two numbers."""
return a + b
Step 3: Configure Your Client
Add to your Claude Desktop config (claude_desktop_config.json):
{{
"mcpServers": {{
"my-server": {{
"command": "python",
"args": ["path/to/my_server.py"]
}}
}}
}}Step 4: Use It!
Restart Claude Desktop. Now you can ask Claude to greet someone or add numbers — it'll use your MCP server automatically.
Next Steps
- Add more tools: database queries, API calls, file operations
- Browse 500+ existing MCP servers for inspiration
- Check out the official Python SDK for advanced features
💡 Deploy Your MCP Server
Need a server to host your MCP server or AI agent? Get $200 free credit on DigitalOcean →