How to Use the Deployxa MCP Server with Claude Code CLI
Claude Code CLI is Anthropic's terminal-based AI assistant, and it is a favorite of developers who prefer the terminal over GUI-based editors. Like Cursor and Claude Desktop, it supports the Model Context Protocol, which means it can call the Deployxa MCP server's 40+ tools for cloud control. The setup is similar to other MCP clients: install the MCP server, authenticate with OAuth 2.1 PKCE, configure Claude Code CLI to use the server, and start deploying from the terminal. This guide covers the setup, the key workflows, and how Claude Code CLI's terminal-first approach enhances the agentic cloud control experience.
The direct answer is that Claude Code CLI supports the Model Context Protocol, which means it can call the 40+ tools exposed by the Deployxa MCP server. The setup is similar to Cursor: install the MCP server, authenticate with OAuth 2.1 PKCE, configure Claude Code CLI to use the server, and start deploying from chat. The key difference is Claude Code CLI's terminal-first approach: everything happens in the terminal, which is faster for developers who are already comfortable with the command line. For more on the MCP server, see our article on giving Cursor cloud superpowers.
Why Claude Code CLI Is a Strong Choice for Terminal-First Developers
Three properties make Claude Code CLI a strong choice for terminal-first developers. First, it is terminal-based: everything happens in the terminal, which is faster than switching between a GUI editor and a terminal. For developers who live in the terminal (e.g., Vim/Neovim users, tmux users), Claude Code CLI fits naturally into their workflow. Second, it has deep code understanding: Claude Code CLI's AI model is trained to understand code structure, dependencies, and patterns, which means it can make better deployment decisions. Third, it is scriptable: Claude Code CLI can be invoked from scripts and CI/CD pipelines, which makes it ideal for automation. For more on terminal-first workflows, see our article on building the Deployxa CLI.
What the Deployxa MCP Server Exposes
The MCP server exposes 40+ granular tools organized into several categories. The most commonly used are:
- Deployment tools: deployxa_deploy_workflow (deploy from a Git repo or local folder), deployxa_get_deployment_status, deployxa_list_apps, deployxa_delete_app.
- Observability tools: deployxa_get_logs (stream container logs), deployxa_get_readiness (run the 14-point health check), deployxa_get_metrics (CPU, memory, network).
- Operations tools: deployxa_restart_app, deployxa_rollback_release, deployxa_scale_app.
- Configuration tools: deployxa_set_env_var, deployxa_get_env_vars, deployxa_add_domain, deployxa_get_ssl_status.
- Diagnostic tools: deployxa_doctor (run the full readiness engine), deployxa_diagnose_build_failure, deployxa_get_build_log.
Each tool has a defined input schema, so the AI assistant knows exactly what parameters to provide. Dangerous actions (delete app, roll back release) require a confirmed: true parameter. For more on the security model, see our article on securing agentic cloud deployments.
Step-by-Step: Configuring the MCP Server in Claude Code CLI
Here is the exact workflow for setting up the Deployxa MCP server in Claude Code CLI.
Step 1: Install Claude Code CLI
npm install -g @anthropic-ai/claude-codeStep 2: Install the Deployxa MCP server
npm install -g @deployxa/mcp-server
deployxa-mcp loginThe deployxa-mcp login command opens a browser window for OAuth authorization. After authorization, the MCP server stores a refresh token locally.
Step 3: Configure Claude Code CLI to use the MCP server
Claude Code CLI's configuration file is at ~/.claude/config.json (or %APPDATA%\claude\config.json on Windows). Add the Deployxa MCP server:
{
"mcpServers": {
"deployxa": {
"command": "deployxa-mcp",
"args": ["start"],
"env": {}
}
}
}Restart Claude Code CLI. The MCP server is now available.
Step 4: Test the integration
In Claude Code CLI, type: "List all my Deployxa apps." The AI assistant calls deployxa_list_apps, and you see a list of your apps with their current status, URLs, and health grades. If this works, the MCP server is configured correctly.
Step 5: Deploy from Claude Code CLI
In Claude Code CLI, type: "Deploy the current project to Deployxa and check if it's healthy." The AI assistant calls deployxa_deploy_workflow with your current project's path, waits for the build to complete, calls deployxa_get_readiness to run the 14-point health check, and reports back an A-to-F grade with details on any failing checks. You did not leave the terminal.
Step 6: Inspect logs from Claude Code CLI
If the deployment has an issue, type: "Show me the last 100 lines of logs for this app." The AI assistant calls deployxa_get_logs, and the logs appear in the terminal. You can ask follow-up questions: "What does this error mean?" or "Fix the bug causing this error." The AI assistant has the log context and can propose a fix, which you can apply and redeploy without leaving Claude Code CLI.
Step 7: Roll back from Claude Code CLI
If a deployment introduces a regression, type: "Roll back this app to the previous release." The AI assistant asks for confirmation: "This will roll back the app to the previous release. Confirm?" You say yes, and the AI assistant calls deployxa_rollback_release with confirmed: true. The app rolls back in seconds.
Common Pitfalls and Troubleshooting
The first pitfall is authentication failures. If deployxa-mcp login fails with a redirect error, check that your browser is not blocking pop-ups. The OAuth flow requires a redirect from the browser back to the MCP server. The second pitfall is the MCP server not appearing in Claude Code CLI. After adding the configuration, you need to restart Claude Code CLI completely. If the MCP server still does not appear, check the configuration file for syntax errors. The third pitfall is tool call timeouts. The deployxa_deploy_workflow tool can take 1 to 3 minutes, which might exceed Claude Code CLI's MCP client timeout. The fix is to increase the timeout in Claude Code CLI's MCP settings. The fourth pitfall is permission errors. If the MCP server returns a 403 error, the OAuth token does not have the required scope. The fix is to re-run deployxa-mcp login and grant the additional permissions. The fifth pitfall is terminal compatibility. Claude Code CLI works best in modern terminals (iTerm2, Windows Terminal, Alacritty) with true color support. If you are using an older terminal, some features might not work correctly. The fix is to use a modern terminal.
Comparing Claude Code CLI with Other MCP Clients
Claude Code CLI, Cursor, Claude Desktop, and Windsurf all support the Deployxa MCP server, but they have different strengths. Claude Code CLI is best for terminal-first developers who want a fast, scriptable workflow. Cursor is best for GUI-based development with a smooth code-deploy-debug loop. Claude Desktop is best for operations work and long conversations. Windsurf is best for complex, multi-step workflows with deep code understanding. Many developers use multiple clients: Claude Code CLI for quick terminal commands, Cursor for active development, Claude Desktop for operations and monitoring. The MCP server works identically in all clients, so you can switch between them based on what you are doing. For more on the other clients, see our articles on giving Cursor cloud superpowers, using Claude Desktop as your autonomous DevOps engineer, and giving Windsurf cloud superpowers.
Scripting Claude Code CLI for Automation
Claude Code CLI can be invoked from scripts, which makes it ideal for automation. For example, you can write a bash script that deploys an app, checks its health, and rolls back if the health check fails:
#!/bin/bash
# Deploy the app
claude-code "Deploy the current project to Deployxa and return the app ID"
# Wait for the deployment to complete
sleep 60
# Check the health
GRADE=$(claude-code "Run deployxa doctor on the latest deployment and return only the grade")
# Roll back if the grade is below B
if [ "$GRADE" \< "B" ]; then
echo "Grade is $GRADE, rolling back..."
claude-code "Roll back the latest deployment to the previous release"
else
echo "Grade is $GRADE, deployment successful"
fiThis script can be integrated into CI/CD pipelines (e.g., GitHub Actions) for automated deployment with health checks. For more on CI/CD integration, see our article on building a self-healing CI/CD pipeline with Deployxa MCP and GitHub Actions.
Advanced Claude Code CLI Patterns
Beyond the basics, Claude Code CLI benefits from several advanced patterns. The first is custom prompts. Claude Code CLI supports custom prompts (via .claude/prompts/), which let you define reusable prompts for common tasks (e.g., "deploy and verify", "diagnose and fix"). This speeds up common workflows. The second is project-specific configuration. Claude Code CLI supports a .claude/config.json file in your project, which lets you specify project-specific MCP servers, prompts, and settings. The third is integration with other tools. Claude Code CLI can be combined with other CLI tools (e.g., gh for GitHub, jq for JSON processing) to build powerful workflows. For example, you can deploy via Claude Code CLI, then use gh to create a pull request with the deployment URL. The fourth is automated workflows. Claude Code CLI can be invoked from cron jobs or CI/CD pipelines to run automated workflows (e.g., "every morning, check all apps' health and report to Slack"). The fifth is multi-agent orchestration. Claude Code CLI can be used alongside other AI assistants (e.g., Cursor, Windsurf) in a multi-agent workflow, where each assistant handles a specific task. For more on advanced patterns, see our articles on building a multi-agent deployment pipeline and version controlling your infrastructure.
When Claude Code CLI Is Not the Right Choice
Claude Code CLI is not always the right choice. For developers who prefer GUI-based editors (e.g., VS Code, Cursor), Claude Code CLI's terminal-first approach is a poor fit. For developers who need visual feedback (e.g., diff views, syntax highlighting), Claude Code CLI's plain-text output is limited. For developers who are not comfortable with the terminal, Claude Code CLI is intimidating. For these developers, Cursor, Claude Desktop, or Windsurf are better choices. The key is to match the tool to the developer's preferences: for terminal-first developers, Claude Code CLI is great; for GUI-preferring developers, other MCP clients are better. For more on other MCP clients, see our articles on giving Cursor cloud superpowers and giving Windsurf cloud superpowers.
Conclusion: Terminal-First Deployment with Claude Code CLI
Claude Code CLI is a strong choice for terminal-first developers who want agentic cloud control without leaving the terminal. With the Deployxa MCP server, you can deploy, inspect, diagnose, and roll back from the terminal, with the AI assistant handling the tool calls. The setup is straightforward, and the integration works identically to other MCP clients.
Ready to give Claude Code CLI cloud superpowers? Install the MCP server with npm i -g @deployxa/mcp-server, run deployxa-mcp login, and configure Claude Code CLI to use it. For more on agentic workflows, see our articles on building an AI agent that monitors your app 24/7 and building a Slack bot that deploys apps via Deployxa MCP. Learn about the agentic incident response pipeline and version controlling your infrastructure with Deployxa MCP in our companion articles. Explore our free developer tools to speed up your workflow.