Claude Code Commands Reference
A comprehensive guide to essential Claude Code CLI commands for efficient AI-powered development workflows, with special focus on Docker MCP Gateway integration.
Docker MCP Gateway Management
I prefer to use MCP servers through the Docker MCP Gateway. It provides a unified way for managing MCP servers across different tools like Cursor, Claude, and other AI clients without manual configuration for each tool.
Key Benefits:
- Centralized MCP server management
- Container-based isolation and security
- Unified configuration across clients
- Built-in secret management
- Server catalog discovery
Learn more: Docker MCP Gateway: Open Source, Secure Infrastructure for Agentic AI ↗
Docker MCP Gateway Configuration
Basic Gateway Configuration (Claude Desktop)
| |
Advanced Gateway Configuration
| |
Server Catalog Management
# View available MCP servers in catalog
docker mcp catalog show
# Enable specific servers
docker mcp server enable google-maps brave
# Disable servers
docker mcp server disable <server-name>Secret and Configuration Management
# Set API keys and secrets
docker mcp secret set 'brave.api_key=YOUR_API_KEY'
docker mcp secret set 'github.token=YOUR_GITHUB_TOKEN'
# View current configuration
docker mcp config readGateway Security Features
- Container Isolation: Each MCP server runs in isolated Docker containers
- Signature Verification: Verify provenance of MCP container images
- Secret Scanning: Block secrets in inbound/outbound payloads
- Network Restrictions: Controlled network access for servers
- Resource Limits: CPU and memory constraints per server
Traditional MCP Server Management
List MCP Servers
claude mcp listPurpose: Display all configured MCP (Model Context Protocol) servers and their status.
Add MCP Servers from Claude Desktop
claude mcp add-from-claude-desktop -s userPurpose: Import MCP server configurations from Claude Desktop application to Claude Code CLI.
Remove MCP Server
claude mcp remove <server-name> -s userPurpose: Remove an MCP server configuration.
Add MCP Servers (Manual Configuration)
| |
Get Server Details
claude mcp get <server-name>Purpose: Display detailed information about a specific MCP server configuration.
Output Formats & Scripting
JSON Output for Automation
# Get structured JSON response
claude -p "analyze this code" --output-format json
# Stream JSON for real-time processing
claude "process large dataset" --output-format stream-json
# Combine with jq for parsing
claude -p "list project dependencies" --output-format json | jq '.content'Scripting Examples
# Automated code review
claude -p "review changes in $(git diff --name-only)" > review.md
git diff | claude "review these changes" -pConfiguration & Settings
View Settings File
cat ~/.claude/settings.jsonresponse:
| |
Purpose: Display current Claude Code configuration including MCP servers, shortcuts, and allowed tools. I use this configuration to auto allow of these tools
Session Management
Start Interactive Session
claude chatPurpose: Begin a new interactive conversation with Claude.
Resume Previous Session
claude --resume
# or
claude -cPurpose: Continue from your last conversation session.
Enhanced Development Workflow
Model Selection & Performance
# Use specific model
claude --model claude-3-7-sonnet-latest
claude --model claude-3-5-sonnet-20241022
claude --model claude-3-5-haiku-20241022
# Model comparison workflow
claude --model claude-3-5-sonnet-20241022 "complex analysis task"
claude --model claude-3-5-haiku-20241022 "simple quick task"Advanced Command Execution
| |
File and Directory Operations
| |
Troubleshooting & Debug
Get Help
claude --helpPurpose: Display available commands and options.
Show Version
claude --versionPurpose: Display Claude Code version information.
Debug Mode
claude --debugPurpose: Run with detailed debugging information.
Advanced MCP Server Management
Project-Level Configuration
| |
Multi-Server Workflows
# Enable multiple complementary servers
claude mcp add filesystem-server file-tools
claude mcp add database-server db-tools
claude mcp add api-server http-clientAdvanced Usage & Integrations
Useful Alias
# Terminal integration
alias c='claude -p'
alias cr='claude --resume'Background Processing
# Run long tasks in background
claude "analyze large codebase" &
# output:- [1] pid
ps pidPerformance Optimization
# Use faster model for simple tasks
claude --model claude-3-5-haiku-20241022 "quick syntax check"
# Cache frequently used prompts
echo "Review code for security vulnerabilities" > security-review.prompt
claude < security-review.promptDebug MCP Issues
claude --debug mcp listTroubleshooting & Performance Tips
Common Issues & Solutions
MCP Server Connection Problems
# Check server status
claude mcp list --debugPerformance Optimization Tips
- Choose Right Model: Use Haiku for simple tasks, Sonnet for complex analysis
- Cache Prompts: Save frequently used prompts to files
- Batch Operations: Group related tasks together
- Clean Sessions: Regularly remove old conversation history
Resources & References
Official Documentation
Community Resources
Quick Command Reference
| |
This comprehensive reference covers Claude Code CLI usage with special focus on Docker MCP Gateway integration. For the latest features and updates, always refer to claude --help or the official documentation ↗.