Claude Code Complete Installation Guide: From Node.js Setup to MCP Server Integration

Claude Code Complete Installation Guide: First Run to Full Configuration

Claude Code is Anthropic’s agentic AI coding tool that operates directly in your terminal. This guide walks you through every step — from installing Node.js to configuring CLAUDE.md project instructions, connecting MCP servers, and setting up permission modes — so you can go from zero to a fully productive environment in one session.

Step 1: Install Node.js (v18+)

Claude Code requires Node.js version 18 or later. Verify your current version or install it fresh. # Check current version node —version

Install via nvm (recommended)

nvm install 20 nvm use 20

Or download directly from https://nodejs.org

Confirm the installation succeeded:

node —version

Expected: v20.x.x or higher

npm —version

Step 2: Install Claude Code Globally

Install Claude Code as a global npm package: npm install -g @anthropic-ai/claude-code

After installation, verify it works: claude --version

On first launch, Claude Code will prompt you to authenticate with your Anthropic account or API key. # Launch Claude Code claude

Or set your API key as an environment variable

export ANTHROPIC_API_KEY=YOUR_API_KEY

Step 3: Configure CLAUDE.md Project Instructions

CLAUDE.md files are persistent instruction files that Claude Code reads automatically on every session. They control how the AI behaves within your project.

File Hierarchy

File LocationScopePurpose
~/.claude/CLAUDE.mdGlobal (all projects)Personal preferences, universal rules
./CLAUDE.md (project root)Project-wideCoding standards, architecture notes, tool configs
./src/CLAUDE.mdDirectory-specificModule-level instructions
### Creating Your Project CLAUDE.md Navigate to your project root and create a CLAUDE.md file: # In your project root cat > CLAUDE.md << 'EOF' # Project Instructions

Tech Stack

  • Framework: Next.js 14 (App Router)
  • Language: TypeScript (strict mode)
  • Styling: Tailwind CSS
  • Database: PostgreSQL with Prisma ORM

Coding Standards

  • Use functional components with hooks
  • Prefer named exports over default exports
  • All functions must have JSDoc comments
  • Tests required for business logic (use Vitest)

File Structure

  • src/app/ — route handlers and pages
  • src/components/ — reusable UI components
  • src/lib/ — utility functions and shared logic
  • src/db/ — Prisma schema and migrations

Commands

  • Dev server: npm run dev
  • Run tests: npm run test
  • Lint: npm run lint
  • Build: npm run build EOF

Step 4: Set Up MCP Server Integration

Model Context Protocol (MCP) servers extend Claude Code's capabilities by connecting it to external tools and data sources. Configuration lives in JSON settings files.

MCP Configuration Locations

  • Project-level: .claude/mcp.json in your project root- User-level: ~/.claude/mcp.json for global MCP servers

Example: Adding a Filesystem and Database MCP Server

# Create the project MCP config directory mkdir -p .claude

