Your First MCP Server
The MCP Inspector
The MCP Inspector is the official tool provided by the MCP team to help developers test and debug their MCP servers. It provides a user-friendly web interface to interact with a server, send requests, and view responses in real-time.
This tool is especially useful during development to quickly test your server's functionality without needing to set up a full client application.
Install the MCP Inspector:
npm i -g @modelcontextprotocol/inspector@0.20.0
You can run the following command in your terminal to start the tool and connect it to your server:
# cd $HOME/workspace/mcp-server
npx @modelcontextprotocol/inspector calculator_server.py
This will generate a URL in the terminal with a session token:
Starting MCP inspector...
⚙️ Proxy server listening on 127.0.0.1:6277
🔑 Session token: 8efcf5ecb60382471505f3f9cd9ee8c8ccc72213d2189e7551480327fd466e4d
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=8efcf5ecb60382471505f3f9cd9ee8c8ccc72213d2189e7551480327fd466e4d
🔍 MCP Inspector is up and running at http://127.0.0.1:6274 🚀
If you're running a remote server and want to access the inspector from its public interface using your web browser, you need to use a command like HOST=0.0.0.0 ALLOWED_ORIGINS= to allow the inspector to accept connections from the server's public IP address.
Here is how to do it:
# Get public IP address
PUBLIC_IP=$(curl -s ifconfig.me)
# Run the inspector with the appropriate environment variables
HOST=0.0.0.0 \
ALLOWED_ORIGINS=http://$PUBLIC_IP:6274 \
npx @modelcontextprotocol/inspector
Practical MCP with FastMCP & LangChain
Engineering the Agentic ExperienceEnroll now to unlock current content and receive all future updates for free. Your purchase supports the author and fuels the creation of more exciting content. Act fast, as the price will rise as the course nears completion!
