learning-it by example

Back to the video

Debug an MCP Server with the MCP Inspector

A tool on my MCP server failed with an error a model could do nothing with. The Inspector's command line mode showed me that error exactly as a model would get it.

Video #31 ยท AI agents and MCP

Steps in the video

  1. 0:00 An MCP tool error that says nothing
  2. 0:34 The idea
  3. 1:07 Setup
  4. 1:40 The server
  5. 2:06 Install the Inspector
  6. 2:28 Drive it from a script
  7. 2:56 What a model would see
  8. 3:17 The fixed server
  9. 4:14 What this does not show
  10. 4:46 Mistakes to avoid
  11. 5:14 My take and next steps
  12. 5:38 Recap

Files

  • package.json (7 lines)
  • run.py (62 lines)
  • server.py (20 lines)
  • server_fixed.py (24 lines)

Download the code (zip)

Tested with

Python 3.12.15 | mcp==2.3.0

What this does not show

Two small made-up tools over standard input and output. Only the Inspector's command line mode was run (Inspector 2.12.0 on Node 22.14.0, which is older than the documentation asks for), not the web page or the terminal interface. The two checks are my own and no language model was used.

Sources

Learning IT by Example.