StudyBuddy

StudyBuddy

An educational MCP server demonstrating the MCP protocol with simple tools like rolling dice and returning vocabulary words.

Category
Visit Server

README

MCP in 45 Minutes — A Classroom Walkthrough

You've already given the theory. This is the "now let's see it" session. Two files, ~90 lines of Python total, nothing exotic.

Setup (5 min, do this before class starts)

pip install "mcp[cli]==1.29.0"

That's the only dependency. Both files run with plain python3.

The three files

File Role What it plays the part of
study_buddy_server.py MCP server The "tool box" — e.g. a school's database, a weather API, a calculator
simple_client.py MCP client (scripted) The "app" that wants to use those tools — calls are hardcoded so you can read the protocol steps in order
interactive_client.py MCP client (REPL) Same idea, but it asks you which tool to call and for its arguments, live in the terminal

About interactive_client.py

Run it with:

python3 interactive_client.py

It connects to the server, calls list_tools(), and prints whatever tools come back as a numbered menu — nothing is hardcoded, so if a student adds a new tool to study_buddy_server.py, it just shows up next time this runs. Pick a number, and for each argument the tool needs it prompts you for a value (reading the schema FastMCP built from the function's type hints — this is a nice moment to point out that the schema is not hand-written). Type q to quit.

This is the best one to leave running on a projector: it's the closest students will get to "talking to the server" without wiring up a real LLM, and it makes the discovery step (menu built live from list_tools()) visually obvious in a way the scripted client doesn't.

Suggested flow in class

1. Read the server first, run nothing yet (10 min)

Open study_buddy_server.py on the projector. Walk through it top to bottom:

  • mcp = FastMCP("StudyBuddy") — creating the server and naming it.
  • @mcp.tool() — point out this is the entire difference between "a Python function" and "a function an AI can discover and call." Nothing else changes.
  • The docstring under each function ("""Roll a dice...""") is not just a comment — the client/model reads this text to decide when to use the tool. This is worth emphasizing: MCP tool descriptions are part of the protocol, not decoration.
  • mcp.run() at the bottom — starts the server listening for a connection.

Ask students: "If I wanted to add a tool that looks up tomorrow's weather, what three things would I need to write?" (a function, a docstring, the decorator) — this checks they got the pattern.

2. Run the server alone (2 min)

python3 study_buddy_server.py

It will appear to hang / do nothing. That's the point — a server on its own is inert. It's just sitting there waiting for something to talk to it over stdin/stdout. Ctrl+C to stop.

3. Read and run the client (15 min)

Open simple_client.py. This is the file that shows the protocol steps explicitly, because normally an AI app hides them from you:

  1. Launch — stdio_client(server_params) starts the server as a subprocess and opens a pipe to it.
  2. Handshake — session.initialize(). Client and server introduce themselves and agree on what they support.
  3. Discover — session.list_tools(). The client asks "what can you do?" and gets back the tool names + docstrings + expected inputs.
  4. Call — session.call_tool("roll_dice", {"sides": 20}). The client asks the server to actually run one specific tool with specific arguments, and gets a result back.

Run it:

python3 simple_client.py

Point out: no AI model was involved anywhere in this script. We (the humans) hardcoded which tool to call. That's deliberate — it isolates "what MCP does" from "what an LLM adds on top," which is normally where the confusion is. The LLM's job in a real app is just step 4: deciding which tool to call and what arguments to pass, based on the tool descriptions from step 3 and the user's message.

4. Live-code a new tool together (10 min)

Add a fourth tool to study_buddy_server.py as a class, e.g.:

@mcp.tool()
def word_of_the_day() -> str:
    """Return a random vocabulary word with its definition."""
    words = {
        "ephemeral": "lasting for a very short time",
        "resilient": "able to recover quickly from difficulty",
        "lucid": "clear and easy to understand",
    }
    word, definition = random.choice(list(words.items()))
    return f"{word}: {definition}"

Then add one line to simple_client.py to call it, and re-run. This is the moment that usually makes it click: adding a capability took one decorator and zero protocol code.

5. Bonus, if time allows: connect it to Claude Desktop

If any students have Claude Desktop installed, show them that the same study_buddy_server.py file can be registered in Claude Desktop's config (claude_desktop_config.json) instead of simple_client.py, and then Claude itself — not a hardcoded script — decides when to roll a dice or quiz them, based on what they type in chat. This is the "aha": the server code never changes, only who's driving the client side.

Key takeaway to write on the board

MCP doesn't make the AI smarter. It gives the AI a standard way to discover and call tools it doesn't know about in advance — so anyone can plug new capabilities into any AI app without custom integration code.

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured