Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

Session 17: Model Context Protocol (MCP) & Agent-to-Agent (A2A) Protocol

Session Sheet Recording Slides Repo Homework Feedback
MCP Servers & A2A Recording!
passcode: fJ9tx4h.
Session 17 Slides You are here! (Optional) Session 17 Assignment: MCP Servers & A2A Feedback 3/12

📚 Useful Resources

MCP (Model Context Protocol)

A2A (Agent-to-Agent Protocol)

MCP vs A2A


Running the MCP Server

1. Install dependencies

uv sync

2. Set up environment variables

Copy the example env file and fill in your OpenAI API key:

cp .env.example .env

3. Run the MCP server locally

uv run server.py

The server will start on http://localhost:8000.

4. Expose the server with ngrok (for remote/Claude Desktop access)

In a separate terminal, start an ngrok tunnel:

ngrok http 8000

Copy the ngrok forwarding URL (e.g. https://xxxx-xx-xx-xx-xx.ngrok-free.app) and restart the server with it:

ISSUER_URL=https://xxxx-xx-xx-xx-xx.ngrok-free.app uv run server.py

Note: The ISSUER_URL must match the public URL clients use to reach the server, otherwise OAuth authentication will fail.


Build 🏗️

In today's assignment, we'll be building an MCP server with OAuth authentication — a cat shop application that exposes tools for browsing products, managing a cart, and checking out.

  • 🤝 Breakout Room #1

    • Set up the MCP server with OAuth and the product database
    • Explore the MCP tools: list_products, get_product, add_to_cart, view_cart, remove_from_cart, checkout
  • 🤝 Breakout Room #2

    • Connect an MCP client to the server
    • Build an end-to-end interaction flow using the MCP tools

Ship 🚢

The completed MCP server and client integration!

Deliverables

  • A short Loom of either:
    • the MCP server you built and a demo of the client interacting with it; or
    • the notebook you created for the Advanced Build

Share 🚀

Make a social media post about your final application!

Deliverables

  • Make a post on any social media platform about what you built!

Here's a template to get you started:

🚀 Exciting News! 🚀

I am thrilled to announce that I have just built and shipped an MCP server with OAuth authentication! 🎉🤖

🔍 Three Key Takeaways:
1️⃣
2️⃣
3️⃣

Let's continue pushing the boundaries of what's possible in the world of AI and tool integration. Here's to many more innovations! 🚀
Shout out to @AIMakerspace !

#MCP #ModelContextProtocol #OAuth #Innovation #AI #TechMilestone

Feel free to reach out if you're curious or would like to collaborate on similar projects! 🤝🔥

Submitting Your Homework [OPTIONAL]

Main Homework Assignment

Follow these steps to prepare and submit your homework assignment:

  1. Review the MCP server code in server.py and the app/ directory
  2. Run the MCP server locally using uv run server.py
  3. Connect to the server using an MCP client (e.g., Claude Desktop, or a custom client)
  4. Test all available tools: browsing products, adding to cart, viewing cart, removing items, and checkout
  5. Record a Loom video reviewing what you have learned from this session

Questions

❓ Question #1:

Why is OAuth important for MCP servers, and what security considerations should you keep in mind when exposing tools to AI clients?

✅ Answer:

(insert your answer here)

❓ Question #2:

What is the Agent-to-Agent (A2A) protocol, and how does it differ from MCP in terms of purpose and architecture? When would you choose A2A over MCP?

✅ Answer:

(insert your answer here)

Activity 1: Extend the MCP Server

Add at least one new tool to the cat shop MCP server (e.g., search_products, update_cart_quantity, or get_order_history). Ensure the new tool integrates properly with the existing database and OAuth authentication. Demo the new tool through an MCP client and include it in your Loom video.

Advanced Activity: Build a Custom MCP Client

Build a custom MCP client that connects to the cat shop server over Streamable HTTP, authenticates via OAuth, and orchestrates a multi-step shopping flow (browse → add to cart → checkout). Compare the developer experience of MCP-based tool integration vs. traditional REST API calls.

Include your findings and a demo in your Loom video.