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)#
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
| {
"globalShortcut": "Alt+Space",
"mcpServers": {
"DOCKER": {
"command": "env",
"args": [
"PATH=/Applications/Docker.app/Contents/Resources/bin:/usr/local/bin:/opt/homebrew/bin:/usr/bin:/bin:/usr/sbin:/sbin",
"/Applications/Docker.app/Contents/Resources/bin/docker",
"mcp",
"gateway",
"run"
]
}
}
}
|
Advanced Gateway Configuration#
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
| # Run gateway with security features enabled
docker mcp gateway run \
--verify-signatures \
--log-calls \
--block-secrets
# Run gateway with specific servers and transport
docker mcp gateway run \
--transport=sse \
--servers=wikipedia-mcp \
--tools=get_article,get_summary,get_related_topics
# Servers I have currently enabled
docker mcp server list
# context7, docker, duckduckgo, fetch, filesystem, sequentialthinking, time
|
Server Catalog Management#
1
2
3
4
5
6
7
8
| # 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#
1
2
3
4
5
6
| # 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 read
|
Gateway 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#
Purpose: Display all configured MCP (Model Context Protocol) servers and their status.
Add MCP Servers from Claude Desktop#
1
| claude mcp add-from-claude-desktop -s user
|
Purpose: Import MCP server configurations from Claude Desktop application to Claude Code CLI.
Remove MCP Server#
1
| claude mcp remove <server-name> -s user
|
Purpose: Remove an MCP server configuration.
Add MCP Servers (Manual Configuration)#
1
2
3
4
5
6
7
8
9
10
11
12
| # Add stdio server
claude mcp add <server-name> <command> [args...]
# Add SSE server
claude mcp add --transport sse <server-name> <url>
# Add HTTP server
claude mcp add --transport http <server-name> <url>
# Add with specific scope
claude mcp add --scope user <server-name> <command>
claude mcp add --scope project <server-name> <command>
|
Get Server Details#
1
| claude mcp get <server-name>
|
Purpose: Display detailed information about a specific MCP server configuration.
JSON Output for Automation#
1
2
3
4
5
6
7
8
| # 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#
1
2
3
| # Automated code review
claude -p "review changes in $(git diff --name-only)" > review.md
git diff | claude "review these changes" -p
|
Configuration & Settings#
View Settings File#
1
| cat ~/.claude/settings.json
|
response:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
| {
"permissions": {
"allow": [
"mcp__DOCKER__get-library-docs",
"mcp__DOCKER__resolve-library-id",
"mcp__DOCKER__sequentialthinking",
"mcp__DOCKER__fetch",
"mcp__DOCKER__fetch_content",
"mcp__DOCKER__search",
"WebFetch(domain:docs.anthropic.com)",
"WebFetch(domain:*)",
"Bash(npm run lint)"
],
"deny": []
}
}
|
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#
Purpose: Begin a new interactive conversation with Claude.
Resume Previous Session#
1
2
3
| claude --resume
# or
claude -c
|
Purpose: Continue from your last conversation session.
Enhanced Development Workflow#
1
2
3
4
5
6
7
8
| # 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#
1
2
3
4
5
6
7
8
9
| # Single command with print flag
claude "your prompt here" -p
claude "your prompt here" --print
# Continue conversation from command
claude -c "follow up question"
# Verbose execution for debugging
claude --debug "debug this issue"
|
File and Directory Operations#
1
2
3
4
5
6
7
8
9
10
11
| # Add multiple directories to context
claude --add-dir /path/to/src --add-dir /path/to/tests
# Process file input
claude < analysis-prompt.txt
# Save formatted output
claude "generate report" -p --output-format json > report.json
# Pipe operations
git diff | claude "review these changes" -p
|
Troubleshooting & Debug#
Get Help#
Purpose: Display available commands and options.
Show Version#
Purpose: Display Claude Code version information.
Debug Mode#
Purpose: Run with detailed debugging information.
Advanced MCP Server Management#
Project-Level Configuration#
1
2
3
4
5
6
7
8
9
10
11
12
13
| # Create project-specific MCP configuration
echo '{
"mcpServers": {
"project-tools": {
"command": "npm",
"args": ["run", "mcp-server"],
"scope": "project"
}
}
}' > .mcp.json
# Use project configuration
claude --mcp-config .mcp.json chat
|
Multi-Server Workflows#
1
2
3
4
| # Enable multiple complementary servers
claude mcp add filesystem-server file-tools
claude mcp add database-server db-tools
claude mcp add api-server http-client
|
Advanced Usage & Integrations#
Useful Alias#
1
2
3
| # Terminal integration
alias c='claude -p'
alias cr='claude --resume'
|
Background Processing#
1
2
3
4
| # Run long tasks in background
claude "analyze large codebase" &
# output:- [1] pid
ps pid
|
1
2
3
4
5
6
| # 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.prompt
|
Debug MCP Issues#
1
| claude --debug mcp list
|
Common Issues & Solutions#
MCP Server Connection Problems#
1
2
| # Check server status
claude mcp list --debug
|
- 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#
Quick Command Reference#
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
| # Essential commands
claude --help # Get help
claude chat # Start interactive session
claude -p "query" # One-time query
claude --resume # Resume last session
# MCP management
claude mcp list # List servers
claude mcp add <name> <cmd> # Add server
claude mcp get <name> # Server details
claude mcp remove <name> # Remove server
# Docker Gateway
docker mcp gateway run # Start gateway
docker mcp catalog show # Browse catalog
docker mcp server enable <name> # Enable server
docker mcp secret set 'key=val' # Set secrets
|
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 ↗.