learning-it by example

Back to the video

Inside an MCP Server: Tools, stdio and Errors

One toy, two dates: the same MCP tool said 3.16, then 3.17, because the date picked the schedule.

Video #332 ยท AI agents and MCP

Steps in the video

  1. 0:00 One toy, two dates, two answers
  2. 0:28 The idea
  3. 0:49 Setup
  4. 1:07 The data: a dated schedule
  5. 1:27 The engine
  6. 1:51 The server: setup and errors
  7. 2:12 The server: tools
  8. 2:31 The client: starting the server
  9. 3:47 What is on the wire
  10. 4:23 Use it from a client
  11. 4:42 How the real one differs
  12. 5:07 What this does not show
  13. 5:32 Mistakes to avoid
  14. 5:59 My take and next steps
  15. 6:22 Recap

Files

  • client.py (62 lines)
  • engine.py (24 lines)
  • schedule.py (23 lines)
  • server.py (48 lines)

Download the code (zip)

Tested with

Python 3.12.15 | mcp==2.3.0

What this does not show

Made-up, simplified fees and dates; a two-tool demo, not the owner's private eight-tool server; one client and one hand-written message on one machine; the by-hand message used an older protocol version string; no other clients or protocol versions were tried.

Sources

Learning IT by Example.