MCP Inspector
The Inspector is a powerful debugging and testing tool for MCP servers. It provides a web-based interface to interact with your Arcade , test , and monitor protocol messages.
Installation
Install the Inspector globally:
npm install -g @modelcontextprotocol/inspector
Or use npx to run without installing:
npx @modelcontextprotocol/inspector
Basic usage
Connecting to HTTP servers
For servers running over HTTP:
# Start your MCP server
uv run server.py
# In another terminal, start the inspector
mcp-inspector http://localhost:8000/mcp
Connecting to stdio servers
For stdio-based servers:
# Start the inspector with your server command
mcp-inspector "uv run server.py stdio"
# With additional project directory
mcp-inspector --cwd /path/to/project "uv run server.py stdio"
Inspector features
Tool Explorer
The Explorer shows all available tools with:
- names and descriptions
- Parameter schemas
- Return type information
- Example invocations
Interactive testing
Test directly from the interface:
- Select a from the explorer
- Fill in parameter values
- Click “Execute” to run the
- View results and execution time
Protocol Monitor
Monitor all protocol messages:
- Request/response pairs
- Message timing
- Protocol errors
- Raw JSON data
Resource Browser
If your server provides resources:
- Browse available resources
- View resource contents
- Test resource operations
Prompt templates
Test prompt templates if supported:
- View available prompts
- Fill template parameters
- Preview rendered prompts
Advanced usage
Custom environment
Pass environment variables to your server:
# Using env command
env ARCADE_API_KEY=your-key mcp-inspector "uv run server.py stdio"
# Using inspector's env option
mcp-inspector --env ARCADE_API_KEY=your-key "uv run server.py stdio"
Working directory
Set the working directory for your server:
mcp-inspector --cwd /path/to/project "uv run server.py stdio"
Debug mode
Enable verbose logging:
# Debug the inspector
mcp-inspector --debug "uv run server.py stdio"
# Server debug logging is configured in your server.py
# app = MCPApp(name="my_server", version="1.0.0", log_level="DEBUG")
Testing workflows
Tool development
- Configure your server with hot reload:
# In your server.py
if __name__ == "__main__":
transport = sys.argv[1] if len(sys.argv) > 1 else "http"
app.run(transport=transport, host="127.0.0.1", port=8000, reload=True)
Then run:
uv run server.py
- Connect the inspector:
mcp-inspector http://localhost:8000/mcp
- Develop and test:
- Modify your code
- Server auto-reloads
- Test immediately in inspector
Performance testing
Use the inspector to measure performance:
- Enable timing in the Protocol Monitor
- Execute multiple times
- Analyze response times
- Identify bottlenecks
Error debugging
Debug errors effectively:
- Enable debug mode on your server
- Execute the failing
- Check Protocol Monitor for error details
- View server logs in terminal
Integration testing
Test suites
Create test suites using the inspector:
// test-tools.js
const tests = [
{
tool: "greet",
params: { name: "World" },
expected: "Hello, World!"
},
{
tool: "calculate",
params: { expression: "2 + 2" },
expected: 4
}
];
// Run tests via inspector API
Automated testing
Combine with testing frameworks:
# test_mcp_tools.py
import subprocess
import json
import pytest
def test_tool_via_inspector():
# Start server
server = subprocess.Popen(
["python", "-m", "arcade_mcp_server"],
stdout=subprocess.PIPE
)
# Use inspector's API to test tools
# ...
Best practices
Development setup
-
Use split terminal:
- Terminal 1: server with reload
- Terminal 2: Inspector
- Terminal 3: Code editor
-
Enable all debugging:
# In server.py
app = MCPApp(name="my_server", version="1.0.0", log_level="DEBUG")
# Run with reload
app.run(transport="http", host="127.0.0.1", port=8000, reload=True)
Then run with environment file:
uv run server.py
- Save test cases:
- Export successful calls
- Build regression test suite
- Document edge cases
Production testing
- Test against production config:
mcp-inspector "uv run server.py stdio"
-
Verify security:
- Test with limited permissions
- Verify handling
- Check error messages don’t leak secrets
-
Load testing:
- Execute rapidly
- Monitor memory usage
- Check for resource leaks
Troubleshooting
Common issues
Server not starting
- Verify server is running
- Check correct URL/command
- Ensure ports aren’t blocked
- Try with
--debug
flag
Protocol error
- Ensure server implements correctly
- Check for version compatibility
- Review server logs
- Verify transport type
Tool not found
- Verify is decorated with
@tool
- Check discovery in server
- Ensure no import errors
- Restart server and inspector
Parameter validation failed
- Check parameter types match schema
- Verify required parameters
- Test with simpler values
- Review documentation
Examples
Quick test session
# 1. Start a simple MCP server
cat > test_tools.py << 'EOF'
from arcade_mcp_server import tool
from typing import Annotated
@tool
def echo(message: Annotated[str, "Message to echo"]) -> str:
"""Echo the message back."""
return message
@tool
def add(
a: Annotated[int, "First number"],
b: Annotated[int, "Second number"]
) -> Annotated[int, "Sum"]:
"""Add two numbers."""
return a + b
EOF
# 2. Start inspector
mcp-inspector "uv run server.py stdio"
# 3. Test tools in the web interface
HTTP server testing
# 1. Create an MCPApp server
cat > app.py << 'EOF'
from arcade_mcp_server import MCPApp
from typing import Annotated
app = MCPApp(name="test-server", version="1.0.0")
@app.tool
def get_time() -> Annotated[str, "Current time"]:
"""Get the current time."""
from datetime import datetime
return datetime.now().isoformat()
if __name__ == "__main__":
app.run(port=9000, reload=True)
EOF
# 2. Run the server
python app.py
# 3. Connect inspector
mcp-inspector http://localhost:9000/mcp
Debugging session
# 1. Enable all debugging
export DEBUG=*
export MCP_DEBUG=true
# 2. Start server with verbose logging
# (configure log_level="DEBUG" in your server.py)
uv run server.py stdio 2>server.log
# 3. Start inspector with debugging
mcp-inspector --debug "uv run server.py stdio"