How to use MCP Inspector

MCP Insepctor can be used to test multiple types of transport, http, sse or stdio. We will be using the http-streaming for this tutorial. The official mcp sdk for python uses fastmcp 1.0 as of this writing, but we will be using 2.0

Lets create and run a simple mcp server

For this we will use FastMCP 2.0, Here is a quick example

lets first create a project

uv init greeting
cd greeting
uv add fastmcp

Now open this folder in vscode or your editor and modify main.py

from fastmcp import FastMCP

mcp = FastMCP("My MCP Server")

@mcp.tool
def greet(name: str) -> str:
    return f"Hello, {name}!"

To run this

uv run fastmcp run main.py --transport http

This will run your server with http streaming

Running the inspector

You need nodejs installed. You can download nodejs from

https://nodejs.org

npx @modelcontextprotocol/inspector 

When you run the inspector, you will see a url printed on the screen which includes the proxy token.

the output will look like below, copy the url

npx @modelcontextprotocol/inspector
Starting MCP inspector...
⚙️ Proxy server listening on 127.0.0.1:6277
🔑 Session token: a85ec289a6242bf47e7fb4822207138908c2b478c1a329f1b36432cdbf3b0385
Use this token to authenticate requests or set DANGEROUSLY_OMIT_AUTH=true to disable auth

🔗 Open inspector with token pre-filled:
   http://localhost:6274/?MCP_PROXY_AUTH_TOKEN=a85ec289a6242bf47e7fb4822207138908c2b478c1a329f1b36432cdbf3b0385

MCP Inspector Start

Change the url to

http://localhost:8000/mcp and click on connect

Now click on Tools -> List Tools

You should see your greet tool

MCP Inspector Tools

In order to test it, click on it and you should see the result as below

MCP Inspector Execute

By: Gavi Narra on: