Hello, WebMCP
Overview
Hey there! This codelab introduces you to WebMCP - the very early W3C draft submitted by Google and Microsoft to enable better AI agents in the browser. In the shortest, and as per the draft report: the WebMCP API enables web applications to provide JavaScript-based tools to AI agents.
You can read the draft report here: https://webmachinelearning.github.io/webmcp/
Requirements
In order to follow this codelab, you'll need the following:
- Python on local machine
- Chrome: Version 146.0.7672.0 or higher.
- Gemini API Key, obtain a free one here - https://ai.dev/apikey
Enable WebMCP on your browser:
- Open Chrome and navigate to chrome://flags/#enable-webmcp-testing
- Set the flag to Enabled.
- Relaunch Chrome to apply the changes.
Additionally, you can install this extension by Google to test out WebMCP:
WebMCP - Model Context Tool Inspector - Chrome Web StoreInspect, monitor, and execute WebMCP tools manually or with Gemini
Chrome Web Store
This codelab assumes you're on a Linux environment (Mac/Windows WSL/linux distros, etc.). If you're on Windows or any other operating system, you may have to substitute some of the commands to make them work.
Setup Repo
Let's setup our repository for the day.
We'll be working with this repository - https://github.com/xprilion/webmcp-train-your-baby-dragon
Clone it using:
[email protected]:xprilion/webmcp-train-your-baby-dragon.git
Switch to main branch
git checkout main
Assuming you've Python on your device,
python -m http.server
With this done, you should be able to navigate to http://localhost:8000 to see the web page rendered.
Fill in the blanks
At this point, the repo has a bunch of blanks in it, your task - fill them!
Conclusion
Congratulations on making it here! 🎉
In the duration of the codelab you've learnt -
- How to implement WebMCP on your websites