AI Hints
Home›MCP Tutorial›Testing and Debugging
MCP · Lesson 87 of 120

Debugging

Common failures.

⏱ 2 min read▶ Video at 1:17:16🎓 Free
Watch this lesson in the MCP courseWatch on YouTube ↗Full MCP course

When a server won't work in a host, the cause is usually one of a few common mistakes. Let's go through them, and how to spot each one.

Debugging
From the video: Debugging
  • It won't work
  • A few causes
  • How to spot them

Symptoms and fixes

If the server never connects, check the command and use full paths. If the connection breaks, look for prints on standard output. If tools are missing, restart the host. If a tool fails, read standard error, and test it in the Inspector.

SymptomLikely causeFix
Never connectswrong command or pathfull paths
Connection breaksprint() to stdoutlog to stderr
Tools missinghost not restartedrestart the host
Tool failsan exceptionstderr + Inspector

A debugging routine

First, run the server alone, and look for errors. Then test it in the Inspector. Then run your tests. Then check the host's logs. And only then, change the code.

  1. Run alone
  2. Inspector
  3. Tests
  4. Host logs
  5. Fix
A debugging routine
From the video: A debugging routine

Summary

Most failures are wrong paths, stray prints, or a host that needs a restart. Next, performance.

Key takeaways
  • Full paths
  • No stdout prints
  • Restart host
Next up: Performance — fast tools