cat > .claude/mcp.json << ‘EOF’ { “mcpServers”: { “filesystem”: { “command”: “npx”, “args”: [“-y”, “@anthropic-ai/mcp-server-filesystem”, “/path/to/allowed/dir”] }, “postgres”: { “command”: “npx”, “args”: [“-y”, “@anthropic-ai/mcp-server-postgres”], “env”: { “DATABASE_URL”: “postgresql://user:password@localhost:5432/mydb” } }, “github”: { “command”: “npx”, “args”: [“-y”, “@anthropic-ai/mcp-server-github”], “env”: { “GITHUB_TOKEN”: “YOUR_API_KEY” } } } } EOF

After saving the config, restart Claude Code. You can verify connected servers by running: # Inside Claude Code session, type: /mcp

Step 5: Configure Permission Modes

Claude Code has three permission modes that control how much autonomy the AI has when executing tools:

ModeBehaviorBest For
**Default**Prompts for approval on risky actions (file writes, shell commands)Daily development
**Plan Mode**Claude Code can only read files and propose changes, never executeCode review, planning
**Auto-accept (yolo)**All tool calls execute without promptingTrusted automation pipelines
### Setting Permission Modes # Start in plan mode (read-only) claude --plan

Start with auto-accept for all actions

claude —dangerously-skip-permissions

Configure allowed tools in settings

claude config set autoApprove “Bash(npm run test),Read,Glob,Grep”

You can also configure permissions per-project in .claude/settings.json: { “autoApprove”: [ “Read”, “Glob”, “Grep”, “Bash(npm run test)”, “Bash(npm run lint)” ] }

Step 6: Your First Productive Session

With everything configured, start Claude Code in your project directory: cd /your/project claude

Try these workflows to validate your setup: - **Explore the codebase:** Ask Claude to summarize the project structure- **Run tests:** Ask Claude to run and analyze your test suite- **Fix a bug:** Point Claude at an issue and let it diagnose, fix, and verify- **Add a feature:** Describe what you need and let Claude implement it across files# Example: start a session with an initial prompt claude "Review the authentication module and identify any security issues"

Resume a previous conversation

claude —resume

Continue the most recent session

claude —continue

Pro Tips for Power Users

  • Use slash commands: Type /help inside a session to see all commands. /compact compresses conversation context when you are running long.- Pipe input: Feed files or command output directly — cat error.log | claude “What caused this crash?”- Multi-turn memory: Claude Code remembers context within a session. Chain requests without repeating background.- Custom slash commands: Create .claude/commands/ directory with markdown files for reusable prompt templates.- Headless mode for CI/CD: Use claude -p “Run tests and report” —output-format json in pipelines for structured output.- Use the Explore subagent: For complex codebase research, Claude Code dispatches a dedicated exploration agent that searches broadly without consuming your main conversation context.

Troubleshooting Common Errors

ErrorCauseFix
command not found: claudenpm global bin not in PATHRun npm config get prefix and add its bin/ directory to your PATH
ANTHROPIC_API_KEY not setMissing authenticationExport the variable or log in via the interactive prompt on first run
Node.js version too oldNode < 18 detectedUpgrade with nvm install 20 or download from nodejs.org
MCP server not appearingInvalid JSON config or wrong pathValidate .claude/mcp.json syntax and restart Claude Code
Permission denied on tool callDefault permission mode blockingApprove when prompted or add the tool to autoApprove in settings
## Frequently Asked Questions

Can I use Claude Code without an Anthropic API key?

Yes. Claude Code supports authentication through your Anthropic account via an interactive login flow on first launch. You can also use it through Claude Pro, Team, or Enterprise subscriptions. The API key method is an alternative for users who prefer environment-variable-based auth or need headless/CI usage.

How do I add MCP servers without restarting Claude Code?

Currently, MCP server configuration changes require restarting your Claude Code session. After editing .claude/mcp.json, exit and relaunch Claude Code. You can verify your servers loaded correctly by running the /mcp slash command inside the session.

What is the difference between CLAUDE.md and .claude/settings.json?

CLAUDE.md contains natural-language instructions that guide the AI’s behavior — coding standards, project context, and workflow rules. The .claude/settings.json file is a structured configuration file that controls Claude Code’s operational settings like permission auto-approvals and tool configurations. Use CLAUDE.md for “how to code in this project” and settings.json for “how Claude Code should operate.”

Explore More Tools

Grok Best Practices for Academic Research and Literature Discovery: Leveraging X/Twitter for Scholarly Intelligence Best Practices Grok Best Practices for Content Strategy: Identify Trending Topics Before They Peak and Create Content That Captures Demand Best Practices Grok Case Study: How a DTC Beauty Brand Used Real-Time Social Listening to Save Their Product Launch Case Study Grok Case Study: How a Pharma Company Tracked Patient Sentiment During a Drug Launch and Caught a Safety Signal 48 Hours Before the FDA Case Study Grok Case Study: How a Disaster Relief Nonprofit Used Real-Time X/Twitter Monitoring to Coordinate Emergency Response 3x Faster Case Study Grok Case Study: How a Political Campaign Used X/Twitter Sentiment Analysis to Reshape Messaging and Win a Swing District Case Study How to Use Grok for Competitive Intelligence: Track Product Launches, Pricing Changes, and Market Positioning in Real Time How-To Grok vs Perplexity vs ChatGPT Search for Real-Time Information: Which AI Search Tool Is Most Accurate in 2026? Comparison How to Use Grok for Crisis Communication Monitoring: Detect, Assess, and Respond to PR Emergencies in Real Time How-To How to Use Grok for Product Improvement: Extract Customer Feedback Signals from X/Twitter That Your Support Team Misses How-To How to Use Grok for Conference Live Monitoring: Extract Event Insights and Identify Networking Opportunities in Real Time How-To How to Use Grok for Influencer Marketing: Discover, Vet, and Track Influencer Partnerships Using Real X/Twitter Data How-To How to Use Grok for Job Market Analysis: Track Industry Hiring Trends, Layoff Signals, and Salary Discussions on X/Twitter How-To How to Use Grok for Investor Relations: Track Earnings Sentiment, Analyst Reactions, and Shareholder Concerns in Real Time How-To How to Use Grok for Recruitment and Talent Intelligence: Identifying Hiring Signals from X/Twitter Data How-To How to Use Grok for Startup Fundraising Intelligence: Track Investor Sentiment, VC Activity, and Funding Trends on X/Twitter How-To How to Use Grok for Regulatory Compliance Monitoring: Real-Time Policy Tracking Across Industries How-To NotebookLM Best Practices for Financial Analysts: Due Diligence, Investment Research & Risk Factor Analysis Across SEC Filings Best Practices NotebookLM Best Practices for Teachers: Build Curriculum-Aligned Lesson Plans, Study Guides, and Assessment Materials from Your Own Resources Best Practices NotebookLM Case Study: How an Insurance Company Built a Claims Processing Training System That Cut Errors by 35% Case Study