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
- 0:00 One toy, two dates, two answers
- 0:28 The idea
- 0:49 Setup
- 1:07 The data: a dated schedule
- 1:27 The engine
- 1:51 The server: setup and errors
- 2:12 The server: tools
- 2:31 The client: starting the server
- 3:47 What is on the wire
- 4:23 Use it from a client
- 4:42 How the real one differs
- 5:07 What this does not show
- 5:32 Mistakes to avoid
- 5:59 My take and next steps
- 6:22 Recap
Files
- client.py (62 lines)
- engine.py (24 lines)
- schedule.py (23 lines)
- server.py (48 lines)
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
- https://docs.python.org/3/library/decimal.html
- https://modelcontextprotocol.io/docs/2026-07-28/develop/connect-local-servers
- https://modelcontextprotocol.io/specification/2026-07-28/basic/transports/stdio
- https://modelcontextprotocol.io/specification/2026-07-28/server/tools
- https://py.sdk.modelcontextprotocol.io/
Learning IT by Example.