Troubleshooting
This guide covers common issues and their solutions when working with the MCP Client module.
Connection Issues
"Could not fetch tools from server"
This error appears when the module cannot connect to or communicate with an MCP server.
For HTTP Transport
Symptoms: - Error when saving MCP server configuration - Tools list is empty - Connection timeout errors
Solutions:
-
Verify endpoint URL
bash curl -X POST https://your-mcp-server.com/mcp \ -H "Content-Type: application/json" \ -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' -
Check server is running
- Verify the MCP server process is running
- Check server logs for errors
-
Ensure server is listening on the correct port
-
Verify network connectivity
- Check firewall rules allow outbound connections
- Verify DNS resolves correctly:
nslookup your-server.com -
Test from the Drupal server:
ping your-server.com -
Check SSL certificates (for HTTPS)
- Verify certificate is valid:
curl -vI https://your-server.com - Check certificate is not expired
-
Ensure certificate chain is complete
-
Review timeout settings
- Increase timeout value if server is slow
- Try 60-120 seconds for initial testing
For STDIO Transport
Symptoms: - Error when saving MCP server configuration - Process starts but no tools appear - "Command not found" errors
Solutions:
- Test command manually ```bash # Switch to web server user sudo -u www-data bash
# Test the command node /path/to/mcp-server/index.js
# Test with STDIO echo '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' | node /path/to/server.js ```
- Verify file paths ```bash # Check file exists ls -la /path/to/mcp-server/index.js
# Check execute permissions ls -la $(which node) ```
- Check permissions ```bash # Verify ownership ls -la /path/to/mcp-server/
# Fix if needed chown -R www-data:www-data /path/to/mcp-server/ chmod +x /path/to/mcp-server/index.js ```
- Review process output
- Check Drupal logs: Administration » Reports » Recent log messages
- Look for stderr output from the process
-
Check for missing dependencies
-
Verify working directory
- Ensure working directory exists
- Check web server user can access it
- Set correct working directory in configuration
Server Status Issues
"MCP server is not enabled"
Problem: Trying to use a disabled MCP server.
Solution:
- Navigate to Administration » Configuration » AI » MCP Servers
- Find your server in the list
- Click "Edit"
- Check the "Enabled" checkbox
- Click "Save"
Server Appears Enabled But Tools Don't Work
Solutions:
-
Clear cache
bash drush cr -
Verify connection
- Test in API Explorer
- Check recent log messages
- Review server logs
Tool Issues
"MCP tool is not enabled"
Problem: Trying to call a disabled tool.
Solution:
- Navigate to server configuration
- Scroll to "Enabled tools" section
- Check the box for the desired tool
- Click "Save"
Tools Don't Appear in API Explorer
Symptoms: - MCP server is configured and enabled - Tools list shows tools are enabled - Tools don't appear in API Explorer
Solutions:
-
Clear cache
bash drush cr -
Verify server is enabled
- Check server status in MCP Server list
-
Ensure "Enabled" is checked
-
Check AI module integration
- Verify AI module is enabled
- Check AI module configuration
-
Review AI module logs
-
Refresh plugin cache
bash drush cr drush php-eval "\\Drupal::service('plugin.manager.ai.function')->clearCachedDefinitions();"
Tool Execution Fails
Symptoms: - Tool appears in API Explorer - Calling tool returns an error - Error messages in logs
Solutions:
- Check parameters
- Verify all required parameters are provided
- Check parameter types match schema
-
Review parameter format
-
Review error messages
- Check Drupal logs for detailed errors
- Look for MCP server error responses
-
Review parameter validation errors
-
Test with minimal parameters
- Start with required parameters only
- Add optional parameters one at a time
-
Identify which parameter causes issues
-
Verify MCP server health
- Check server logs
- Test tool directly on MCP server
- Verify server isn't overloaded
Authentication Issues
Environment Variables Not Working
Symptoms: - MCP server returns authentication errors - API keys seem not to be passed - "Unauthorized" or "403" errors
Solutions:
-
Verify Key module configuration
bash drush config:get key.key.your_key_name -
Check key exists and is accessible
- Navigate to Administration » Configuration » System » Keys
- Verify key exists
- Test key value retrieval
-
Check key permissions
-
Review environment variable configuration
- Edit MCP server configuration
- Verify variable names match what server expects
- Ensure "Type" is set to "Key" for sensitive values
-
Confirm correct key is selected
-
For STDIO: Test environment ```bash # Create test script echo '#!/bin/bash' > /tmp/test-env.sh echo 'env' >> /tmp/test-env.sh chmod +x /tmp/test-env.sh
# Run as web server user sudo -u www-data /tmp/test-env.sh ```
- For HTTP: Check headers
- Review MCP server logs to see what headers are received
- Verify authentication method matches server expectations
- Test with curl including headers
Performance Issues
Slow Tool Execution
Symptoms: - Tools take long time to execute - Timeout errors - Agent operations are slow
Solutions:
- Increase timeout
- Edit MCP server configuration
- Increase timeout value (60-120 seconds)
-
Save and test
-
Check server performance
- Monitor MCP server resource usage
- Check for slow database queries
-
Review server logs for performance issues
-
Optimize tool calls
- Reduce unnecessary tool calls
- Cache results when possible
-
Use batch operations if available
-
Monitor network latency (HTTP)
bash curl -w "@curl-format.txt" -o /dev/null -s https://your-server.com
High Memory Usage
Symptoms: - PHP memory errors - Server running out of memory - Slow performance
Solutions:
-
Increase PHP memory limit
php // In settings.php ini_set('memory_limit', '512M'); -
Limit concurrent connections
- Reduce number of enabled MCP servers
- Disable unused tools
-
Implement queueing for heavy operations
-
Monitor process memory (STDIO)
bash ps aux | grep mcp top -p $(pgrep -f "mcp-server")
Installation Issues
PHP Version Error
Error: "MCP Client requires PHP 8.2 or higher"
Solution:
Upgrade PHP to version 8.2 or higher:
# Check current version
php -v
# Ubuntu/Debian
sudo apt-get install php8.2
# Update Drupal to use new PHP version
# (varies by web server configuration)
Composer Installation Fails
Solutions:
-
Memory issues
bash COMPOSER_MEMORY_LIMIT=-1 composer require drupal/mcp_client -
Dependency conflicts
bash composer require drupal/mcp_client --with-dependencies composer update --with-dependencies -
Clear Composer cache
bash composer clear-cache composer require drupal/mcp_client
Debugging
Enable Debug Logging
-
Enable Drupal logging
php // In settings.php $config['system.logging']['error_level'] = 'verbose'; -
Watch logs
bash drush watchdog:tail # or tail -f /path/to/drupal/sites/default/files/logs/drupal.log -
For STDIO processes
- Add DEBUG environment variable
- Review process output in logs
- Use process monitoring tools
Testing Checklist
When troubleshooting, work through this checklist:
- [ ] Module is installed and enabled
- [ ] Dependencies are met (PHP version, required modules)
- [ ] MCP server configuration is saved
- [ ] MCP server is enabled
- [ ] Connection test succeeds (manual curl/command test)
- [ ] Tools are discovered and listed
- [ ] Desired tools are enabled
- [ ] Environment variables are configured (if needed)
- [ ] Keys are created and accessible (if needed)
- [ ] Cache is cleared
- [ ] Logs show no errors
- [ ] Test in API Explorer works
Getting Help
If you're still experiencing issues:
- Check issue queue
- Visit https://www.drupal.org/project/issues/mcp_client
- Search for similar issues
-
Review open and closed issues
-
Gather information
- PHP version:
php -v - Drupal version:
drush status - Module version:
drush pm:list | grep mcp_client - Error messages from logs
-
Steps to reproduce
-
Create issue
- Provide detailed information
- Include error messages
- Describe expected vs actual behavior
-
List troubleshooting steps tried
-
Community support
- Drupal Slack: #ai channel
- Stack Exchange: drupal.stackexchange.com
- Drupal forums