Skip to content

Repository files navigation

Build MCP agents locally

A 90-minute, hands-on workshop for building with the Model Context Protocol (MCP) on a prebuilt Windows VM. The lab uses Indian travel examples and runs fully offline during the event.

The tested stack is:

  • FastMCP 4.0.0
  • MCP protocol revision 2026-07-28
  • Foundry Local Python SDK foundry-local-sdk-winml==1.2.4
  • Foundry Local model alias qwen3.5-0.8b
  • Python 3.11 or newer on Windows

No cloud account, API key, package install, model download, or event Wi-Fi is required. The facilitator prepares .venv, the Foundry Local runtime, and the portable CPU model cache before distributing the VM image.

Start here

Open PowerShell in the repository root on the workshop VM and run:

.\workshop.ps1 check

The final line should be:

All good - you are ready for the offline workshop.

If the script reports a failure, stop and ask the facilitator for a clean VM. Attendees should not run pip install, download another model, or add cloud credentials during the session.

Full setup guidance is in docs/01-get-started.md.

The 90-minute route

Stage Lesson Time
1 Check the offline VM 5 min
2 Understand MCP 10 min
3 Build a FastMCP server 20 min
4 Run a client and agent loop 25 min
5 Use the browser app 10 min
6 Review production controls and approval 13 min
7 Knowledge check and close 7 min
Total 90 min

The coding exercise creates one small server. The complete client, handwritten agent loop, and browser app are supplied under src/solution so every attendee can run the end-to-end experience within the session.

What you build

The server publishes fictional weather, forecast, flight, and destination data for Indian cities. Deterministic local data keeps the protocol behavior easy to reproduce and prevents accidental real-world booking decisions.

flowchart LR
    U[Attendee] --> B[Local browser]
    B --> A[Handwritten agent loop]
    A <--> F[Foundry Local qwen3.5-0.8b]
    A <-->|FastMCP over stdio| S[Bharat Travel Desk]
    S --> D[Deterministic India travel data]
Loading

Foundry Local runs in-process through its native Python chat client. FastMCP starts the travel server as a subprocess and exchanges JSON-RPC over standard input and output. Nothing in this path requires a listening model endpoint.

Commands

Run all commands from the repository root:

.\workshop.ps1 check
.\workshop.ps1 raw
.\workshop.ps1 client
.\workshop.ps1 agent "Find a flight from Bengaluru to Kochi and tell me what to pack."
.\workshop.ps1 web
.\workshop.ps1 approval
.\workshop.ps1 test

The browser command serves http://127.0.0.1:7932. Stop it with Ctrl+C.

The optional Makefile wraps the same files for maintainers who already have GNU Make on Windows. Learner instructions use workshop.ps1 throughout.

Repository map

docs/                     timed workshop and reference material
global-ai-learn/          Global AI Learn version of the course
scripts/prepare_vm.py     online image-building step
scripts/verify_setup.py   offline acceptance check
scripts/validate_content.py Learn schema, timing, and link validation
scripts/raw_jsonrpc.py    protocol demo without a client SDK
src/model_config.py       cache-only Foundry Local configuration
src/solution/             completed server, client, agent, approval, and browser app
tests/                    deterministic offline protocol and loop tests
requirements-lock.txt     accepted Windows dependency closure
workshop.ps1              attendee command surface

Reference material:

VM image builders

Internet access is required only while building the image. Follow docs/vm-image-runbook.md, then perform the final acceptance test with networking disabled. Do not treat package installation alone as readiness: the cached model must also produce a real tool call.

Licence

MIT. Use it, adapt it, and run it at your own event.

About

A 90-minute hands-on workshop for building fully offline MCP agents on Windows with FastMCP 4, Foundry Local, and a CPU-optimized Qwen model

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages