Testing and Debugging with the MCP Inspector
~10 min read
The MCP Inspector is a web-based dashboard, launched automatically in development mode, for browsing tools, exploring resources, and monitoring JSON-RPC traffic before connecting an agent.
Having built a server with Tools and Resources (previous two subtopics), the natural next question is: how do you actually verify it works BEFORE wiring it up to a real agent? This course's answer is the MCP Inspector.
When you start your server in development mode (this course's example uses npm run dev, reflecting the TypeScript-oriented tooling this mcp-use section demonstrates), mcp-use automatically launches the MCP Inspector, a web-based dashboard for inspecting and debugging MCP servers.
The Inspector lets you: browse and test tools interactively (call a tool with sample inputs and see the result directly, without writing any client code); explore resources and inspect their content (fetch a resource URI and view what comes back); preview prompts and validate arguments (for the Prompts primitive, seeing exactly what message templates a prompt produces); watch sampling and notification events in real time (observe the Sampling and Notifications primitives as they fire); and monitor all JSON-RPC traffic between client and server (the raw protocol-level messages underlying every one of the above interactions, useful when something isn't behaving as expected and you need to see exactly what's being sent and received).
This course frames this directly as the fastest way to verify your server's capabilities before connecting it to an agent — this ordering matters as a practical workflow: build a tool or resource, verify it behaves correctly in the Inspector's interactive dashboard, and only THEN connect a real agent to it. This separates two very different classes of bugs: 'is my server's capability itself broken' (something the Inspector answers directly, in isolation) versus 'is my AGENT using this capability correctly' (a separate question that's much harder to debug if you haven't first ruled out the server-side possibility). Testing server capabilities in isolation via the Inspector, before adding the agent's own reasoning into the mix, is what keeps debugging tractable as a server's tool/resource surface grows.
💻 Code example
# The book's workflow uses `npm run dev` to auto-launch the MCP
# Inspector for a TypeScript mcp-use server. The same "test in
# isolation before connecting an agent" principle applies when
# testing a Python MCP server directly via the SDK's dev tooling:
#
# mcp dev my_server.py
#
# This launches an equivalent inspector UI for a Python FastMCP server.
from mcp.server.fastmcp import FastMCP
mcp = FastMCP("weather-server")
@mcp.tool()
def get_weather(location: str) -> dict:
return {"location": location, "forecast": "Sunny", "temp_c": 22}
@mcp.resource("file://{path}")
def read_file(path: str) -> str:
with open(path, "r") as f:
return f.read()
# Before wiring this server up to any real agent, the Inspector lets
# you call get_weather("Paris") directly and confirm the response
# shape is correct -- isolating server bugs from agent-reasoning bugs
if __name__ == "__main__":
mcp.run()
💬 Deep Dive with AI
Key points
- •The MCP Inspector is a web-based dashboard, launched automatically in development mode, for inspecting and debugging MCP servers
- •It lets you browse/test tools, explore resources, preview prompts, and watch sampling/notification events interactively
- •It also monitors all JSON-RPC traffic between client and server — the raw protocol messages underlying every interaction
- •The book frames it as the fastest way to verify server capabilities before connecting an agent
- •Testing in the Inspector first isolates 'is my server broken' from 'is my agent using it correctly' — two very different debugging problems