MCP Server Basics 🔌🛠️⚡
Learn the basics of Word Embeddings and how they enable AI agents to understand context and relationships between words. By the end of this lesson, you'll be able to explain the concept of Word2Vec and its applications in NLP.
Day 1 — Build Your First MCP Server
MCP & AI Agents — Agent Bootcamp Part 2 — RohithBuilds
Welcome to Part 2! In the first course you built an agent that could search the web, do math, and read files — but its "brain" had to manually check the AI's reply for text like search_web( and decide what to run. Today you'll learn the modern way: the Model Context Protocol (MCP). By the end of today, you'll have built and tested your first real MCP server.
Step 1 — What Is MCP, and Why Does It Matter?
In Part 1, Day 4, you built a "tool router" — a function that scanned the AI's reply for specific text and decided which Python function to run. It worked, but it was fragile: if the AI phrased its reply slightly differently, the router could miss it completely.
MCP (Model Context Protocol) solves this properly. It's an open standard that lets you describe your tools once — using normal Python type hints and docstrings — and any AI client (Claude Desktop, Cursor, or an agent you build yourself) can automatically discover what your tools do, what inputs they need, and call them correctly.
Think of it like a USB-C port for AI: instead of wiring every tool directly into your agent with custom matching logic, you plug tools into a standard "port" (an MCP server), and any AI app that speaks MCP can use them — no router required.
💼 Why This Matters for Your Career
MCP has gone from a brand-new idea in late 2024 to one of the most-requested skills in AI and GenAI job postings in 2026. Companies want developers who can build MCP servers that expose tools, resources, and prompts for AI systems. This course gives you exactly that skill, hands-on.
Step 2 — Set Up a New Project Folder
We're starting a fresh project for this course. Open Command Prompt and run:
mkdir mcp-agent-bootcamp
cd mcp-agent-bootcamp
Now create and activate a virtual environment — same as Part 1, Day 1:
python -m venv venv
Windows
venv\Scripts\activate
Mac / Linux
source venv/bin/activate
Expected Output
Open this folder in VS Code: File → Open Folder → mcp-agent-bootcamp.
Step 3 — Install the MCP Python SDK
With your virtual environment active, install the official MCP Python SDK along with its CLI tools — these give you the Inspector you'll use in Step 6:
pip install "mcp[cli]"
Expected Output
Verify it installed correctly:
python -c "import mcp; print('MCP SDK ready:', mcp.__version__)"
Expected Output
Step 4 — Build Your First MCP Server
Let's build something genuinely useful for a student: an Exam Countdown tool. Create a file named server.py and add:
from datetime import datetime
from mcp.server.fastmcp import FastMCP
# Create your MCP server and give it a name
mcp = FastMCP("RohiMCP")
def get_exam_countdown(exam_name: str, exam_date: str) -> str:
"""Core logic, kept separate so we can test it without MCP."""
target = datetime.strptime(exam_date, "%Y-%m-%d")
today = datetime.now()
days_left = (target - today).days
if days_left > 0:
return f"{exam_name} is in {days_left} day(s). Time to prepare!"
elif days_left == 0:
return f"{exam_name} is TODAY! All the best!"
else:
return f"{exam_name} was {abs(days_left)} day(s) ago. Hope it went well!"
@mcp.tool()
def exam_countdown(exam_name: str, exam_date: str) -> str:
"""Calculate how many days are left until an exam.
exam_date must be in YYYY-MM-DD format."""
return get_exam_countdown(exam_name, exam_date)
if __name__ == "__main__":
mcp.run()
Save the file. Don't run python server.py directly yet — stdio-based MCP servers like this one sit and wait for a client to connect, so it will look like nothing is happening. In Step 6 we'll connect a client properly.
Step 5 — Understand What You Just Wrote
Compare this to Part 1, Day 4. There, you manually wrote a run_tool() router and a system prompt explaining each tool in plain English. Here, three things do all that work for you:
@mcp.tool()— this one line registersexam_countdownas a tool any MCP client can discover- Type hints (
exam_name: str,-> str) — MCP reads these to automatically build the tool's input/output schema, no manual JSON needed - The docstring — MCP uses this as the tool's description, so the AI knows when to use it
No router, no system prompt explaining tools manually — FastMCP reads your function signature and docstring and handles the rest.
Step 6 — Test Your Server With MCP Inspector
The MCP Inspector is a browser-based tool that lets you see and test your server's tools — perfect for development. Run:
mcp dev server.py
⚠️ First Time Running This?
The Inspector UI runs on Node.js. If your terminal asks to install something via npx and you don't have Node.js, install it from nodejs.org (default options are fine), then run the command again.
Expected Output
Open the link printed in your terminal (a local address such as http://localhost:6274). You'll see the MCP Inspector interface, already connected to server.py.
Step 7 — Run Your Tool From the Inspector
- Click the Tools tab
- You should see
exam_countdownlisted, with its description pulled straight from your docstring - Click on it — the Inspector automatically builds a form for
exam_nameandexam_date - Enter
exam_name: GATE 2027andexam_date: 2027-02-08 - Click Run Tool
Expected Output
You should see a result like "GATE 2027 is in XXX day(s). Time to prepare!" appear in the output panel. You didn't write any code to build that form or format that response — MCP generated all of it from your function signature alone.
Step 8 — Quick Fallback Test (No Inspector Needed)
If Inspector setup gives you trouble, you can still verify your logic — remember, get_exam_countdown() is just a normal Python function. Create a new file test_local.py:
from server import get_exam_countdown
print(get_exam_countdown("GATE 2027", "2027-02-08"))
print(get_exam_countdown("Mini Project Review", "2026-06-20"))
Run it:
python test_local.py
Expected Output
Step 9 — Save Your Progress
Create a requirements.txt so far:
pip freeze > requirements.txt
And a .gitignore:
venv/
__pycache__/
*.pyc
.env
You'll push everything to GitHub on Day 7 once the full project is ready.
✅ Day 1 Complete
Here is what you accomplished today:
Key Takeaways
- Understood what MCP is and why it replaces manual tool routers ✅
- New project set up with a virtual environment ✅
- MCP Python SDK installed ✅
- Built your first MCP server with a real tool (exam_countdown) ✅
- Tested the tool live using MCP Inspector ✅
- Verified it also works as a plain Python function ✅
What Is Coming Tomorrow
On Day 2 you will:
- Add a SQLite database to your MCP server
- Build three new tools: add_note, list_notes, and delete_note
- Test full CRUD operations live in the Inspector
- Turn your server into a real personal "Notes Assistant"
See you there! 🚀
Continue Learning with Rohi
You've used your 3 free Rohi questions. Create a free account to continue learning.