Step 4 of 4
Inspect the Connection
Launch the server with MCP Inspector and verify initialization, tool discovery, and a complete tool invocation.
The server is useful only when a client can initialize a session, discover the tool, and invoke it successfully. Use the SDK development command to launch MCP Inspector:
uv run mcp dev server.pyThe command imports the module, finds the mcp server object, launches it over stdio, and opens the Inspector development interface.
Verify the protocol flow
In Inspector:
- Connect to the server.
- Open the Tools section.
- Confirm that
addappears with integer fields foraandb. - Invoke it with
a = 2andb = 3. - Confirm that the result contains
5.
You have now exercised the essential path: initialization, capability negotiation, tool discovery, tool invocation, and a structured result.
Diagnose the common failures
- If the module cannot be imported, run the command from the project directory and recheck the filename.
- If the tool is missing, confirm that
@mcp.tool()decorates the function attached to the samemcpinstance. - If the stdio connection breaks, remove ordinary
print()calls from server code.
Step 4
Ready to continue?
Mark this step complete when you have finished the checks above.
Checking saved progress…