Effective testing ensures your MCP server behaves as expected and helps you quickly identify and resolve issues. MCP gives you three complementary approaches: the visual Inspector, HTTP-based manual testing with curl, and automated unit tests.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/microsoft/mcp-for-beginners/llms.txt
Use this file to discover all available pages before exploring further.
Learning objectives
By the end of this lesson you will be able to:- Use the MCP Inspector in both visual and CLI modes
- Test MCP server endpoints manually using curl
- Write unit tests for server tools using pytest
- Select the right testing approach for each situation
Testing approaches
MCP Inspector
Visual GUI + CLI tool for interactively discovering and testing tools, resources, and prompts.
Manual testing (curl)
Direct HTTP requests to test individual endpoints. Good for quick checks and CI scripting.
Unit testing
Automated tests using your language’s testing framework. Ideal for regression testing.
MCP Inspector
The MCP Inspector is built in Node.js and runs vianpx — no global install required.
Visual mode
Launch the Inspector with your server command. It starts a browser UI where you can discover capabilities and test tools interactively:- All registered tools with their parameter schemas
- Resources and prompts
- Raw JSON-RPC message exchange
- Real-time response output
CLI mode
Add--cli to run the Inspector without a browser. This is useful in CI/CD pipelines:
Manual testing with curl
For HTTP-based servers (Streamable HTTP transport), test endpoints directly with curl:Unit testing
Unit tests let you verify that individual tools produce the correct output without a running server. Use your language’s standard testing framework.Python (pytest)
The MCP Python SDK providescreate_connected_server_and_client_session for in-process testing:
Python: testing tool logic directly
You can also test the tool functions directly, without MCP infrastructure:When to use each approach
| Approach | Best for |
|---|---|
| Inspector (visual) | Interactive exploration during development |
| Inspector (CLI) | CI/CD smoke tests and scripted validation |
| curl | Quick HTTP endpoint checks; scripting |
| Unit tests | Regression testing; testing edge cases |
Key takeaways
- Use the MCP Inspector for interactive exploration and debugging during development.
- Use CLI mode of the Inspector (
--cli) in automated pipelines. - Write unit tests with your language’s testing framework to catch regressions early.
- All major MCP SDKs have similar testing utilities — the patterns shown in Python apply to other languages too.