4/18/2025
Learn how to get started with Model Context Protocol (MCP), set up your environment, and create your first MCP server.
MCP Quick Start Guide
What is MCP?
Model Context Protocol (MCP) is a simple protocol that connects AI assistants like Claude to your data and tools. It allows your AI to:
- Access your data through Resources
- Use your code through Tools
- Follow your templates through Prompts
The best part? Your data stays under your control.
Set Up Your Environment
We recommend using uv to manage your Python projects.
- If you haven't installed uv yet, install it with:
pip install uv
- Create a new uv-managed project:
uv init mcp-server-demo
cd mcp-server-demo
- Add MCP to your project dependencies:
uv add "mcp[cli]"
Alternatively, for projects using pip for dependencies:
pip install mcp
Create Your First MCP Server in 2 Minutes
Let's create a tiny MCP server with a simple calculator and greeting function:
- Create a file named
server.py
:
# server.py
from mcp.server.fastmcp import FastMCP
# Create an MCP server
mcp = FastMCP("Demo")
# Add an addition tool
@mcp.tool()
def add(a: int, b: int) -> int:
"""Add two numbers"""
return a + b
# Add a dynamic greeting resource
@mcp.resource("greeting://{name}")
def get_greeting(name: str) -> str:
"""Get a personalized greeting"""
return f"Hello, {name}!"
That's it! Your server now has:
- A tool that adds two numbers
- A resource that creates personalized greetings
Test Your MCP Server
Using the MCP Inspector (Browser-based)
With uv:
uv run mcp dev server.py
With pip:
mcp dev server.py
This opens a local web interface where you can try your tools and resources directly.
How It Works (Simple Version)
- You define resources and tools in your MCP server
- Claude or another AI assistant recognizes when it needs to use them
- The assistant sends a request to your MCP server
- Your server returns the result
- The assistant includes the result in its response
Next Steps
- Add more tools and resources to your server
- Connect to databases or APIs
- Create more complex use cases with prompts and context
Congratulations! You've built your first MCP server. Now your AI assistant can directly use your code and access your data, all while keeping everything under your control.