How to Use MCP Inspector: A Testing Tool for MCP Servers

This is a quick guide on how to use "MCP Inspector," a browser-based test tool for MCP servers.

Introduction

MCP Inspector is an official browser-based testing and debugging tool for MCP servers provided by MCP.

Here's a summary of how to use it.

# Environment: macOS
# Versions
$ python --version
Python 3.11.9
$ node --version
v20.19.0

Note: This article was translated from my original post.

How to Use MCP Inspector

Preparation: Set Up a Minimal MCP Server

First, let’s create a minimal MCP server in Python to use in this article. We’ll use uv as the package manager.

# Create a Python project
uv init hellomcp
cd hellomcp

# Create a virtual environment
uv venv
source .venv/bin/activate

# Install MCP server Python SDK
uv add "mcp[cli]"

In main.py, implement a minimal MCP server like this:

from mcp.server.fastmcp import FastMCP


mcp = FastMCP("HelloMCP")


@mcp.tool()
def add(a: int, b: int) -> int:
    """Add two numbers"""
    return a + b


@mcp.resource("greeting://{name}")
def get_greeting(name: str) -> str:
    """Get a personalized greeting"""
    return f"Hello, {name}!"


@mcp.prompt()
def translation_ja(txt: str) -> str:
    """Translating to Japanese"""
    return f"Please translate this sentence into Japanese:\n\n{txt}"

Ref. GitHub - bioerrorlog/hellomcp: The minimal Python MCP server implementation with MCP Python SDK.

This sets up basic examples for the three main features provided by MCP: Tools, Resources, and Prompts.

Now let’s use MCP Inspector to test this server.

Launching MCP Inspector

There are two ways to launch MCP Inspector:

  • Launch with MCP CLI
  • Launch with npx @modelcontextprotocol/inspector

If you install the SDK with the cli option like uv add "mcp[cli]", you can use the MCP CLI. To start MCP Inspector, run mcp dev.

$ mcp dev --help
                                                                                          
 Usage: mcp dev [OPTIONS] FILE_SPEC                                                       
                                                                                          
 Run a MCP server with the MCP Inspector.                                                 
                                                                                          
╭─ Arguments ────────────────────────────────────────────────────────────────────────────╮
│ *    file_spec      TEXT  Python file to run, optionally with :object suffix           │
│                           [default: None]                                              │
│                           [required]                                                   │
╰────────────────────────────────────────────────────────────────────────────────────────╯
╭─ Options ──────────────────────────────────────────────────────────────────────────────╮
│ --with-editable  -e      DIRECTORY  Directory containing pyproject.toml to install in  │
│                                     editable mode                                      │
│                                     [default: None]                                    │
│ --with                   TEXT       Additional packages to install                     │
│ --help                              Show this message and exit.                        │
╰────────────────────────────────────────────────────────────────────────────────────────╯
# Example
$ mcp dev main.py
Starting MCP inspector...
⚙️ Proxy server listening on port 6277
🔍 MCP Inspector is up and running at http://127.0.0.1:6274 🚀


Alternatively, you can start MCP Inspector directly using npx @modelcontextprotocol/inspector. Internally, mcp dev also uses this command.

npx @modelcontextprotocol/inspector <MCP server start command>
# Example
$ npx @modelcontextprotocol/inspector mcp run main.py
Starting MCP inspector...
⚙️ Proxy server listening on port 6277
🔍 MCP Inspector is up and running at http://127.0.0.1:6274 🚀

Once it's running, open http://127.0.0.1:6274 in your browser to access MCP Inspector.

Using MCP Inspector

Now, let’s use MCP Inspector at http://127.0.0.1:6274.

MCP Inspector UI

Start by clicking the "▶︎Connect" button on the left tab to connect the MCP server with the Inspector.

Connected to MCP server using Connect button

From the top tabs—Resources / Prompts / Tools—you can test each feature provided by the MCP server.

Each tab allows you to retrieve a list of the server’s Resources, Prompts, or Tools and invoke them with arguments.

Resources: calling get_greeting

Prompts: calling translation_ja

Tools: calling add

You can test the MCP server functionality end-to-end without connecting to a full MCP client like Claude Desktop. That makes this a handy way to test specific features.

Conclusion

This was a quick guide on how to use the MCP server testing tool, MCP Inspector.

Tools are especially model-controlled, so testing them with a full MCP client can be cumbersome.
By using MCP Inspector to check the end-to-end behavior of the MCP server, you can save time and effort.

Hope this helps someone!

[Related Articles]

en.bioerrorlog.work

en.bioerrorlog.work

References