MCP Inspector
The MCP Inspector is a powerful debugging and testing tool for MCP servers. It provides a web-based interface to interact with your Arcade MCP server, test tools, and monitor protocol messages.
Installation
Install the MCP Inspector globally:
Or use npx to run without installing:
Basic Usage
Connecting to HTTP Servers
For MCP 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 Tool Explorer shows all available tools with:
- Tool names and descriptions
- Parameter schemas
- Return type information
- Example invocations
Interactive Testing
Test tools directly from the interface:
- Select a tool from the explorer
- Fill in parameter values
- Click "Execute" to run the tool
- View results and execution time
Protocol Monitor
Monitor all MCP 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:
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:
Then run:
-
Connect the inspector:
-
Develop and test:
- Modify your tool code
- Server auto-reloads
- Test immediately in inspector
Performance Testing
Use the inspector to measure tool performance:
- Enable timing in the Protocol Monitor
- Execute tools multiple times
- Analyze response times
- Identify bottlenecks
Error Debugging
Debug tool errors effectively:
- Enable debug mode on your server
- Execute the failing tool
- 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: MCP server with reload
- Terminal 2: Inspector
-
Terminal 3: Code editor
-
Enable All Debugging:
Then run with environment file:
- Save Test Cases:
- Export successful tool calls
- Build regression test suite
- Document edge cases
Production Testing
-
Test Against Production Config:
-
Verify Security:
- Test with limited permissions
- Verify API key handling
-
Check error messages don't leak secrets
-
Load Testing:
- Execute tools rapidly
- Monitor memory usage
- Check for resource leaks
Troubleshooting
Connection Issues
"Failed to connect"
- Verify server is running
- Check correct URL/command
- Ensure ports aren't blocked
- Try with
--debug
flag
"Protocol error"
- Ensure server implements MCP correctly
- Check for version compatibility
- Review server logs
- Verify transport type
Tool Issues
"Tool not found"
- Verify tool is decorated with
@tool
- Check tool 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 tool 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