Common Issues & Solutions
Common Issues & Solutions
This guide covers the most frequently encountered issues when using MCP Client Tester, along with step-by-step solutions and prevention strategies.
Installation & Setup Issues
Docker Services Not Starting
Symptoms:
- Services fail to start with
docker-compose up - Health check failures
- Connection refused errors
Common Causes & Solutions:
Problem: Ports 80, 443, or other required ports are already in use.
Solution:
# Check which process is using the portsudo lsof -i :80sudo lsof -i :443
# Kill the conflicting process or change ports in docker-compose.yml# Alternative: Use different ports in .env filePORT_HTTP=8080PORT_HTTPS=8443Problem: External Caddy network doesn’t exist or conflicts.
Solution:
# Check if caddy network existsdocker network ls | grep caddy
# Create the network if it doesn't existdocker network create caddy
# If there are conflicts, remove and recreatedocker network rm caddydocker network create caddyProblem: Docker daemon running out of memory or disk space.
Solution:
# Check Docker system usagedocker system df
# Clean up unused resourcesdocker system prune -a
# Increase Docker memory limit in Docker Desktop settings# Or for Linux, check available memoryfree -hDomain Resolution Issues
Symptoms:
- Cannot access
https://mcp-tester.local - DNS resolution failures
- SSL certificate errors
Solutions:
-
Configure Hosts File
Terminal window # Linux/macOS: Edit /etc/hostssudo nano /etc/hosts# Add these lines127.0.0.1 mcp-tester.local127.0.0.1 api.mcp-tester.local127.0.0.1 docs.mcp-tester.local127.0.0.1 reports.mcp-tester.local# Windows: Edit C:\Windows\System32\drivers\etc\hosts (as Administrator) -
Use Alternative Domain
Terminal window # Update .env fileDOMAIN=localhostPUBLIC_DOMAIN=localhost# Restart servicesdocker-compose down && docker-compose up -d -
Setup Local DNS Server
Terminal window # Using dnsmasq on macOSbrew install dnsmasqecho 'address=/.local/127.0.0.1' > /etc/dnsmasq.confsudo brew services start dnsmasq
Connection & Transport Issues
STDIO Transport Problems
Symptoms:
- Client fails to connect via STDIO
- Process spawn errors
- Broken pipe errors
Diagnostic Steps:
# Check if the MCP server process is executabledocker-compose exec backend python -m app.mcp.stdio_server --help
# Test STDIO connection manuallyecho '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{}}' | \ docker-compose exec -T backend python -m app.mcp.stdio_server
# Check container logsdocker-compose logs backendCommon Solutions:
-
Permission Issues
Terminal window # Ensure the script is executablechmod +x path/to/mcp/server/script# Check container permissionsdocker-compose exec backend ls -la /app/app/mcp/ -
Path Problems
Terminal window # Use absolute paths in client configuration{"command": "/usr/bin/docker","args": ["compose", "exec", "backend", "python", "-m", "app.mcp.stdio_server"]} -
Environment Variables
Terminal window # Ensure required environment variables are setdocker-compose exec backend env | grep MCP
HTTP Transport Issues
Symptoms:
- HTTP 404/500 errors
- Timeout issues
- CORS problems
Diagnostic Commands:
# Test HTTP endpoint directlycurl -v "https://api.mcp-tester.local/mcp" \ -H "Content-Type: application/json" \ -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{}}'
# Check backend healthcurl "https://api.mcp-tester.local/health"
# Test without SSLcurl -k "https://api.mcp-tester.local/mcp" --insecureSolutions:
-
SSL Certificate Issues
Terminal window # For development, accept self-signed certificatescurl -k "https://api.mcp-tester.local/mcp" --insecure# Or configure your client to accept self-signed certificates -
CORS Configuration
# In backend configurationfrom fastapi.middleware.cors import CORSMiddlewareapp.add_middleware(CORSMiddleware,allow_origins=["*"], # Configure appropriately for productionallow_credentials=True,allow_methods=["*"],allow_headers=["*"],) -
Reverse Proxy Issues
Terminal window # Check Caddy logsdocker logs caddy_container_name# Test direct backend connection (bypassing proxy)curl "http://localhost:8000/health"
WebSocket/SSE Connection Problems
Symptoms:
- WebSocket connection failures
- SSE stream interruptions
- Real-time updates not working
Debugging Steps:
# Test WebSocket connectionwscat -c "wss://api.mcp-tester.local/ws"
# Test SSE endpointcurl -N "https://api.mcp-tester.local/api/v1/sessions/test-session/events"
# Check browser developer tools for WebSocket errorsSolutions:
-
Proxy Configuration
# In docker-compose.yml labelscaddy.@ws.0_header: Connection *Upgrade*caddy.@ws.1_header: Upgrade websocketcaddy.0_reverse_proxy: "@ws {{upstreams 8000}}" -
Firewall/Network Issues
Terminal window # Check if WebSocket ports are accessibletelnet api.mcp-tester.local 443# Test from different network location
Protocol & Message Issues
JSON-RPC Format Errors
Symptoms:
- “Invalid Request” errors
- “Parse error” responses
- Message format validation failures
Common Format Issues:
Validation Steps:
# Validate JSON-RPC message formatimport json
def validate_jsonrpc(message): required_fields = ["jsonrpc", "method"]
if not isinstance(message, dict): return False, "Message must be a JSON object"
if message.get("jsonrpc") != "2.0": return False, "jsonrpc must be '2.0'"
if "method" not in message: return False, "method field is required"
# For requests, id is required if "id" in message and not isinstance(message["id"], (str, int, type(None))): return False, "id must be string, number, or null"
return True, "Valid"
# Test your messagesmessage = {"jsonrpc": "2.0", "id": 1, "method": "tools/list"}valid, error = validate_jsonrpc(message)print(f"Valid: {valid}, Error: {error}")Method Not Found Errors
Symptoms:
- “Method not found” error responses
- Client calls fail for existing methods
Debugging Steps:
-
List Available Methods
Terminal window # Get server capabilitiescurl -X POST "https://api.mcp-tester.local/mcp" \-H "Content-Type: application/json" \-d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{}}' -
Check Method Names
# Common method name issuescorrect_methods = ["initialize","tools/list","tools/call","resources/list","resources/read","prompts/list","prompts/get"]# Case-sensitive - "Tools/List" vs "tools/list"# Spelling - "tool/list" vs "tools/list" -
Verify Server Implementation
# Check if method is actually implemented@app.tool()def my_tool(param: str) -> str:return f"Result: {param}"# Method name becomes "tools/call" with name="my_tool"
Parameter Validation Errors
Symptoms:
- “Invalid params” errors
- Type validation failures
- Required parameter missing
Common Parameter Issues:
# Tool definition@app.tool()def search_data(query: str, limit: int = 10) -> dict: """Search for data""" return {"results": []}
# ❌ Wrong parameter types{ "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "search_data", "arguments": { "query": 123, # Should be string "limit": "invalid" # Should be integer } }}
# ✅ Correct parameter types{ "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "search_data", "arguments": { "query": "test search", "limit": 10 } }}Performance Issues
Slow Response Times
Symptoms:
- High latency in tool calls
- Timeouts during operations
- Poor user experience
Diagnostic Steps:
-
Enable Performance Monitoring
Terminal window # In session configuration{"config": {"enable_metrics": true,"detailed_timing": true,"profile_requests": true}} -
Check System Resources
Terminal window # Monitor container resourcesdocker stats# Check backend logs for performance warningsdocker-compose logs backend | grep -i "slow\|timeout\|performance" -
Analyze Session Data
Terminal window # Export session performance datacurl "https://api.mcp-tester.local/api/v1/sessions/{session_id}/export?format=json&include=performance"
Optimization Strategies:
-
Database Optimization
# Add database indexes# Use connection pooling# Implement query optimization# Example: Add async/await for I/O operations@app.tool()async def search_data(query: str) -> dict:async with database.transaction():results = await database.fetch_all("SELECT * FROM data WHERE content LIKE :query",{"query": f"%{query}%"})return {"results": [dict(row) for row in results]} -
Caching Implementation
from functools import lru_cacheimport redis# In-memory caching@lru_cache(maxsize=128)def expensive_operation(param):# Expensive computationreturn result# Redis cachingredis_client = redis.Redis(host='redis')@app.tool()async def cached_search(query: str) -> dict:cache_key = f"search:{query}"cached_result = redis_client.get(cache_key)if cached_result:return json.loads(cached_result)result = await perform_search(query)redis_client.setex(cache_key, 300, json.dumps(result))return result
Memory Issues
Symptoms:
- Out of memory errors
- Container restarts
- Performance degradation over time
Solutions:
-
Memory Monitoring
Terminal window # Monitor memory usagedocker stats --format "table {{.Container}}\t{{.CPUPerc}}\t{{.MemUsage}}\t{{.MemPerc}}"# Check for memory leaksdocker-compose logs backend | grep -i "memory\|oom" -
Memory Optimization
# Implement proper cleanup@app.tool()async def process_large_data(file_path: str) -> dict:try:# Process data in chunkswith open(file_path, 'r') as f:results = []for chunk in read_chunks(f, chunk_size=1024):result = process_chunk(chunk)results.append(result)# Clean up intermediate datadel chunkreturn {"processed": len(results)}finally:# Explicit cleanupgc.collect()
Client-Specific Issues
Claude Desktop Integration Problems
Symptoms:
- Claude Desktop doesn’t see MCP server
- Tools not available in conversations
- Connection drops frequently
Troubleshooting:
-
Check Configuration Format
// ❌ Incorrect configuration{"mcpServers": {"test-server": {"command": ["python", "server.py"] // Should be string}}}// ✅ Correct configuration{"mcpServers": {"test-server": {"command": "python","args": ["server.py"]}}} -
Verify Server Executable
Terminal window # Test server manuallypython server.py# Check if server responds to initializationecho '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{}}' | python server.py -
Check Claude Desktop Logs
- macOS:
~/Library/Logs/Claude/ - Windows:
%APPDATA%\Claude\logs\ - Look for MCP-related error messages
- macOS:
Custom Client Issues
Symptoms:
- Custom client can’t connect
- Protocol negotiation fails
- Feature detection problems
Debugging Process:
-
Implement Debug Logging
import logginglogging.basicConfig(level=logging.DEBUG)logger = logging.getLogger(__name__)class DebugMCPClient:def send_message(self, message):logger.debug(f"Sending: {json.dumps(message)}")response = self.transport.send(message)logger.debug(f"Received: {json.dumps(response)}")return response -
Test Protocol Compliance
# Minimal compliant clientdef test_basic_connection():# Step 1: Initializeinit_request = {"jsonrpc": "2.0","id": 1,"method": "initialize","params": {"protocolVersion": "1.0.0","capabilities": {},"clientInfo": {"name": "Test Client","version": "1.0.0"}}}response = send_request(init_request)assert response.get("result") is not None# Step 2: Test basic functionalitytools_request = {"jsonrpc": "2.0","id": 2,"method": "tools/list"}response = send_request(tools_request)assert "result" in response
Error Codes Reference
Standard JSON-RPC Errors
| Code | Name | Description | Solution |
|---|---|---|---|
| -32700 | Parse error | Invalid JSON | Check JSON syntax |
| -32600 | Invalid Request | Invalid JSON-RPC | Verify message format |
| -32601 | Method not found | Unknown method | Check method name spelling |
| -32602 | Invalid params | Invalid parameters | Validate parameter types |
| -32603 | Internal error | Server error | Check server logs |
MCP-Specific Errors
| Code | Name | Description | Solution |
|---|---|---|---|
| -32000 | Server error | MCP server error | Check server implementation |
| -32001 | Tool not found | Unknown tool name | Verify tool is registered |
| -32002 | Resource not found | Invalid resource URI | Check resource path |
| -32003 | Permission denied | Access denied | Verify permissions |
Getting Help
When you encounter issues not covered here:
-
Check Logs
Terminal window # View all service logsdocker-compose logs# View specific service logsdocker-compose logs backenddocker-compose logs frontend -
Enable Debug Mode
Terminal window # Set debug environment variablesexport DEBUG=trueexport LOG_LEVEL=DEBUGdocker-compose up -d -
Export Session Data
Terminal window # Get detailed session informationcurl "https://api.mcp-tester.local/api/v1/sessions/{session_id}/export?format=json&include=all" \--output debug_session.json -
Create Minimal Reproduction
- Isolate the issue to the smallest possible test case
- Document the exact steps to reproduce
- Include relevant configuration and error messages
Still having issues? Check our specific troubleshooting guides for Connection Problems, Protocol Errors, or Performance Issues.